Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63167 - branches/quickbook-1.5-spirit2
From: daniel_james_at_[hidden]
Date: 2010-06-20 16:32:38


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

Log:
Various small tweaks to the grammar.
Text files modified:
   branches/quickbook-1.5-spirit2/actions.cpp | 6 +---
   branches/quickbook-1.5-spirit2/actions.hpp | 4 +-
   branches/quickbook-1.5-spirit2/block_grammar.cpp | 42 +++++++++------------------------------
   branches/quickbook-1.5-spirit2/block_markup_grammar.cpp | 3 -
   branches/quickbook-1.5-spirit2/phrase_grammar.cpp | 2 -
   branches/quickbook-1.5-spirit2/strings.hpp | 4 +-
   branches/quickbook-1.5-spirit2/syntax_highlight_grammar.cpp | 30 ++++++++++++++++------------
   7 files changed, 34 insertions(+), 57 deletions(-)

Modified: branches/quickbook-1.5-spirit2/actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/actions.cpp 2010-06-20 16:32:36 EDT (Sun, 20 Jun 2010)
@@ -34,17 +34,15 @@
         , error(state.error_count)
     {}
 
- void error_action::operator()(iterator_range x, unused_type, unused_type) const
+ void error_action::operator()(file_position pos, unused_type, unused_type) const
     {
- file_position const pos = x.begin().get_position();
         detail::outerr(pos.file,pos.line)
             << "Syntax Error near column " << pos.column << ".\n";
         ++error_count;
     }
 
- void element_id_warning_action::operator()(iterator_range x, unused_type, unused_type) const
+ void element_id_warning_action::operator()(file_position pos, unused_type, unused_type) const
     {
- file_position const pos = x.begin().get_position();
         detail::outwarn(pos.file,pos.line) << "Empty id.\n";
     }
 

Modified: branches/quickbook-1.5-spirit2/actions.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/actions.hpp (original)
+++ branches/quickbook-1.5-spirit2/actions.hpp 2010-06-20 16:32:36 EDT (Sun, 20 Jun 2010)
@@ -77,7 +77,7 @@
             int& error_count)
         : error_count(error_count) {}
 
- void operator()(iterator_range, unused_type, unused_type) const;
+ void operator()(file_position, unused_type, unused_type) const;
 
         int& error_count;
     };
@@ -87,7 +87,7 @@
 
     struct element_id_warning_action
     {
- void operator()(iterator_range, unused_type, unused_type) const;
+ void operator()(file_position, unused_type, unused_type) const;
     };
 
     struct phrase_push_action

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:32:36 EDT (Sun, 20 Jun 2010)
@@ -97,7 +97,7 @@
                     ( qi::eol >> *qi::blank >> &(qi::char_('*') | '#')
                     | (eol >> *qi::blank >> qi::eol)
                     )
- ) [actions.process]
+ ) [actions.process]
             )
>> +eol
>> qi::eps[actions.phrase_pop]
@@ -113,21 +113,15 @@
             ] >> qi::attr(quickbook::hr())
             ;
 
- qi::rule<iterator>& paragraph_end = store_.create();
-
         // Paragraph
 
         paragraph =
                +( common
- | (qi::char_ - paragraph_end) [actions.process]
+ | (qi::char_ - (block_separator | block_markup_start))
+ [actions.process]
                 )
             ;
 
- paragraph_end =
- block_separator
- | block_markup_start
- ;
-
         // Define block_separator using qi::eol/qi::blank rather than 'eol'
         // because we don't want any comments in the blank line.
 
@@ -160,47 +154,31 @@
         // Error
 
         error =
- qi::raw[qi::eps] [actions.error];
+ position [actions.error];
 
         // Block contents
 
- qi::rule<iterator>& inside_paragraph2 = store_.create();
-
         inside_paragraph =
                 qi::eps [actions.block_push][actions.phrase_push]
- >> (
- inside_paragraph2 [actions.process]
- % block_separator [actions.process]
+ >> *( common
+ | (qi::char_ - phrase_end) [actions.process]
+ | block_separator [actions.process]
                 )
>> qi::attr(quickbook::block_separator())
                                                     [actions.process]
>> qi::eps [actions.phrase_pop][actions.block_pop]
             ;
 
- inside_paragraph2 =
- *( common
- | (qi::char_ - phrase_end) [actions.process]
- )
- ;
-
         // Identifiers
 
- qi::rule<iterator, raw_string()>& element_id_part = store_.create();
-
         element_id =
- ( ':'
+ -( ':'
>> -(qi::eps(qbk_since(105u)) >> space)
>> (
- element_id_part
- | qi::omit[
- qi::raw[qi::eps] [actions.element_id_warning]
- ]
+ qi::raw[+(qi::alnum | '_')] [qi::_val = qi::_1]
+ | position [actions.element_id_warning]
                 )
             )
- | qi::eps
             ;
-
- element_id_part = qi::raw[+(qi::alnum | qi::char_('_'))]
- [qi::_val = qi::_1];
     }
 }

Modified: branches/quickbook-1.5-spirit2/block_markup_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_markup_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/block_markup_grammar.cpp 2010-06-20 16:32:36 EDT (Sun, 20 Jun 2010)
@@ -113,8 +113,7 @@
>> (*(qi::char_ - phrase_end)) [member_assign(&quickbook::include::path)]
             ;
 
- include_id = qi::raw[*((qi::alnum | '_') - qi::space)]
- [qi::_val = qi::_1];
+ include_id = qi::raw[*(qi::alnum | '_')] [qi::_val = qi::_1];
 
         // Import
 

Modified: branches/quickbook-1.5-spirit2/phrase_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/phrase_grammar.cpp 2010-06-20 16:32:36 EDT (Sun, 20 Jun 2010)
@@ -36,7 +36,6 @@
 
         simple_phrase =
            *( common
- | comment
             | (qi::char_ - ']') [actions.process]
             )
             ;
@@ -44,7 +43,6 @@
         phrase =
                 qi::eps [actions.phrase_push]
>> *( common
- | comment
                 | (qi::char_ - phrase_end) [actions.process]
                 )
>> qi::eps [actions.phrase_pop]

Modified: branches/quickbook-1.5-spirit2/strings.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/strings.hpp (original)
+++ branches/quickbook-1.5-spirit2/strings.hpp 2010-06-20 16:32:36 EDT (Sun, 20 Jun 2010)
@@ -15,7 +15,7 @@
 {
     struct raw_string {
         raw_string() {}
- explicit raw_string(raw_source const& x) : value(x.begin(), x.end()) {}
+ raw_string(raw_source const& x) : value(x.begin(), x.end()) {}
         raw_string& operator=(raw_source const& x) {
             value.assign(x.begin(), x.end());
             return *this;
@@ -37,4 +37,4 @@
     };
 }
 
-#endif
\ No newline at end of file
+#endif

Modified: branches/quickbook-1.5-spirit2/syntax_highlight_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/syntax_highlight_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/syntax_highlight_grammar.cpp 2010-06-20 16:32:36 EDT (Sun, 20 Jun 2010)
@@ -18,6 +18,7 @@
 #include "utils.hpp"
 #include "syntax_highlight.hpp"
 #include "parse_utils.hpp"
+#include "misc_rules.hpp"
 
 namespace quickbook
 {
@@ -74,11 +75,12 @@
                 ;
 
             escape =
- "``" >> (
- (qi::raw[+(qi::char_ - "``")] >> "``")
+ "``"
+ >> ( (qi::raw[+(qi::char_ - "``")] >> "``")
                                                         [parse_escaped]
- | qi::raw[*qi::char_] [actions.error]
- )
+ | position [actions.error]
+ >> *qi::char_
+ )
                 ;
 
             space
@@ -220,11 +222,12 @@
                 ;
 
             escape =
- "``" >> (
- (qi::raw[+(qi::char_ - "``")] >> "``")
+ "``"
+ >> ( (qi::raw[+(qi::char_ - "``")] >> "``")
                                                         [parse_escaped]
- | qi::raw[*qi::char_] [actions.error]
- )
+ | position [actions.error]
+ >> *qi::char_
+ )
                 ;
 
             space
@@ -353,11 +356,12 @@
                 ;
 
             escape =
- "``" >> (
- (qi::raw[+(qi::char_ - "``")] >> "``")
- [parse_escaped]
- | qi::raw[*qi::char_] [actions.error]
- )
+ "``"
+ >> ( (qi::raw[+(qi::char_ - "``")] >> "``")
+ [parse_escaped]
+ | position [actions.error]
+ >> *qi::char_
+ )
                 ;
         }
 


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