Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69171 - branches/quickbook-filenames/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-02-22 15:32:20


Author: danieljames
Date: 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
New Revision: 69171
URL: http://svn.boost.org/trac/boost/changeset/69171

Log:
Rearrange grammar/actions to remove the 'tag' method.

It was error prone and a bit confusing. Also renamed 'scoped' to the
more appropriate 'list'.
Text files modified:
   branches/quickbook-filenames/tools/quickbook/src/actions.cpp | 8 +-
   branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp | 24 +++-----
   branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp | 2
   branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp | 109 +++++++++++++++++++++++++--------------
   branches/quickbook-filenames/tools/quickbook/src/doc_info_grammar.cpp | 41 ++++++--------
   branches/quickbook-filenames/tools/quickbook/src/grammar_impl.hpp | 2
   branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp | 29 +++++----
   branches/quickbook-filenames/tools/quickbook/src/phrase_element_grammar.cpp | 2
   branches/quickbook-filenames/tools/quickbook/src/values.cpp | 19 +-----
   branches/quickbook-filenames/tools/quickbook/src/values.hpp | 37 ++++++++++---
   branches/quickbook-filenames/tools/quickbook/src/values_parse.hpp | 89 ++++++++++++++++---------------
   11 files changed, 198 insertions(+), 164 deletions(-)

Modified: branches/quickbook-filenames/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions.cpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -1611,7 +1611,7 @@
 
     void phrase_to_docinfo_action_impl::operator()(iterator first, iterator last) const
     {
- return (*this)(first, last, actions.values.builder.release_tag());
+ return (*this)(first, last, value::default_tag);
     }
     
     void phrase_to_value_action::operator()(iterator first, iterator last) const
@@ -1621,7 +1621,7 @@
         std::string value;
         actions.phrase.swap(value);
         actions.values.builder.insert(
- bbk_value(value, actions.values.builder.release_tag()));
+ bbk_value(value, value::default_tag));
     }
     
     void inner_phrase_action_pre::operator()(iterator, iterator) const
@@ -1680,7 +1680,7 @@
     void scoped_block_push::success_impl()
     {
         actions.values.builder.insert(
- bbk_value(actions.out.str(), actions.values.builder.release_tag()));
+ bbk_value(actions.out.str(), value::default_tag));
     }
 
     scoped_phrase_push::scoped_phrase_push(quickbook::actions& actions)
@@ -1699,7 +1699,7 @@
     void scoped_phrase_push::success_impl()
     {
         actions.values.builder.insert(
- bbk_value(actions.phrase.str(), actions.values.builder.release_tag()));
+ bbk_value(actions.phrase.str(), value::default_tag));
     }
 
     set_no_eols_scoped::set_no_eols_scoped(quickbook::actions& actions)

Modified: branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -72,25 +72,21 @@
             ;
 
         local.begin_section =
- actions.values.scoped
- [ space
+ space
>> local.element_id
>> space
>> local.inner_phrase
- ]
             ;
 
         local.end_section =
- cl::eps_p [actions.values.entry(ph::arg1, ph::arg2)]
+ cl::eps_p
             ;
 
         local.heading
- = actions.values.scoped
- [ space
- >> local.element_id_1_6
- >> space
- >> local.inner_phrase
- ]
+ = space
+ >> local.element_id_1_6
+ >> space
+ >> local.inner_phrase
             ;
 
         elements.add
@@ -181,7 +177,7 @@
                space
>> local.template_id [actions.values.reset()]
                                                 [actions.values.entry(ph::arg1, ph::arg2)]
- >> actions.values.scoped[
+ >> actions.values.list()[
             !(
                 space >> '['
>> *(
@@ -218,7 +214,7 @@
         local.varlistentry =
             space
>> cl::ch_p('[')
- >> actions.values.scoped
+ >> actions.values.list()
             [
                 (
                     local.varlistterm
@@ -273,7 +269,7 @@
>>
             (
                 (
- actions.values.scoped(table_tags::row)[*local.table_cell]
+ actions.values.list(table_tags::row)[*local.table_cell]
>> cl::ch_p(']')
>> space
                 )
@@ -284,7 +280,7 @@
         local.table_cell =
                 space
>> cl::ch_p('[')
- >> ( cl::eps_p [actions.values.tag(table_tags::cell)]
+ >> ( cl::eps_p
>> inside_paragraph
>> cl::ch_p(']')
>> space

Modified: branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -20,7 +20,7 @@
     )
 
     QUICKBOOK_VALUE_TAGS(table_tags, 0x250,
- (title)(row)(cell)
+ (title)(row)
     )
 
     QUICKBOOK_VALUE_TAGS(general_tags, 0x300,

Modified: branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/doc_info_actions.cpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -43,6 +43,20 @@
         return p;
     }
 
+ value consume_last_single(value_consumer& c, value::tag_type tag,
+ std::vector<std::string>* duplicates)
+ {
+ value l = consume_last(c, tag, duplicates);
+ if(l.is_empty()) return l;
+
+ assert(l.is_list());
+ value_consumer c2 = l;
+ value p = c2.consume();
+ assert(!c2.is());
+
+ return p;
+ }
+
     std::vector<value> consume_multiple(value_consumer& c, value::tag_type tag)
     {
         std::vector<value> values;
@@ -60,6 +74,11 @@
         // *before* anything else.
 
         value_consumer values = actions.values.get();
+
+ // Skip over invalid attributes
+
+ while (values.is(value::default_tag)) values.consume();
+
         std::vector<std::string> duplicates;
 
         value doc_title;
@@ -70,17 +89,22 @@
             actions.doc_title_qbk = doc_title.get_quickbook();
         }
 
- value id = consume_last(values, doc_info_attributes::id, &duplicates);
- value dirname = consume_last(values, doc_info_attributes::dirname, &duplicates);
- value last_revision = consume_last(values, doc_info_attributes::last_revision, &duplicates);
- value purpose = consume_last(values, doc_info_attributes::purpose, &duplicates);
+ value id = consume_last_single(values, doc_info_attributes::id, &duplicates);
+ value dirname = consume_last_single(values, doc_info_attributes::dirname, &duplicates);
+ value last_revision = consume_last_single(values, doc_info_attributes::last_revision, &duplicates);
+ value purpose = consume_last_single(values, doc_info_attributes::purpose, &duplicates);
         std::vector<value> categories = consume_multiple(values, doc_info_attributes::category);
- value lang = consume_last(values, doc_info_attributes::lang, &duplicates);
- value version = consume_last(values, doc_info_attributes::version, &duplicates);
+ value lang = consume_last_single(values, doc_info_attributes::lang, &duplicates);
+ value version = consume_last_single(values, doc_info_attributes::version, &duplicates);
         std::vector<value> authors = consume_multiple(values, doc_info_attributes::authors);
         std::vector<value> copyrights = consume_multiple(values, doc_info_attributes::copyright);
- value license = consume_last(values, doc_info_attributes::license, &duplicates);
+ value license = consume_last_single(values, doc_info_attributes::license, &duplicates);
         std::vector<value> biblioids = consume_multiple(values, doc_info_attributes::biblioid);
+
+ // Skip over source-mode tags (already dealt with)
+
+ while (values.is(doc_info_attributes::source_mode)) values.consume();
+
 
         BOOST_ASSERT(!values.is());
 
@@ -109,7 +133,6 @@
             }
         }
 
-
         if (last_revision.is_empty())
         {
             // default value for last-revision is now
@@ -255,40 +278,43 @@
 
         BOOST_FOREACH(value_consumer copyright, copyrights)
         {
- tmp << "\n" << " <copyright>\n";
-
- while(copyright.is(doc_info_tags::copyright_year))
+ while(copyright.is())
             {
- int year_start =
- boost::lexical_cast<int>(copyright.consume().get_quickbook());
- int year_end =
- copyright.is(doc_info_tags::copyright_year_end) ?
- boost::lexical_cast<int>(copyright.consume().get_quickbook()) :
- year_start;
-
- if (year_end < year_start) {
- ++actions.error_count;
-
- detail::outerr(actions.filename,
- copyright.begin()->get_position().line)
- << "Invalid year range: "
- << year_start
- << "-"
- << year_end
- << "."
- << std::endl;
+ tmp << "\n" << " <copyright>\n";
+
+ while(copyright.is(doc_info_tags::copyright_year))
+ {
+ int year_start =
+ boost::lexical_cast<int>(copyright.consume().get_quickbook());
+ int year_end =
+ copyright.is(doc_info_tags::copyright_year_end) ?
+ boost::lexical_cast<int>(copyright.consume().get_quickbook()) :
+ year_start;
+
+ if (year_end < year_start) {
+ ++actions.error_count;
+
+ detail::outerr(actions.filename,
+ copyright.begin()->get_position().line)
+ << "Invalid year range: "
+ << year_start
+ << "-"
+ << year_end
+ << "."
+ << std::endl;
+ }
+
+ for(; year_start <= year_end; ++year_start)
+ tmp << " <year>" << year_start << "</year>\n";
                 }
-
- for(; year_start <= year_end; ++year_start)
- tmp << " <year>" << year_start << "</year>\n";
+
+ tmp << " <holder>"
+ << doc_info_output(copyright.consume(doc_info_tags::copyright_name), 106)
+ << "</holder>\n"
+ << " </copyright>\n"
+ << "\n"
+ ;
             }
-
- tmp << " <holder>"
- << doc_info_output(copyright.consume(doc_info_tags::copyright_name), 106)
- << "</holder>\n"
- << " </copyright>\n"
- << "\n"
- ;
         }
 
         if (!license.is_empty())
@@ -311,7 +337,8 @@
                 ;
         }
 
- BOOST_FOREACH(value const& category, categories) {
+ BOOST_FOREACH(value_consumer values, categories) {
+ value category = values.optional_consume();
             if(!category.is_empty()) {
                 tmp << " <" << actions.doc_type << "category name=\"category:"
                     << doc_info_output(category, 106)
@@ -319,6 +346,7 @@
                     << "\n"
                 ;
             }
+ assert(!values.is());
         }
 
         BOOST_FOREACH(value_consumer biblioid, biblioids)
@@ -333,6 +361,7 @@
                 << "</biblioid>"
                 << "\n"
                 ;
+ assert(!biblioid.is());
         }
 
         if(actions.doc_type != "library") {

Modified: branches/quickbook-filenames/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/doc_info_grammar.cpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -42,6 +42,7 @@
 
             void operator()(value::tag_type& t) const {
                 l.attribute_rule = *l.attribute_rules[t];
+ l.attribute_tag = t;
             }
             
             doc_info_grammar_local& l;
@@ -55,6 +56,7 @@
 
             void operator()(iterator, iterator) const {
                 l.attribute_rule = l.doc_fallback;
+ l.attribute_tag = value::default_tag;
             }
             
             doc_info_grammar_local& l;
@@ -69,6 +71,7 @@
         cl::symbols<> doc_types;
         cl::symbols<value::tag_type> doc_attributes;
         std::map<value::tag_type, cl::rule<scanner>* > attribute_rules;
+ value::tag_type attribute_tag;
         cl::rule<scanner> attribute_rule;
         assign_attribute_type assign_attribute;
         fallback_attribute_type fallback_attribute;
@@ -115,13 +118,13 @@
>> space
>> ( local.doc_attributes
                                             [local.assign_attribute]
- [actions.values.tag(ph::arg1)]
                     | (+(cl::alnum_p | '_' | '-'))
                                             [local.fallback_attribute]
                                             [actions.error("Unrecognized document attribute: '%s'.")]
                     )
>> hard_space
- >> local.attribute_rule
+ >> actions.values.list(detail::var(local.attribute_tag))
+ [local.attribute_rule]
>> space
>> ']'
>> +cl::eol_p
@@ -154,6 +157,7 @@
         local.attribute_rules[doc_info_attributes::lang] = &local.doc_simple;
 
         local.doc_copyright_year = cl::repeat_p(4)[cl::digit_p];
+
         local.doc_copyright_holder
             = *( ~cl::eps_p
                     ( ']'
@@ -163,28 +167,27 @@
                 );
 
         local.doc_copyright =
- *actions.values.scoped(doc_info_attributes::copyright)
- [
- +( local.doc_copyright_year
+ +( +( local.doc_copyright_year
                                             [actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::copyright_year)]
>> space
>> !( '-'
>> space
>> local.doc_copyright_year
                                             [actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::copyright_year_end)]
+ >> space
                     )
>> !cl::ch_p(',')
+ >> space
                 )
- >> space
>> local.doc_copyright_holder [actions.docinfo_value(ph::arg1, ph::arg2, doc_info_tags::copyright_name)]
>> !cl::ch_p(',')
>> space
- ]
+ )
             ;
 
         local.attribute_rules[doc_info_attributes::copyright] = &local.doc_copyright;
 
- local.doc_phrase = simple_phrase[actions.docinfo_value(ph::arg1, ph::arg2)];
+ local.doc_phrase = simple_phrase [actions.docinfo_value(ph::arg1, ph::arg2)];
         local.attribute_rules[doc_info_attributes::purpose] = &local.doc_phrase;
         local.attribute_rules[doc_info_attributes::license] = &local.doc_phrase;
 
@@ -200,15 +203,12 @@
             ;
 
         local.doc_authors =
- actions.values.scoped(doc_info_attributes::authors)
- [
- local.doc_author
+ local.doc_author
+ >> space
+ >> *( !(cl::ch_p(',') >> space)
+ >> local.doc_author
>> space
- >> *( !(cl::ch_p(',') >> space)
- >> local.doc_author
- >> space
- )
- ]
+ )
             ;
 
         local.attribute_rules[doc_info_attributes::authors] = &local.doc_authors;
@@ -224,13 +224,10 @@
         local.attribute_rules[doc_info_attributes::source_mode] = &local.doc_source_mode;
 
         local.doc_biblioid =
- actions.values.scoped(doc_info_attributes::biblioid)
- [
- (+cl::alnum_p) [actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::biblioid_class)]
- >> hard_space
- >> (+(~cl::eps_p(']') >> local.char_))
+ (+cl::alnum_p) [actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::biblioid_class)]
+ >> hard_space
+ >> (+(~cl::eps_p(']') >> local.char_))
                                             [actions.docinfo_value(ph::arg1, ph::arg2, doc_info_tags::biblioid_value)]
- ]
             ;
 
         local.attribute_rules[doc_info_attributes::biblioid] = &local.doc_biblioid;

Modified: branches/quickbook-filenames/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/grammar_impl.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/grammar_impl.hpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -37,7 +37,7 @@
         element_info(
                 type_enum t,
                 cl::rule<scanner>* r,
- value::tag_type tag = value::no_tag)
+ value::tag_type tag = value::default_tag)
             : type(t), rule(r), tag(tag) {}
 
         type_enum type;

Modified: branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -176,11 +176,12 @@
>> cl::eps_p(local.check_element(element_info::in_block))
                                                 [actions.inside_paragraph]
                                                 [actions.values.reset()]
- [actions.values.tag(detail::var(local.element_tag))]
- >> ( local.element_rule
- >> ( (space >> ']') [actions.element]
- | cl::eps_p [actions.error]
- )
+ >> ( actions.values.list(detail::var(local.element_tag))
+ [ local.element_rule
+ >> ( (space >> ']')
+ | cl::eps_p [actions.error]
+ )
+ ] [actions.element]
                 | cl::eps_p [actions.error]
                 )
             ;
@@ -387,9 +388,10 @@
>> ( local.element
>> cl::eps_p(local.check_element(element_info::in_phrase))
                                                 [actions.values.reset()]
- [actions.values.tag(detail::var(local.element_tag))]
- >> local.element_rule
- >> cl::eps_p(space >> ']') [actions.element]
+ >> actions.values.list(detail::var(local.element_tag))
+ [ local.element_rule
+ >> cl::eps_p(space >> ']')
+ ] [actions.element]
                 | local.template_
                 | cl::str_p("br") [actions.break_]
                 )
@@ -402,12 +404,13 @@
>> cl::eps_p(local.check_element(element_info::in_conditional))
                                                 [actions.inside_paragraph]
                                                 [actions.values.reset()]
- [actions.values.tag(detail::var(local.element_tag))]
- >> ( local.element_rule
- >> ( (space >> ']') [actions.element]
+ >> ( actions.values.list(detail::var(local.element_tag))
+ [ local.element_rule
+ >> ( (space >> ']')
+ | cl::eps_p [actions.error]
+ )
+ ] [actions.element]
                     | cl::eps_p [actions.error]
- )
- | cl::eps_p [actions.error]
                 )
             ;
 

Modified: branches/quickbook-filenames/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/phrase_element_grammar.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/phrase_element_grammar.cpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -63,7 +63,7 @@
>> +(cl::anychar_p - (cl::space_p | phrase_end | '['))
                         )) [actions.values.entry(ph::arg1, ph::arg2)]
>> hard_space
- >> *actions.values.scoped[
+ >> *actions.values.list()[
                             '['
>> (*(cl::alnum_p | '_'))
                                                 [actions.values.entry(ph::arg1, ph::arg2)]

Modified: branches/quickbook-filenames/tools/quickbook/src/values.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/values.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/values.cpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -710,8 +710,7 @@
     
     value_builder::value_builder()
         : current()
- , list_tag(value::no_tag)
- , next_tag(value::default_tag)
+ , list_tag(value::default_tag)
         , saved()
     {
     }
@@ -719,7 +718,6 @@
     void value_builder::swap(value_builder& other) {
         current.swap(other.current);
         std::swap(list_tag, other.list_tag);
- std::swap(next_tag, other.next_tag);
         saved.swap(other.saved);
     }
     
@@ -742,18 +740,7 @@
     void value_builder::reset() {
         detail::value_list_builder new_builder;
         current.swap(new_builder);
- list_tag = value::no_tag;
- next_tag = value::default_tag;
- }
-
- void value_builder::set_tag(value::tag_type tag) {
- next_tag = tag;
- }
-
- value::tag_type value_builder::release_tag(value::tag_type t) {
- value::tag_type r = t != value::no_tag ? t : next_tag;
- next_tag = value::default_tag;
- return r;
+ list_tag = value::default_tag;
     }
 
     void value_builder::insert(value const& item) {
@@ -761,7 +748,7 @@
     }
 
     void value_builder::start_list(value::tag_type tag) {
- value::tag_type saved_tag = release_tag(tag);
+ value::tag_type saved_tag = tag;
         save();
         list_tag = saved_tag;
     }

Modified: branches/quickbook-filenames/tools/quickbook/src/values.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/values.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/values.hpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -77,7 +77,7 @@
 
             typedef iterator const_iterator;
             typedef value_node::tag_type tag_type;
- enum { no_tag = -1, default_tag = 0 };
+ enum { default_tag = 0 };
 
         protected:
             explicit value_base(value_node* base)
@@ -243,17 +243,16 @@
 
         void reset();
         void set_tag(value::tag_type);
- value::tag_type release_tag(value::tag_type = value::no_tag);
         void insert(value const&);
 
- void start_list(value::tag_type);
+ void start_list(value::tag_type = value::default_tag);
         void finish_list();
         void clear_list();
         void sort_list();
 
     private:
         detail::value_list_builder current;
- value::tag_type list_tag, next_tag;
+ value::tag_type list_tag;
         boost::scoped_ptr<value_builder> saved;
     };
 
@@ -280,13 +279,29 @@
             , end_(x.end())
         {}
 
- reference consume(value::tag_type t = value::no_tag)
+ reference consume()
+ {
+ assert(is());
+ return *pos_++;
+ }
+
+ reference consume(value::tag_type t)
         {
             assert(is(t));
             return *pos_++;
         }
 
- value optional_consume(value::tag_type t = value::no_tag)
+ value optional_consume()
+ {
+ if(is()) {
+ return *pos_++;
+ }
+ else {
+ return value();
+ }
+ }
+
+ value optional_consume(value::tag_type t)
         {
             if(is(t)) {
                 return *pos_++;
@@ -296,10 +311,14 @@
             }
         }
 
- bool is(value::tag_type t = value::no_tag)
+ bool is()
+ {
+ return pos_ != end_;
+ }
+
+ bool is(value::tag_type t)
         {
- return (pos_ != end_ &&
- (t == value::no_tag || t == pos_->get_tag()));
+ return pos_ != end_ && t == pos_->get_tag();
         }
 
         iterator begin() const { return pos_; }

Modified: branches/quickbook-filenames/tools/quickbook/src/values_parse.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/values_parse.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/values_parse.hpp 2011-02-22 15:32:16 EST (Tue, 22 Feb 2011)
@@ -12,6 +12,7 @@
 #include "values.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/spirit/include/phoenix1_functions.hpp>
+#include <boost/spirit/include/phoenix1_primitives.hpp>
 
 namespace quickbook {
     namespace cl = boost::spirit::classic;
@@ -93,12 +94,12 @@
         bool finished;
     };
 
- template <typename ParserT>
+ template <typename TagActor, typename ParserT>
     struct value_scoped_list_parser
- : public cl::unary< ParserT, cl::parser< value_scoped_list_parser<ParserT> > >
+ : public cl::unary< ParserT, cl::parser< value_scoped_list_parser<TagActor, ParserT> > >
     {
- typedef value_scoped_list_parser<ParserT> self_t;
- typedef cl::unary< ParserT, cl::parser< value_scoped_list_parser<ParserT> > > base_t;
+ typedef value_scoped_list_parser<TagActor, ParserT> self_t;
+ typedef cl::unary< ParserT, cl::parser<self_t> > base_t;
 
         template <typename ScannerT>
         struct result
@@ -106,7 +107,7 @@
             typedef typename cl::parser_result<ParserT, ScannerT>::type type;
         };
 
- value_scoped_list_parser(value_builder& a, value::tag_type k, ParserT const &p)
+ value_scoped_list_parser(value_builder& a, TagActor k, ParserT const &p)
             : base_t(p)
             , builder_(a)
             , tag_(k)
@@ -117,8 +118,7 @@
         {
             typedef typename ScannerT::iterator_t iterator_t;
             iterator_t save = scan.first;
-
- value_builder_list list(builder_, tag_);
+ value_builder_list list(builder_, tag_());
             typename cl::parser_result<ParserT, ScannerT>::type result
                 = this->subject().parse(scan);
 
@@ -132,32 +132,54 @@
         }
         
         value_builder& builder_;
- value::tag_type tag_;
+ TagActor tag_;
     };
-
- struct value_scoped_list_gen
- {
- explicit value_scoped_list_gen(value_builder& b, value::tag_type t = value::no_tag)
+
+ template <typename TagActor>
+ struct value_scoped_list_gen2
+ {
+ explicit value_scoped_list_gen2(value_builder& b, TagActor t)
             : b(b), tag_(t) {}
 
         template<typename ParserT>
- value_scoped_list_parser<typename cl::as_parser<ParserT>::type>
+ value_scoped_list_parser<TagActor, typename cl::as_parser<ParserT>::type>
         operator[](ParserT const& p) const
         {
             typedef typename cl::as_parser<ParserT> as_parser_t;
             typedef typename as_parser_t::type parser_t;
             
- return value_scoped_list_parser<parser_t>
+ return value_scoped_list_parser<TagActor, parser_t>
                 (b, tag_, as_parser_t::convert(p));
         }
         
- value_scoped_list_gen operator()(value::tag_type const& tag) const
+ value_builder& b;
+ TagActor tag_;
+ };
+
+ struct value_scoped_list_gen
+ {
+ template <typename Arg1> struct result { typedef void type; };
+ typedef void result_type;
+
+ explicit value_scoped_list_gen(value_builder& b)
+ : b(b) {}
+
+ template <typename T>
+ value_scoped_list_gen2<typename ph::as_actor<T>::type>
+ operator()(T const& tag) const
         {
- return value_scoped_list_gen(b, tag);
+ return value_scoped_list_gen2<typename ph::as_actor<T>::type>(
+ b, ph::as_actor<T>::convert(tag));
         }
-
+
+ value_scoped_list_gen2<ph::as_actor<value::tag_type>::type>
+ operator()(value::tag_type tag = value::default_tag) const
+ {
+ return value_scoped_list_gen2<ph::as_actor<value::tag_type>::type>(
+ b, ph::as_actor<value::tag_type>::convert(tag));
+ }
+
         value_builder& b;
- value::tag_type tag_;
     };
 
     struct value_entry
@@ -172,34 +194,17 @@
 
         template <typename Iterator>
         void operator()(Iterator begin, Iterator end,
- value::tag_type tag = value::no_tag) const
+ value::tag_type tag = value::default_tag) const
         {
- b.insert(qbk_value(begin, end, b.release_tag(tag)));
+ b.insert(qbk_value(begin, end, tag));
         }
 
         template <typename Iterator>
         void operator()(Iterator begin, Iterator,
                 std::string const& v,
- value::tag_type tag = value::no_tag) const
+ value::tag_type tag = value::default_tag) const
         {
- b.insert(qbk_value(v, begin.get_position(), b.release_tag(tag)));
- }
-
- value_builder& b;
- };
-
- struct value_tag
- {
- template <typename Arg>
- struct result {
- typedef void type;
- };
-
- value_tag(value_builder& b)
- : b(b) {}
-
- void operator()(value::tag_type value) const {
- b.set_tag(value);
+ b.insert(qbk_value(v, begin.get_position(), tag));
         }
 
         value_builder& b;
@@ -238,10 +243,9 @@
         value_parser()
             : builder()
             , save(builder)
- , scoped(builder)
+ , list(builder)
             , entry(builder)
             , reset(builder)
- , tag(builder)
             , sort(builder)
             {}
     
@@ -249,10 +253,9 @@
 
         value_builder builder;
         value_save_gen save;
- value_scoped_list_gen scoped;
+ value_scoped_list_gen list;
         ph::function<value_entry> entry;
         ph::function<value_reset> reset;
- ph::function<value_tag> tag;
         ph::function<value_sort> sort;
     };
 }


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