diff --git a/src/block_grammar.cpp b/src/block_grammar.cpp index ebd5752..c0e2f16 100644 --- a/src/block_grammar.cpp +++ b/src/block_grammar.cpp @@ -23,452 +23,452 @@ namespace quickbook { using namespace boost::spirit::classic; - template - struct block_grammar::definition + template + struct block_grammar::definition + { + definition(block_grammar const&); + + bool no_eols; + + rule 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 const& + start() const { return start_; } + }; + + template + block_grammar::definition::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) { - definition(block_grammar const&); + start_ = + *(blank_p | comment) >> blocks >> blank + ; + } + else + { + start_ = + blocks >> blank + ; + } - bool no_eols; + blocks = + *( block_markup + | code + | list [actions.list] + | hr [actions.hr] + | +eol + | paragraph [actions.inside_paragraph] + [actions.write_paragraphs] + ) + ; - rule 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; + space = + *(space_p | comment) + ; - symbols<> paragraph_end_markups; + blank = + *(blank_p | comment) + ; - phrase_grammar common; + eol = blank >> eol_p + ; - rule const& - start() const { return start_; } - }; + 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. - template - block_grammar::definition::definition(block_grammar const& self) - : no_eols(true) - , common(self.actions, no_eols) - { - using detail::var; - quickbook::actions& actions = self.actions; + hard_space = + (eps_p - (alnum_p | '_')) >> space // must not be preceded by + ; // alpha-numeric or underscore - if (self.skip_initial_spaces) - { - start_ = - *(blank_p | comment) >> blocks >> blank - ; - } - else - { - start_ = - blocks >> blank - ; - } + comment = + "[/" >> *(dummy_block | (anychar_p - ']')) >> ']' + ; - blocks = - *( block_markup - | code - | list [actions.list] - | hr [actions.hr] - | +eol - | paragraph [actions.inside_paragraph] - [actions.write_paragraphs] + 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] + ; - space = - *(space_p | comment) - ; + template_body = + *(('[' >> template_body >> ']') | (anychar_p - ']')) + >> eps_p(space >> ']') + >> space + ; - blank = - *(blank_p | comment) - ; + variablelist = + "variablelist" + >> (eps_p(*blank_p >> eol_p) | hard_space) + >> (*(anychar_p - eol)) [assign_a(actions.table_title)] + >> +eol + >> *varlistentry + >> eps_p [actions.variablelist] + ; - eol = blank >> eol_p - ; + 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] + ) + ; - 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. + varlistterm = + space + >> ch_p('[') [actions.start_varlistterm] + >> + ( + ( + phrase + >> ch_p(']') [actions.end_varlistterm] + >> space + ) + | eps_p [actions.error] + ) + ; - hard_space = - (eps_p - (alnum_p | '_')) >> space // must not be preceded by - ; // alpha-numeric or underscore + varlistitem = + space + >> ch_p('[') + >> + ( + ( + inside_paragraph + >> ch_p(']') + >> space + ) + | eps_p [actions.error] + ) + ; - comment = - "[/" >> *(dummy_block | (anychar_p - ']')) >> ']' - ; + 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] + ; - dummy_block = - '[' >> *(dummy_block | (anychar_p - ']')) >> ']' - ; + table_row = + space + >> ch_p('[') [actions.start_row] + >> + ( + ( + *table_cell + >> ch_p(']') [actions.end_row] + >> space + ) + | eps_p [actions.error] + ) + ; - hr = - str_p("----") - >> *(anychar_p - eol) - >> +eol - ; + table_cell = + space + >> ch_p('[') [actions.start_cell] + >> + ( + ( + inside_paragraph + >> ch_p(']') [actions.end_cell] + >> space + ) + | eps_p [actions.error] + ) + ; - 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)] - ] - ; + xinclude = + "xinclude" + >> hard_space + >> (*(anychar_p - + phrase_end)) [actions.xinclude] + ; - element_id_1_6 = - if_p(qbk_since(106u)) [ - element_id - ] - .else_p [ - eps_p [assign_a(actions.element_id)] - ] - ; + import = + "import" + >> hard_space + >> (*(anychar_p - + phrase_end)) [actions.import] + ; - begin_section = - "section" - >> hard_space - >> element_id - >> space - >> phrase [actions.begin_section] - ; + include = + "include" + >> hard_space + >> + !( + ':' + >> (*((alnum_p | '_') - space_p))[assign_a(actions.include_doc_id)] + >> space + ) + >> (*(anychar_p - + phrase_end)) [actions.include] + ; - end_section = - str_p("endsect") [actions.end_section] - ; + code = + ( + code_line + >> *(*blank_line >> code_line) + ) [actions.code] + >> *eol + ; - headings = - h1 | h2 | h3 | h4 | h5 | h6 | h - ; + code_line = + blank_p >> *(anychar_p - eol_p) >> eol_p + ; - 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]; + blank_line = + *blank_p >> eol_p + ; - static const bool true_ = true; - static const bool false_ = false; + list = + eps_p(ch_p('*') | '#') >> + +( + (*blank_p + >> (ch_p('*') | '#')) [actions.list_format] + >> *blank_p + >> list_item + ) [actions.list_item] + ; - inside_paragraph = - phrase [actions.inside_paragraph] - >> *( - +eol >> phrase [actions.inside_paragraph] + list_item = + *( common + | (anychar_p - + ( eol_p >> *blank_p >> eps_p(ch_p('*') | '#') + | (eol >> eol) ) - ; + ) [actions.plain_char] + ) + >> +eol + ; - blurb = - "blurb" >> hard_space - >> inside_paragraph [actions.blurb] - >> eps_p - ; + 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", ":" + ; - blockquote = - ':' >> blank >> - inside_paragraph [actions.blockquote] - ; + paragraph_end = + '[' >> space >> paragraph_end_markups >> hard_space | eol >> *blank_p >> eol_p + ; - 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] - ; + paragraph = + +( common + | (anychar_p - // Make sure we don't go past + paragraph_end // a single block. + ) [actions.plain_char] + ) + >> (eps_p('[') | +eol) + ; - 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] - ) - ; - } + phrase = + *( common + | comment + | (anychar_p - + phrase_end) [actions.plain_char] + ) + ; + } template parse_info parse(Iterator& first, Iterator last, Grammar& g) diff --git a/src/doc_info_grammar.cpp b/src/doc_info_grammar.cpp index a073e96..0935acb 100644 --- a/src/doc_info_grammar.cpp +++ b/src/doc_info_grammar.cpp @@ -21,190 +21,189 @@ namespace quickbook { using namespace boost::spirit::classic; - template - struct doc_info_grammar::definition - { - definition(doc_info_grammar const&); + template + struct doc_info_grammar::definition + { + definition(doc_info_grammar const&); - typedef uint_parser uint2_t; + typedef uint_parser uint2_t; - bool unused; - std::string category; - rule 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; + bool unused; + std::string category; + rule 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 const& - start() const { return doc_info; } - }; + rule const& + start() const { return doc_info; } + }; - template - doc_info_grammar::definition::definition(doc_info_grammar const& self) - : unused(false), common(self.actions, unused) - { - quickbook::actions& actions = self.actions; + template + doc_info_grammar::definition::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] + 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 + ; - 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] - ; - } + 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 parse_info parse(Iterator& first, Iterator last, Grammar& g) diff --git a/src/phrase_grammar.cpp b/src/phrase_grammar.cpp index 4cd1cb4..eea4f3b 100644 --- a/src/phrase_grammar.cpp +++ b/src/phrase_grammar.cpp @@ -58,480 +58,480 @@ namespace quickbook ; } - template - phrase_grammar::definition::definition(phrase_grammar const& self) - { - using detail::var; - quickbook::actions& actions = self.actions; + template + phrase_grammar::definition::definition(phrase_grammar const& self) + { + using detail::var; + quickbook::actions& actions = self.actions; - space = - *(space_p | comment) - ; + space = + *(space_p | comment) + ; - blank = - *(blank_p | comment) - ; + blank = + *(blank_p | comment) + ; - eol = blank >> eol_p - ; + 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. + 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 + hard_space = + (eps_p - (alnum_p | '_')) >> space // must not be preceded by + ; // alpha-numeric or underscore - comment = - "[/" >> *(dummy_block | (anychar_p - ']')) >> ']' - ; + comment = + "[/" >> *(dummy_block | (anychar_p - ']')) >> ']' + ; - dummy_block = - '[' >> *(dummy_block | (anychar_p - ']')) >> ']' - ; + dummy_block = + '[' >> *(dummy_block | (anychar_p - ']')) >> ']' + ; - common = - macro - | phrase_markup - | code_block - | inline_code - | simple_format - | escape - | comment - ; + 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] - ; + 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; + static const bool true_ = true; + static const bool false_ = false; - template_ = + 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 = + ( + "```" >> ( - 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 - "```") + >> eps_p("```") + ) [actions.code_block] + >> "```" + ) + | ( + "``" >> ( - *(anychar_p - - ( '`' - | (eol >> eol) // Make sure that we don't go - ) // past a single block - ) >> eps_p('`') - ) [actions.inline_code] - >> '`' - ; + *(anychar_p - "``") + >> eps_p("``") + ) [actions.code_block] + >> "``" + ) + ; - 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] + ) + ; + + 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] + ) + ; + + 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 ) - | ( - "``" >> - ( - *(anychar_p - "``") - >> eps_p("``") - ) [actions.code_block] - >> "``" - ) - ; + ].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] + ; - simple_format = - simple_bold - | simple_italic - | simple_underline - | simple_teletype - ; + link = + "link" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.link_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.link_post] + ; - simple_phrase_end = '[' | phrase_end; + anchor = + '#' + >> blank + >> ( *(anychar_p - + phrase_end) + ) [actions.anchor] + ; - 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); + funcref = + "funcref" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.funcref_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.funcref_post] + ; - phrase = - *( common - | comment - | (anychar_p - phrase_end) [actions.plain_char] - ) - ; + classref = + "classref" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.classref_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.classref_post] + ; - 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_] - ) - >> ']' - ; + memberref = + "memberref" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.memberref_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.memberref_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] - ) - ; + enumref = + "enumref" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.enumref_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.enumref_post] + ; - macro_identifier = - +(anychar_p - (space_p | ']')) - ; + macroref = + "macroref" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.macroref_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.macroref_post] + ; - cond_phrase = - '?' >> blank - >> macro_identifier [actions.cond_phrase_pre] - >> (!phrase) [actions.cond_phrase_post] - ; + headerref = + "headerref" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.headerref_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.headerref_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] - ; + conceptref = + "conceptref" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.conceptref_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.conceptref_post] + ; - link = - "link" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.link_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.link_post] - ; + globalref = + "globalref" >> hard_space + >> (*(anychar_p - + (']' | hard_space))) [actions.globalref_pre] + >> ( eps_p(']') + | (hard_space >> phrase) + ) [actions.globalref_post] + ; - anchor = - '#' - >> blank - >> ( *(anychar_p - - phrase_end) - ) [actions.anchor] - ; + bold = + ch_p('*') [actions.bold_pre] + >> blank >> phrase [actions.bold_post] + ; - funcref = - "funcref" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.funcref_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.funcref_post] - ; + italic = + ch_p('\'') [actions.italic_pre] + >> blank >> phrase [actions.italic_post] + ; - classref = - "classref" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.classref_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.classref_post] - ; + underline = + ch_p('_') [actions.underline_pre] + >> blank >> phrase [actions.underline_post] + ; - memberref = - "memberref" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.memberref_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.memberref_post] - ; + teletype = + ch_p('^') [actions.teletype_pre] + >> blank >> phrase [actions.teletype_post] + ; - enumref = - "enumref" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.enumref_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.enumref_post] - ; + strikethrough = + ch_p('-') [actions.strikethrough_pre] + >> blank >> phrase [actions.strikethrough_post] + ; - macroref = - "macroref" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.macroref_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.macroref_post] - ; + quote = + ch_p('"') [actions.quote_pre] + >> blank >> phrase [actions.quote_post] + ; - headerref = - "headerref" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.headerref_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.headerref_post] - ; + replaceable = + ch_p('~') [actions.replaceable_pre] + >> blank >> phrase [actions.replaceable_post] + ; - conceptref = - "conceptref" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.conceptref_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.conceptref_post] - ; + source_mode = + ( + str_p("c++") + | "python" + | "teletype" + ) [assign_a(actions.source_mode)] + ; - globalref = - "globalref" >> hard_space - >> (*(anychar_p - - (']' | hard_space))) [actions.globalref_pre] - >> ( eps_p(']') - | (hard_space >> phrase) - ) [actions.globalref_post] - ; + footnote = + str_p("footnote") [actions.footnote_pre] + >> blank >> phrase [actions.footnote_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 - struct simple_phrase_grammar::definition + template + 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; + quickbook::actions& actions = self.actions; - phrase = - *( common - | comment - | (anychar_p - ']') [actions.plain_char] - ) - ; + phrase = + *( common + | comment + | (anychar_p - ']') [actions.plain_char] + ) + ; - comment = - "[/" >> *(dummy_block | (anychar_p - ']')) >> ']' - ; + comment = + "[/" >> *(dummy_block | (anychar_p - ']')) >> ']' + ; - dummy_block = - '[' >> *(dummy_block | (anychar_p - ']')) >> ']' - ; - } + dummy_block = + '[' >> *(dummy_block | (anychar_p - ']')) >> ']' + ; + } - bool unused; - rule phrase, comment, dummy_block; - phrase_grammar common; + bool unused; + rule phrase, comment, dummy_block; + phrase_grammar common; - rule const& - start() const { return phrase; } - }; + rule const& + start() const { return phrase; } + }; - template - struct command_line_grammar::definition + template + 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; + quickbook::actions& actions = self.actions; - macro = - *space_p - >> macro_identifier [actions.macro_identifier] + macro = + *space_p + >> macro_identifier [actions.macro_identifier] + >> *space_p + >> ( '=' + >> *space_p + >> phrase [actions.macro_definition] >> *space_p - >> ( '=' - >> *space_p - >> phrase [actions.macro_definition] - >> *space_p - ) - | eps_p [actions.macro_definition] - ; - - macro_identifier = - +(anychar_p - (space_p | ']' | '=')) - ; - - phrase = - *( common - | (anychar_p - ']') [actions.plain_char] ) - ; - } + | eps_p [actions.macro_definition] + ; - bool unused; - rule macro, macro_identifier, phrase; - phrase_grammar common; + macro_identifier = + +(anychar_p - (space_p | ']' | '=')) + ; - rule const& - start() const { return macro; } - }; + phrase = + *( common + | (anychar_p - ']') [actions.plain_char] + ) + ; + } + + bool unused; + rule macro, macro_identifier, phrase; + phrase_grammar common; + + rule const& + start() const { return macro; } + }; template parse_info parse(Iterator& first, Iterator last, Grammar& g) diff --git a/src/phrase_grammar.hpp b/src/phrase_grammar.hpp index 3425e21..ad051b3 100644 --- a/src/phrase_grammar.hpp +++ b/src/phrase_grammar.hpp @@ -16,29 +16,29 @@ namespace quickbook { using namespace boost::spirit::classic; - template - struct phrase_grammar::definition - { - definition(phrase_grammar const& self); + template + struct phrase_grammar::definition + { + definition(phrase_grammar const& self); - rule 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 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 const& - start() const { return common; } - }; + rule const& + start() const { return common; } + }; } #endif // BOOST_SPIRIT_QUICKBOOK_PHRASE_HPP