Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63164 - branches/quickbook-1.5-spirit2
From: daniel_james_at_[hidden]
Date: 2010-06-20 16:31:18


Author: danieljames
Date: 2010-06-20 16:31:17 EDT (Sun, 20 Jun 2010)
New Revision: 63164
URL: http://svn.boost.org/trac/boost/changeset/63164

Log:
Use the same rule for the start of a block as for the end of a paragraph.
Text files modified:
   branches/quickbook-1.5-spirit2/block_grammar.cpp | 37 ++++++++++++++++---------------------
   1 files changed, 16 insertions(+), 21 deletions(-)

Modified: branches/quickbook-1.5-spirit2/block_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/block_grammar.cpp 2010-06-20 16:31:17 EDT (Sun, 20 Jun 2010)
@@ -28,6 +28,7 @@
     void quickbook_grammar::impl::init_block()
     {
         qi::rule<iterator>& block_markup = store_.create();
+ qi::rule<iterator, qi::rule<iterator>()>& block_markup_start = store_.create();
         qi::rule<iterator>& blocks = store_.create();
         qi::rule<iterator, quickbook::list()>& list = store_.create();
         qi::rule<iterator, quickbook::hr()>& hr = store_.create();
@@ -53,20 +54,23 @@
 
         qi::rule<iterator, qi::locals<qi::rule<iterator> > >& block_markup_impl = store_.create();
 
- block_markup =
- '[' >> space
- >> block_markup_impl
+ block_markup = block_markup_impl;
+
+ block_markup_impl
+ = block_markup_start [qi::_a = qi::_1]
+ >> lazy(qi::_a)
>> ( (space >> ']' >> +eol)
                 | error
                 )
             ;
 
- block_markup_impl
- = ( block_keyword_rules >> !(qi::alnum | '_')
+ block_markup_start
+ = '['
+ >> space
+ >> ( block_keyword_rules >> !(qi::alnum | '_')
                 | block_symbol_rules
- ) [qi::_a = qi::_1]
- >> lazy(qi::_a)
- ;
+ )
+ ;
 
         // List
 
@@ -110,23 +114,21 @@
             ;
 
         qi::rule<iterator>& paragraph_end = store_.create();
- qi::symbols<>& paragraph_end_markups = store_.create();
 
         // Paragraph
 
         paragraph =
                +( common
- | (qi::char_ - // Make sure we don't go past
- paragraph_end // a single block.
- ) [actions.process]
+ | (qi::char_ - paragraph_end) [actions.process]
                 )
             ;
 
         paragraph_end =
- '[' >> space >> paragraph_end_markups >> hard_space | block_separator
+ block_separator
+ | block_markup_start
             ;
 
- // Define block_seperator using qi::eol/qi::blank rather than 'eol'
+ // Define block_separator using qi::eol/qi::blank rather than 'eol'
         // because we don't want any comments in the blank line.
 
         block_separator =
@@ -136,13 +138,6 @@
                 ]
             ;
 
- 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", ":"
- ;
-
         // Parse command line macro definition. This is more here out of
         // convenience than anything.
 


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