Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70563 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-03-26 07:12:20


Author: danieljames
Date: 2011-03-26 07:12:19 EDT (Sat, 26 Mar 2011)
New Revision: 70563
URL: http://svn.boost.org/trac/boost/changeset/70563

Log:
Quickbook: Template as value.
Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 12 ++++++------
   trunk/tools/quickbook/src/actions.hpp | 12 ------------
   trunk/tools/quickbook/src/actions_class.cpp | 1 -
   trunk/tools/quickbook/src/actions_class.hpp | 1 -
   trunk/tools/quickbook/src/main_grammar.cpp | 30 +++++++++++++-----------------
   trunk/tools/quickbook/src/template_tags.hpp | 1 +
   6 files changed, 20 insertions(+), 37 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp (original)
+++ trunk/tools/quickbook/src/actions.cpp 2011-03-26 07:12:19 EDT (Sat, 26 Mar 2011)
@@ -71,6 +71,7 @@
     void phrase_action(quickbook::actions&, value);
     void raw_phrase_action(quickbook::actions&, value);
     void source_mode_action(quickbook::actions&, value);
+ void do_template_action(quickbook::actions&, value, file_position);
 
     void element_action::operator()(iterator first, iterator) const
     {
@@ -153,6 +154,8 @@
         case source_mode_tags::python:
         case source_mode_tags::teletype:
             return source_mode_action(actions, v);
+ case template_tags::template_:
+ return do_template_action(actions, v, first.get_position());
         default:
             break;
         }
@@ -1102,14 +1105,13 @@
         int callout_id = 0;
     }
 
- void do_template_action::operator()(iterator first, iterator) const
+ void do_template_action(quickbook::actions& actions, value template_list,
+ file_position pos)
     {
         if(actions.suppress) return;
 
- file_position const pos = first.get_position();
-
         // Get the arguments
- value_consumer values = actions.values.release();
+ value_consumer values = template_list;
 
         bool template_escape = values.check(template_tags::escape);
         if(template_escape) values.consume();
@@ -1227,7 +1229,6 @@
 
             if (!parse_template(symbol->body, template_escape, actions))
             {
- file_position const pos = first.get_position();
                 detail::outerr(actions.filename, pos.line)
                     << "Expanding "
                     << (symbol->body.is_block() ? "block" : "phrase")
@@ -1245,7 +1246,6 @@
 
             if (actions.section_level != actions.min_section_level)
             {
- file_position const pos = first.get_position();
                 detail::outerr(actions.filename, pos.line)
                     << "Mismatched sections in template " << detail::utf8(identifier) << std::endl;
                 actions.pop(); // restore the actions' states

Modified: trunk/tools/quickbook/src/actions.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions.hpp (original)
+++ trunk/tools/quickbook/src/actions.hpp 2011-03-26 07:12:19 EDT (Sat, 26 Mar 2011)
@@ -327,18 +327,6 @@
         quickbook::actions& actions;
     };
 
- struct do_template_action
- {
- // Handles template substitutions
-
- do_template_action(quickbook::actions& actions)
- : actions(actions) {}
-
- void operator()(iterator first, iterator last) const;
-
- quickbook::actions& actions;
- };
-
    struct element_id_warning_action
    {
         element_id_warning_action(quickbook::actions& actions_)

Modified: trunk/tools/quickbook/src/actions_class.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.cpp (original)
+++ trunk/tools/quickbook/src/actions_class.cpp 2011-03-26 07:12:19 EDT (Sat, 26 Mar 2011)
@@ -80,7 +80,6 @@
 
         , break_(phrase, *this)
         , do_macro(phrase, *this)
- , do_template(*this)
 
         , element_id_warning(*this)
 

Modified: trunk/tools/quickbook/src/actions_class.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.hpp (original)
+++ trunk/tools/quickbook/src/actions_class.hpp 2011-03-26 07:12:19 EDT (Sat, 26 Mar 2011)
@@ -129,7 +129,6 @@
 
         break_action break_;
         do_macro_action do_macro;
- do_template_action do_template;
 
         element_id_warning_action element_id_warning;
 

Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp (original)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2011-03-26 07:12:19 EDT (Sat, 26 Mar 2011)
@@ -265,23 +265,19 @@
 
         local.template_ =
             ( '['
- >> space [actions.values.reset()]
- >> !cl::str_p("`") [actions.values.entry(ph::arg1, ph::arg2, template_tags::escape)]
- >>
- ( (
- (cl::eps_p(cl::punct_p)
- >> actions.templates.scope
- ) [actions.values.entry(ph::arg1, ph::arg2, template_tags::identifier)]
- >> !local.template_args
- ) | (
- (actions.templates.scope
- >> cl::eps_p(hard_space)
- ) [actions.values.entry(ph::arg1, ph::arg2, template_tags::identifier)]
- >> space
- >> !local.template_args
- ) )
- >> ']'
- ) [actions.do_template]
+ >> space
+ >> actions.values.list(template_tags::template_)
+ [ !cl::str_p("`") [actions.values.entry(ph::arg1, ph::arg2, template_tags::escape)]
+ >> ( cl::eps_p(cl::punct_p)
+ >> actions.templates.scope [actions.values.entry(ph::arg1, ph::arg2, template_tags::identifier)]
+ | actions.templates.scope [actions.values.entry(ph::arg1, ph::arg2, template_tags::identifier)]
+ >> cl::eps_p(hard_space)
+ )
+ >> space
+ >> !local.template_args
+ >> ']'
+ ]
+ ) [actions.element]
             ;
 
         local.template_args =

Modified: trunk/tools/quickbook/src/template_tags.hpp
==============================================================================
--- trunk/tools/quickbook/src/template_tags.hpp (original)
+++ trunk/tools/quickbook/src/template_tags.hpp 2011-03-26 07:12:19 EDT (Sat, 26 Mar 2011)
@@ -14,6 +14,7 @@
 namespace quickbook
 {
     QUICKBOOK_VALUE_TAGS(template_tags, 0x100,
+ (template_)
         (escape)
         (identifier)
         (block)


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