Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67334 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2010-12-19 08:34:10


Author: danieljames
Date: 2010-12-19 08:34:09 EST (Sun, 19 Dec 2010)
New Revision: 67334
URL: http://svn.boost.org/trac/boost/changeset/67334

Log:
Get rid of 'skip_initial_spaces'.
Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 41 ++++++++++++++++++++-------------------
   trunk/tools/quickbook/src/grammar.cpp | 9 ++++---
   trunk/tools/quickbook/src/grammar.hpp | 3 +
   trunk/tools/quickbook/src/grammar_impl.hpp | 5 ++-
   trunk/tools/quickbook/src/main_grammar.cpp | 21 +++++++------------
   5 files changed, 39 insertions(+), 40 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp (original)
+++ trunk/tools/quickbook/src/actions.cpp 2010-12-19 08:34:09 EST (Sun, 19 Dec 2010)
@@ -808,29 +808,30 @@
                 (body.is_block ? actions.out : actions.phrase) << body.content;
                 return true;
             }
- else if (!body.is_block)
- {
- quickbook_grammar g(actions);
-
- // do a phrase level parse
- iterator first(body.content.begin(), body.content.end(),
- position(body.position.file.c_str(), body.position.line, body.position.column));
- iterator last(body.content.end(), body.content.end());
- return cl::parse(first, last, g.simple_phrase).full;
- }
             else
             {
- quickbook_grammar g(actions, true);
+ quickbook_grammar g(actions);
 
- // do a block level parse
- // ensure that we have enough trailing newlines to eliminate
- // the need to check for end of file in the grammar.
-
- std::string content = body.content + "\n\n";
- iterator first(content.begin(), content.end(),
- position(body.position.file.c_str(), body.position.line, body.position.column));
- iterator last(content.end(), content.end());
- return cl::parse(first, last, g.block).full;
+ if (!body.is_block)
+ {
+ // do a phrase level parse
+ iterator first(body.content.begin(), body.content.end(),
+ position(body.position.file.c_str(), body.position.line, body.position.column));
+ iterator last(body.content.end(), body.content.end());
+ return cl::parse(first, last, g.simple_phrase).full;
+ }
+ else
+ {
+ // do a block level parse
+ // ensure that we have enough trailing newlines to eliminate
+ // the need to check for end of file in the grammar.
+
+ std::string content = body.content + "\n\n";
+ iterator first(content.begin(), content.end(),
+ position(body.position.file.c_str(), body.position.line, body.position.column));
+ iterator last(content.end(), content.end());
+ return cl::parse(first, last, g.block).full;
+ }
             }
         }
     }

Modified: trunk/tools/quickbook/src/grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/grammar.cpp (original)
+++ trunk/tools/quickbook/src/grammar.cpp 2010-12-19 08:34:09 EST (Sun, 19 Dec 2010)
@@ -13,12 +13,13 @@
 
 namespace quickbook
 {
- quickbook_grammar::quickbook_grammar(quickbook::actions& a, bool skip_initial_spaces)
- : impl_(new impl(a, skip_initial_spaces))
+ quickbook_grammar::quickbook_grammar(quickbook::actions& a)
+ : impl_(new impl(a))
         , command_line_macro(impl_->command_line, "command_line_macro")
         , common(impl_->common, "phrase")
         , simple_phrase(impl_->simple_phrase, "simple_phrase")
         , block(impl_->block_start, "block")
+ , block_skip_initial_spaces(impl_->block_skip_initial_spaces, "block")
         , doc_info(impl_->doc_info_details, "doc_info")
     {
     }
@@ -27,12 +28,12 @@
     {
     }
 
- quickbook_grammar::impl::impl(quickbook::actions& a, bool skip_initial_spaces)
+ quickbook_grammar::impl::impl(quickbook::actions& a)
         : actions(a)
         , no_eols(true)
         , store_()
     {
- init_main(skip_initial_spaces);
+ init_main();
         init_block_markup();
         init_phrase_markup();
         init_doc_info();

Modified: trunk/tools/quickbook/src/grammar.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar.hpp (original)
+++ trunk/tools/quickbook/src/grammar.hpp 2010-12-19 08:34:09 EST (Sun, 19 Dec 2010)
@@ -57,9 +57,10 @@
         grammar common;
         grammar simple_phrase;
         grammar block;
+ grammar block_skip_initial_spaces;
         grammar doc_info;
 
- quickbook_grammar(quickbook::actions&, bool skip_initial_spaces = false);
+ quickbook_grammar(quickbook::actions&);
         ~quickbook_grammar();
     };
 }

Modified: trunk/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar_impl.hpp (original)
+++ trunk/tools/quickbook/src/grammar_impl.hpp 2010-12-19 08:34:09 EST (Sun, 19 Dec 2010)
@@ -35,17 +35,18 @@
 
         // block
         cl::rule<scanner> block_start;
+ cl::rule<scanner> block_skip_initial_spaces;
         cl::symbols<cl::rule<scanner>*> block_keyword_rules;
         cl::symbols<cl::rule<scanner>*> block_symbol_rules;
         
         // doc_info
         cl::rule<scanner> doc_info_details;
         
- impl(quickbook::actions&, bool);
+ impl(quickbook::actions&);
 
     private:
 
- void init_main(bool);
+ void init_main();
         void init_block_markup();
         void init_phrase_markup();
         void init_doc_info();

Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp (original)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2010-12-19 08:34:09 EST (Sun, 19 Dec 2010)
@@ -84,24 +84,19 @@
         cl::rule<scanner> phrase_keyword_rule;
     };
 
- void quickbook_grammar::impl::init_main(bool skip_initial_spaces)
+ void quickbook_grammar::impl::init_main()
     {
         using detail::var;
 
         main_grammar_local& local = store_.create();
 
- if (skip_initial_spaces)
- {
- block_start =
- *(cl::blank_p | local.comment) >> local.top_level >> local.blank
- ;
- }
- else
- {
- block_start =
- local.top_level >> local.blank
- ;
- }
+ block_skip_initial_spaces =
+ *(cl::blank_p | local.comment) >> block_start
+ ;
+
+ block_start =
+ local.top_level >> local.blank
+ ;
 
         local.top_level
             = local.blocks


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