Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68887 - branches/quickbook-filenames/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-02-14 19:24:00


Author: danieljames
Date: 2011-02-14 19:23:57 EST (Mon, 14 Feb 2011)
New Revision: 68887
URL: http://svn.boost.org/trac/boost/changeset/68887

Log:
Use values for various block elements.
Added:
   branches/quickbook-filenames/tools/quickbook/src/table_tags.hpp (contents, props changed)
Text files modified:
   branches/quickbook-filenames/tools/quickbook/src/actions.cpp | 176 +++++++++++++++++++++++----------------
   branches/quickbook-filenames/tools/quickbook/src/actions.hpp | 47 ++--------
   branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp | 35 ++-----
   branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp | 19 ----
   branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp | 97 +++++++++------------
   branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp | 3
   6 files changed, 169 insertions(+), 208 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-14 19:23:57 EST (Mon, 14 Feb 2011)
@@ -22,6 +22,7 @@
 #include "grammar.hpp"
 #include "input_path.hpp"
 #include "template_tags.hpp"
+#include "table_tags.hpp"
 
 namespace quickbook
 {
@@ -84,7 +85,8 @@
     {
         if(!actions.output_pre(out)) return;
 
- out << pre << actions.inside_text << post;
+ value_consumer values = actions.values.get();
+ out << pre << values.consume().get_boostbook() << post;
     }
 
     void phrase_action::operator()() const
@@ -143,6 +145,8 @@
 
         std::string str;
         phrase.swap(str);
+
+ value_consumer values = actions.values.get();
 
         std::string anchor;
 
@@ -154,7 +158,7 @@
         else
         {
             std::string id =
- !element_id.empty() ? element_id :
+ values.is(general_tags::element_id) ? values.consume().get_quickbook() :
                 qbk_version_n >= 106 ? detail::make_identifier(first, last) :
                 detail::make_identifier(str.begin(), str.end());
 
@@ -183,8 +187,10 @@
         std::string str;
         phrase.swap(str);
 
+ value_consumer values = actions.values.get();
+
         std::string id =
- !element_id.empty() ? element_id :
+ values.is(general_tags::element_id) ? values.consume().get_quickbook() :
             qbk_version_n >= 106 ? detail::make_identifier(first, last) :
             detail::make_identifier(str.begin(), str.end());
 
@@ -683,27 +689,37 @@
         actions.phrase.pop(); // restore the phrase
     }
 
- void template_body_action::operator()(iterator first, iterator last) const
+ void template_body_action::operator()(iterator, iterator) const
     {
         if(actions.suppress) return;
+
+ value_consumer values = actions.values.get();
+ std::string identifier = values.consume().get_quickbook();
+
+ std::vector<std::string> template_values;
+ BOOST_FOREACH(value const& p, values.consume()) {
+ template_values.push_back(p.get_quickbook());
+ }
+
+ BOOST_ASSERT(values.is(template_tags::block) || values.is(template_tags::phrase));
+ value body = values.consume();
+ BOOST_ASSERT(!values.is());
+
         if (!actions.templates.add(
             template_symbol(
- actions.template_identifier,
- actions.template_info,
- std::string(first, last),
+ identifier,
+ template_values,
+ body.get_quickbook(),
                 actions.filename,
- first.get_position(),
- actions.template_block,
+ body.get_position(),
+ body.get_tag() == template_tags::block,
                 &actions.templates.top_scope())))
         {
- file_position const pos = first.get_position();
+ file_position const pos = body.get_position();
             detail::outerr(actions.filename, pos.line)
- << "Template Redefinition: " << detail::utf8(actions.template_identifier) << std::endl;
+ << "Template Redefinition: " << detail::utf8(identifier) << std::endl;
             ++actions.error_count;
         }
-
- actions.template_identifier.clear();
- actions.template_info.clear();
     }
 
     namespace
@@ -1141,46 +1157,72 @@
     {
         if(actions.suppress) return;
 
+ value_consumer values = actions.values.get();
+ std::string title = values.consume(table_tags::title).get_quickbook();
+
         actions.out << "<variablelist>\n";
 
         actions.out << "<title>";
- std::string::iterator first = actions.table_title.begin();
- std::string::iterator last = actions.table_title.end();
- while (first != last)
- detail::print_char(*first++, actions.out.get());
+ detail::print_string(title, actions.out.get());
         actions.out << "</title>\n";
 
- std::string str;
- actions.phrase.swap(str);
- actions.out << str;
+ BOOST_FOREACH(value_consumer entry, values) {
+ actions.out << start_varlistentry_;
+
+ if(entry.is()) {
+ actions.out << start_varlistterm_;
+ actions.out << entry.consume().get_boostbook();
+ actions.out << end_varlistterm_;
+ }
+
+ if(entry.is()) {
+ actions.out << start_varlistitem_;
+ BOOST_FOREACH(value phrase, entry) actions.out << phrase.get_boostbook();
+ actions.out << end_varlistitem_;
+ }
+
+ actions.out << end_varlistentry_;
+ }
 
         actions.out << "</variablelist>\n";
- actions.table_span = 0;
- actions.table_header.clear();
- actions.table_title.clear();
     }
 
     void table_action::operator()(iterator, iterator) const
     {
         if(actions.suppress) return;
 
- std::string::iterator first = actions.table_title.begin();
- std::string::iterator last = actions.table_title.end();
- bool has_title = first != last;
+ value_consumer values = actions.values.get();
+
+ std::string element_id;
+ if(values.is(general_tags::element_id))
+ element_id = values.consume().get_quickbook();
+
+ std::string title = values.consume(table_tags::title).get_quickbook();
+ bool has_title = !title.empty();
         
         std::string table_id;
         if(qbk_version_n >= 105) {
- if(!actions.element_id.empty()) {
+ if(!element_id.empty()) {
                 table_id = fully_qualified_id(actions.doc_id,
- actions.qualified_section_id, actions.element_id);
+ actions.qualified_section_id, element_id);
             }
             else if(has_title) {
                 table_id = fully_qualified_id(actions.doc_id,
                     actions.qualified_section_id,
- detail::make_identifier(first, last));
+ detail::make_identifier(title.begin(), title.end()));
             }
         }
 
+ // Emulating the old behaviour which used the width of the final
+ // row for span_count.
+ int row_count = 0;
+ int span_count = 0;
+
+ BOOST_FOREACH(value row, values) {
+ ++row_count;
+ span_count = boost::distance(row);
+ }
+
         if (has_title)
         {
             actions.out << "<table frame=\"all\"";
@@ -1188,8 +1230,7 @@
                 actions.out << " id=\"" << table_id << "\"";
             actions.out << ">\n";
             actions.out << "<title>";
- while (first != last)
- detail::print_char(*first++, actions.out.get());
+ detail::print_string(title, actions.out.get());
             actions.out << "</title>";
         }
         else
@@ -1200,18 +1241,26 @@
             actions.out << ">\n";
         }
 
- actions.out << "<tgroup cols=\"" << actions.table_span << "\">\n";
+ actions.out << "<tgroup cols=\"" << span_count << "\">\n";
 
- if (!actions.table_header.empty())
+ if (row_count > 1)
         {
- actions.out << "<thead>" << actions.table_header << "</thead>\n";
+ actions.out << "<thead>" << start_row_;
+ BOOST_FOREACH(value cell, values.consume()) {
+ actions.out << start_cell_ << cell.get_boostbook() << end_cell_;
+ }
+ actions.out << end_row_ << "</thead>\n";
         }
 
         actions.out << "<tbody>\n";
 
- std::string str;
- actions.phrase.swap(str);
- actions.out << str;
+ BOOST_FOREACH(value row, values) {
+ actions.out << start_row_;
+ BOOST_FOREACH(value cell, row) {
+ actions.out << start_cell_ << cell.get_boostbook() << end_cell_;
+ }
+ actions.out << end_row_;
+ }
 
         actions.out << "</tbody>\n"
                      << "</tgroup>\n";
@@ -1224,45 +1273,17 @@
         {
             actions.out << "</informaltable>\n";
         }
-
- actions.table_span = 0;
- actions.table_header.clear();
- actions.table_title.clear();
- }
-
- void start_row_action::operator()(char) const
- {
- if (actions.suppress) return;
-
- // the first row is the header
- if (header.empty() && !phrase.str().empty())
- {
- phrase.swap(header);
- }
-
- phrase << start_row_;
- span = 0;
- }
-
- void start_row_action::operator()(iterator f, iterator) const
- {
- (*this)(*f);
- }
-
- void col_action::operator()(iterator, iterator) const
- {
- if(actions.suppress) return;
- phrase << start_cell_ << actions.inside_text << end_cell_;
- ++span;
     }
 
     void begin_section_action::operator()(iterator first, iterator last) const
     {
         if(actions.suppress) return;
 
- section_id = element_id.empty() ?
- detail::make_identifier(first, last) :
- element_id;
+ value_consumer values = actions.values.get();
+
+ section_id = values.is(general_tags::element_id) ?
+ values.consume().get_quickbook() :
+ detail::make_identifier(first, last);
 
         if (section_level != 0)
             qualified_section_id += '.';
@@ -1548,6 +1569,16 @@
         out.raw = std::string(first, last);
     }
     
+ void phrase_to_value_action::operator()(iterator first, iterator last) const
+ {
+ if(!actions.output_pre(actions.phrase)) return;
+
+ std::string value;
+ actions.phrase.swap(value);
+ actions.values.builder.insert(
+ bbk_value(value, actions.values.builder.release_tag()));
+ }
+
     void inner_phrase_action_pre::operator()(iterator, iterator) const
     {
         // TODO: Really?
@@ -1604,7 +1635,8 @@
     void scoped_block_push::success_impl()
     {
         actions.inside_paragraph();
- actions.inside_text = actions.out.str();
+ actions.values.builder.insert(
+ bbk_value(actions.out.str(), actions.values.builder.release_tag()));
     }
 
     set_no_eols_scoped::set_no_eols_scoped(quickbook::actions& actions)

Modified: branches/quickbook-filenames/tools/quickbook/src/actions.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions.hpp 2011-02-14 19:23:57 EST (Mon, 14 Feb 2011)
@@ -175,7 +175,6 @@
         header_action(
             collector& out,
             collector& phrase,
- std::string const& element_id,
             std::string const& library_id,
             std::string const& section_id,
             std::string const& qualified_section_id,
@@ -183,7 +182,6 @@
             quickbook::actions& actions)
         : out(out)
         , phrase(phrase)
- , element_id(element_id)
         , library_id(library_id)
         , section_id(section_id)
         , qualified_section_id(qualified_section_id)
@@ -194,7 +192,6 @@
 
         collector& out;
         collector& phrase;
- std::string const& element_id;
         std::string const& library_id;
         std::string const& section_id;
         std::string const& qualified_section_id;
@@ -209,7 +206,6 @@
         generic_header_action(
             collector& out,
             collector& phrase,
- std::string const& element_id,
             std::string const& library_id,
             std::string const& section_id,
             std::string const& qualified_section_id,
@@ -217,7 +213,6 @@
             quickbook::actions& actions)
         : out(out)
         , phrase(phrase)
- , element_id(element_id)
         , library_id(library_id)
         , section_id(section_id)
         , qualified_section_id(qualified_section_id)
@@ -228,7 +223,6 @@
 
         collector& out;
         collector& phrase;
- std::string const& element_id;
         std::string const& library_id;
         std::string const& section_id;
         std::string const& qualified_section_id;
@@ -661,34 +655,6 @@
         quickbook::actions& actions;
     };
 
- struct start_row_action
- {
- // Handles table rows
-
- start_row_action(collector& phrase, unsigned& span, std::string& header, quickbook::actions& actions)
- : phrase(phrase), span(span), header(header), actions(actions) {}
-
- void operator()(char) const;
- void operator()(iterator f, iterator) const;
-
- collector& phrase;
- unsigned& span;
- std::string& header;
- quickbook::actions& actions;
- };
-
- struct col_action
- {
- col_action(collector& phrase, unsigned& span, quickbook::actions& actions)
- : phrase(phrase), span(span), actions(actions) {}
-
- void operator()(iterator, iterator) const;
-
- collector& phrase;
- unsigned& span;
- quickbook::actions& actions;
- };
-
     struct begin_section_action
     {
         // Handles begin page
@@ -700,7 +666,6 @@
           , std::string& section_id
           , int& section_level
           , std::string& qualified_section_id
- , std::string& element_id
           , quickbook::actions& actions)
         : out(out)
         , phrase(phrase)
@@ -708,7 +673,6 @@
         , section_id(section_id)
         , section_level(section_level)
         , qualified_section_id(qualified_section_id)
- , element_id(element_id)
         , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
@@ -719,7 +683,6 @@
         std::string& section_id;
         int& section_level;
         std::string& qualified_section_id;
- std::string& element_id;
         quickbook::actions& actions;
     };
 
@@ -847,6 +810,16 @@
         quickbook::actions& actions;
     };
 
+ struct phrase_to_value_action
+ {
+ phrase_to_value_action(quickbook::actions& actions)
+ : actions(actions) {}
+
+ void operator()(iterator first, iterator last) const;
+
+ quickbook::actions& actions;
+ };
+
     struct inner_phrase_action_pre
     {
         inner_phrase_action_pre(quickbook::actions& actions)

Modified: branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp 2011-02-14 19:23:57 EST (Mon, 14 Feb 2011)
@@ -23,6 +23,9 @@
     actions::actions(fs::path const& filein_, fs::path const& outdir_, string_stream& out_)
         : grammar_()
 
+ , values()
+ , phrase_value(*this)
+
     // header info
         , doc_type()
         , doc_title()
@@ -56,15 +59,9 @@
         , source_mode("c++")
 
     // temporary or global state
- , element_id()
- , table_title()
- , table_span(0)
- , table_header()
         , macro_id()
         , list_marks()
         , list_indent(-1)
- , template_identifier()
- , template_info()
         , template_depth(0)
         , templates()
         , error_count(0)
@@ -94,13 +91,13 @@
         , code_block(phrase, phrase, *this)
         , inline_code(phrase, *this)
         , inside_paragraph(out, phrase, paragraph_pre, paragraph_post, *this)
- , h(out, phrase, element_id, doc_id, section_id, qualified_section_id, section_level, *this)
- , h1(out, phrase, element_id, doc_id, section_id, qualified_section_id, 1, *this)
- , h2(out, phrase, element_id, doc_id, section_id, qualified_section_id, 2, *this)
- , h3(out, phrase, element_id, doc_id, section_id, qualified_section_id, 3, *this)
- , h4(out, phrase, element_id, doc_id, section_id, qualified_section_id, 4, *this)
- , h5(out, phrase, element_id, doc_id, section_id, qualified_section_id, 5, *this)
- , h6(out, phrase, element_id, doc_id, section_id, qualified_section_id, 6, *this)
+ , h(out, phrase, doc_id, section_id, qualified_section_id, section_level, *this)
+ , h1(out, phrase, doc_id, section_id, qualified_section_id, 1, *this)
+ , h2(out, phrase, doc_id, section_id, qualified_section_id, 2, *this)
+ , h3(out, phrase, doc_id, section_id, qualified_section_id, 3, *this)
+ , h4(out, phrase, doc_id, section_id, qualified_section_id, 4, *this)
+ , h5(out, phrase, doc_id, section_id, qualified_section_id, 5, *this)
+ , h6(out, phrase, doc_id, section_id, qualified_section_id, 6, *this)
         , hr(out, hr_, *this)
         , blurb(out, blurb_pre, blurb_post, *this)
         , blockquote(out, blockquote_pre, blockquote_post, *this)
@@ -164,13 +161,6 @@
         , simple_strikethrough(phrase, strikethrough_pre_, strikethrough_post_, macro, *this)
 
         , variablelist(*this)
- , start_varlistentry(phrase, start_varlistentry_, *this)
- , end_varlistentry(phrase, end_varlistentry_, *this)
- , start_varlistterm(phrase, start_varlistterm_, *this)
- , end_varlistterm(phrase, end_varlistterm_, *this)
- , start_varlistitem(phrase, start_varlistitem_, *this)
- , varlistitem(phrase, "", "", *this)
- , end_varlistitem(phrase, end_varlistitem_, *this)
 
         , break_(phrase, *this)
         , macro_identifier(*this)
@@ -183,12 +173,9 @@
         , link_pre(phrase, link_pre_, *this)
         , link_post(phrase, link_post_, *this)
         , table(*this)
- , start_row(phrase, table_span, table_header, *this)
- , end_row(phrase, end_row_, *this)
- , cell(phrase, table_span, *this)
         , anchor(*this)
 
- , begin_section(out, phrase, doc_id, section_id, section_level, qualified_section_id, element_id, *this)
+ , begin_section(out, phrase, doc_id, section_id, section_level, qualified_section_id, *this)
         , end_section(out, section_level, min_section_level, qualified_section_id, error_count, *this)
         , element_id_warning(*this)
         , xinclude(out, *this)

Modified: branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp 2011-02-14 19:23:57 EST (Mon, 14 Feb 2011)
@@ -46,6 +46,7 @@
         static int const max_template_depth = 100;
 
         value_parser values;
+ phrase_to_value_action phrase_value;
 
     // header info
         std::string doc_type;
@@ -104,19 +105,11 @@
         std::stack<string_symbols> macro_stack;
 
     // temporary or global state
- std::string inside_text;
- std::string element_id;
- std::string table_title;
- unsigned table_span;
- std::string table_header;
         std::string macro_id;
         std::stack<mark_type> list_marks;
         int list_indent;
         bool condition;
- std::string template_identifier;
- string_list template_info;
         int template_depth;
- bool template_block;
         template_stack templates;
         int error_count;
         string_list anchors;
@@ -218,13 +211,6 @@
         simple_phrase_action simple_strikethrough;
 
         variablelist_action variablelist;
- markup_action start_varlistentry;
- markup_action end_varlistentry;
- markup_action start_varlistterm;
- markup_action end_varlistterm;
- markup_action start_varlistitem;
- tagged_action varlistitem;
- markup_action end_varlistitem;
 
         break_action break_;
         macro_identifier_action macro_identifier;
@@ -237,9 +223,6 @@
         link_action link_pre;
         markup_action link_post;
         table_action table;
- start_row_action start_row;
- markup_action end_row;
- col_action cell;
         anchor_action anchor;
 
         begin_section_action begin_section;

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-14 19:23:57 EST (Mon, 14 Feb 2011)
@@ -11,6 +11,8 @@
 #include "utils.hpp"
 #include "actions_class.hpp"
 #include "grammar_impl.hpp"
+#include "table_tags.hpp"
+#include "template_tags.hpp"
 #include <boost/spirit/include/classic_assign_actor.hpp>
 #include <boost/spirit/include/classic_if.hpp>
 #include <boost/spirit/include/classic_clear_actor.hpp>
@@ -41,33 +43,24 @@
         block_element_grammar_local& local = store_.create();
 
         local.element_id =
- ':'
- >>
- (
- cl::if_p(qbk_since(105u)) [space]
- >> (+(cl::alnum_p | '_')) [cl::assign_a(actions.element_id)]
+ !( ':'
+ >> ( cl::if_p(qbk_since(105u)) [space]
+ >> (+(cl::alnum_p | '_')) [actions.values.entry(general_tags::element_id)]
                 | cl::eps_p [actions.element_id_warning]
- [cl::assign_a(actions.element_id)]
                 )
- | cl::eps_p [cl::assign_a(actions.element_id)]
+ )
             ;
         
         local.element_id_1_5 =
                 cl::if_p(qbk_since(105u)) [
                     local.element_id
                 ]
- .else_p [
- cl::eps_p [cl::assign_a(actions.element_id)]
- ]
                 ;
 
         local.element_id_1_6 =
                 cl::if_p(qbk_since(106u)) [
                     local.element_id
                 ]
- .else_p [
- cl::eps_p [cl::assign_a(actions.element_id)]
- ]
                 ;
 
         elements.add
@@ -104,9 +97,6 @@
         local.h5 = space >> local.element_id_1_6 >> space >> local.inner_phrase [actions.h5];
         local.h6 = space >> local.element_id_1_6 >> space >> local.inner_phrase [actions.h6];
         
- static const bool true_ = true;
- static const bool false_ = false;
-
         elements.add("blurb", element_info(element_info::block, &local.blurb));
 
         local.blurb =
@@ -183,22 +173,21 @@
 
         local.template_ =
                space
- >> local.template_id [cl::assign_a(actions.template_identifier)]
- [cl::clear_a(actions.template_info)]
- >>
+ >> local.template_id [actions.values.reset][actions.values.entry]
+ >> actions.values.scoped[
             !(
                 space >> '['
>> *(
                         space
- >> local.template_id [cl::push_back_a(actions.template_info)]
+ >> local.template_id [actions.values.entry]
                     )
>> space >> ']'
             )
+ ]
>> ( cl::eps_p(*cl::blank_p >> cl::eol_p)
- [cl::assign_a(actions.template_block, true_)]
- | cl::eps_p [cl::assign_a(actions.template_block, false_)]
- )
- >> local.template_body [actions.template_body]
+ >> local.template_body [actions.values.entry(template_tags::block)]
+ | local.template_body [actions.values.entry(template_tags::phrase)]
+ ) [actions.template_body]
             ;
 
         local.template_body =
@@ -213,7 +202,7 @@
 
         local.variablelist =
                 (cl::eps_p(*cl::blank_p >> cl::eol_p) | space)
- >> (*(cl::anychar_p - eol)) [cl::assign_a(actions.table_title)]
+ >> (*(cl::anychar_p - eol)) [actions.values.entry(table_tags::title)]
>> (+eol) [actions.output_pre]
>> *local.varlistentry
>> cl::eps_p [actions.variablelist]
@@ -221,47 +210,40 @@
 
         local.varlistentry =
             space
- >> cl::ch_p('[') [actions.start_varlistentry]
- >>
- (
+ >> cl::ch_p('[')
+ >> actions.values.scoped
+ [
                 (
- local.varlistterm [actions.start_varlistitem]
- >> ( +local.varlistitem [actions.varlistitem]
+ local.varlistterm
+ >> ( +local.varlistitem
                         | cl::eps_p [actions.error]
- ) [actions.end_varlistitem]
- >> cl::ch_p(']') [actions.end_varlistentry]
+ )
+ >> cl::ch_p(']')
>> space
                 )
                 | cl::eps_p [actions.error]
- )
+ ]
             ;
 
         local.varlistterm =
             space
- >> cl::ch_p('[') [actions.start_varlistterm]
- >>
- (
- (
- phrase
- >> cl::ch_p(']') [actions.end_varlistterm]
- >> space
- )
- | cl::eps_p [actions.error]
- )
+ >> cl::ch_p('[')
+ >> actions.values.save
+ [ phrase
+ >> cl::ch_p(']')
+ >> space
+ | cl::eps_p [actions.error]
+ ] [actions.phrase_value]
             ;
 
         local.varlistitem =
             space
>> cl::ch_p('[')
- >>
- (
- (
- inside_paragraph
- >> cl::ch_p(']')
- >> space
+ >> ( inside_paragraph
+ >> cl::ch_p(']')
+ >> space
+ | cl::eps_p [actions.error]
                 )
- | cl::eps_p [actions.error]
- )
             ;
 
         elements.add
@@ -272,7 +254,7 @@
                 (cl::eps_p(*cl::blank_p >> cl::eol_p) | space)
>> local.element_id_1_5
>> (cl::eps_p(*cl::blank_p >> cl::eol_p) | space)
- >> (*(cl::anychar_p - eol)) [cl::assign_a(actions.table_title)]
+ >> (*(cl::anychar_p - eol)) [actions.values.entry(table_tags::title)]
>> (+eol) [actions.output_pre]
>> *local.table_row
>> cl::eps_p [actions.table]
@@ -280,12 +262,12 @@
 
         local.table_row =
             space
- >> cl::ch_p('[') [actions.start_row]
+ >> cl::ch_p('[')
>>
             (
                 (
- *local.table_cell
- >> cl::ch_p(']') [actions.end_row]
+ actions.values.scoped(table_tags::row)[*local.table_cell]
+ >> cl::ch_p(']')
>> space
                 )
                 | cl::eps_p [actions.error]
@@ -295,9 +277,10 @@
         local.table_cell =
                 space
>> cl::ch_p('[')
- >> ( inside_paragraph
+ >> ( cl::eps_p [actions.values.tag(table_tags::cell)]
+ >> inside_paragraph
>> cl::ch_p(']')
- >> space [actions.cell]
+ >> space
                 | cl::eps_p [actions.error]
                 )
             ;

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-14 19:23:57 EST (Mon, 14 Feb 2011)
@@ -164,6 +164,7 @@
>> local.element
>> cl::eps_p(local.check_element(element_info::in_block))
                                                 [actions.inside_paragraph]
+ [actions.values.reset]
>> ( local.element_rule
>> ( (space >> ']')
                     | cl::eps_p [actions.error]
@@ -357,11 +358,13 @@
 
         inside_paragraph =
             actions.scoped_block[
+ actions.values.save[
             (*( common
             | (cl::anychar_p - phrase_end) [actions.plain_char]
             | (+eol) [actions.inside_paragraph]
             )) [actions.inside_paragraph]
             ]
+ ]
             ;
 
         local.phrase_element

Added: branches/quickbook-filenames/tools/quickbook/src/table_tags.hpp
==============================================================================
--- (empty file)
+++ branches/quickbook-filenames/tools/quickbook/src/table_tags.hpp 2011-02-14 19:23:57 EST (Mon, 14 Feb 2011)
@@ -0,0 +1,26 @@
+/*=============================================================================
+ Copyright (c) 2011 Daniel James
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#if !defined(BOOST_SPIRIT_QUICKBOOK_TABLE_TAGS_HPP)
+#define BOOST_SPIRIT_QUICKBOOK_TABLE_TAGS_HPP
+
+#include "value_tags.hpp"
+
+namespace quickbook
+{
+ QUICKBOOK_VALUE_TAGS(table_tags, 0x200,
+ (title)(row)(cell)
+ )
+
+ QUICKBOOK_VALUE_TAGS(general_tags, 0x300,
+ (element_id)
+ )
+
+}
+
+#endif
\ No newline at end of file


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