|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65032 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2010-08-26 16:58:23
Author: danieljames
Date: 2010-08-26 16:58:22 EDT (Thu, 26 Aug 2010)
New Revision: 65032
URL: http://svn.boost.org/trac/boost/changeset/65032
Log:
Fix indentation.
Text files modified:
trunk/tools/quickbook/src/block_grammar.cpp | 886 +++++++++++++++++++-------------------
trunk/tools/quickbook/src/doc_info_grammar.cpp | 361 +++++++-------
trunk/tools/quickbook/src/phrase_grammar.cpp | 910 ++++++++++++++++++++--------------------
trunk/tools/quickbook/src/phrase_grammar.hpp | 42
4 files changed, 1099 insertions(+), 1100 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-08-26 16:58:22 EDT (Thu, 26 Aug 2010)
@@ -23,452 +23,452 @@
{
using namespace boost::spirit::classic;
- template <typename Scanner>
- struct block_grammar::definition
- {
- definition(block_grammar const&);
-
- bool no_eols;
-
- 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,
- macro_identifier, table, table_row, variablelist,
- varlistentry, varlistterm, varlistitem, table_cell,
- preformatted, list_item, begin_section, end_section,
- xinclude, include, hard_space, eol, paragraph_end,
- template_, template_id, template_formal_arg,
- template_body, identifier, dummy_block, import,
- inside_paragraph,
- element_id, element_id_1_5, element_id_1_6;
-
- symbols<> paragraph_end_markups;
-
- phrase_grammar common;
-
- rule<Scanner> const&
- start() const { return start_; }
- };
-
- template <typename Scanner>
- block_grammar::definition<Scanner>::definition(block_grammar const& self)
- : no_eols(true)
- , common(self.actions, no_eols)
- {
- using detail::var;
- quickbook::actions& actions = self.actions;
-
- if (self.skip_initial_spaces)
- {
- start_ =
- *(blank_p | comment) >> blocks >> blank
- ;
- }
- else
- {
- start_ =
- blocks >> blank
- ;
- }
-
- blocks =
- *( block_markup
- | code
- | list [actions.list]
- | hr [actions.hr]
- | +eol
- | paragraph [actions.inside_paragraph]
- [actions.write_paragraphs]
- )
- ;
-
- space =
- *(space_p | comment)
- ;
-
- blank =
- *(blank_p | comment)
- ;
-
- eol = blank >> eol_p
- ;
-
- phrase_end =
- ']' |
- if_p(var(no_eols))
- [
- eol >> *blank_p >> eol_p
- // Make sure that we don't go
- ] // past a single block, except
- ; // when preformatted.
-
- hard_space =
- (eps_p - (alnum_p | '_')) >> space // must not be preceded by
- ; // alpha-numeric or underscore
-
- comment =
- "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
- ;
-
- hr =
- str_p("----")
- >> *(anychar_p - eol)
- >> +eol
- ;
-
- block_markup =
- '[' >> space
- >> ( begin_section
- | end_section
- | headings
- | blurb
- | blockquote
- | admonition
- | preformatted
- | def_macro
- | table
- | variablelist
- | xinclude
- | include
- | import
- | template_
- )
- >> ( (space >> ']' >> +eol)
- | eps_p [actions.error]
- )
- ;
-
- element_id =
- ':'
- >>
- (
- if_p(qbk_since(105u)) [space]
- >> (+(alnum_p | '_')) [assign_a(actions.element_id)]
- | eps_p [actions.element_id_warning]
- [assign_a(actions.element_id)]
- )
- | eps_p [assign_a(actions.element_id)]
- ;
-
- element_id_1_5 =
- if_p(qbk_since(105u)) [
- element_id
- ]
- .else_p [
- eps_p [assign_a(actions.element_id)]
- ]
- ;
-
- element_id_1_6 =
- if_p(qbk_since(106u)) [
- element_id
- ]
- .else_p [
- eps_p [assign_a(actions.element_id)]
- ]
- ;
-
- begin_section =
- "section"
- >> hard_space
- >> element_id
- >> space
- >> phrase [actions.begin_section]
- ;
-
- end_section =
- str_p("endsect") [actions.end_section]
- ;
-
- headings =
- h1 | h2 | h3 | h4 | h5 | h6 | h
- ;
-
- h = "heading" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h];
- h1 = "h1" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h1];
- h2 = "h2" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h2];
- h3 = "h3" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h3];
- h4 = "h4" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h4];
- h5 = "h5" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h5];
- h6 = "h6" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h6];
-
- static const bool true_ = true;
- static const bool false_ = false;
-
- inside_paragraph =
- phrase [actions.inside_paragraph]
- >> *(
- +eol >> phrase [actions.inside_paragraph]
- )
- ;
-
- blurb =
- "blurb" >> hard_space
- >> inside_paragraph [actions.blurb]
- >> eps_p
- ;
-
- blockquote =
- ':' >> blank >>
- inside_paragraph [actions.blockquote]
- ;
-
- admonition =
- "warning" >> blank >>
- inside_paragraph [actions.warning]
- |
- "caution" >> blank >>
- inside_paragraph [actions.caution]
- |
- "important" >> blank >>
- inside_paragraph [actions.important]
- |
- "note" >> blank >>
- inside_paragraph [actions.note]
- |
- "tip" >> blank >>
- inside_paragraph [actions.tip]
- ;
-
- preformatted =
- "pre" >> hard_space [assign_a(no_eols, false_)]
- >> !eol >> phrase [actions.preformatted]
- >> eps_p [assign_a(no_eols, true_)]
- ;
-
- macro_identifier =
- +(anychar_p - (space_p | ']'))
- ;
-
- def_macro =
- "def" >> hard_space
- >> macro_identifier [actions.macro_identifier]
- >> blank >> phrase [actions.macro_definition]
- ;
-
- identifier =
- (alpha_p | '_') >> *(alnum_p | '_')
- ;
-
- template_id =
- identifier | (punct_p - (ch_p('[') | ']'))
- ;
-
- template_ =
- "template"
- >> hard_space
- >> template_id [assign_a(actions.template_identifier)]
- [clear_a(actions.template_info)]
- >>
- !(
- space >> '['
- >> *(
- space >> template_id [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_)]
- )
- >> template_body [actions.template_body]
- ;
-
- template_body =
- *(('[' >> template_body >> ']') | (anychar_p - ']'))
- >> eps_p(space >> ']')
- >> space
- ;
-
- variablelist =
- "variablelist"
- >> (eps_p(*blank_p >> eol_p) | hard_space)
- >> (*(anychar_p - eol)) [assign_a(actions.table_title)]
- >> +eol
- >> *varlistentry
- >> eps_p [actions.variablelist]
- ;
-
- varlistentry =
- space
- >> ch_p('[') [actions.start_varlistentry]
- >>
- (
- (
- varlistterm [actions.start_varlistitem]
- >> ( +varlistitem
- | eps_p [actions.error]
- ) [actions.end_varlistitem]
- >> ch_p(']') [actions.end_varlistentry]
- >> space
- )
- | eps_p [actions.error]
- )
- ;
-
- varlistterm =
- space
- >> ch_p('[') [actions.start_varlistterm]
- >>
- (
- (
- phrase
- >> ch_p(']') [actions.end_varlistterm]
- >> space
- )
- | eps_p [actions.error]
- )
- ;
-
- varlistitem =
- space
- >> ch_p('[')
- >>
- (
- (
- inside_paragraph
- >> ch_p(']')
- >> space
- )
- | eps_p [actions.error]
- )
- ;
-
- table =
- "table"
- >> (eps_p(*blank_p >> eol_p) | hard_space)
- >> element_id_1_5
- >> (eps_p(*blank_p >> eol_p) | space)
- >> (*(anychar_p - eol)) [assign_a(actions.table_title)]
- >> +eol
- >> *table_row
- >> eps_p [actions.table]
- ;
-
- table_row =
- space
- >> ch_p('[') [actions.start_row]
- >>
- (
- (
- *table_cell
- >> ch_p(']') [actions.end_row]
- >> space
- )
- | eps_p [actions.error]
- )
- ;
-
- table_cell =
- space
- >> ch_p('[') [actions.start_cell]
- >>
- (
- (
- inside_paragraph
- >> ch_p(']') [actions.end_cell]
- >> space
- )
- | eps_p [actions.error]
- )
- ;
+ template <typename Scanner>
+ struct block_grammar::definition
+ {
+ definition(block_grammar const&);
- xinclude =
- "xinclude"
- >> hard_space
- >> (*(anychar_p -
- phrase_end)) [actions.xinclude]
- ;
-
- import =
- "import"
- >> hard_space
- >> (*(anychar_p -
- phrase_end)) [actions.import]
- ;
-
- include =
- "include"
- >> hard_space
- >>
- !(
- ':'
- >> (*((alnum_p | '_') - space_p))[assign_a(actions.include_doc_id)]
- >> space
- )
- >> (*(anychar_p -
- phrase_end)) [actions.include]
- ;
-
- code =
- (
- code_line
- >> *(*blank_line >> code_line)
- ) [actions.code]
- >> *eol
- ;
-
- code_line =
- blank_p >> *(anychar_p - eol_p) >> eol_p
- ;
-
- blank_line =
- *blank_p >> eol_p
- ;
-
- list =
- eps_p(ch_p('*') | '#') >>
- +(
- (*blank_p
- >> (ch_p('*') | '#')) [actions.list_format]
- >> *blank_p
- >> list_item
- ) [actions.list_item]
- ;
-
- list_item =
- *( common
- | (anychar_p -
- ( eol_p >> *blank_p >> eps_p(ch_p('*') | '#')
- | (eol >> eol)
- )
- ) [actions.plain_char]
- )
- >> +eol
- ;
+ bool no_eols;
- paragraph_end_markups =
- "section", "endsect", "h1", "h2", "h3", "h4", "h5", "h6",
- "blurb", ":", "pre", "def", "table", "include", "xinclude",
- "variablelist", "import", "template", "warning", "caution",
- "important", "note", "tip", ":"
- ;
-
- paragraph_end =
- '[' >> space >> paragraph_end_markups >> hard_space | eol >> *blank_p >> eol_p
- ;
-
- paragraph =
- +( common
- | (anychar_p - // Make sure we don't go past
- paragraph_end // a single block.
- ) [actions.plain_char]
- )
- >> (eps_p('[') | +eol)
- ;
+ 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,
+ macro_identifier, table, table_row, variablelist,
+ varlistentry, varlistterm, varlistitem, table_cell,
+ preformatted, list_item, begin_section, end_section,
+ xinclude, include, hard_space, eol, paragraph_end,
+ template_, template_id, template_formal_arg,
+ template_body, identifier, dummy_block, import,
+ inside_paragraph,
+ element_id, element_id_1_5, element_id_1_6;
+
+ symbols<> paragraph_end_markups;
+
+ phrase_grammar common;
+
+ rule<Scanner> const&
+ start() const { return start_; }
+ };
+
+ template <typename Scanner>
+ block_grammar::definition<Scanner>::definition(block_grammar const& self)
+ : no_eols(true)
+ , common(self.actions, no_eols)
+ {
+ using detail::var;
+ quickbook::actions& actions = self.actions;
- phrase =
- *( common
- | comment
- | (anychar_p -
- phrase_end) [actions.plain_char]
- )
- ;
- }
+ if (self.skip_initial_spaces)
+ {
+ start_ =
+ *(blank_p | comment) >> blocks >> blank
+ ;
+ }
+ else
+ {
+ start_ =
+ blocks >> blank
+ ;
+ }
+
+ blocks =
+ *( block_markup
+ | code
+ | list [actions.list]
+ | hr [actions.hr]
+ | +eol
+ | paragraph [actions.inside_paragraph]
+ [actions.write_paragraphs]
+ )
+ ;
+
+ space =
+ *(space_p | comment)
+ ;
+
+ blank =
+ *(blank_p | comment)
+ ;
+
+ eol = blank >> eol_p
+ ;
+
+ phrase_end =
+ ']' |
+ if_p(var(no_eols))
+ [
+ eol >> *blank_p >> eol_p
+ // Make sure that we don't go
+ ] // past a single block, except
+ ; // when preformatted.
+
+ hard_space =
+ (eps_p - (alnum_p | '_')) >> space // must not be preceded by
+ ; // alpha-numeric or underscore
+
+ comment =
+ "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
+ ;
+
+ dummy_block =
+ '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
+ ;
+
+ hr =
+ str_p("----")
+ >> *(anychar_p - eol)
+ >> +eol
+ ;
+
+ block_markup =
+ '[' >> space
+ >> ( begin_section
+ | end_section
+ | headings
+ | blurb
+ | blockquote
+ | admonition
+ | preformatted
+ | def_macro
+ | table
+ | variablelist
+ | xinclude
+ | include
+ | import
+ | template_
+ )
+ >> ( (space >> ']' >> +eol)
+ | eps_p [actions.error]
+ )
+ ;
+
+ element_id =
+ ':'
+ >>
+ (
+ if_p(qbk_since(105u)) [space]
+ >> (+(alnum_p | '_')) [assign_a(actions.element_id)]
+ | eps_p [actions.element_id_warning]
+ [assign_a(actions.element_id)]
+ )
+ | eps_p [assign_a(actions.element_id)]
+ ;
+
+ element_id_1_5 =
+ if_p(qbk_since(105u)) [
+ element_id
+ ]
+ .else_p [
+ eps_p [assign_a(actions.element_id)]
+ ]
+ ;
+
+ element_id_1_6 =
+ if_p(qbk_since(106u)) [
+ element_id
+ ]
+ .else_p [
+ eps_p [assign_a(actions.element_id)]
+ ]
+ ;
+
+ begin_section =
+ "section"
+ >> hard_space
+ >> element_id
+ >> space
+ >> phrase [actions.begin_section]
+ ;
+
+ end_section =
+ str_p("endsect") [actions.end_section]
+ ;
+
+ headings =
+ h1 | h2 | h3 | h4 | h5 | h6 | h
+ ;
+
+ h = "heading" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h];
+ h1 = "h1" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h1];
+ h2 = "h2" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h2];
+ h3 = "h3" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h3];
+ h4 = "h4" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h4];
+ h5 = "h5" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h5];
+ h6 = "h6" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h6];
+
+ static const bool true_ = true;
+ static const bool false_ = false;
+
+ inside_paragraph =
+ phrase [actions.inside_paragraph]
+ >> *(
+ +eol >> phrase [actions.inside_paragraph]
+ )
+ ;
+
+ blurb =
+ "blurb" >> hard_space
+ >> inside_paragraph [actions.blurb]
+ >> eps_p
+ ;
+
+ blockquote =
+ ':' >> blank >>
+ inside_paragraph [actions.blockquote]
+ ;
+
+ admonition =
+ "warning" >> blank >>
+ inside_paragraph [actions.warning]
+ |
+ "caution" >> blank >>
+ inside_paragraph [actions.caution]
+ |
+ "important" >> blank >>
+ inside_paragraph [actions.important]
+ |
+ "note" >> blank >>
+ inside_paragraph [actions.note]
+ |
+ "tip" >> blank >>
+ inside_paragraph [actions.tip]
+ ;
+
+ preformatted =
+ "pre" >> hard_space [assign_a(no_eols, false_)]
+ >> !eol >> phrase [actions.preformatted]
+ >> eps_p [assign_a(no_eols, true_)]
+ ;
+
+ macro_identifier =
+ +(anychar_p - (space_p | ']'))
+ ;
+
+ def_macro =
+ "def" >> hard_space
+ >> macro_identifier [actions.macro_identifier]
+ >> blank >> phrase [actions.macro_definition]
+ ;
+
+ identifier =
+ (alpha_p | '_') >> *(alnum_p | '_')
+ ;
+
+ template_id =
+ identifier | (punct_p - (ch_p('[') | ']'))
+ ;
+
+ template_ =
+ "template"
+ >> hard_space
+ >> template_id [assign_a(actions.template_identifier)]
+ [clear_a(actions.template_info)]
+ >>
+ !(
+ space >> '['
+ >> *(
+ space >> template_id [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_)]
+ )
+ >> template_body [actions.template_body]
+ ;
+
+ template_body =
+ *(('[' >> template_body >> ']') | (anychar_p - ']'))
+ >> eps_p(space >> ']')
+ >> space
+ ;
+
+ variablelist =
+ "variablelist"
+ >> (eps_p(*blank_p >> eol_p) | hard_space)
+ >> (*(anychar_p - eol)) [assign_a(actions.table_title)]
+ >> +eol
+ >> *varlistentry
+ >> eps_p [actions.variablelist]
+ ;
+
+ varlistentry =
+ space
+ >> ch_p('[') [actions.start_varlistentry]
+ >>
+ (
+ (
+ varlistterm [actions.start_varlistitem]
+ >> ( +varlistitem
+ | eps_p [actions.error]
+ ) [actions.end_varlistitem]
+ >> ch_p(']') [actions.end_varlistentry]
+ >> space
+ )
+ | eps_p [actions.error]
+ )
+ ;
+
+ varlistterm =
+ space
+ >> ch_p('[') [actions.start_varlistterm]
+ >>
+ (
+ (
+ phrase
+ >> ch_p(']') [actions.end_varlistterm]
+ >> space
+ )
+ | eps_p [actions.error]
+ )
+ ;
+
+ varlistitem =
+ space
+ >> ch_p('[')
+ >>
+ (
+ (
+ inside_paragraph
+ >> ch_p(']')
+ >> space
+ )
+ | eps_p [actions.error]
+ )
+ ;
+
+ table =
+ "table"
+ >> (eps_p(*blank_p >> eol_p) | hard_space)
+ >> element_id_1_5
+ >> (eps_p(*blank_p >> eol_p) | space)
+ >> (*(anychar_p - eol)) [assign_a(actions.table_title)]
+ >> +eol
+ >> *table_row
+ >> eps_p [actions.table]
+ ;
+
+ table_row =
+ space
+ >> ch_p('[') [actions.start_row]
+ >>
+ (
+ (
+ *table_cell
+ >> ch_p(']') [actions.end_row]
+ >> space
+ )
+ | eps_p [actions.error]
+ )
+ ;
+
+ table_cell =
+ space
+ >> ch_p('[') [actions.start_cell]
+ >>
+ (
+ (
+ inside_paragraph
+ >> ch_p(']') [actions.end_cell]
+ >> space
+ )
+ | eps_p [actions.error]
+ )
+ ;
+
+ xinclude =
+ "xinclude"
+ >> hard_space
+ >> (*(anychar_p -
+ phrase_end)) [actions.xinclude]
+ ;
+
+ import =
+ "import"
+ >> hard_space
+ >> (*(anychar_p -
+ phrase_end)) [actions.import]
+ ;
+
+ include =
+ "include"
+ >> hard_space
+ >>
+ !(
+ ':'
+ >> (*((alnum_p | '_') - space_p))[assign_a(actions.include_doc_id)]
+ >> space
+ )
+ >> (*(anychar_p -
+ phrase_end)) [actions.include]
+ ;
+
+ code =
+ (
+ code_line
+ >> *(*blank_line >> code_line)
+ ) [actions.code]
+ >> *eol
+ ;
+
+ code_line =
+ blank_p >> *(anychar_p - eol_p) >> eol_p
+ ;
+
+ blank_line =
+ *blank_p >> eol_p
+ ;
+
+ list =
+ eps_p(ch_p('*') | '#') >>
+ +(
+ (*blank_p
+ >> (ch_p('*') | '#')) [actions.list_format]
+ >> *blank_p
+ >> list_item
+ ) [actions.list_item]
+ ;
+
+ list_item =
+ *( common
+ | (anychar_p -
+ ( eol_p >> *blank_p >> eps_p(ch_p('*') | '#')
+ | (eol >> eol)
+ )
+ ) [actions.plain_char]
+ )
+ >> +eol
+ ;
+
+ paragraph_end_markups =
+ "section", "endsect", "h1", "h2", "h3", "h4", "h5", "h6",
+ "blurb", ":", "pre", "def", "table", "include", "xinclude",
+ "variablelist", "import", "template", "warning", "caution",
+ "important", "note", "tip", ":"
+ ;
+
+ paragraph_end =
+ '[' >> space >> paragraph_end_markups >> hard_space | eol >> *blank_p >> eol_p
+ ;
+
+ paragraph =
+ +( common
+ | (anychar_p - // Make sure we don't go past
+ paragraph_end // a single block.
+ ) [actions.plain_char]
+ )
+ >> (eps_p('[') | +eol)
+ ;
+
+ phrase =
+ *( common
+ | comment
+ | (anychar_p -
+ phrase_end) [actions.plain_char]
+ )
+ ;
+ }
template <typename Iterator, typename Grammar>
parse_info<Iterator> parse(Iterator& first, Iterator last, Grammar& g)
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-08-26 16:58:22 EDT (Thu, 26 Aug 2010)
@@ -21,190 +21,189 @@
{
using namespace 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;
-
- bool unused;
- std::string category;
- 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;
-
- rule<Scanner> const&
- start() const { return doc_info; }
- };
-
- template <typename Scanner>
- doc_info_grammar::definition<Scanner>::definition(doc_info_grammar const& self)
- : unused(false), common(self.actions, unused)
- {
- quickbook::actions& actions = self.actions;
-
- doc_types =
- "book", "article", "library", "chapter", "part"
- , "appendix", "preface", "qandadiv", "qandaset"
- , "reference", "set"
- ;
-
- doc_info =
- space
- >> '[' >> space
- >> (doc_types >> eps_p) [assign_a(actions.doc_type)]
- >> hard_space
- >> ( *(~eps_p(ch_p('[') | ']' | eol_p) >> char_)
- ) [actions.extract_doc_title]
- >> !(
- space >> '[' >>
- quickbook_version
- >> space >> ']'
- )
- >>
- *(
- space >> '[' >>
- (
- doc_version
- | doc_id
- | doc_dirname
- | doc_copyright [push_back_a(actions.doc_copyrights, actions.copyright)]
- | doc_purpose
- | doc_category
- | doc_authors
- | doc_license
- | doc_last_revision
- | doc_source_mode
- )
- >> space >> ']' >> +eol_p
- )
- >> space >> ']' >> +eol_p
- ;
+ template <typename Scanner>
+ struct doc_info_grammar::definition
+ {
+ definition(doc_info_grammar const&);
- quickbook_version =
- "quickbook" >> hard_space
- >> ( uint_p [assign_a(qbk_major_version)]
- >> '.'
- >> uint2_t() [assign_a(qbk_minor_version)]
- )
- ;
-
- doc_version =
- "version" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_version]
- ;
-
- // TODO: Restrictions on doc_id?
- doc_id =
- "id" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_id]
- ;
-
- // TODO: Restrictions on doc_dirname?
- doc_dirname =
- "dirname" >> hard_space
- >> (*(~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)]
- >> space
- )
- >> space
- >> (*(~eps_p(']') >> char_)) [actions.extract_copyright_second]
- ;
-
- doc_purpose =
- "purpose" >> hard_space
- >> phrase [actions.extract_doc_purpose]
- ;
-
- doc_category =
- "category" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_category]
- [push_back_a(actions.doc_categories, actions.doc_category)]
- ;
-
- doc_author =
- '[' >> space
- >> (*(~eps_p(',') >> char_)) [actions.extract_name_second] // surname
- >> ',' >> space
- >> (*(~eps_p(']') >> char_)) [actions.extract_name_first] // firstname
- >> ']'
- ;
-
- doc_authors =
- "authors"
- >> hard_space
- >> doc_author [push_back_a(actions.doc_authors, actions.name)]
- >> space
- >> *( !(ch_p(',') >> space)
- >> doc_author [push_back_a(actions.doc_authors, actions.name)]
- >> space
- )
- ;
-
- doc_license =
- "license" >> hard_space
- >> phrase [actions.extract_doc_license]
- ;
-
- doc_last_revision =
- "last-revision" >> hard_space
- >> (*(~eps_p(']') >> char_)) [actions.extract_doc_last_revision]
- ;
-
- doc_source_mode =
- "source-mode" >> hard_space
- >> (
- str_p("c++")
- | "python"
- | "teletype"
- ) [assign_a(actions.source_mode)]
- ;
-
- comment =
- "[/" >> *(anychar_p - ']') >> ']'
- ;
-
- space =
- *(space_p | comment)
- ;
-
- hard_space =
- (eps_p - (alnum_p | '_')) >> space // must not be preceded by
- ; // alpha-numeric or underscore
-
- phrase =
- *( common
- | comment
- | (anychar_p - ']') [actions.plain_char]
- )
- ;
+ typedef uint_parser<int, 10, 1, 2> uint2_t;
- char_ =
- str_p("\\n") [actions.break_]
- | "\\ " // ignore an escaped space
- | '\\' >> punct_p [actions.raw_char]
- | "\\u" >> repeat_p(4) [chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
- | "\\U" >> repeat_p(8) [chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
- | (
- ("'''" >> !eol_p) [actions.escape_pre]
- >> *(anychar_p - "'''") [actions.raw_char]
- >> str_p("'''") [actions.escape_post]
- )
- | anychar_p [actions.plain_char]
- ;
- }
+ bool unused;
+ std::string category;
+ 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;
+
+ rule<Scanner> const&
+ start() const { return doc_info; }
+ };
+
+ template <typename Scanner>
+ doc_info_grammar::definition<Scanner>::definition(doc_info_grammar const& self)
+ : unused(false), common(self.actions, unused)
+ {
+ quickbook::actions& actions = self.actions;
+ doc_types =
+ "book", "article", "library", "chapter", "part"
+ , "appendix", "preface", "qandadiv", "qandaset"
+ , "reference", "set"
+ ;
+
+ doc_info =
+ space
+ >> '[' >> space
+ >> (doc_types >> eps_p) [assign_a(actions.doc_type)]
+ >> hard_space
+ >> ( *(~eps_p(ch_p('[') | ']' | eol_p) >> char_)
+ ) [actions.extract_doc_title]
+ >> !(
+ space >> '[' >>
+ quickbook_version
+ >> space >> ']'
+ )
+ >>
+ *(
+ space >> '[' >>
+ (
+ doc_version
+ | doc_id
+ | doc_dirname
+ | doc_copyright [push_back_a(actions.doc_copyrights, actions.copyright)]
+ | doc_purpose
+ | doc_category
+ | doc_authors
+ | doc_license
+ | doc_last_revision
+ | doc_source_mode
+ )
+ >> space >> ']' >> +eol_p
+ )
+ >> space >> ']' >> +eol_p
+ ;
+
+ quickbook_version =
+ "quickbook" >> hard_space
+ >> ( uint_p [assign_a(qbk_major_version)]
+ >> '.'
+ >> uint2_t() [assign_a(qbk_minor_version)]
+ )
+ ;
+
+ doc_version =
+ "version" >> hard_space
+ >> (*(~eps_p(']') >> char_)) [actions.extract_doc_version]
+ ;
+
+ // TODO: Restrictions on doc_id?
+ doc_id =
+ "id" >> hard_space
+ >> (*(~eps_p(']') >> char_)) [actions.extract_doc_id]
+ ;
+
+ // TODO: Restrictions on doc_dirname?
+ doc_dirname =
+ "dirname" >> hard_space
+ >> (*(~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)]
+ >> space
+ )
+ >> space
+ >> (*(~eps_p(']') >> char_)) [actions.extract_copyright_second]
+ ;
+
+ doc_purpose =
+ "purpose" >> hard_space
+ >> phrase [actions.extract_doc_purpose]
+ ;
+
+ doc_category =
+ "category" >> hard_space
+ >> (*(~eps_p(']') >> char_)) [actions.extract_doc_category]
+ [push_back_a(actions.doc_categories, actions.doc_category)]
+ ;
+
+ doc_author =
+ '[' >> space
+ >> (*(~eps_p(',') >> char_)) [actions.extract_name_second] // surname
+ >> ',' >> space
+ >> (*(~eps_p(']') >> char_)) [actions.extract_name_first] // firstname
+ >> ']'
+ ;
+
+ doc_authors =
+ "authors"
+ >> hard_space
+ >> doc_author [push_back_a(actions.doc_authors, actions.name)]
+ >> space
+ >> *( !(ch_p(',') >> space)
+ >> doc_author [push_back_a(actions.doc_authors, actions.name)]
+ >> space
+ )
+ ;
+
+ doc_license =
+ "license" >> hard_space
+ >> phrase [actions.extract_doc_license]
+ ;
+
+ doc_last_revision =
+ "last-revision" >> hard_space
+ >> (*(~eps_p(']') >> char_)) [actions.extract_doc_last_revision]
+ ;
+
+ doc_source_mode =
+ "source-mode" >> hard_space
+ >> (
+ str_p("c++")
+ | "python"
+ | "teletype"
+ ) [assign_a(actions.source_mode)]
+ ;
+
+ comment =
+ "[/" >> *(anychar_p - ']') >> ']'
+ ;
+
+ space =
+ *(space_p | comment)
+ ;
+
+ hard_space =
+ (eps_p - (alnum_p | '_')) >> space // must not be preceded by
+ ; // alpha-numeric or underscore
+
+ phrase =
+ *( common
+ | comment
+ | (anychar_p - ']') [actions.plain_char]
+ )
+ ;
+
+ char_ =
+ str_p("\\n") [actions.break_]
+ | "\\ " // ignore an escaped space
+ | '\\' >> punct_p [actions.raw_char]
+ | "\\u" >> repeat_p(4) [chset<>("0-9a-fA-F")]
+ [actions.escape_unicode]
+ | "\\U" >> repeat_p(8) [chset<>("0-9a-fA-F")]
+ [actions.escape_unicode]
+ | (
+ ("'''" >> !eol_p) [actions.escape_pre]
+ >> *(anychar_p - "'''") [actions.raw_char]
+ >> str_p("'''") [actions.escape_post]
+ )
+ | anychar_p [actions.plain_char]
+ ;
+ }
template <typename Iterator, typename Grammar>
parse_info<Iterator> parse(Iterator& first, Iterator last, Grammar& 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-08-26 16:58:22 EDT (Thu, 26 Aug 2010)
@@ -58,480 +58,480 @@
;
}
- template <typename Scanner>
- phrase_grammar::definition<Scanner>::definition(phrase_grammar const& self)
- {
- using detail::var;
- quickbook::actions& actions = self.actions;
-
- space =
- *(space_p | comment)
- ;
-
- blank =
- *(blank_p | comment)
- ;
-
- eol = blank >> eol_p
- ;
-
- phrase_end =
- ']' |
- if_p(var(self.no_eols))
- [
- eol >> eol // Make sure that we don't go
- ] // past a single block, except
- ; // when preformatted.
-
- hard_space =
- (eps_p - (alnum_p | '_')) >> space // must not be preceded by
- ; // alpha-numeric or underscore
-
- comment =
- "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
- ;
-
- common =
- macro
- | phrase_markup
- | code_block
- | inline_code
- | simple_format
- | escape
- | comment
- ;
-
- macro =
- eps_p(actions.macro // must not be followed by
- >> (eps_p - (alpha_p | '_'))) // alpha or underscore
- >> actions.macro [actions.do_macro]
- ;
+ template <typename Scanner>
+ phrase_grammar::definition<Scanner>::definition(phrase_grammar const& self)
+ {
+ using detail::var;
+ quickbook::actions& actions = self.actions;
- static const bool true_ = true;
- static const bool false_ = false;
+ space =
+ *(space_p | comment)
+ ;
- template_ =
- (
- ch_p('`') [assign_a(actions.template_escape,true_)]
- |
- eps_p [assign_a(actions.template_escape,false_)]
- )
- >>
- ( (
- (eps_p(punct_p)
- >> actions.templates.scope
- ) [assign_a(actions.template_identifier)]
- [clear_a(actions.template_args)]
- >> !template_args
- ) | (
- (actions.templates.scope
- >> eps_p(hard_space)
- ) [assign_a(actions.template_identifier)]
- [clear_a(actions.template_args)]
- >> space
- >> !template_args
- ) )
- >> eps_p(']')
- ;
-
- template_args =
- if_p(qbk_since(105u)) [
- template_args_1_5
- ].else_p [
- template_args_1_4
- ]
- ;
-
- 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_)]
- )
- >> template_inner_arg_1_4 [actions.template_arg]
- ;
+ blank =
+ *(blank_p | comment)
+ ;
- template_inner_arg_1_4 =
- +(brackets_1_4 | (anychar_p - (str_p("..") | ']')))
- ;
-
- brackets_1_4 =
- '[' >> template_inner_arg_1_4 >> ']'
- ;
-
- 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_)]
- )
- >> (+(brackets_1_5 | ('\\' >> anychar_p) | (anychar_p - (str_p("..") | '[' | ']'))))
- [actions.template_arg]
- ;
-
- template_inner_arg_1_5 =
- +(brackets_1_5 | ('\\' >> anychar_p) | (anychar_p - (str_p('[') | ']')))
- ;
-
- brackets_1_5 =
- '[' >> template_inner_arg_1_5 >> ']'
- ;
+ eol = blank >> eol_p
+ ;
+
+ phrase_end =
+ ']' |
+ if_p(var(self.no_eols))
+ [
+ eol >> eol // Make sure that we don't go
+ ] // past a single block, except
+ ; // when preformatted.
+
+ hard_space =
+ (eps_p - (alnum_p | '_')) >> space // must not be preceded by
+ ; // alpha-numeric or underscore
+
+ comment =
+ "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
+ ;
+
+ dummy_block =
+ '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
+ ;
- inline_code =
- '`' >>
+ common =
+ macro
+ | phrase_markup
+ | code_block
+ | inline_code
+ | simple_format
+ | escape
+ | comment
+ ;
+
+ macro =
+ eps_p(actions.macro // must not be followed by
+ >> (eps_p - (alpha_p | '_'))) // alpha or underscore
+ >> actions.macro [actions.do_macro]
+ ;
+
+ static const bool true_ = true;
+ static const bool false_ = false;
+
+ template_ =
+ (
+ ch_p('`') [assign_a(actions.template_escape,true_)]
+ |
+ eps_p [assign_a(actions.template_escape,false_)]
+ )
+ >>
+ ( (
+ (eps_p(punct_p)
+ >> actions.templates.scope
+ ) [assign_a(actions.template_identifier)]
+ [clear_a(actions.template_args)]
+ >> !template_args
+ ) | (
+ (actions.templates.scope
+ >> eps_p(hard_space)
+ ) [assign_a(actions.template_identifier)]
+ [clear_a(actions.template_args)]
+ >> space
+ >> !template_args
+ ) )
+ >> eps_p(']')
+ ;
+
+ template_args =
+ if_p(qbk_since(105u)) [
+ template_args_1_5
+ ].else_p [
+ template_args_1_4
+ ]
+ ;
+
+ 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_)]
+ )
+ >> template_inner_arg_1_4 [actions.template_arg]
+ ;
+
+ template_inner_arg_1_4 =
+ +(brackets_1_4 | (anychar_p - (str_p("..") | ']')))
+ ;
+
+ brackets_1_4 =
+ '[' >> template_inner_arg_1_4 >> ']'
+ ;
+
+ 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_)]
+ )
+ >> (+(brackets_1_5 | ('\\' >> anychar_p) | (anychar_p - (str_p("..") | '[' | ']'))))
+ [actions.template_arg]
+ ;
+
+ template_inner_arg_1_5 =
+ +(brackets_1_5 | ('\\' >> anychar_p) | (anychar_p - (str_p('[') | ']')))
+ ;
+
+ brackets_1_5 =
+ '[' >> template_inner_arg_1_5 >> ']'
+ ;
+
+ inline_code =
+ '`' >>
+ (
+ *(anychar_p -
+ ( '`'
+ | (eol >> eol) // Make sure that we don't go
+ ) // past a single block
+ ) >> eps_p('`')
+ ) [actions.inline_code]
+ >> '`'
+ ;
+
+ code_block =
+ (
+ "```" >>
(
- *(anychar_p -
- ( '`'
- | (eol >> eol) // Make sure that we don't go
- ) // past a single block
- ) >> eps_p('`')
- ) [actions.inline_code]
- >> '`'
- ;
-
- code_block =
- (
- "```" >>
- (
- *(anychar_p - "```")
- >> eps_p("```")
- ) [actions.code_block]
- >> "```"
- )
- | (
- "``" >>
- (
- *(anychar_p - "``")
- >> eps_p("``")
- ) [actions.code_block]
- >> "``"
- )
- ;
+ *(anychar_p - "```")
+ >> eps_p("```")
+ ) [actions.code_block]
+ >> "```"
+ )
+ | (
+ "``" >>
+ (
+ *(anychar_p - "``")
+ >> eps_p("``")
+ ) [actions.code_block]
+ >> "``"
+ )
+ ;
- simple_format =
- simple_bold
- | simple_italic
- | simple_underline
- | simple_teletype
- ;
-
- simple_phrase_end = '[' | phrase_end;
-
- simple_markup(simple_bold,
- '*', actions.simple_bold, simple_phrase_end);
- simple_markup(simple_italic,
- '/', actions.simple_italic, simple_phrase_end);
- simple_markup(simple_underline,
- '_', actions.simple_underline, simple_phrase_end);
- simple_markup(simple_teletype,
- '=', actions.simple_teletype, simple_phrase_end);
-
- phrase =
- *( common
- | comment
- | (anychar_p - phrase_end) [actions.plain_char]
- )
- ;
+ simple_format =
+ simple_bold
+ | simple_italic
+ | simple_underline
+ | simple_teletype
+ ;
- phrase_markup =
- '['
- >> ( cond_phrase
- | image
- | url
- | link
- | anchor
- | source_mode
- | funcref
- | classref
- | memberref
- | enumref
- | macroref
- | headerref
- | conceptref
- | globalref
- | bold
- | italic
- | underline
- | teletype
- | strikethrough
- | quote
- | replaceable
- | footnote
- | template_ [actions.do_template]
- | str_p("br") [actions.break_]
- )
- >> ']'
- ;
+ simple_phrase_end = '[' | phrase_end;
+
+ simple_markup(simple_bold,
+ '*', actions.simple_bold, simple_phrase_end);
+ simple_markup(simple_italic,
+ '/', actions.simple_italic, simple_phrase_end);
+ simple_markup(simple_underline,
+ '_', actions.simple_underline, simple_phrase_end);
+ simple_markup(simple_teletype,
+ '=', actions.simple_teletype, simple_phrase_end);
+
+ phrase =
+ *( common
+ | comment
+ | (anychar_p - phrase_end) [actions.plain_char]
+ )
+ ;
+
+ phrase_markup =
+ '['
+ >> ( cond_phrase
+ | image
+ | url
+ | link
+ | anchor
+ | source_mode
+ | funcref
+ | classref
+ | memberref
+ | enumref
+ | macroref
+ | headerref
+ | conceptref
+ | globalref
+ | bold
+ | italic
+ | underline
+ | teletype
+ | strikethrough
+ | quote
+ | replaceable
+ | footnote
+ | template_ [actions.do_template]
+ | 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")]
+ [actions.escape_unicode]
+ | "\\U" >> repeat_p(8) [chset<>("0-9a-fA-F")]
+ [actions.escape_unicode]
+ | (
+ ("'''" >> !eol) [actions.escape_pre]
+ >> *(anychar_p - "'''") [actions.raw_char]
+ >> str_p("'''") [actions.escape_post]
+ )
+ ;
- escape =
- str_p("\\ ") // ignore an escaped space
- | '\\' >> punct_p [actions.raw_char]
- | "\\u" >> repeat_p(4) [chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
- | "\\U" >> repeat_p(8) [chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
- | (
- ("'''" >> !eol) [actions.escape_pre]
- >> *(anychar_p - "'''") [actions.raw_char]
- >> str_p("'''") [actions.escape_post]
+ macro_identifier =
+ +(anychar_p - (space_p | ']'))
+ ;
+
+ cond_phrase =
+ '?' >> blank
+ >> macro_identifier [actions.cond_phrase_pre]
+ >> (!phrase) [actions.cond_phrase_post]
+ ;
+
+ image =
+ '$' >> blank [clear_a(actions.attributes)]
+ >> if_p(qbk_since(105u)) [
+ (+(
+ *space_p
+ >> +(anychar_p - (space_p | phrase_end | '['))
+ )) [assign_a(actions.image_fileref)]
+ >> hard_space
+ >> *(
+ '['
+ >> (*(alnum_p | '_')) [assign_a(actions.attribute_name)]
+ >> space
+ >> (*(anychar_p - (phrase_end | '[')))
+ [actions.attribute]
+ >> ']'
+ >> space
)
- ;
+ ].else_p [
+ (*(anychar_p -
+ phrase_end)) [assign_a(actions.image_fileref)]
+ ]
+ >> eps_p(']') [actions.image]
+ ;
+
+ url =
+ '@'
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.url_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.url_post]
+ ;
- macro_identifier =
- +(anychar_p - (space_p | ']'))
- ;
-
- cond_phrase =
- '?' >> blank
- >> macro_identifier [actions.cond_phrase_pre]
- >> (!phrase) [actions.cond_phrase_post]
- ;
-
- image =
- '$' >> blank [clear_a(actions.attributes)]
- >> if_p(qbk_since(105u)) [
- (+(
- *space_p
- >> +(anychar_p - (space_p | phrase_end | '['))
- )) [assign_a(actions.image_fileref)]
- >> hard_space
- >> *(
- '['
- >> (*(alnum_p | '_')) [assign_a(actions.attribute_name)]
- >> space
- >> (*(anychar_p - (phrase_end | '[')))
- [actions.attribute]
- >> ']'
- >> space
- )
- ].else_p [
- (*(anychar_p -
- phrase_end)) [assign_a(actions.image_fileref)]
- ]
- >> eps_p(']') [actions.image]
- ;
-
- url =
- '@'
- >> (*(anychar_p -
- (']' | hard_space))) [actions.url_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.url_post]
- ;
-
- link =
- "link" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.link_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.link_post]
- ;
-
- anchor =
- '#'
- >> blank
- >> ( *(anychar_p -
- phrase_end)
- ) [actions.anchor]
- ;
-
- funcref =
- "funcref" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.funcref_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.funcref_post]
- ;
-
- classref =
- "classref" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.classref_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.classref_post]
- ;
-
- memberref =
- "memberref" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.memberref_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.memberref_post]
- ;
-
- enumref =
- "enumref" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.enumref_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.enumref_post]
- ;
-
- macroref =
- "macroref" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.macroref_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.macroref_post]
- ;
-
- headerref =
- "headerref" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.headerref_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.headerref_post]
- ;
-
- conceptref =
- "conceptref" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.conceptref_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.conceptref_post]
- ;
-
- globalref =
- "globalref" >> hard_space
- >> (*(anychar_p -
- (']' | hard_space))) [actions.globalref_pre]
- >> ( eps_p(']')
- | (hard_space >> phrase)
- ) [actions.globalref_post]
- ;
-
- bold =
- ch_p('*') [actions.bold_pre]
- >> blank >> phrase [actions.bold_post]
- ;
-
- italic =
- ch_p('\'') [actions.italic_pre]
- >> blank >> phrase [actions.italic_post]
- ;
-
- underline =
- ch_p('_') [actions.underline_pre]
- >> blank >> phrase [actions.underline_post]
- ;
-
- teletype =
- ch_p('^') [actions.teletype_pre]
- >> blank >> phrase [actions.teletype_post]
- ;
-
- strikethrough =
- ch_p('-') [actions.strikethrough_pre]
- >> blank >> phrase [actions.strikethrough_post]
- ;
-
- quote =
- ch_p('"') [actions.quote_pre]
- >> blank >> phrase [actions.quote_post]
- ;
-
- replaceable =
- ch_p('~') [actions.replaceable_pre]
- >> blank >> phrase [actions.replaceable_post]
- ;
+ link =
+ "link" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.link_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.link_post]
+ ;
- source_mode =
- (
- str_p("c++")
- | "python"
- | "teletype"
- ) [assign_a(actions.source_mode)]
- ;
-
- footnote =
- str_p("footnote") [actions.footnote_pre]
- >> blank >> phrase [actions.footnote_post]
- ;
- }
+ anchor =
+ '#'
+ >> blank
+ >> ( *(anychar_p -
+ phrase_end)
+ ) [actions.anchor]
+ ;
+
+ funcref =
+ "funcref" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.funcref_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.funcref_post]
+ ;
+
+ classref =
+ "classref" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.classref_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.classref_post]
+ ;
- template <typename Scanner>
- struct simple_phrase_grammar::definition
+ memberref =
+ "memberref" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.memberref_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.memberref_post]
+ ;
+
+ enumref =
+ "enumref" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.enumref_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.enumref_post]
+ ;
+
+ macroref =
+ "macroref" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.macroref_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.macroref_post]
+ ;
+
+ headerref =
+ "headerref" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.headerref_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.headerref_post]
+ ;
+
+ conceptref =
+ "conceptref" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.conceptref_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.conceptref_post]
+ ;
+
+ globalref =
+ "globalref" >> hard_space
+ >> (*(anychar_p -
+ (']' | hard_space))) [actions.globalref_pre]
+ >> ( eps_p(']')
+ | (hard_space >> phrase)
+ ) [actions.globalref_post]
+ ;
+
+ bold =
+ ch_p('*') [actions.bold_pre]
+ >> blank >> phrase [actions.bold_post]
+ ;
+
+ italic =
+ ch_p('\'') [actions.italic_pre]
+ >> blank >> phrase [actions.italic_post]
+ ;
+
+ underline =
+ ch_p('_') [actions.underline_pre]
+ >> blank >> phrase [actions.underline_post]
+ ;
+
+ teletype =
+ ch_p('^') [actions.teletype_pre]
+ >> blank >> phrase [actions.teletype_post]
+ ;
+
+ strikethrough =
+ ch_p('-') [actions.strikethrough_pre]
+ >> blank >> phrase [actions.strikethrough_post]
+ ;
+
+ quote =
+ ch_p('"') [actions.quote_pre]
+ >> blank >> phrase [actions.quote_post]
+ ;
+
+ replaceable =
+ ch_p('~') [actions.replaceable_pre]
+ >> blank >> phrase [actions.replaceable_post]
+ ;
+
+ source_mode =
+ (
+ str_p("c++")
+ | "python"
+ | "teletype"
+ ) [assign_a(actions.source_mode)]
+ ;
+
+ footnote =
+ str_p("footnote") [actions.footnote_pre]
+ >> blank >> phrase [actions.footnote_post]
+ ;
+ }
+
+ template <typename Scanner>
+ struct simple_phrase_grammar::definition
+ {
+ definition(simple_phrase_grammar const& self)
+ : unused(false), common(self.actions, unused)
{
- definition(simple_phrase_grammar const& self)
- : unused(false), common(self.actions, unused)
- {
- quickbook::actions& actions = self.actions;
-
- phrase =
- *( common
- | comment
- | (anychar_p - ']') [actions.plain_char]
- )
- ;
+ quickbook::actions& actions = self.actions;
- comment =
- "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
- ;
- }
-
- bool unused;
- rule<Scanner> phrase, comment, dummy_block;
- phrase_grammar common;
-
- rule<Scanner> const&
- start() const { return phrase; }
- };
+ phrase =
+ *( common
+ | comment
+ | (anychar_p - ']') [actions.plain_char]
+ )
+ ;
+
+ comment =
+ "[/" >> *(dummy_block | (anychar_p - ']')) >> ']'
+ ;
+
+ dummy_block =
+ '[' >> *(dummy_block | (anychar_p - ']')) >> ']'
+ ;
+ }
+
+ bool unused;
+ rule<Scanner> phrase, comment, dummy_block;
+ phrase_grammar common;
+
+ rule<Scanner> const&
+ start() const { return phrase; }
+ };
- template <typename Scanner>
- struct command_line_grammar::definition
+ template <typename Scanner>
+ struct command_line_grammar::definition
+ {
+ definition(command_line_grammar const& self)
+ : unused(false), common(self.actions, unused)
{
- definition(command_line_grammar const& self)
- : unused(false), common(self.actions, unused)
- {
- quickbook::actions& actions = self.actions;
-
- macro =
- *space_p
- >> macro_identifier [actions.macro_identifier]
- >> *space_p
- >> ( '='
- >> *space_p
- >> phrase [actions.macro_definition]
- >> *space_p
- )
- | eps_p [actions.macro_definition]
- ;
+ quickbook::actions& actions = self.actions;
- macro_identifier =
- +(anychar_p - (space_p | ']' | '='))
- ;
-
- phrase =
- *( common
- | (anychar_p - ']') [actions.plain_char]
+ macro =
+ *space_p
+ >> macro_identifier [actions.macro_identifier]
+ >> *space_p
+ >> ( '='
+ >> *space_p
+ >> phrase [actions.macro_definition]
+ >> *space_p
)
- ;
- }
+ | eps_p [actions.macro_definition]
+ ;
- bool unused;
- rule<Scanner> macro, macro_identifier, phrase;
- phrase_grammar common;
-
- rule<Scanner> const&
- start() const { return macro; }
- };
+ macro_identifier =
+ +(anychar_p - (space_p | ']' | '='))
+ ;
+
+ phrase =
+ *( common
+ | (anychar_p - ']') [actions.plain_char]
+ )
+ ;
+ }
+
+ bool unused;
+ rule<Scanner> macro, macro_identifier, phrase;
+ phrase_grammar common;
+
+ rule<Scanner> const&
+ start() const { return macro; }
+ };
template <typename Iterator, typename Grammar>
parse_info<Iterator> parse(Iterator& first, Iterator last, Grammar& 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-08-26 16:58:22 EDT (Thu, 26 Aug 2010)
@@ -16,29 +16,29 @@
{
using namespace boost::spirit::classic;
- template <typename Scanner>
- struct phrase_grammar::definition
- {
- definition(phrase_grammar const& self);
+ template <typename Scanner>
+ struct phrase_grammar::definition
+ {
+ definition(phrase_grammar const& self);
- rule<Scanner> space, blank, comment, phrase, phrase_markup, image,
- simple_phrase_end, phrase_end, bold, italic, underline, teletype,
- strikethrough, escape, url, common, funcref, classref,
- memberref, enumref, macroref, headerref, conceptref, globalref,
- anchor, link, hard_space, eol, inline_code, simple_format,
- simple_bold, simple_italic, simple_underline,
- simple_teletype, source_mode, template_,
- quote, code_block, footnote, replaceable, macro,
- dummy_block, cond_phrase, macro_identifier, template_args,
- template_args_1_4, template_arg_1_4,
- template_inner_arg_1_4, brackets_1_4,
- template_args_1_5, template_arg_1_5,
- template_inner_arg_1_5, brackets_1_5
- ;
+ rule<Scanner> space, blank, comment, phrase, phrase_markup, image,
+ simple_phrase_end, phrase_end, bold, italic, underline, teletype,
+ strikethrough, escape, url, common, funcref, classref,
+ memberref, enumref, macroref, headerref, conceptref, globalref,
+ anchor, link, hard_space, eol, inline_code, simple_format,
+ simple_bold, simple_italic, simple_underline,
+ simple_teletype, source_mode, template_,
+ quote, code_block, footnote, replaceable, macro,
+ dummy_block, cond_phrase, macro_identifier, template_args,
+ template_args_1_4, template_arg_1_4,
+ template_inner_arg_1_4, brackets_1_4,
+ template_args_1_5, template_arg_1_5,
+ template_inner_arg_1_5, brackets_1_5
+ ;
- rule<Scanner> const&
- start() const { return common; }
- };
+ rule<Scanner> const&
+ start() const { return common; }
+ };
}
#endif // BOOST_SPIRIT_QUICKBOOK_PHRASE_HPP
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