Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59311 - in branches/quickbook-1.5-spirit2: . detail
From: daniel_james_at_[hidden]
Date: 2010-01-27 17:04:05


Author: danieljames
Date: 2010-01-27 17:04:03 EST (Wed, 27 Jan 2010)
New Revision: 59311
URL: http://svn.boost.org/trac/boost/changeset/59311

Log:
Trim more stuff, now only one output collector.
Text files modified:
   branches/quickbook-1.5-spirit2/block.cpp | 36 ++++++++++++++++++------------------
   branches/quickbook-1.5-spirit2/detail/actions.cpp | 37 -------------------------------------
   branches/quickbook-1.5-spirit2/detail/actions.hpp | 31 -------------------------------
   branches/quickbook-1.5-spirit2/detail/actions_class.cpp | 9 +--------
   branches/quickbook-1.5-spirit2/detail/actions_class.hpp | 5 -----
   branches/quickbook-1.5-spirit2/detail/quickbook.cpp | 4 ++--
   branches/quickbook-1.5-spirit2/phrase_template.cpp | 2 +-
   7 files changed, 22 insertions(+), 102 deletions(-)

Modified: branches/quickbook-1.5-spirit2/block.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block.cpp (original)
+++ branches/quickbook-1.5-spirit2/block.cpp 2010-01-27 17:04:03 EST (Wed, 27 Jan 2010)
@@ -206,11 +206,11 @@
 
         blocks =
            +( block_markup
- | code [actions.process][actions.output]
- | list [actions.process][actions.output]
- | hr [actions.process][actions.output]
+ | code [actions.process]
+ | list [actions.process]
+ | hr [actions.process]
             | comment >> *eol
- | paragraph [actions.process][actions.output]
+ | paragraph [actions.process]
             | eol
             )
             ;
@@ -255,20 +255,20 @@
 
         block_markup =
                 '[' >> space
- >> ( begin_section [actions.process][actions.output]
- | end_section [actions.process][actions.output]
- | heading [actions.process][actions.output]
- | paragraph_block [actions.process][actions.output]
- | blockquote [actions.process][actions.output]
- | preformatted [actions.process][actions.output]
- | def_macro [actions.process][actions.output]
- | table [actions.process][actions.output]
- | variablelist [actions.process][actions.output]
- | xinclude [actions.process][actions.output]
- | include [actions.process][actions.output]
- | import [actions.process][actions.output]
- | define_template [actions.process][actions.output]
- )
+ >> ( begin_section
+ | end_section
+ | heading
+ | paragraph_block
+ | blockquote
+ | preformatted
+ | def_macro
+ | table
+ | variablelist
+ | xinclude
+ | include
+ | import
+ | define_template
+ ) [actions.process]
>> ( (space >> ']' >> +eol)
                 | error
                 )

Modified: branches/quickbook-1.5-spirit2/detail/actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/actions.cpp 2010-01-27 17:04:03 EST (Wed, 27 Jan 2010)
@@ -91,35 +91,6 @@
             detail::print_space(*first++, out.get());
     }
 
- void code_action::operator()(iterator_range x, unused_type, unused_type) const
- {
- // preprocess the code section to remove the initial indentation
- std::string program(x.begin(), x.end());
- detail::unindent(program);
- if (program.size() == 0)
- return; // Nothing left to do here. The program is empty.
-
- iterator first_(program.begin(), program.end());
- iterator last_(program.end(), program.end());
- first_.set_position(x.begin().get_position());
-
- std::string save;
- phrase.swap(save);
-
- // print the code with syntax coloring
- std::string str = syntax_p(first_, last_);
-
- phrase.swap(save);
-
- //
- // We must not place a \n after the <programlisting> tag
- // otherwise PDF output starts code blocks with a blank line:
- //
- out << "<programlisting>";
- out << str;
- out << "</programlisting>\n";
- }
-
     void raw_char_action::operator()(char ch, unused_type, unused_type) const
     {
         phrase << ch;
@@ -459,13 +430,5 @@
     {
         phrase.swap(out);
     }
-
- void output_action::operator()(unused_type, unused_type, unused_type) const
- {
- std::string out;
- actions.phrase.swap(out);
- actions.out << out;
- }
-
 }
 

Modified: branches/quickbook-1.5-spirit2/detail/actions.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/actions.hpp (original)
+++ branches/quickbook-1.5-spirit2/detail/actions.hpp 2010-01-27 17:04:03 EST (Wed, 27 Jan 2010)
@@ -178,27 +178,6 @@
         actions& escape_actions;
     };
 
- struct code_action
- {
- // Does the actual syntax highlighing of code
-
- code_action(
- collector& out
- , collector& phrase
- , syntax_highlight& syntax_p)
- : out(out)
- , phrase(phrase)
- , syntax_p(syntax_p)
- {
- }
-
- void operator()(iterator_range, unused_type, unused_type) const;
-
- collector& out;
- collector& phrase;
- syntax_highlight& syntax_p;
- };
-
    struct element_id_warning_action
    {
        void operator()(iterator_range, unused_type, unused_type) const;
@@ -341,16 +320,6 @@
         
         quickbook::actions& actions;
     };
-
- struct output_action
- {
- output_action(quickbook::actions& actions)
- : actions(actions) {}
-
- void operator()(unused_type, unused_type, unused_type) const;
-
- quickbook::actions& actions;
- };
 }
 
 #ifdef BOOST_MSVC

Modified: branches/quickbook-1.5-spirit2/detail/actions_class.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/actions_class.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/actions_class.cpp 2010-01-27 17:04:03 EST (Wed, 27 Jan 2010)
@@ -34,10 +34,7 @@
         , doc_purpose_1_1()
 
     // main output stream
- , out(out_)
-
- // auxilliary streams
- , phrase()
+ , phrase(out_)
 
     // state
         , filename(fs::complete(fs::path(filein_, fs::native)))
@@ -55,7 +52,6 @@
         , error_count(0)
 
     // actions
- , output(*this)
         , process(*this)
         , phrase_push(phrase)
         , phrase_pop(phrase)
@@ -64,7 +60,6 @@
         , extract_doc_purpose(doc_purpose, phrase)
 
         , syntax_p(source_mode, *this)
- , code(out, phrase, syntax_p)
         , plain_char(phrase)
         , raw_char(phrase)
     {
@@ -95,7 +90,6 @@
             )
         );
 
- out.push();
         phrase.push();
         templates.push();
     }
@@ -113,7 +107,6 @@
         ) = state_stack.top();
         state_stack.pop();
 
- out.pop();
         phrase.pop();
         templates.pop();
     }

Modified: branches/quickbook-1.5-spirit2/detail/actions_class.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/actions_class.hpp (original)
+++ branches/quickbook-1.5-spirit2/detail/actions_class.hpp 2010-01-27 17:04:03 EST (Wed, 27 Jan 2010)
@@ -48,9 +48,6 @@
         std::string doc_purpose_1_1;
 
     // main output stream
- collector out;
-
- // auxilliary streams
         collector phrase;
 
     // state
@@ -87,7 +84,6 @@
     ///////////////////////////////////////////////////////////////////////////
     // actions
     ///////////////////////////////////////////////////////////////////////////
- output_action output;
         process_action process;
         phrase_push_action phrase_push;
         phrase_pop_action phrase_pop;
@@ -96,7 +92,6 @@
         phrase_to_string_action extract_doc_purpose;
 
         syntax_highlight syntax_p;
- code_action code;
         plain_char_action plain_char;
         raw_char_action raw_char;
 

Modified: branches/quickbook-1.5-spirit2/detail/quickbook.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/quickbook.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/quickbook.cpp 2010-01-27 17:04:03 EST (Wed, 27 Jan 2010)
@@ -69,13 +69,13 @@
         {
             if(!success) first = start;
 
- pre(actor.out, actor, ignore_docinfo);
+ pre(actor.phrase, actor, ignore_docinfo);
 
             block_grammar g(actor);
             success = parse(first, last, g);
             if (success && first == last)
             {
- post(actor.out, actor, ignore_docinfo);
+ post(actor.phrase, actor, ignore_docinfo);
             }
         }
         else {

Modified: branches/quickbook-1.5-spirit2/phrase_template.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_template.cpp (original)
+++ branches/quickbook-1.5-spirit2/phrase_template.cpp 2010-01-27 17:04:03 EST (Wed, 27 Jan 2010)
@@ -206,7 +206,7 @@
                 first.set_position(template_pos);
                 iterator last(body.end(), body.end());
                 r = boost::spirit::qi::parse(first, last, block_p) && first == last;
- actions.out.swap(result);
+ actions.phrase.swap(result);
             }
             return r;
         }


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