|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65357 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2010-09-08 20:09:39
Author: danieljames
Date: 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
New Revision: 65357
URL: http://svn.boost.org/trac/boost/changeset/65357
Log:
Use explicit namespaces.
Text files modified:
trunk/tools/quickbook/src/block_grammar.cpp | 163 +++++++++++++++++----------------
trunk/tools/quickbook/src/code_snippet.cpp | 92 +++++++++---------
trunk/tools/quickbook/src/doc_info_grammar.cpp | 94 ++++++++++--------
trunk/tools/quickbook/src/phrase_grammar.cpp | 34 +++---
trunk/tools/quickbook/src/phrase_grammar.hpp | 193 ++++++++++++++++++++-------------------
trunk/tools/quickbook/src/post_process.cpp | 44 ++++----
trunk/tools/quickbook/src/quickbook.cpp | 5
trunk/tools/quickbook/src/syntax_highlight.hpp | 152 ++++++++++++++++--------------
8 files changed, 405 insertions(+), 372 deletions(-)
Modified: trunk/tools/quickbook/src/block_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/block_grammar.cpp (original)
+++ trunk/tools/quickbook/src/block_grammar.cpp 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
@@ -21,7 +21,7 @@
namespace quickbook
{
- using namespace boost::spirit::classic;
+ namespace cl = boost::spirit::classic;
template <typename Scanner>
struct block_grammar::definition
@@ -30,7 +30,8 @@
bool no_eols;
- rule<Scanner> start_, blocks, block_markup, code, code_line, blank_line,
+ cl::rule<Scanner>
+ start_, blocks, block_markup, code, code_line, blank_line,
paragraph, space, blank, comment, headings, h, h1, h2,
h3, h4, h5, h6, hr, blurb, blockquote, admonition,
phrase, list, phrase_end, ordered_list, def_macro,
@@ -43,11 +44,11 @@
inside_paragraph,
element_id, element_id_1_5, element_id_1_6;
- symbols<> paragraph_end_markups;
+ cl::symbols<> paragraph_end_markups;
phrase_grammar common;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return start_; }
};
@@ -62,7 +63,7 @@
if (self.skip_initial_spaces)
{
start_ =
- *(blank_p | comment) >> blocks >> blank
+ *(cl::blank_p | comment) >> blocks >> blank
;
}
else
@@ -84,40 +85,42 @@
;
space =
- *(space_p | comment)
+ *(cl::space_p | comment)
;
blank =
- *(blank_p | comment)
+ *(cl::blank_p | comment)
;
- eol = blank >> eol_p
+ eol = blank >> cl::eol_p
;
phrase_end =
']' |
- if_p(var(no_eols))
+ cl::if_p(var(no_eols))
[
- eol >> *blank_p >> eol_p
+ eol >> *cl::blank_p >> cl::eol_p
// Make sure that we don't go
] // past a single block, except
; // when preformatted.
+ // Follows after an alphanumeric identifier - ensures that it doesn't
+ // match an empty space in the middle of the identifier.
hard_space =
- (eps_p - (alnum_p | '_')) >> space // must not be preceded by
+ (cl::eps_p - (cl::alnum_p | '_')) >> space // must not be preceded by
; // alpha-numeric or underscore
comment =
- "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
+ "[/" >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
;
dummy_block =
- '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
+ '[' >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
;
hr =
- str_p("----")
- >> *(anychar_p - eol)
+ cl::str_p("----")
+ >> *(cl::anychar_p - eol)
>> +eol
;
@@ -139,7 +142,7 @@
| template_
)
>> ( (space >> ']' >> +eol)
- | eps_p [actions.error]
+ | cl::eps_p [actions.error]
)
;
@@ -147,29 +150,29 @@
':'
>>
(
- if_p(qbk_since(105u)) [space]
- >> (+(alnum_p | '_')) [assign_a(actions.element_id)]
- | eps_p [actions.element_id_warning]
- [assign_a(actions.element_id)]
+ cl::if_p(qbk_since(105u)) [space]
+ >> (+(cl::alnum_p | '_')) [cl::assign_a(actions.element_id)]
+ | cl::eps_p [actions.element_id_warning]
+ [cl::assign_a(actions.element_id)]
)
- | eps_p [assign_a(actions.element_id)]
+ | cl::eps_p [cl::assign_a(actions.element_id)]
;
element_id_1_5 =
- if_p(qbk_since(105u)) [
+ cl::if_p(qbk_since(105u)) [
element_id
]
.else_p [
- eps_p [assign_a(actions.element_id)]
+ cl::eps_p [cl::assign_a(actions.element_id)]
]
;
element_id_1_6 =
- if_p(qbk_since(106u)) [
+ cl::if_p(qbk_since(106u)) [
element_id
]
.else_p [
- eps_p [assign_a(actions.element_id)]
+ cl::eps_p [cl::assign_a(actions.element_id)]
]
;
@@ -182,7 +185,7 @@
;
end_section =
- str_p("endsect") [actions.end_section]
+ cl::str_p("endsect") [actions.end_section]
;
headings =
@@ -210,7 +213,7 @@
blurb =
"blurb" >> hard_space
>> inside_paragraph [actions.blurb]
- >> eps_p
+ >> cl::eps_p
;
blockquote =
@@ -236,13 +239,13 @@
;
preformatted =
- "pre" >> hard_space [assign_a(no_eols, false_)]
+ "pre" >> hard_space [cl::assign_a(no_eols, false_)]
>> !eol >> phrase [actions.preformatted]
- >> eps_p [assign_a(no_eols, true_)]
+ >> cl::eps_p [cl::assign_a(no_eols, true_)]
;
macro_identifier =
- +(anychar_p - (space_p | ']'))
+ +(cl::anychar_p - (cl::space_p | ']'))
;
def_macro =
@@ -252,142 +255,143 @@
;
identifier =
- (alpha_p | '_') >> *(alnum_p | '_')
+ (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
;
template_id =
- identifier | (punct_p - (ch_p('[') | ']'))
+ identifier | (cl::punct_p - (cl::ch_p('[') | ']'))
;
template_ =
"template"
>> hard_space
- >> template_id [assign_a(actions.template_identifier)]
- [clear_a(actions.template_info)]
+ >> template_id [cl::assign_a(actions.template_identifier)]
+ [cl::clear_a(actions.template_info)]
>>
!(
space >> '['
>> *(
- space >> template_id [push_back_a(actions.template_info)]
+ space >> template_id [cl::push_back_a(actions.template_info)]
)
>> space >> ']'
)
- >> ( eps_p(*blank_p >> eol_p) [assign_a(actions.template_block, true_)]
- | eps_p [assign_a(actions.template_block, false_)]
+ >> ( cl::eps_p(*cl::blank_p >> cl::eol_p)
+ [cl::assign_a(actions.template_block, true_)]
+ | cl::eps_p [cl::assign_a(actions.template_block, false_)]
)
>> template_body [actions.template_body]
;
template_body =
- *(('[' >> template_body >> ']') | (anychar_p - ']'))
- >> eps_p(space >> ']')
+ *(('[' >> template_body >> ']') | (cl::anychar_p - ']'))
+ >> cl::eps_p(space >> ']')
>> space
;
variablelist =
"variablelist"
- >> (eps_p(*blank_p >> eol_p) | hard_space)
- >> (*(anychar_p - eol)) [assign_a(actions.table_title)]
+ >> (cl::eps_p(*cl::blank_p >> cl::eol_p) | hard_space)
+ >> (*(cl::anychar_p - eol)) [cl::assign_a(actions.table_title)]
>> +eol
>> *varlistentry
- >> eps_p [actions.variablelist]
+ >> cl::eps_p [actions.variablelist]
;
varlistentry =
space
- >> ch_p('[') [actions.start_varlistentry]
+ >> cl::ch_p('[') [actions.start_varlistentry]
>>
(
(
varlistterm [actions.start_varlistitem]
>> ( +varlistitem
- | eps_p [actions.error]
+ | cl::eps_p [actions.error]
) [actions.end_varlistitem]
- >> ch_p(']') [actions.end_varlistentry]
+ >> cl::ch_p(']') [actions.end_varlistentry]
>> space
)
- | eps_p [actions.error]
+ | cl::eps_p [actions.error]
)
;
varlistterm =
space
- >> ch_p('[') [actions.start_varlistterm]
+ >> cl::ch_p('[') [actions.start_varlistterm]
>>
(
(
phrase
- >> ch_p(']') [actions.end_varlistterm]
+ >> cl::ch_p(']') [actions.end_varlistterm]
>> space
)
- | eps_p [actions.error]
+ | cl::eps_p [actions.error]
)
;
varlistitem =
space
- >> ch_p('[')
+ >> cl::ch_p('[')
>>
(
(
inside_paragraph
- >> ch_p(']')
+ >> cl::ch_p(']')
>> space
)
- | eps_p [actions.error]
+ | cl::eps_p [actions.error]
)
;
table =
"table"
- >> (eps_p(*blank_p >> eol_p) | hard_space)
+ >> (cl::eps_p(*cl::blank_p >> cl::eol_p) | hard_space)
>> element_id_1_5
- >> (eps_p(*blank_p >> eol_p) | space)
- >> (*(anychar_p - eol)) [assign_a(actions.table_title)]
+ >> (cl::eps_p(*cl::blank_p >> cl::eol_p) | space)
+ >> (*(cl::anychar_p - eol)) [cl::assign_a(actions.table_title)]
>> +eol
>> *table_row
- >> eps_p [actions.table]
+ >> cl::eps_p [actions.table]
;
table_row =
space
- >> ch_p('[') [actions.start_row]
+ >> cl::ch_p('[') [actions.start_row]
>>
(
(
*table_cell
- >> ch_p(']') [actions.end_row]
+ >> cl::ch_p(']') [actions.end_row]
>> space
)
- | eps_p [actions.error]
+ | cl::eps_p [actions.error]
)
;
table_cell =
space
- >> ch_p('[') [actions.start_cell]
+ >> cl::ch_p('[') [actions.start_cell]
>>
(
(
inside_paragraph
- >> ch_p(']') [actions.end_cell]
+ >> cl::ch_p(']') [actions.end_cell]
>> space
)
- | eps_p [actions.error]
+ | cl::eps_p [actions.error]
)
;
xinclude =
"xinclude"
>> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
phrase_end)) [actions.xinclude]
;
import =
"import"
>> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
phrase_end)) [actions.import]
;
@@ -397,10 +401,11 @@
>>
!(
':'
- >> (*((alnum_p | '_') - space_p))[assign_a(actions.include_doc_id)]
+ >> (*((cl::alnum_p | '_') - cl::space_p))
+ [cl::assign_a(actions.include_doc_id)]
>> space
)
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
phrase_end)) [actions.include]
;
@@ -413,27 +418,27 @@
;
code_line =
- blank_p >> *(anychar_p - eol_p) >> eol_p
+ cl::blank_p >> *(cl::anychar_p - cl::eol_p) >> cl::eol_p
;
blank_line =
- *blank_p >> eol_p
+ *cl::blank_p >> cl::eol_p
;
list =
- eps_p(ch_p('*') | '#') >>
+ cl::eps_p(cl::ch_p('*') | '#') >>
+(
- (*blank_p
- >> (ch_p('*') | '#')) [actions.list_format]
- >> *blank_p
+ (*cl::blank_p
+ >> (cl::ch_p('*') | '#')) [actions.list_format]
+ >> *cl::blank_p
>> list_item
) [actions.list_item]
;
list_item =
*( common
- | (anychar_p -
- ( eol_p >> *blank_p >> eps_p(ch_p('*') | '#')
+ | (cl::anychar_p -
+ ( cl::eol_p >> *cl::blank_p >> cl::eps_p(cl::ch_p('*') | '#')
| (eol >> eol)
)
) [actions.plain_char]
@@ -449,28 +454,28 @@
;
paragraph_end =
- '[' >> space >> paragraph_end_markups >> hard_space | eol >> *blank_p >> eol_p
+ '[' >> space >> paragraph_end_markups >> hard_space | eol >> *cl::blank_p >> cl::eol_p
;
paragraph =
+( common
- | (anychar_p - // Make sure we don't go past
+ | (cl::anychar_p - // Make sure we don't go past
paragraph_end // a single block.
) [actions.plain_char]
)
- >> (eps_p('[') | +eol)
+ >> (cl::eps_p('[') | +eol)
;
phrase =
*( common
| comment
- | (anychar_p -
+ | (cl::anychar_p -
phrase_end) [actions.plain_char]
)
;
}
- parse_info<iterator> call_parse(
+ cl::parse_info<iterator> call_parse(
iterator& first, iterator last, block_grammar& g)
{
return boost::spirit::classic::parse(first, last, g);
Modified: trunk/tools/quickbook/src/code_snippet.cpp
==============================================================================
--- trunk/tools/quickbook/src/code_snippet.cpp (original)
+++ trunk/tools/quickbook/src/code_snippet.cpp 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
@@ -16,7 +16,7 @@
namespace quickbook
{
- using namespace boost::spirit::classic;
+ namespace cl = boost::spirit::classic;
struct code_snippet_actions
{
@@ -67,7 +67,7 @@
};
struct python_code_snippet_grammar
- : grammar<python_code_snippet_grammar>
+ : cl::grammar<python_code_snippet_grammar>
{
typedef code_snippet_actions actions_type;
@@ -88,7 +88,7 @@
start_ = *code_elements;
identifier =
- (alpha_p | '_') >> *(alnum_p | '_')
+ (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
;
code_elements =
@@ -96,45 +96,46 @@
| end_snippet [boost::bind(&actions_type::end_snippet, &actions, _1, _2)]
| escaped_comment
| ignore
- | anychar_p [boost::bind(&actions_type::pass_thru_char, &actions, _1)]
+ | cl::anychar_p [boost::bind(&actions_type::pass_thru_char, &actions, _1)]
;
start_snippet =
- "#[" >> *space_p
- >> identifier [assign_a(actions.id)]
+ "#[" >> *cl::space_p
+ >> identifier [cl::assign_a(actions.id)]
;
end_snippet =
- str_p("#]")
+ cl::str_p("#]")
;
ignore =
- *blank_p >> "#<-"
- >> (*(anychar_p - "#->"))
- >> "#->" >> *blank_p >> eol_p
+ *cl::blank_p >> "#<-"
+ >> (*(cl::anychar_p - "#->"))
+ >> "#->" >> *cl::blank_p >> cl::eol_p
| "\"\"\"<-\"\"\""
- >> (*(anychar_p - "\"\"\"->\"\"\""))
+ >> (*(cl::anychar_p - "\"\"\"->\"\"\""))
>> "\"\"\"->\"\"\""
| "\"\"\"<-"
- >> (*(anychar_p - "->\"\"\""))
+ >> (*(cl::anychar_p - "->\"\"\""))
>> "->\"\"\""
;
escaped_comment =
- *space_p >> "#`"
- >> ((*(anychar_p - eol_p))
- >> eol_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
- | *space_p >> "\"\"\"`"
- >> (*(anychar_p - "\"\"\"")) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ *cl::space_p >> "#`"
+ >> ((*(cl::anychar_p - cl::eol_p))
+ >> cl::eol_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ | *cl::space_p >> "\"\"\"`"
+ >> (*(cl::anychar_p - "\"\"\""))
+ [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
>> "\"\"\""
;
}
- rule<Scanner>
+ cl::rule<Scanner>
start_, identifier, code_elements, start_snippet, end_snippet,
escaped_comment, ignore;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return start_; }
};
@@ -142,7 +143,7 @@
};
struct cpp_code_snippet_grammar
- : grammar<cpp_code_snippet_grammar>
+ : cl::grammar<cpp_code_snippet_grammar>
{
typedef code_snippet_actions actions_type;
@@ -160,7 +161,7 @@
start_ = *code_elements;
identifier =
- (alpha_p | '_') >> *(alnum_p | '_')
+ (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
;
code_elements =
@@ -170,64 +171,65 @@
| ignore
| line_callout
| inline_callout
- | anychar_p [boost::bind(&actions_type::pass_thru_char, &actions, _1)]
+ | cl::anychar_p [boost::bind(&actions_type::pass_thru_char, &actions, _1)]
;
start_snippet =
- "//[" >> *space_p
- >> identifier [assign_a(actions.id)]
+ "//[" >> *cl::space_p
+ >> identifier [cl::assign_a(actions.id)]
|
- "/*[" >> *space_p
- >> identifier [assign_a(actions.id)]
- >> *space_p >> "*/"
+ "/*[" >> *cl::space_p
+ >> identifier [cl::assign_a(actions.id)]
+ >> *cl::space_p >> "*/"
;
end_snippet =
- str_p("//]") | "/*]*/"
+ cl::str_p("//]") | "/*]*/"
;
inline_callout =
"/*<"
- >> *space_p
- >> (*(anychar_p - ">*/")) [boost::bind(&actions_type::callout, &actions, _1, _2)]
+ >> *cl::space_p
+ >> (*(cl::anychar_p - ">*/")) [boost::bind(&actions_type::callout, &actions, _1, _2)]
>> ">*/"
;
line_callout =
"/*<<"
- >> *space_p
- >> (*(anychar_p - ">>*/")) [boost::bind(&actions_type::callout, &actions, _1, _2)]
+ >> *cl::space_p
+ >> (*(cl::anychar_p - ">>*/")) [boost::bind(&actions_type::callout, &actions, _1, _2)]
>> ">>*/"
- >> *space_p
+ >> *cl::space_p
;
ignore =
- *blank_p >> "//<-"
- >> (*(anychar_p - "//->"))
- >> "//->" >> *blank_p >> eol_p
+ *cl::blank_p >> "//<-"
+ >> (*(cl::anychar_p - "//->"))
+ >> "//->" >> *cl::blank_p >> cl::eol_p
| "/*<-*/"
- >> (*(anychar_p - "/*->*/"))
+ >> (*(cl::anychar_p - "/*->*/"))
>> "/*->*/"
| "/*<-"
- >> (*(anychar_p - "->*/"))
+ >> (*(cl::anychar_p - "->*/"))
>> "->*/"
;
escaped_comment =
- *space_p >> "//`"
- >> ((*(anychar_p - eol_p))
- >> eol_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
- | *space_p >> "/*`"
- >> (*(anychar_p - "*/")) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ *cl::space_p >> "//`"
+ >> ((*(cl::anychar_p - cl::eol_p))
+ >> cl::eol_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ | *cl::space_p >> "/*`"
+ >> (*(cl::anychar_p - "*/"))
+ [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
>> "*/"
;
}
- rule<Scanner>
+ cl::rule<Scanner>
start_, identifier, code_elements, start_snippet, end_snippet,
escaped_comment, inline_callout, line_callout, ignore;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return start_; }
};
Modified: trunk/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ trunk/tools/quickbook/src/doc_info_grammar.cpp 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
@@ -19,26 +19,27 @@
namespace quickbook
{
- using namespace boost::spirit::classic;
+ namespace cl = boost::spirit::classic;
template <typename Scanner>
struct doc_info_grammar::definition
{
definition(doc_info_grammar const&);
- typedef uint_parser<int, 10, 1, 2> uint2_t;
+ typedef cl::uint_parser<int, 10, 1, 2> uint2_t;
bool unused;
std::string category;
- rule<Scanner> doc_info, doc_title, doc_version, doc_id, doc_dirname,
+ cl::rule<Scanner>
+ doc_info, doc_title, doc_version, doc_id, doc_dirname,
doc_copyright, doc_purpose, doc_category, doc_authors,
doc_author, comment, space, hard_space, doc_license,
doc_last_revision, doc_source_mode, phrase, quickbook_version,
char_;
phrase_grammar common;
- symbols<> doc_types;
+ cl::symbols<> doc_types;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return doc_info; }
};
@@ -57,9 +58,9 @@
doc_info =
space
>> '[' >> space
- >> (doc_types >> eps_p) [assign_a(actions.doc_type)]
+ >> (doc_types >> cl::eps_p) [cl::assign_a(actions.doc_type)]
>> hard_space
- >> ( *(~eps_p(ch_p('[') | ']' | eol_p) >> char_)
+ >> ( *(~cl::eps_p(cl::ch_p('[') | ']' | cl::eol_p) >> char_)
) [actions.extract_doc_title]
>> !(
space >> '[' >>
@@ -73,7 +74,7 @@
doc_version
| doc_id
| doc_dirname
- | doc_copyright [push_back_a(actions.doc_copyrights, actions.copyright)]
+ | doc_copyright [cl::push_back_a(actions.doc_copyrights, actions.copyright)]
| doc_purpose
| doc_category
| doc_authors
@@ -81,43 +82,48 @@
| doc_last_revision
| doc_source_mode
)
- >> space >> ']' >> +eol_p
+ >> space >> ']' >> +cl::eol_p
)
- >> space >> ']' >> +eol_p
+ >> space >> ']' >> +cl::eol_p
;
quickbook_version =
"quickbook" >> hard_space
- >> ( uint_p [assign_a(qbk_major_version)]
+ >> ( cl::uint_p [cl::assign_a(qbk_major_version)]
>> '.'
- >> uint2_t() [assign_a(qbk_minor_version)]
+ >> uint2_t() [cl::assign_a(qbk_minor_version)]
)
;
doc_version =
"version" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_version]
+ >> (*(~cl::eps_p(']') >> char_))
+ [actions.extract_doc_version]
;
// TODO: Restrictions on doc_id?
doc_id =
"id" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_id]
+ >> (*(~cl::eps_p(']') >> char_))
+ [actions.extract_doc_id]
;
// TODO: Restrictions on doc_dirname?
doc_dirname =
"dirname" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_dirname]
+ >> (*(~cl::eps_p(']') >> char_))
+ [actions.extract_doc_dirname]
;
doc_copyright =
- "copyright" >> hard_space [clear_a(actions.copyright.first)]
- >> +( repeat_p(4)[digit_p] [push_back_a(actions.copyright.first)]
+ "copyright" >> hard_space [cl::clear_a(actions.copyright.first)]
+ >> +( cl::repeat_p(4)[cl::digit_p]
+ [cl::push_back_a(actions.copyright.first)]
>> space
)
>> space
- >> (*(~eps_p(']') >> char_)) [actions.extract_copyright_second]
+ >> (*(~cl::eps_p(']') >> char_))
+ [actions.extract_copyright_second]
;
doc_purpose =
@@ -127,25 +133,28 @@
doc_category =
"category" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_category]
- [push_back_a(actions.doc_categories, actions.doc_category)]
+ >> (*(~cl::eps_p(']') >> char_))
+ [actions.extract_doc_category]
+ [cl::push_back_a(actions.doc_categories, actions.doc_category)]
;
doc_author =
'[' >> space
- >> (*(~eps_p(',') >> char_)) [actions.extract_name_second] // surname
+ >> (*(~cl::eps_p(',') >> char_))
+ [actions.extract_name_second]
>> ',' >> space
- >> (*(~eps_p(']') >> char_)) [actions.extract_name_first] // firstname
+ >> (*(~cl::eps_p(']') >> char_))
+ [actions.extract_name_first]
>> ']'
;
doc_authors =
"authors"
>> hard_space
- >> doc_author [push_back_a(actions.doc_authors, actions.name)]
+ >> doc_author [cl::push_back_a(actions.doc_authors, actions.name)]
>> space
- >> *( !(ch_p(',') >> space)
- >> doc_author [push_back_a(actions.doc_authors, actions.name)]
+ >> *( !(cl::ch_p(',') >> space)
+ >> doc_author [cl::push_back_a(actions.doc_authors, actions.name)]
>> space
)
;
@@ -157,55 +166,58 @@
doc_last_revision =
"last-revision" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_last_revision]
+ >> (*(~cl::eps_p(']') >> char_))
+ [actions.extract_doc_last_revision]
;
doc_source_mode =
"source-mode" >> hard_space
>> (
- str_p("c++")
+ cl::str_p("c++")
| "python"
| "teletype"
- ) [assign_a(actions.source_mode)]
+ ) [cl::assign_a(actions.source_mode)]
;
comment =
- "[/" >> *(anychar_p - ']') >> ']'
+ "[/" >> *(cl::anychar_p - ']') >> ']'
;
space =
- *(space_p | comment)
+ *(cl::space_p | comment)
;
hard_space =
- (eps_p - (alnum_p | '_')) >> space // must not be preceded by
+ (cl::eps_p - (cl::alnum_p | '_')) >> space // must not be preceded by
; // alpha-numeric or underscore
phrase =
*( common
| comment
- | (anychar_p - ']') [actions.plain_char]
+ | (cl::anychar_p - ']') [actions.plain_char]
)
;
char_ =
- str_p("\\n") [actions.break_]
+ cl::str_p("\\n") [actions.break_]
| "\\ " // ignore an escaped space
- | '\\' >> punct_p [actions.raw_char]
- | "\\u" >> repeat_p(4) [chset<>("0-9a-fA-F")]
+ | '\\' >> cl::punct_p [actions.raw_char]
+ | "\\u" >> cl::repeat_p(4)
+ [cl::chset<>("0-9a-fA-F")]
[actions.escape_unicode]
- | "\\U" >> repeat_p(8) [chset<>("0-9a-fA-F")]
+ | "\\U" >> cl::repeat_p(8)
+ [cl::chset<>("0-9a-fA-F")]
[actions.escape_unicode]
| (
- ("'''" >> !eol_p) [actions.escape_pre]
- >> *(anychar_p - "'''") [actions.raw_char]
- >> str_p("'''") [actions.escape_post]
+ ("'''" >> !cl::eol_p) [actions.escape_pre]
+ >> *(cl::anychar_p - "'''")[actions.raw_char]
+ >> cl::str_p("'''") [actions.escape_post]
)
- | anychar_p [actions.plain_char]
+ | cl::anychar_p [actions.plain_char]
;
}
- parse_info<iterator> call_parse(
+ cl::parse_info<iterator> call_parse(
iterator& first, iterator last, doc_info_grammar& g)
{
return boost::spirit::classic::parse(first, last, g);
Modified: trunk/tools/quickbook/src/phrase_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/phrase_grammar.cpp (original)
+++ trunk/tools/quickbook/src/phrase_grammar.cpp 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
@@ -23,24 +23,24 @@
phrase =
*( common
| comment
- | (anychar_p - ']') [actions.plain_char]
+ | (cl::anychar_p - ']') [actions.plain_char]
)
;
comment =
- "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
+ "[/" >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
;
dummy_block =
- '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
+ '[' >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
;
}
bool unused;
- rule<Scanner> phrase, comment, dummy_block;
+ cl::rule<Scanner> phrase, comment, dummy_block;
phrase_grammar common;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return phrase; }
};
@@ -53,49 +53,49 @@
quickbook::actions& actions = self.actions;
macro =
- *space_p
+ *cl::space_p
>> macro_identifier [actions.macro_identifier]
- >> *space_p
+ >> *cl::space_p
>> ( '='
- >> *space_p
+ >> *cl::space_p
>> phrase [actions.macro_definition]
- >> *space_p
+ >> *cl::space_p
)
- | eps_p [actions.macro_definition]
+ | cl::eps_p [actions.macro_definition]
;
macro_identifier =
- +(anychar_p - (space_p | ']' | '='))
+ +(cl::anychar_p - (cl::space_p | ']' | '='))
;
phrase =
*( common
- | (anychar_p - ']') [actions.plain_char]
+ | (cl::anychar_p - ']') [actions.plain_char]
)
;
}
bool unused;
- rule<Scanner> macro, macro_identifier, phrase;
+ cl::rule<Scanner> macro, macro_identifier, phrase;
phrase_grammar common;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return macro; }
};
- parse_info<iterator> call_parse(
+ cl::parse_info<iterator> call_parse(
iterator& first, iterator last, phrase_grammar& g)
{
return boost::spirit::classic::parse(first, last, g);
}
- parse_info<iterator> call_parse(
+ cl::parse_info<iterator> call_parse(
iterator& first, iterator last, simple_phrase_grammar& g)
{
return boost::spirit::classic::parse(first, last, g);
}
- parse_info<iterator> call_parse(
+ cl::parse_info<iterator> call_parse(
iterator& first, iterator last, command_line_grammar& g)
{
return boost::spirit::classic::parse(first, last, g);
Modified: trunk/tools/quickbook/src/phrase_grammar.hpp
==============================================================================
--- trunk/tools/quickbook/src/phrase_grammar.hpp (original)
+++ trunk/tools/quickbook/src/phrase_grammar.hpp 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
@@ -25,7 +25,6 @@
namespace quickbook
{
namespace cl = boost::spirit::classic;
- using namespace boost::spirit::classic;
template <typename Rule, typename Action>
inline void
@@ -40,20 +39,20 @@
mark >>
(
(
- graph_p // A single char. e.g. *c*
- >> eps_p(mark
- >> (space_p | punct_p | end_p))
+ cl::graph_p // A single char. e.g. *c*
+ >> cl::eps_p(mark
+ >> (cl::space_p | cl::punct_p | cl::end_p))
// space_p, punct_p or end_p
) // must follow mark
|
- ( graph_p >> // graph_p must follow mark
- *(anychar_p -
- ( (graph_p >> mark) // Make sure that we don't go
- | close // past a single block
+ ( cl::graph_p >> // graph_p must follow mark
+ *(cl::anychar_p -
+ ( (cl::graph_p >> mark) // Make sure that we don't go
+ | close // past a single block
)
- ) >> graph_p // graph_p must precede mark
- >> eps_p(mark
- >> (space_p | punct_p | end_p))
+ ) >> cl::graph_p // graph_p must precede mark
+ >> cl::eps_p(mark
+ >> (cl::space_p | cl::punct_p | cl::end_p))
// space_p, punct_p or end_p
) // must follow mark
) [action]
@@ -93,34 +92,36 @@
quickbook::actions& actions = self.actions;
space =
- *(space_p | comment)
+ *(cl::space_p | comment)
;
blank =
- *(blank_p | comment)
+ *(cl::blank_p | comment)
;
- eol = blank >> eol_p
+ eol = blank >> cl::eol_p
;
phrase_end =
']' |
- if_p(var(self.no_eols))
+ cl::if_p(var(self.no_eols))
[
eol >> eol // Make sure that we don't go
] // past a single block, except
; // when preformatted.
+ // Follows an alphanumeric identifier - ensures that it doesn't
+ // match an empty space in the middle of the identifier.
hard_space =
- (eps_p - (alnum_p | '_')) >> space // must not be preceded by
- ; // alpha-numeric or underscore
+ (cl::eps_p - (cl::alnum_p | '_')) >> space
+ ;
comment =
- "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
+ "[/" >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
;
dummy_block =
- '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
+ '[' >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
;
common =
@@ -134,8 +135,9 @@
;
macro =
- eps_p(actions.macro // must not be followed by
- >> (eps_p - (alpha_p | '_'))) // alpha or underscore
+ // must not be followed by alpha or underscore
+ cl::eps_p(actions.macro
+ >> (cl::eps_p - (cl::alpha_p | '_')))
>> actions.macro [actions.do_macro]
;
@@ -144,30 +146,30 @@
template_ =
(
- ch_p('`') [assign_a(actions.template_escape,true_)]
+ cl::ch_p('`') [cl::assign_a(actions.template_escape,true_)]
|
- eps_p [assign_a(actions.template_escape,false_)]
+ cl::eps_p [cl::assign_a(actions.template_escape,false_)]
)
>>
( (
- (eps_p(punct_p)
+ (cl::eps_p(cl::punct_p)
>> actions.templates.scope
- ) [assign_a(actions.template_identifier)]
- [clear_a(actions.template_args)]
+ ) [cl::assign_a(actions.template_identifier)]
+ [cl::clear_a(actions.template_args)]
>> !template_args
) | (
(actions.templates.scope
- >> eps_p(hard_space)
- ) [assign_a(actions.template_identifier)]
- [clear_a(actions.template_args)]
+ >> cl::eps_p(hard_space)
+ ) [cl::assign_a(actions.template_identifier)]
+ [cl::clear_a(actions.template_args)]
>> space
>> !template_args
) )
- >> eps_p(']')
+ >> cl::eps_p(']')
;
template_args =
- if_p(qbk_since(105u)) [
+ cl::if_p(qbk_since(105u)) [
template_args_1_5
].else_p [
template_args_1_4
@@ -177,14 +179,15 @@
template_args_1_4 = template_arg_1_4 >> *(".." >> template_arg_1_4);
template_arg_1_4 =
- ( eps_p(*blank_p >> eol_p) [assign_a(actions.template_block, true_)]
- | eps_p [assign_a(actions.template_block, false_)]
+ ( cl::eps_p(*cl::blank_p >> cl::eol_p)
+ [cl::assign_a(actions.template_block, true_)]
+ | cl::eps_p [cl::assign_a(actions.template_block, false_)]
)
>> template_inner_arg_1_4 [actions.template_arg]
;
template_inner_arg_1_4 =
- +(brackets_1_4 | (anychar_p - (str_p("..") | ']')))
+ +(brackets_1_4 | (cl::anychar_p - (cl::str_p("..") | ']')))
;
brackets_1_4 =
@@ -194,15 +197,16 @@
template_args_1_5 = template_arg_1_5 >> *(".." >> template_arg_1_5);
template_arg_1_5 =
- ( eps_p(*blank_p >> eol_p) [assign_a(actions.template_block, true_)]
- | eps_p [assign_a(actions.template_block, false_)]
+ ( cl::eps_p(*cl::blank_p >> cl::eol_p)
+ [cl::assign_a(actions.template_block, true_)]
+ | cl::eps_p [cl::assign_a(actions.template_block, false_)]
)
- >> (+(brackets_1_5 | ('\\' >> anychar_p) | (anychar_p - (str_p("..") | '[' | ']'))))
+ >> (+(brackets_1_5 | ('\\' >> cl::anychar_p) | (cl::anychar_p - (cl::str_p("..") | '[' | ']'))))
[actions.template_arg]
;
template_inner_arg_1_5 =
- +(brackets_1_5 | ('\\' >> anychar_p) | (anychar_p - (str_p('[') | ']')))
+ +(brackets_1_5 | ('\\' >> cl::anychar_p) | (cl::anychar_p - (cl::str_p('[') | ']')))
;
brackets_1_5 =
@@ -212,11 +216,11 @@
inline_code =
'`' >>
(
- *(anychar_p -
+ *(cl::anychar_p -
( '`'
| (eol >> eol) // Make sure that we don't go
) // past a single block
- ) >> eps_p('`')
+ ) >> cl::eps_p('`')
) [actions.inline_code]
>> '`'
;
@@ -225,16 +229,16 @@
(
"```" >>
(
- *(anychar_p - "```")
- >> eps_p("```")
+ *(cl::anychar_p - "```")
+ >> cl::eps_p("```")
) [actions.code_block]
>> "```"
)
| (
"``" >>
(
- *(anychar_p - "``")
- >> eps_p("``")
+ *(cl::anychar_p - "``")
+ >> cl::eps_p("``")
) [actions.code_block]
>> "``"
)
@@ -261,7 +265,7 @@
phrase =
*( common
| comment
- | (anychar_p - phrase_end) [actions.plain_char]
+ | (cl::anychar_p - phrase_end) [actions.plain_char]
)
;
@@ -290,27 +294,27 @@
| replaceable
| footnote
| template_ [actions.do_template]
- | str_p("br") [actions.break_]
+ | cl::str_p("br") [actions.break_]
)
>> ']'
;
escape =
- str_p("\\ ") // ignore an escaped space
- | '\\' >> punct_p [actions.raw_char]
- | "\\u" >> repeat_p(4) [chset<>("0-9a-fA-F")]
+ cl::str_p("\\ ") // ignore an escaped space
+ | '\\' >> cl::punct_p [actions.raw_char]
+ | "\\u" >> cl::repeat_p(4) [cl::chset<>("0-9a-fA-F")]
[actions.escape_unicode]
- | "\\U" >> repeat_p(8) [chset<>("0-9a-fA-F")]
+ | "\\U" >> cl::repeat_p(8) [cl::chset<>("0-9a-fA-F")]
[actions.escape_unicode]
| (
("'''" >> !eol) [actions.escape_pre]
- >> *(anychar_p - "'''") [actions.raw_char]
- >> str_p("'''") [actions.escape_post]
+ >> *(cl::anychar_p - "'''") [actions.raw_char]
+ >> cl::str_p("'''") [actions.escape_post]
)
;
macro_identifier =
- +(anychar_p - (space_p | ']'))
+ +(cl::anychar_p - (cl::space_p | ']'))
;
cond_phrase =
@@ -320,43 +324,43 @@
;
image =
- '$' >> blank [clear_a(actions.attributes)]
- >> if_p(qbk_since(105u)) [
+ '$' >> blank [cl::clear_a(actions.attributes)]
+ >> cl::if_p(qbk_since(105u)) [
(+(
- *space_p
- >> +(anychar_p - (space_p | phrase_end | '['))
- )) [assign_a(actions.image_fileref)]
+ *cl::space_p
+ >> +(cl::anychar_p - (cl::space_p | phrase_end | '['))
+ )) [cl::assign_a(actions.image_fileref)]
>> hard_space
>> *(
'['
- >> (*(alnum_p | '_')) [assign_a(actions.attribute_name)]
+ >> (*(cl::alnum_p | '_')) [cl::assign_a(actions.attribute_name)]
>> space
- >> (*(anychar_p - (phrase_end | '[')))
+ >> (*(cl::anychar_p - (phrase_end | '[')))
[actions.attribute]
>> ']'
>> space
)
].else_p [
- (*(anychar_p -
- phrase_end)) [assign_a(actions.image_fileref)]
+ (*(cl::anychar_p - phrase_end))
+ [cl::assign_a(actions.image_fileref)]
]
- >> eps_p(']') [actions.image]
+ >> cl::eps_p(']') [actions.image]
;
url =
'@'
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.url_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.url_post]
;
link =
"link" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.link_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.link_post]
;
@@ -364,128 +368,127 @@
anchor =
'#'
>> blank
- >> ( *(anychar_p -
- phrase_end)
+ >> ( *(cl::anychar_p - phrase_end)
) [actions.anchor]
;
funcref =
"funcref" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.funcref_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.funcref_post]
;
classref =
"classref" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.classref_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.classref_post]
;
memberref =
"memberref" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.memberref_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.memberref_post]
;
enumref =
"enumref" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.enumref_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.enumref_post]
;
macroref =
"macroref" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.macroref_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.macroref_post]
;
headerref =
"headerref" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.headerref_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.headerref_post]
;
conceptref =
"conceptref" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.conceptref_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.conceptref_post]
;
globalref =
"globalref" >> hard_space
- >> (*(anychar_p -
+ >> (*(cl::anychar_p -
(']' | hard_space))) [actions.globalref_pre]
- >> ( eps_p(']')
+ >> ( cl::eps_p(']')
| (hard_space >> phrase)
) [actions.globalref_post]
;
bold =
- ch_p('*') [actions.bold_pre]
+ cl::ch_p('*') [actions.bold_pre]
>> blank >> phrase [actions.bold_post]
;
italic =
- ch_p('\'') [actions.italic_pre]
+ cl::ch_p('\'') [actions.italic_pre]
>> blank >> phrase [actions.italic_post]
;
underline =
- ch_p('_') [actions.underline_pre]
+ cl::ch_p('_') [actions.underline_pre]
>> blank >> phrase [actions.underline_post]
;
teletype =
- ch_p('^') [actions.teletype_pre]
+ cl::ch_p('^') [actions.teletype_pre]
>> blank >> phrase [actions.teletype_post]
;
strikethrough =
- ch_p('-') [actions.strikethrough_pre]
+ cl::ch_p('-') [actions.strikethrough_pre]
>> blank >> phrase [actions.strikethrough_post]
;
quote =
- ch_p('"') [actions.quote_pre]
+ cl::ch_p('"') [actions.quote_pre]
>> blank >> phrase [actions.quote_post]
;
replaceable =
- ch_p('~') [actions.replaceable_pre]
+ cl::ch_p('~') [actions.replaceable_pre]
>> blank >> phrase [actions.replaceable_post]
;
source_mode =
(
- str_p("c++")
+ cl::str_p("c++")
| "python"
| "teletype"
- ) [assign_a(actions.source_mode)]
+ ) [cl::assign_a(actions.source_mode)]
;
footnote =
- str_p("footnote") [actions.footnote_pre]
+ cl::str_p("footnote") [actions.footnote_pre]
>> blank >> phrase [actions.footnote_post]
;
}
Modified: trunk/tools/quickbook/src/post_process.cpp
==============================================================================
--- trunk/tools/quickbook/src/post_process.cpp (original)
+++ trunk/tools/quickbook/src/post_process.cpp 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
@@ -16,8 +16,7 @@
namespace quickbook
{
- using namespace boost::spirit::classic;
- using boost::bind;
+ namespace cl = boost::spirit::classic;
typedef std::string::const_iterator iter_type;
struct printer
@@ -256,7 +255,7 @@
std::string current_tag;
};
- struct tidy_grammar : grammar<tidy_grammar>
+ struct tidy_grammar : cl::grammar<tidy_grammar>
{
tidy_grammar(tidy_compiler& state, int indent)
: state(state), indent(indent) {}
@@ -266,43 +265,43 @@
{
definition(tidy_grammar const& self)
{
- tag = (lexeme_d[+(alpha_p | '_' | ':')]) [boost::bind(&tidy_grammar::do_tag, &self, _1, _2)];
+ tag = (cl::lexeme_d[+(cl::alpha_p | '_' | ':')]) [boost::bind(&tidy_grammar::do_tag, &self, _1, _2)];
code =
"<programlisting>"
- >> *(anychar_p - "</programlisting>")
+ >> *(cl::anychar_p - "</programlisting>")
>> "</programlisting>"
;
- // What's the business of lexeme_d['>' >> *space_p]; ?
+ // What's the business of cl::lexeme_d['>' >> *cl::space_p]; ?
// It is there to preserve the space after the tag that is
- // otherwise consumed by the space_p skipper.
+ // otherwise consumed by the cl::space_p skipper.
escape =
- str_p("<!--quickbook-escape-prefix-->") >>
- (*(anychar_p - str_p("<!--quickbook-escape-postfix-->")))
+ cl::str_p("<!--quickbook-escape-prefix-->") >>
+ (*(cl::anychar_p - cl::str_p("<!--quickbook-escape-postfix-->")))
[
boost::bind(&tidy_grammar::do_escape, &self, _1, _2)
]
- >> lexeme_d
+ >> cl::lexeme_d
[
- str_p("<!--quickbook-escape-postfix-->") >>
- (*space_p)
+ cl::str_p("<!--quickbook-escape-postfix-->") >>
+ (*cl::space_p)
[
boost::bind(&tidy_grammar::do_escape_post, &self, _1, _2)
]
]
;
- start_tag = '<' >> tag >> *(anychar_p - '>') >> lexeme_d['>' >> *space_p];
+ start_tag = '<' >> tag >> *(cl::anychar_p - '>') >> cl::lexeme_d['>' >> *cl::space_p];
start_end_tag =
- '<' >> tag >> *(anychar_p - ("/>" | ch_p('>'))) >> lexeme_d["/>" >> *space_p]
- | "<?" >> tag >> *(anychar_p - '?') >> lexeme_d["?>" >> *space_p]
- | "<!--" >> *(anychar_p - "-->") >> lexeme_d["-->" >> *space_p]
- | "<!" >> tag >> *(anychar_p - '>') >> lexeme_d['>' >> *space_p]
+ '<' >> tag >> *(cl::anychar_p - ("/>" | cl::ch_p('>'))) >> cl::lexeme_d["/>" >> *cl::space_p]
+ | "<?" >> tag >> *(cl::anychar_p - '?') >> cl::lexeme_d["?>" >> *cl::space_p]
+ | "<!--" >> *(cl::anychar_p - "-->") >> cl::lexeme_d["-->" >> *cl::space_p]
+ | "<!" >> tag >> *(cl::anychar_p - '>') >> cl::lexeme_d['>' >> *cl::space_p]
;
- content = lexeme_d[ +(anychar_p - '<') ];
- end_tag = "</" >> +(anychar_p - '>') >> lexeme_d['>' >> *space_p];
+ content = cl::lexeme_d[ +(cl::anychar_p - '<') ];
+ end_tag = "</" >> +(cl::anychar_p - '>') >> cl::lexeme_d['>' >> *cl::space_p];
markup =
escape
@@ -316,10 +315,11 @@
tidy = +markup;
}
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() { return tidy; }
- rule<Scanner> tidy, tag, start_tag, start_end_tag,
+ cl::rule<Scanner>
+ tidy, tag, start_tag, start_end_tag,
content, end_tag, markup, code, escape;
};
@@ -435,7 +435,7 @@
std::string tidy;
tidy_compiler state(tidy, linewidth);
tidy_grammar g(state, indent);
- parse_info<iter_type> r = parse(in.begin(), in.end(), g, space_p);
+ cl::parse_info<iter_type> r = parse(in.begin(), in.end(), g, cl::space_p);
if (r.full)
{
out << tidy;
Modified: trunk/tools/quickbook/src/quickbook.cpp
==============================================================================
--- trunk/tools/quickbook/src/quickbook.cpp (original)
+++ trunk/tools/quickbook/src/quickbook.cpp 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
@@ -32,8 +32,9 @@
namespace quickbook
{
- using namespace boost::spirit::classic;
+ namespace cl = boost::spirit::classic;
namespace fs = boost::filesystem;
+
tm* current_time; // the current time
tm* current_gm_time; // the current UTC time
bool debug_mode; // for quickbook developers only
@@ -84,7 +85,7 @@
iterator last(storage.end(), storage.end());
doc_info_grammar l(actor);
- parse_info<iterator> info = call_parse(first, last, l);
+ cl::parse_info<iterator> info = call_parse(first, last, l);
if (info.hit || ignore_docinfo)
{
Modified: trunk/tools/quickbook/src/syntax_highlight.hpp
==============================================================================
--- trunk/tools/quickbook/src/syntax_highlight.hpp (original)
+++ trunk/tools/quickbook/src/syntax_highlight.hpp 2010-09-08 20:09:34 EDT (Wed, 08 Sep 2010)
@@ -19,7 +19,7 @@
namespace quickbook
{
- using namespace boost::spirit::classic;
+ namespace cl = boost::spirit::classic;
// Grammar for C++ highlighting
template <
@@ -32,7 +32,7 @@
, typename Unexpected
, typename Out>
struct cpp_highlight
- : public grammar<cpp_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, Unexpected, Out> >
+ : public cl::grammar<cpp_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, Unexpected, Out> >
{
cpp_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
: out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
@@ -46,7 +46,7 @@
{
program
=
- *( (+space_p) [Space(self.out)]
+ *( (+cl::space_p) [Space(self.out)]
| macro
| escape
| preprocessor [Process("preprocessor", self.out)]
@@ -57,51 +57,54 @@
| string_ [Process("string", self.out)]
| char_ [Process("char", self.out)]
| number [Process("number", self.out)]
- | repeat_p(1)[anychar_p] [Unexpected(self.out)]
+ | cl::repeat_p(1)[cl::anychar_p]
+ [Unexpected(self.out)]
)
;
- macro =
- eps_p(self.macro // must not be followed by
- >> (eps_p - (alpha_p | '_'))) // alpha or underscore
+ macro =
+ // must not be followed by alpha or underscore
+ cl::eps_p(self.macro
+ >> (cl::eps_p - (cl::alpha_p | '_')))
>> self.macro [self.do_macro]
;
qbk_phrase =
*( common
- | (anychar_p - str_p("``")) [self.escape_actions.plain_char]
+ | (cl::anychar_p - cl::str_p("``"))
+ [self.escape_actions.plain_char]
)
;
escape =
- str_p("``") [PreEscape(self.escape_actions, save)]
+ cl::str_p("``") [PreEscape(self.escape_actions, save)]
>>
(
(
(
- (+(anychar_p - "``") >> eps_p("``"))
+ (+(cl::anychar_p - "``") >> cl::eps_p("``"))
& qbk_phrase
)
- >> str_p("``")
+ >> cl::str_p("``")
)
|
(
- eps_p [self.escape_actions.error]
- >> *anychar_p
+ cl::eps_p [self.escape_actions.error]
+ >> *cl::anychar_p
)
) [PostEscape(self.out, self.escape_actions, save)]
;
preprocessor
- = '#' >> *space_p >> ((alpha_p | '_') >> *(alnum_p | '_'))
+ = '#' >> *cl::space_p >> ((cl::alpha_p | '_') >> *(cl::alnum_p | '_'))
;
comment
- = comment_p("//") | comment_p("/*", "*/")
+ = cl::comment_p("//") | cl::comment_p("/*", "*/")
;
keyword
- = keyword_ >> (eps_p - (alnum_p | '_'))
+ = keyword_ >> (cl::eps_p - (cl::alnum_p | '_'))
; // make sure we recognize whole words only
keyword_
@@ -122,43 +125,44 @@
;
special
- = +chset_p("~!%^&*()+={[}]:;,<.>?/|\\-")
+ = +cl::chset_p("~!%^&*()+={[}]:;,<.>?/|\\-")
;
- string_char = ('\\' >> anychar_p) | (anychar_p - '\\');
+ string_char = ('\\' >> cl::anychar_p) | (cl::anychar_p - '\\');
string_
- = !as_lower_d['l'] >> confix_p('"', *string_char, '"')
+ = !cl::as_lower_d['l'] >> cl::confix_p('"', *string_char, '"')
;
char_
- = !as_lower_d['l'] >> confix_p('\'', *string_char, '\'')
+ = !cl::as_lower_d['l'] >> cl::confix_p('\'', *string_char, '\'')
;
number
= (
- as_lower_d["0x"] >> hex_p
- | '0' >> oct_p
- | real_p
+ cl::as_lower_d["0x"] >> cl::hex_p
+ | '0' >> cl::oct_p
+ | cl::real_p
)
- >> *as_lower_d[chset_p("ldfu")]
+ >> *cl::as_lower_d[cl::chset_p("ldfu")]
;
identifier
- = (alpha_p | '_') >> *(alnum_p | '_')
+ = (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
;
}
- rule<Scanner> program, macro, preprocessor, comment, special, string_,
+ cl::rule<Scanner>
+ program, macro, preprocessor, comment, special, string_,
char_, number, identifier, keyword, qbk_phrase, escape,
string_char;
- symbols<> keyword_;
+ cl::symbols<> keyword_;
phrase_grammar common;
std::string save;
bool unused;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return program; }
};
@@ -181,7 +185,7 @@
, typename Unexpected
, typename Out>
struct python_highlight
- : public grammar<python_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, Unexpected, Out> >
+ : public cl::grammar<python_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, Unexpected, Out> >
{
python_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
: out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
@@ -195,7 +199,7 @@
{
program
=
- *( (+space_p) [Space(self.out)]
+ *( (+cl::space_p) [Space(self.out)]
| macro
| escape
| comment [Process("comment", self.out)]
@@ -204,47 +208,50 @@
| special [Process("special", self.out)]
| string_ [Process("string", self.out)]
| number [Process("number", self.out)]
- | repeat_p(1)[anychar_p] [Unexpected(self.out)]
+ | cl::repeat_p(1)[cl::anychar_p]
+ [Unexpected(self.out)]
)
;
macro =
- eps_p(self.macro // must not be followed by
- >> (eps_p - (alpha_p | '_'))) // alpha or underscore
+ // must not be followed by alpha or underscore
+ cl::eps_p(self.macro
+ >> (cl::eps_p - (cl::alpha_p | '_')))
>> self.macro [self.do_macro]
;
qbk_phrase =
*( common
- | (anychar_p - str_p("``")) [self.escape_actions.plain_char]
+ | (cl::anychar_p - cl::str_p("``"))
+ [self.escape_actions.plain_char]
)
;
escape =
- str_p("``") [PreEscape(self.escape_actions, save)]
+ cl::str_p("``") [PreEscape(self.escape_actions, save)]
>>
(
(
(
- (+(anychar_p - "``") >> eps_p("``"))
+ (+(cl::anychar_p - "``") >> cl::eps_p("``"))
& qbk_phrase
)
- >> str_p("``")
+ >> cl::str_p("``")
)
|
(
- eps_p [self.escape_actions.error]
- >> *anychar_p
+ cl::eps_p [self.escape_actions.error]
+ >> *cl::anychar_p
)
) [PostEscape(self.out, self.escape_actions, save)]
;
comment
- = comment_p("#")
+ = cl::comment_p("#")
;
keyword
- = keyword_ >> (eps_p - (alnum_p | '_'))
+ = keyword_ >> (cl::eps_p - (cl::alnum_p | '_'))
; // make sure we recognize whole words only
keyword_
@@ -264,55 +271,56 @@
;
special
- = +chset_p("~!%^&*()+={[}]:;,<.>/|\\-")
+ = +cl::chset_p("~!%^&*()+={[}]:;,<.>/|\\-")
;
string_prefix
- = as_lower_d[str_p("u") >> ! str_p("r")]
+ = cl::as_lower_d[cl::str_p("u") >> ! cl::str_p("r")]
;
string_
= ! string_prefix >> (long_string | short_string)
;
- string_char = ('\\' >> anychar_p) | (anychar_p - '\\');
+ string_char = ('\\' >> cl::anychar_p) | (cl::anychar_p - '\\');
short_string
- = confix_p('\'', * string_char, '\'') |
- confix_p('"', * string_char, '"')
+ = cl::confix_p('\'', * string_char, '\'') |
+ cl::confix_p('"', * string_char, '"')
;
long_string
- // Note: the "str_p" on the next two lines work around
+ // Note: the "cl::str_p" on the next two lines work around
// an INTERNAL COMPILER ERROR when using VC7.1
- = confix_p(str_p("'''"), * string_char, "'''") |
- confix_p(str_p("\"\"\""), * string_char, "\"\"\"")
+ = cl::confix_p(cl::str_p("'''"), * string_char, "'''") |
+ cl::confix_p(cl::str_p("\"\"\""), * string_char, "\"\"\"")
;
number
= (
- as_lower_d["0x"] >> hex_p
- | '0' >> oct_p
- | real_p
+ cl::as_lower_d["0x"] >> cl::hex_p
+ | '0' >> cl::oct_p
+ | cl::real_p
)
- >> *as_lower_d[chset_p("lj")]
+ >> *cl::as_lower_d[cl::chset_p("lj")]
;
identifier
- = (alpha_p | '_') >> *(alnum_p | '_')
+ = (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
;
}
- rule<Scanner> program, macro, comment, special, string_, string_prefix,
+ cl::rule<Scanner>
+ program, macro, comment, special, string_, string_prefix,
short_string, long_string, number, identifier, keyword,
qbk_phrase, escape, string_char;
- symbols<> keyword_;
+ cl::symbols<> keyword_;
phrase_grammar common;
std::string save;
bool unused;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return program; }
};
@@ -331,7 +339,7 @@
, typename PostEscape
, typename Out>
struct teletype_highlight
- : public grammar<teletype_highlight<CharProcess, Macro, DoMacro, PreEscape, PostEscape, Out> >
+ : public cl::grammar<teletype_highlight<CharProcess, Macro, DoMacro, PreEscape, PostEscape, Out> >
{
teletype_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
: out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
@@ -347,49 +355,51 @@
=
*( macro
| escape
- | repeat_p(1)[anychar_p] [CharProcess(self.out)]
+ | cl::repeat_p(1)[cl::anychar_p] [CharProcess(self.out)]
)
;
- macro =
- eps_p(self.macro // must not be followed by
- >> (eps_p - (alpha_p | '_'))) // alpha or underscore
- >> self.macro [self.do_macro]
+ macro =
+ // must not be followed by alpha or underscore
+ cl::eps_p(self.macro
+ >> (cl::eps_p - (cl::alpha_p | '_')))
+ >> self.macro [self.do_macro]
;
qbk_phrase =
*( common
- | (anychar_p - str_p("``")) [self.escape_actions.plain_char]
+ | (cl::anychar_p - cl::str_p("``"))
+ [self.escape_actions.plain_char]
)
;
escape =
- str_p("``") [PreEscape(self.escape_actions, save)]
+ cl::str_p("``") [PreEscape(self.escape_actions, save)]
>>
(
(
(
- (+(anychar_p - "``") >> eps_p("``"))
+ (+(cl::anychar_p - "``") >> cl::eps_p("``"))
& qbk_phrase
)
- >> str_p("``")
+ >> cl::str_p("``")
)
|
(
- eps_p [self.escape_actions.error]
- >> *anychar_p
+ cl::eps_p [self.escape_actions.error]
+ >> *cl::anychar_p
)
) [PostEscape(self.out, self.escape_actions, save)]
;
}
- rule<Scanner> program, macro, qbk_phrase, escape;
+ cl::rule<Scanner> program, macro, qbk_phrase, escape;
phrase_grammar common;
std::string save;
bool unused;
- rule<Scanner> const&
+ cl::rule<Scanner> const&
start() const { return program; }
};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk