Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65029 - in trunk/tools/quickbook: . detail
From: dnljms_at_[hidden]
Date: 2010-08-26 16:54:57


Author: danieljames
Date: 2010-08-26 16:54:54 EDT (Thu, 26 Aug 2010)
New Revision: 65029
URL: http://svn.boost.org/trac/boost/changeset/65029

Log:
Detemplate the main grammars.
Text files modified:
   trunk/tools/quickbook/block.hpp | 11 +++++------
   trunk/tools/quickbook/detail/actions.cpp | 4 ++--
   trunk/tools/quickbook/detail/quickbook.cpp | 17 ++++++++---------
   trunk/tools/quickbook/detail/syntax_highlight.cpp | 3 ---
   trunk/tools/quickbook/doc_info.hpp | 11 +++++------
   trunk/tools/quickbook/phrase.hpp | 21 ++++++++++-----------
   trunk/tools/quickbook/syntax_highlight.hpp | 27 ++++++++++++---------------
   7 files changed, 42 insertions(+), 52 deletions(-)

Modified: trunk/tools/quickbook/block.hpp
==============================================================================
--- trunk/tools/quickbook/block.hpp (original)
+++ trunk/tools/quickbook/block.hpp 2010-08-26 16:54:54 EDT (Thu, 26 Aug 2010)
@@ -24,10 +24,9 @@
 {
     using namespace boost::spirit::classic;
 
- template <typename Actions>
- struct block_grammar : grammar<block_grammar<Actions> >
+ struct block_grammar : grammar<block_grammar>
     {
- block_grammar(Actions& actions_, bool skip_initial_spaces = false)
+ block_grammar(quickbook::actions& actions_, bool skip_initial_spaces = false)
             : actions(actions_), skip_initial_spaces(skip_initial_spaces) { }
 
         template <typename Scanner>
@@ -38,7 +37,7 @@
                 , common(self.actions, no_eols)
             {
                 using detail::var;
- Actions& actions = self.actions;
+ quickbook::actions& actions = self.actions;
 
                 if (self.skip_initial_spaces)
                 {
@@ -468,13 +467,13 @@
 
             symbols<> paragraph_end_markups;
 
- phrase_grammar<Actions> common;
+ phrase_grammar common;
 
             rule<Scanner> const&
             start() const { return start_; }
         };
 
- Actions& actions;
+ quickbook::actions& actions;
         bool const skip_initial_spaces;
     };
 }

Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2010-08-26 16:54:54 EDT (Thu, 26 Aug 2010)
@@ -759,7 +759,7 @@
             }
             else if (!body.is_block)
             {
- simple_phrase_grammar<quickbook::actions> phrase_p(actions);
+ simple_phrase_grammar phrase_p(actions);
 
                 // do a phrase level parse
                 iterator first(body.content.begin(), body.content.end(), body.position);
@@ -770,7 +770,7 @@
             }
             else
             {
- block_grammar<quickbook::actions> block_p(actions, true);
+ block_grammar block_p(actions, true);
 
                 // do a block level parse
                 // ensure that we have enough trailing newlines to eliminate

Modified: trunk/tools/quickbook/detail/quickbook.cpp
==============================================================================
--- trunk/tools/quickbook/detail/quickbook.cpp (original)
+++ trunk/tools/quickbook/detail/quickbook.cpp 2010-08-26 16:54:54 EDT (Thu, 26 Aug 2010)
@@ -50,11 +50,10 @@
     // Parse the macros passed as command line parameters
     //
     ///////////////////////////////////////////////////////////////////////////
- template <typename Actions>
     struct command_line_grammar
- : public grammar<command_line_grammar<Actions> >
+ : public grammar<command_line_grammar>
     {
- command_line_grammar(Actions& actions)
+ command_line_grammar(quickbook::actions& actions)
             : actions(actions) {}
 
         template <typename Scanner>
@@ -63,7 +62,7 @@
             definition(command_line_grammar const& self)
                 : unused(false), common(self.actions, unused)
             {
- Actions& actions = self.actions;
+ quickbook::actions& actions = self.actions;
 
                 macro =
                         *space_p
@@ -90,18 +89,18 @@
 
             bool unused;
             rule<Scanner> macro, macro_identifier, phrase;
- phrase_grammar<Actions> common;
+ phrase_grammar common;
 
             rule<Scanner> const&
             start() const { return macro; }
         };
 
- Actions& actions;
+ quickbook::actions& actions;
     };
 
     static void set_macros(actions& actor)
     {
- quickbook::command_line_grammar<actions> grammar(actor);
+ quickbook::command_line_grammar grammar(actor);
 
         for(std::vector<std::string>::const_iterator
                 it = preset_defines.begin(),
@@ -140,14 +139,14 @@
         iterator_type first(storage.begin(), storage.end(), filein_);
         iterator_type last(storage.end(), storage.end());
 
- doc_info_grammar<actions> l(actor);
+ doc_info_grammar l(actor);
         parse_info<iterator_type> info = parse(first, last, l);
 
         if (info.hit || ignore_docinfo)
         {
             pre(actor.out, actor, ignore_docinfo);
 
- block_grammar<actions> g(actor);
+ block_grammar g(actor);
             info = parse(info.hit ? info.stop : first, last, g);
             if (info.full)
             {

Modified: trunk/tools/quickbook/detail/syntax_highlight.cpp
==============================================================================
--- trunk/tools/quickbook/detail/syntax_highlight.cpp (original)
+++ trunk/tools/quickbook/detail/syntax_highlight.cpp 2010-08-26 16:54:54 EDT (Thu, 26 Aug 2010)
@@ -19,7 +19,6 @@
       , do_macro_action
       , pre_escape_back
       , post_escape_back
- , actions
       , unexpected_char
       , collector>
     cpp_p_type;
@@ -31,7 +30,6 @@
       , do_macro_action
       , pre_escape_back
       , post_escape_back
- , actions
       , unexpected_char
       , collector>
     python_p_type;
@@ -42,7 +40,6 @@
       , do_macro_action
       , pre_escape_back
       , post_escape_back
- , actions
       , collector>
     teletype_p_type;
     

Modified: trunk/tools/quickbook/doc_info.hpp
==============================================================================
--- trunk/tools/quickbook/doc_info.hpp (original)
+++ trunk/tools/quickbook/doc_info.hpp 2010-08-26 16:54:54 EDT (Thu, 26 Aug 2010)
@@ -21,11 +21,10 @@
 {
     using namespace boost::spirit::classic;
 
- template <typename Actions>
     struct doc_info_grammar
- : public grammar<doc_info_grammar<Actions> >
+ : public grammar<doc_info_grammar>
     {
- doc_info_grammar(Actions& actions)
+ doc_info_grammar(quickbook::actions& actions)
             : actions(actions) {}
 
         template <typename Scanner>
@@ -36,7 +35,7 @@
             definition(doc_info_grammar const& self)
                 : unused(false), common(self.actions, unused)
             {
- Actions& actions = self.actions;
+ quickbook::actions& actions = self.actions;
 
                 doc_types =
                     "book", "article", "library", "chapter", "part"
@@ -202,14 +201,14 @@
                             doc_author, comment, space, hard_space, doc_license,
                             doc_last_revision, doc_source_mode, phrase, quickbook_version,
                             char_;
- phrase_grammar<Actions> common;
+ phrase_grammar common;
             symbols<> doc_types;
 
             rule<Scanner> const&
             start() const { return doc_info; }
         };
 
- Actions& actions;
+ quickbook::actions& actions;
     };
 }
 

Modified: trunk/tools/quickbook/phrase.hpp
==============================================================================
--- trunk/tools/quickbook/phrase.hpp (original)
+++ trunk/tools/quickbook/phrase.hpp 2010-08-26 16:54:54 EDT (Thu, 26 Aug 2010)
@@ -11,6 +11,7 @@
 #define BOOST_SPIRIT_QUICKBOOK_PHRASE_HPP
 
 #include "./detail/quickbook.hpp"
+#include "./detail/actions_class.hpp"
 #include "detail/utils.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/spirit/include/classic_confix.hpp>
@@ -58,10 +59,9 @@
             ;
     }
 
- template <typename Actions>
- struct phrase_grammar : grammar<phrase_grammar<Actions> >
+ struct phrase_grammar : grammar<phrase_grammar>
     {
- phrase_grammar(Actions& actions, bool& no_eols)
+ phrase_grammar(quickbook::actions& actions, bool& no_eols)
             : no_eols(no_eols), actions(actions) {}
 
         template <typename Scanner>
@@ -70,7 +70,7 @@
             definition(phrase_grammar const& self)
             {
                 using detail::var;
- Actions& actions = self.actions;
+ quickbook::actions& actions = self.actions;
 
                 space =
                     *(space_p | comment)
@@ -490,14 +490,13 @@
         };
 
         bool& no_eols;
- Actions& actions;
+ quickbook::actions& actions;
     };
 
- template <typename Actions>
     struct simple_phrase_grammar
- : public grammar<simple_phrase_grammar<Actions> >
+ : public grammar<simple_phrase_grammar >
     {
- simple_phrase_grammar(Actions& actions)
+ simple_phrase_grammar(quickbook::actions& actions)
             : actions(actions) {}
 
         template <typename Scanner>
@@ -506,7 +505,7 @@
             definition(simple_phrase_grammar const& self)
                 : unused(false), common(self.actions, unused)
             {
- Actions& actions = self.actions;
+ quickbook::actions& actions = self.actions;
 
                 phrase =
                    *( common
@@ -526,13 +525,13 @@
 
             bool unused;
             rule<Scanner> phrase, comment, dummy_block;
- phrase_grammar<Actions> common;
+ phrase_grammar common;
 
             rule<Scanner> const&
             start() const { return phrase; }
         };
 
- Actions& actions;
+ quickbook::actions& actions;
     };
 }
 

Modified: trunk/tools/quickbook/syntax_highlight.hpp
==============================================================================
--- trunk/tools/quickbook/syntax_highlight.hpp (original)
+++ trunk/tools/quickbook/syntax_highlight.hpp 2010-08-26 16:54:54 EDT (Thu, 26 Aug 2010)
@@ -29,13 +29,12 @@
       , typename DoMacro
       , typename PreEscape
       , typename PostEscape
- , typename EscapeActions
       , typename Unexpected
       , typename Out>
     struct cpp_highlight
- : public grammar<cpp_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, EscapeActions, Unexpected, Out> >
+ : public grammar<cpp_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, Unexpected, Out> >
     {
- cpp_highlight(Out& out, Macro const& macro, DoMacro do_macro, EscapeActions& escape_actions)
+ cpp_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
         : out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
 
         template <typename Scanner>
@@ -155,7 +154,7 @@
                             string_char;
 
             symbols<> keyword_;
- phrase_grammar<EscapeActions> common;
+ phrase_grammar common;
             std::string save;
             bool unused;
 
@@ -166,7 +165,7 @@
         Out& out;
         Macro const& macro;
         DoMacro do_macro;
- EscapeActions& escape_actions;
+ actions& escape_actions;
     };
 
     // Grammar for Python highlighting
@@ -179,13 +178,12 @@
       , typename DoMacro
       , typename PreEscape
       , typename PostEscape
- , typename EscapeActions
       , typename Unexpected
       , typename Out>
     struct python_highlight
- : public grammar<python_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, EscapeActions, Unexpected, Out> >
+ : public grammar<python_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, Unexpected, Out> >
     {
- python_highlight(Out& out, Macro const& macro, DoMacro do_macro, EscapeActions& escape_actions)
+ python_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
         : out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
 
         template <typename Scanner>
@@ -310,7 +308,7 @@
                             qbk_phrase, escape, string_char;
 
             symbols<> keyword_;
- phrase_grammar<EscapeActions> common;
+ phrase_grammar common;
             std::string save;
             bool unused;
 
@@ -321,7 +319,7 @@
         Out& out;
         Macro const& macro;
         DoMacro do_macro;
- EscapeActions& escape_actions;
+ actions& escape_actions;
     };
 
     // Grammar for plain text (no actual highlighting)
@@ -331,12 +329,11 @@
       , typename DoMacro
       , typename PreEscape
       , typename PostEscape
- , typename EscapeActions
       , typename Out>
     struct teletype_highlight
- : public grammar<teletype_highlight<CharProcess, Macro, DoMacro, PreEscape, PostEscape, EscapeActions, Out> >
+ : public grammar<teletype_highlight<CharProcess, Macro, DoMacro, PreEscape, PostEscape, Out> >
     {
- teletype_highlight(Out& out, Macro const& macro, DoMacro do_macro, EscapeActions& escape_actions)
+ teletype_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
         : out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
 
         template <typename Scanner>
@@ -388,7 +385,7 @@
 
             rule<Scanner> program, macro, qbk_phrase, escape;
 
- phrase_grammar<EscapeActions> common;
+ phrase_grammar common;
             std::string save;
             bool unused;
 
@@ -399,7 +396,7 @@
         Out& out;
         Macro const& macro;
         DoMacro do_macro;
- EscapeActions& escape_actions;
+ actions& escape_actions;
     };
 
 }


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