Boost logo

Boost-Commit :

From: joel_at_[hidden]
Date: 2008-07-12 09:15:29


Author: djowel
Date: 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
New Revision: 47352
URL: http://svn.boost.org/trac/boost/changeset/47352

Log:
tutorial updates
Added:
   trunk/libs/spirit/doc/qi_and_karma/mini_xml.qbk (contents, props changed)
Text files modified:
   trunk/libs/spirit/doc/html/index.html | 4
   trunk/libs/spirit/doc/html/spirit/__lex__.html | 4
   trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html | 10
   trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html | 6
   trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_3___counting_words_using_a_parser.html | 8
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts.html | 10
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_states.html | 6
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/the__static__lexer_model.html | 4
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/tokenizing_input_data.html | 4
   trunk/libs/spirit/doc/html/spirit/__lex__/reference/lexer_class.html | 8
   trunk/libs/spirit/doc/html/spirit/acknowledgments.html | 2
   trunk/libs/spirit/doc/html/spirit/qi_and_karma.html | 458 ++++++++++++++++++++++++++++++++++++++++
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html | 10
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html | 10
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html | 2
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html | 10
   trunk/libs/spirit/doc/qi_and_karma.qbk | 1
   trunk/libs/spirit/doc/spirit2.qbk | 2
   trunk/libs/spirit/example/qi/mini_xml1.cpp | 6
   trunk/libs/spirit/example/qi/mini_xml2.cpp | 2
   20 files changed, 518 insertions(+), 49 deletions(-)

Modified: trunk/libs/spirit/doc/html/index.html
==============================================================================
--- trunk/libs/spirit/doc/html/index.html (original)
+++ trunk/libs/spirit/doc/html/index.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -70,6 +70,8 @@
         Numerals</a></span></dt>
 <dt><span class="section"><a href="spirit/qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs">Employee
         - Parsing into structs</a></span></dt>
+<dt><span class="section"><a href="spirit/qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_">Mini
+ XML - ASTs!</a></span></dt>
 </dl></dd>
 <dt><span class="section">Abstracts</span></dt>
 <dd><dl>
@@ -510,7 +512,7 @@
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: July 12, 2008 at 08:35:15 GMT</small></p></td>
+<td align="left"><p><small>Last revised: July 12, 2008 at 11:03:36 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -100,7 +100,7 @@
         </li>
 </ul></div>
 <a name="spirit.__lex__.introduction_to___lex__.why_using_a_separate_lexer"></a><h4>
-<a name="id476356"></a>
+<a name="id481510"></a>
         <a href="__lex__.html#spirit.__lex__.introduction_to___lex__.why_using_a_separate_lexer">Why
         Using a Separate Lexer</a>
       </h4>
@@ -200,7 +200,7 @@
         grammar recognizers.
       </p>
 <a name="spirit.__lex__.introduction_to___lex__.advantages_of_using__emphasis_spirit_lex__emphasis_"></a><h4>
-<a name="id476722"></a>
+<a name="id481863"></a>
         <a href="__lex__.html#spirit.__lex__.introduction_to___lex__.advantages_of_using__emphasis_spirit_lex__emphasis_">Advantages
         of using <span class="emphasis"><em>Spirit.Lex</em></span></a>
       </h4>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -43,7 +43,7 @@
           (for the full example code see here: word_count_functor.cpp).
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.prerequisites"></a><h5>
-<a name="id477232"></a>
+<a name="id482373"></a>
           <a href="quickstart_1___a_word_counter_using___lex__.html#spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.prerequisites">Prerequisites</a>
         </h5>
 <p>
@@ -85,7 +85,7 @@
 <p>
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.defining_tokens"></a><h5>
-<a name="id477621"></a>
+<a name="id482762"></a>
           <a href="quickstart_1___a_word_counter_using___lex__.html#spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.defining_tokens">Defining
           Tokens</a>
         </h5>
@@ -142,7 +142,7 @@
 <p>
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.doing_the_useful_work"></a><h5>
-<a name="id478133"></a>
+<a name="id483274"></a>
           <a href="quickstart_1___a_word_counter_using___lex__.html#spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.doing_the_useful_work">Doing
           the Useful Work</a>
         </h5>
@@ -208,7 +208,7 @@
           as well.
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.pulling_everything_together"></a><h5>
-<a name="id478838"></a>
+<a name="id483979"></a>
           <a href="quickstart_1___a_word_counter_using___lex__.html#spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.pulling_everything_together">Pulling
           Everything Together</a>
         </h5>
@@ -264,7 +264,7 @@
 <p>
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.comparing__emphasis_spirit_lex__emphasis__with__ulink_url__http___flex_sourceforge_net___flex__ulink_"></a><h5>
-<a name="id479980"></a>
+<a name="id485121"></a>
           <a href="quickstart_1___a_word_counter_using___lex__.html#spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.comparing__emphasis_spirit_lex__emphasis__with__ulink_url__http___flex_sourceforge_net___flex__ulink_">Comparing
           <span class="emphasis"><em>Spirit.Lex</em></span> with Flex</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -45,7 +45,7 @@
           options along the lines (for the full example code see here: word_count_lexer.cpp).
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_2___a_better_word_counter_using___lex__.prerequisites"></a><h5>
-<a name="id481054"></a>
+<a name="id486195"></a>
           <a href="quickstart_2___a_better_word_counter_using___lex__.html#spirit.__lex__.__lex___tutorials.quickstart_2___a_better_word_counter_using___lex__.prerequisites">Prerequisites</a>
         </h5>
 <p>
@@ -123,7 +123,7 @@
 <p>
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_2___a_better_word_counter_using___lex__.semantic_actions_in__emphasis_spirit_lex__emphasis_"></a><h5>
-<a name="id482011"></a>
+<a name="id487152"></a>
           <a href="quickstart_2___a_better_word_counter_using___lex__.html#spirit.__lex__.__lex___tutorials.quickstart_2___a_better_word_counter_using___lex__.semantic_actions_in__emphasis_spirit_lex__emphasis_">Semantic
           Actions in <span class="emphasis"><em>Spirit.Lex</em></span></a>
         </h5>
@@ -240,7 +240,7 @@
           to the internal lexer context.
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_2___a_better_word_counter_using___lex__.associating_token_definitions_with_the_lexer"></a><h5>
-<a name="id483471"></a>
+<a name="id488613"></a>
           <a href="quickstart_2___a_better_word_counter_using___lex__.html#spirit.__lex__.__lex___tutorials.quickstart_2___a_better_word_counter_using___lex__.associating_token_definitions_with_the_lexer">Associating
           Token Definitions with the Lexer</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_3___counting_words_using_a_parser.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_3___counting_words_using_a_parser.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_3___counting_words_using_a_parser.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -70,7 +70,7 @@
           code see here: word_count.cpp).
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.prerequisites"></a><h5>
-<a name="id484062"></a>
+<a name="id489203"></a>
           <a href="quickstart_3___counting_words_using_a_parser.html#spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.prerequisites">Prerequisites</a>
         </h5>
 <p>
@@ -121,7 +121,7 @@
 <p>
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.defining_tokens"></a><h5>
-<a name="id484629"></a>
+<a name="id489770"></a>
           <a href="quickstart_3___counting_words_using_a_parser.html#spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.defining_tokens">Defining
           Tokens</a>
         </h5>
@@ -177,7 +177,7 @@
 <p>
         </p>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.using_token_definition_instances_as_parsers"></a><h5>
-<a name="id485137"></a>
+<a name="id490278"></a>
           <a href="quickstart_3___counting_words_using_a_parser.html#spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.using_token_definition_instances_as_parsers">Using
           Token Definition Instances as Parsers</a>
         </h5>
@@ -355,7 +355,7 @@
           </p></td></tr>
 </table></div>
 <a name="spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.pulling_everything_together"></a><h5>
-<a name="id486525"></a>
+<a name="id491666"></a>
           <a href="quickstart_3___counting_words_using_a_parser.html#spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.pulling_everything_together">Pulling
           Everything Together</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__/abstracts.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -84,7 +84,7 @@
             of the <span class="emphasis"><em>Spirit.Lex</em></span> library.
           </p>
 <a name="spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values.the_anatomy_of_a_token"></a><h6>
-<a name="id488006"></a>
+<a name="id493147"></a>
             <a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values.the_anatomy_of_a_token">The
             Anatomy of a Token</a>
           </h6>
@@ -150,7 +150,7 @@
             The lexer iterator returns the same token type for each of the different
             matched token definitions. To accomodate for the possibly different token
             <span class="emphasis"><em>value</em></span> types exposed by the various token types (token
- definitions), the general type of the token value is a boost::variant<>.
+ definitions), the general type of the token value is a boost.variant<>.
             As a minimum (for the default configuration) this token value variant
             will be configured to always hold a boost::iterator_range<>
             containing the pair of iterators pointing to the matched input sequence
@@ -167,7 +167,7 @@
               token value will be converted to the requested token type (parser attribute)
               exactly once. This happens at the time of the first access to the token
               value requiring the corresponding type conversion. The converted token
- value will be stored in the boost::variant<>
+ value will be stored in the boost.variant<>
               replacing the initially stored iterator range. This avoids to convert
               the input sequence to the token value more than once, thus optimizing
               the integration of the lexer with <span class="emphasis"><em>Spirit.Qi</em></span>, even
@@ -222,7 +222,7 @@
             when it is requested for the first time.
           </p>
 <a name="spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values.the_physiognomy_of_a_token_definition"></a><h6>
-<a name="id488816"></a>
+<a name="id493952"></a>
             <a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values.the_physiognomy_of_a_token_definition">The
             Physiognomy of a Token Definition</a>
           </h6>
@@ -296,7 +296,7 @@
 </td></tr>
 </table></div>
 <a name="spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values.examples_of_using__link_linkend__spirit___lex___reference_token_class___code__phrase_role__identifier__lexertl_token__phrase__phrase_role__special___lt__gt___phrase___code___link_"></a><h6>
-<a name="id489230"></a>
+<a name="id494366"></a>
             <a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values.examples_of_using__link_linkend__spirit___lex___reference_token_class___code__phrase_role__identifier__lexertl_token__phrase__phrase_role__special___lt__gt___phrase___code___link_">Examples
             of using lexertl_token<></a>
           </h6>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_states.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_states.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_states.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -26,17 +26,17 @@
 <div class="titlepage"><div><div><h4 class="title">
 <a name="spirit.__lex__.abstracts.lexer_states"></a>Lexer States</h4></div></div></div>
 <a name="spirit.__lex__.abstracts.lexer_states.controlling_the_lexer_state_from_lexer_semantic_actions"></a><h5>
-<a name="id493582"></a>
+<a name="id498718"></a>
           <a href="lexer_states.html#spirit.__lex__.abstracts.lexer_states.controlling_the_lexer_state_from_lexer_semantic_actions">Controlling
           the Lexer State from Lexer Semantic Actions</a>
         </h5>
 <a name="spirit.__lex__.abstracts.lexer_states.controlling_the_lexer_state_from_parser_semantic_actions"></a><h5>
-<a name="id493613"></a>
+<a name="id498749"></a>
           <a href="lexer_states.html#spirit.__lex__.abstracts.lexer_states.controlling_the_lexer_state_from_parser_semantic_actions">Controlling
           the Lexer State from Parser Semantic Actions</a>
         </h5>
 <a name="spirit.__lex__.abstracts.lexer_states.using_a_lexer_state_for_the_skip_parser"></a><h5>
-<a name="id493644"></a>
+<a name="id498780"></a>
           <a href="lexer_states.html#spirit.__lex__.abstracts.lexer_states.using_a_lexer_state_for_the_skip_parser">Using
           a Lexer State for the Skip Parser</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/the__static__lexer_model.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/the__static__lexer_model.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/the__static__lexer_model.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -181,7 +181,7 @@
 <p>
         </p>
 <a name="spirit.__lex__.abstracts.the__static__lexer_model.generating_the_static_analyzer"></a><h5>
-<a name="id491622"></a>
+<a name="id496757"></a>
           <a href="the__static__lexer_model.html#spirit.__lex__.abstracts.the__static__lexer_model.generating_the_static_analyzer">Generating
           the Static Analyzer</a>
         </h5>
@@ -228,7 +228,7 @@
           the next topic (the full generated code can be viewed here).
         </p>
 <a name="spirit.__lex__.abstracts.the__static__lexer_model.modifying_the_dynamic_analyzer"></a><h5>
-<a name="id492146"></a>
+<a name="id497282"></a>
           <a href="the__static__lexer_model.html#spirit.__lex__.abstracts.the__static__lexer_model.modifying_the_dynamic_analyzer">Modifying
           the Dynamic Analyzer</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/tokenizing_input_data.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/tokenizing_input_data.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/tokenizing_input_data.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -30,12 +30,12 @@
         Input Data">Tokenizing
         Input Data</a></h4></div></div></div>
 <a name="spirit.__lex__.abstracts.tokenizing_input_data.the_tokenize___function"></a><h5>
-<a name="id490038"></a>
+<a name="id495173"></a>
           <a href="tokenizing_input_data.html#spirit.__lex__.abstracts.tokenizing_input_data.the_tokenize___function">The
           tokenize() function</a>
         </h5>
 <a name="spirit.__lex__.abstracts.tokenizing_input_data.the_generate_static___function"></a><h5>
-<a name="id490066"></a>
+<a name="id495201"></a>
           <a href="tokenizing_input_data.html#spirit.__lex__.abstracts.tokenizing_input_data.the_generate_static___function">The
           generate_static() function</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/__lex__/reference/lexer_class.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/__lex__/reference/lexer_class.html (original)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/reference/lexer_class.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -26,22 +26,22 @@
 <div class="titlepage"><div><div><h4 class="title">
 <a name="spirit.__lex__.reference.lexer_class"></a>Lexer Class</h4></div></div></div>
 <a name="spirit.__lex__.reference.lexer_class.the_lexertl_lexer_class_implementing_the_dynamic_model"></a><h5>
-<a name="id493835"></a>
+<a name="id498971"></a>
           <a href="lexer_class.html#spirit.__lex__.reference.lexer_class.the_lexertl_lexer_class_implementing_the_dynamic_model">The
           lexertl_lexer Class Implementing the Dynamic Model</a>
         </h5>
 <a name="spirit.__lex__.reference.lexer_class.the_lexertl_actor_lexer_class_implementing_the_dynamic_model"></a><h5>
-<a name="id493864"></a>
+<a name="id498999"></a>
           <a href="lexer_class.html#spirit.__lex__.reference.lexer_class.the_lexertl_actor_lexer_class_implementing_the_dynamic_model">The
           lexertl_actor_lexer Class Implementing the Dynamic Model</a>
         </h5>
 <a name="spirit.__lex__.reference.lexer_class.the_lexertl_static_lexer_class_implementing_the_static_model"></a><h5>
-<a name="id493895"></a>
+<a name="id499030"></a>
           <a href="lexer_class.html#spirit.__lex__.reference.lexer_class.the_lexertl_static_lexer_class_implementing_the_static_model">The
           lexertl_static_lexer Class Implementing the Static Model</a>
         </h5>
 <a name="spirit.__lex__.reference.lexer_class.the_lexertl_static_actor_lexer_class_implementing_the_static_model"></a><h5>
-<a name="id493924"></a>
+<a name="id499059"></a>
           <a href="lexer_class.html#spirit.__lex__.reference.lexer_class.the_lexertl_static_actor_lexer_class_implementing_the_static_model">The
           lexertl_static_actor_lexer Class Implementing the Static Model</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/acknowledgments.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/acknowledgments.html (original)
+++ trunk/libs/spirit/doc/html/spirit/acknowledgments.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -46,7 +46,7 @@
       <span class="bold"><b>FIXME</b></span>: Add more people
     </p>
 <a name="spirit.acknowledgments.acknowledgements_from_the_spirit_v1__emphasis_classic__emphasis__documentation"></a><h3>
-<a name="id494940"></a>
+<a name="id500076"></a>
       <a href="acknowledgments.html#spirit.acknowledgments.acknowledgements_from_the_spirit_v1__emphasis_classic__emphasis__documentation">Acknowledgements
       from the Spirit V1 <span class="emphasis"><em>classic</em></span> Documentation</a>
     </h3>

Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -46,6 +46,8 @@
         Numerals</a></span></dt>
 <dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs">Employee
         - Parsing into structs</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_">Mini
+ XML - ASTs!</a></span></dt>
 </dl></dd>
 <dt><span class="section">Abstracts</span></dt>
 <dd><dl>
@@ -107,6 +109,8 @@
         Numerals</a></span></dt>
 <dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs">Employee
         - Parsing into structs</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_">Mini
+ XML - ASTs!</a></span></dt>
 </dl></div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h4 class="title">
@@ -1972,6 +1976,460 @@
           its work.
         </p>
 </div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_" title="Mini
+ XML - ASTs!">Mini
+ XML - ASTs!</a></h4></div></div></div>
+<p>
+ Stop and think about it... We've come very close to generating an AST in
+ our last example. We parsed a single structure and generated an in-memory
+ representation of it in the form of a struct: the <tt class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">employee</span></tt>. If we changed the implementation
+ to parse one or more employees, the result would be a <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">employee</span><span class="special">&gt;</span></tt>. We can go on and add more hierarchy:
+ teams, departments, corporations. Then we'll have an AST representation
+ of it all.
+ </p>
+<p>
+ In this example (actually two examples), we'll now explore parsers how
+ to create ASTs. We will parse a minimalistic XML like language and compile
+ the results into our data structures in the form of a tree.
+ </p>
+<p>
+ Along the way, we'll see new features:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Inherited attributes
+ </li>
+<li>
+ Variant attributes
+ </li>
+<li>
+ Local Variables
+ </li>
+</ul></div>
+<p>
+ The full cpp files for these examples can be found here: ../../example/qi/mini_xml1.cpp
+ and here: ../../example/qi/mini_xml2.cpp
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.first_cut"></a><h5>
+<a name="id474121"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.first_cut">First
+ Cut</a>
+ </h5>
+<p>
+ Without further delay, here's the first version of the XML grammar:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">mini_xml_grammar</span> <span class="special">:</span> <span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">mini_xml_grammar</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">mini_xml_grammar</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">xml</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">text</span> <span class="special">=</span> <span class="identifier">lexeme</span><span class="special">[+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'&lt;'</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">+=</span> <span class="identifier">_1</span><span class="special">]];</span>
+ <span class="identifier">node</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">xml</span> <span class="special">|</span> <span class="identifier">text</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">];</span>
+
+ <span class="identifier">start_tag</span> <span class="special">=</span>
+ <span class="char">'&lt;'</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">lexeme</span><span class="special">[+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'&gt;'</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">+=</span> <span class="identifier">_1</span><span class="special">]]</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'&gt;'</span>
+ <span class="special">;</span>
+
+ <span class="identifier">end_tag</span> <span class="special">=</span>
+ <span class="string">"&lt;/"</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">_r1</span><span class="special">)</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'&gt;'</span>
+ <span class="special">;</span>
+
+ <span class="identifier">xml</span> <span class="special">=</span>
+ <span class="identifier">start_tag</span> <span class="special">[</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
+ <span class="special">&gt;&gt;</span> <span class="special">*</span><span class="identifier">node</span> <span class="special">[</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">)]</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">end_tag</span><span class="special">(</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">))</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">xml</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml_node</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">node</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">text</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">start_tag</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="keyword">void</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">end_tag</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Going bottom up, let's examine the <tt class="computeroutput"><span class="identifier">text</span></tt>
+ rule:
+ </p>
+<pre class="programlisting">
+<span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">text</span><span class="special">;</span>
+</pre>
+<p>
+ and its definition:
+ </p>
+<pre class="programlisting">
+<span class="identifier">text</span> <span class="special">=</span> <span class="identifier">lexeme</span><span class="special">[+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'&lt;'</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">+=</span> <span class="identifier">_1</span><span class="special">]];</span>
+</pre>
+<p>
+ The semantic action collects the chars and appends them (via +=) to the
+ <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt> attribute of the rule (represented
+ by the placeholder <tt class="computeroutput"><span class="identifier">_val</span></tt>).
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.alternates"></a><h5>
+<a name="id475380"></a>
+ Alternates
+ </h5>
+<pre class="programlisting">
+<span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml_node</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">node</span><span class="special">;</span>
+</pre>
+<p>
+ and its definition:
+ </p>
+<pre class="programlisting">
+<span class="identifier">node</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">xml</span> <span class="special">|</span> <span class="identifier">text</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">];</span>
+</pre>
+<p>
+ We'll see what a <tt class="computeroutput"><span class="identifier">mini_xml_node</span></tt>
+ structure later. Looking at the rule definition, we see some alternation
+ goiing on here. An xml <tt class="computeroutput"><span class="identifier">node</span></tt>
+ is either an <tt class="computeroutput"><span class="identifier">xml</span></tt> OR <tt class="computeroutput"><span class="identifier">text</span></tt>. Hmmm... hold on to that thought...
+ </p>
+<pre class="programlisting">
+<span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">start_tag</span><span class="special">;</span>
+</pre>
+<p>
+ Again, with an attribute of <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt>.
+ Then, it's definition:
+ </p>
+<pre class="programlisting">
+<span class="identifier">start_tag</span> <span class="special">=</span>
+ <span class="char">'&lt;'</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">lexeme</span><span class="special">[+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'&gt;'</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">+=</span> <span class="identifier">_1</span><span class="special">]]</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'&gt;'</span>
+<span class="special">;</span>
+</pre>
+<p>
+ Nothing special. Almost the same as the <tt class="computeroutput"><span class="identifier">text</span></tt>
+ rule apart from the added <tt class="computeroutput"><span class="char">'&lt;'</span></tt>
+ and <tt class="computeroutput"><span class="char">'&gt;'</span></tt>.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.inherited_attribute"></a><h5>
+<a name="id475860"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.inherited_attribute">Inherited
+ Attribute</a>
+ </h5>
+<p>
+ The <tt class="computeroutput"><span class="identifier">end_tag</span></tt>:
+ </p>
+<pre class="programlisting">
+<span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="keyword">void</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">end_tag</span><span class="special">;</span>
+</pre>
+<p>
+ Ohh! Now we see an inherited attribute there: <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt>.
+ The <tt class="computeroutput"><span class="identifier">end_tag</span></tt> does not have
+ a synthesized attribute. Let's see its definition:
+ </p>
+<pre class="programlisting">
+<span class="identifier">end_tag</span> <span class="special">=</span>
+ <span class="string">"&lt;/"</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">_r1</span><span class="special">)</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'&gt;'</span>
+<span class="special">;</span>
+</pre>
+<p>
+ <tt class="computeroutput"><span class="identifier">_r1</span></tt> is yet another Phoenix placeholder for
+ the 1st inherited attribute (we have only one, use <tt class="computeroutput"><span class="identifier">_r2</span></tt>,
+ <tt class="computeroutput"><span class="identifier">_r3</span></tt>, etc. if you have more).
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.a_lazy_lit"></a><h5>
+<a name="id476142"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.a_lazy_lit">A
+ Lazy Lit</a>
+ </h5>
+<p>
+ Check out how we used <tt class="computeroutput"><span class="identifier">lit</span></tt>
+ here, this time, not with a literal string, but with the value of the 1st
+ inherited attribute, which is specified as <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt>
+ in our rule declaration.
+ </p>
+<p>
+ Finally, our <tt class="computeroutput"><span class="identifier">xml</span></tt> rule:
+ </p>
+<pre class="programlisting">
+<span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">xml</span><span class="special">;</span>
+</pre>
+<p>
+ <tt class="computeroutput"><span class="identifier">mini_xml</span></tt> is our attribute
+ here. We'll see later what it is. Let's see its definition:
+ </p>
+<pre class="programlisting">
+<span class="identifier">xml</span> <span class="special">=</span>
+ <span class="identifier">start_tag</span> <span class="special">[</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
+ <span class="special">&gt;&gt;</span> <span class="special">*</span><span class="identifier">node</span> <span class="special">[</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">)]</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">end_tag</span><span class="special">(</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">))</span>
+<span class="special">;</span>
+</pre>
+<p>
+ Those who know Fusion
+ now will notice <tt class="computeroutput"><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span></tt> and
+ <tt class="computeroutput"><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;</span></tt>. This
+ gives us a hint that <tt class="computeroutput"><span class="identifier">mini_xml</span></tt>
+ is a sort of a tuple - a fusion sequence. <tt class="computeroutput"><span class="identifier">at_c</span><span class="special">&lt;</span><span class="identifier">N</span><span class="special">&gt;</span></tt> here is a lazy version of the tuple
+ accessors, provided by Phoenix.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.how_it_all_works"></a><h5>
+<a name="id476625"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.how_it_all_works">How
+ it all works</a>
+ </h5>
+<p>
+ So, what's happening?
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ Upon parsing <tt class="computeroutput"><span class="identifier">start_tag</span></tt>,
+ the parsed start-tag string is placed in <tt class="computeroutput"><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">)</span></tt>.
+ </li>
+<li>
+ Then we parse zero or more <tt class="computeroutput"><span class="identifier">node</span></tt>s.
+ At each step, we <tt class="computeroutput"><span class="identifier">push_back</span></tt>
+ the result into <tt class="computeroutput"><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">)</span></tt>.
+ </li>
+<li>
+ Finally, we parse the <tt class="computeroutput"><span class="identifier">end_tag</span></tt>
+ giving it an inherited attribute: <tt class="computeroutput"><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">)</span></tt>.
+ This is the string we obtained from the <tt class="computeroutput"><span class="identifier">start_tag</span></tt>.
+ Investigate <tt class="computeroutput"><span class="identifier">end_tag</span></tt> above.
+ It will fail to parse if it gets something different from what we got
+ from the <tt class="computeroutput"><span class="identifier">start_tag</span></tt>. This
+ ensures that our tags are balanced.
+ </li>
+</ol></div>
+<p>
+ To give the last item some more light, what happens is this:
+ </p>
+<pre class="programlisting">
+<span class="identifier">end_tag</span><span class="special">(</span><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">))</span>
+</pre>
+<p>
+ calls:
+ </p>
+<pre class="programlisting">
+<span class="identifier">end_tag</span> <span class="special">=</span>
+ <span class="string">"&lt;/"</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">_r1</span><span class="special">)</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'&gt;'</span>
+<span class="special">;</span>
+</pre>
+<p>
+ passing in <tt class="computeroutput"><span class="identifier">at_c</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">_val</span><span class="special">)</span></tt>, the string from start tag. This is referred
+ to in the <tt class="computeroutput"><span class="identifier">end_tag</span></tt> body
+ as <tt class="computeroutput"><span class="identifier">_r1</span></tt>.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.the_structures"></a><h5>
+<a name="id477074"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.the_structures">The
+ Structures</a>
+ </h5>
+<p>
+ Let's see our structures. It will definitely be hierarchical: xml is hierarchical.
+ It will also be recursive: xml is recursive.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">struct</span> <span class="identifier">mini_xml</span><span class="special">;</span>
+
+<span class="keyword">typedef</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">variant</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_wrapper</span><span class="special">&lt;</span><span class="identifier">mini_xml</span><span class="special">&gt;</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span>
+ <span class="special">&gt;</span>
+<span class="identifier">mini_xml_node</span><span class="special">;</span>
+
+<span class="keyword">struct</span> <span class="identifier">mini_xml</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">name</span><span class="special">;</span> <span class="comment">// tag name
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">mini_xml_node</span><span class="special">&gt;</span> <span class="identifier">children</span><span class="special">;</span> <span class="comment">// children
+</span><span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.of_alternates_and_variants"></a><h5>
+<a name="id477348"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.of_alternates_and_variants">Of
+ Alternates and Variants</a>
+ </h5>
+<p>
+ So that's how a <tt class="computeroutput"><span class="identifier">mini_xml_node</span></tt>
+ looks like. We had a hint that it is either a <tt class="computeroutput"><span class="identifier">string</span></tt>
+ or a <tt class="computeroutput"><span class="identifier">mini_xml</span></tt>. For this,
+ we use boost.variant<>.
+ <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_wrapper</span></tt> wraps <tt class="computeroutput"><span class="identifier">mini_xml</span></tt>, making it a recursive data
+ structure.
+ </p>
+<p>
+ Yep, you got that right: the attribute of an alternate:
+ </p>
+<pre class="programlisting">
+<span class="identifier">a</span> <span class="special">|</span> <span class="identifier">b</span>
+</pre>
+<p>
+ is a
+ </p>
+<pre class="programlisting">
+<span class="identifier">boost</span><span class="special">::</span><span class="identifier">variant</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;</span>
+</pre>
+<p>
+ where <tt class="computeroutput"><span class="identifier">A</span></tt> is the attribute
+ of <tt class="computeroutput"><span class="identifier">a</span></tt> and <tt class="computeroutput"><span class="identifier">B</span></tt> is the attribute of <tt class="computeroutput"><span class="identifier">b</span></tt>.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.adapting_structs_again"></a><h5>
+<a name="id477620"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.adapting_structs_again">Adapting
+ structs again</a>
+ </h5>
+<p>
+ <tt class="computeroutput"><span class="identifier">mini_xml</span></tt> is no brainier.
+ It is a plain ol' struct. But as we've seen in our employee example, we
+ can adapt that to be a Fusion
+ sequence:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">BOOST_FUSION_ADAPT_STRUCT</span><span class="special">(</span>
+ <span class="identifier">mini_xml</span><span class="special">,</span>
+ <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">name</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">mini_xml_node</span><span class="special">&gt;,</span> <span class="identifier">children</span><span class="special">)</span>
+<span class="special">)</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.one_more_take"></a><h5>
+<a name="id477802"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.one_more_take">One
+ More Take</a>
+ </h5>
+<p>
+ Here's another version. The AST structure remains the same, but this time,
+ you'll see that we make use of auto-rules making the grammar semantic-action-
+ less. Here it is:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">mini_xml_grammar</span>
+ <span class="special">:</span> <span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">locals</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;,</span> <span class="identifier">space_type</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">mini_xml_grammar</span><span class="special">()</span>
+ <span class="special">:</span> <span class="identifier">mini_xml_grammar</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">xml</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">text</span> <span class="special">%=</span> <span class="identifier">lexeme</span><span class="special">[+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'&lt;'</span><span class="special">)];</span>
+ <span class="identifier">node</span> <span class="special">%=</span> <span class="identifier">xml</span> <span class="special">|</span> <span class="identifier">text</span><span class="special">;</span>
+
+ <span class="identifier">start_tag</span> <span class="special">%=</span>
+ <span class="char">'&lt;'</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">lexeme</span><span class="special">[+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'&gt;'</span><span class="special">)]</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'&gt;'</span>
+ <span class="special">;</span>
+
+ <span class="identifier">end_tag</span> <span class="special">=</span>
+ <span class="string">"&lt;/"</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">_r1</span><span class="special">)</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'&gt;'</span>
+ <span class="special">;</span>
+
+ <span class="identifier">xml</span> <span class="special">%=</span>
+ <span class="identifier">start_tag</span><span class="special">[</span><span class="identifier">_a</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
+ <span class="special">&gt;&gt;</span> <span class="special">*</span><span class="identifier">node</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">end_tag</span><span class="special">(</span><span class="identifier">_a</span><span class="special">)</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">locals</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;,</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">xml</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml_node</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">node</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">text</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">start_tag</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="keyword">void</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">end_tag</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ This one shouldn't be any more difficult to understand after going through
+ the first xml parser example. The rules are almost the same, except that,
+ we got rid of semantic actions and used auto-rules (see the employee example
+ if you missed that). There are a couple of new stuff, though. It's all
+ in the <tt class="computeroutput"><span class="identifier">xml</span></tt> rule:
+ </p>
+<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.local_variables"></a><h5>
+<a name="id478738"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.local_variables">Local
+ Variables</a>
+ </h5>
+<pre class="programlisting">
+<span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">locals</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;,</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">xml</span><span class="special">;</span>
+</pre>
+<p>
+ Wow, we have four template parameters now. What's that <tt class="computeroutput"><span class="identifier">locals</span></tt>
+ guy doing there? Well, it declares that the rule <tt class="computeroutput"><span class="identifier">xml</span></tt>
+ will have one local variable: a <tt class="computeroutput"><span class="identifier">string</span></tt>.
+ Let's see how this is used in action:
+ </p>
+<pre class="programlisting">
+<span class="identifier">xml</span> <span class="special">%=</span>
+ <span class="identifier">start_tag</span><span class="special">[</span><span class="identifier">_a</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
+ <span class="special">&gt;&gt;</span> <span class="special">*</span><span class="identifier">node</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">end_tag</span><span class="special">(</span><span class="identifier">_a</span><span class="special">)</span>
+<span class="special">;</span>
+</pre>
+<div class="orderedlist"><ol type="1">
+<li>
+ Upon parsing <tt class="computeroutput"><span class="identifier">start_tag</span></tt>,
+ the parsed start-tag string is placed in the local variable specified
+ by (yet another) Phoenix
+ placeholder: <tt class="computeroutput"><span class="identifier">_a</span></tt>. We have
+ only one local variable. If we had more, these are designated by <tt class="computeroutput"><span class="identifier">_b</span></tt>..<tt class="computeroutput"><span class="identifier">z</span></tt>.
+ </li>
+<li>
+ Then we parse zero or more <tt class="computeroutput"><span class="identifier">node</span></tt>s.
+ </li>
+<li>
+ Finally, we parse the <tt class="computeroutput"><span class="identifier">end_tag</span></tt>
+ giving it an inherited attribute: <tt class="computeroutput"><span class="identifier">_a</span></tt>,
+ our local variable.
+ </li>
+</ol></div>
+<p>
+ There are no actions involved in stuffing data into our <tt class="computeroutput"><span class="identifier">xml</span></tt>
+ attribute. It's all taken cared of thatnks to the auto-rule.
+ </p>
+</div>
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>

Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -56,27 +56,27 @@
           main reason for Spirit's extensibility.
         </p>
 <a name="spirit.qi_and_karma.abstracts.parsing.the_api_functions_exposed_by__emphasis_spirit_qi__emphasis__"></a><h5>
-<a name="id474092"></a>
+<a name="id479245"></a>
           <a href="parsing.html#spirit.qi_and_karma.abstracts.parsing.the_api_functions_exposed_by__emphasis_spirit_qi__emphasis__">The
           API functions exposed by <span class="emphasis"><em>Spirit.Qi</em></span> </a>
         </h5>
 <a name="spirit.qi_and_karma.abstracts.parsing.the_parse___function"></a><h5>
-<a name="id474124"></a>
+<a name="id479277"></a>
           <a href="parsing.html#spirit.qi_and_karma.abstracts.parsing.the_parse___function">The
           parse() function</a>
         </h5>
 <a name="spirit.qi_and_karma.abstracts.parsing.the_phrase_parse___function"></a><h5>
-<a name="id474153"></a>
+<a name="id479306"></a>
           <a href="parsing.html#spirit.qi_and_karma.abstracts.parsing.the_phrase_parse___function">The
           phrase_parse() function</a>
         </h5>
 <a name="spirit.qi_and_karma.abstracts.parsing.the_tokenize_and_parse___function"></a><h5>
-<a name="id474180"></a>
+<a name="id479333"></a>
           <a href="parsing.html#spirit.qi_and_karma.abstracts.parsing.the_tokenize_and_parse___function">The
           tokenize_and_parse() function</a>
         </h5>
 <a name="spirit.qi_and_karma.abstracts.parsing.the_tokenize_and_phrase_parse___function"></a><h5>
-<a name="id474208"></a>
+<a name="id479362"></a>
           <a href="parsing.html#spirit.qi_and_karma.abstracts.parsing.the_tokenize_and_phrase_parse___function">The
           tokenize_and_phrase_parse() function</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -29,27 +29,27 @@
         and Generating">Parsing
         and Generating</a></h4></div></div></div>
 <a name="spirit.qi_and_karma.abstracts.parsing_and_generating.the_api_functions_exposed_by__emphasis_spirit_qi__emphasis__"></a><h5>
-<a name="id474265"></a>
+<a name="id479420"></a>
           <a href="parsing_and_generating.html#spirit.qi_and_karma.abstracts.parsing_and_generating.the_api_functions_exposed_by__emphasis_spirit_qi__emphasis__">The
           API functions exposed by <span class="emphasis"><em>Spirit.Qi</em></span> </a>
         </h5>
 <a name="spirit.qi_and_karma.abstracts.parsing_and_generating.the_parse___function"></a><h5>
-<a name="id474301"></a>
+<a name="id479455"></a>
           <a href="parsing_and_generating.html#spirit.qi_and_karma.abstracts.parsing_and_generating.the_parse___function">The
           parse() function</a>
         </h5>
 <a name="spirit.qi_and_karma.abstracts.parsing_and_generating.the_phrase_parse___function"></a><h5>
-<a name="id474331"></a>
+<a name="id479485"></a>
           <a href="parsing_and_generating.html#spirit.qi_and_karma.abstracts.parsing_and_generating.the_phrase_parse___function">The
           phrase_parse() function</a>
         </h5>
 <a name="spirit.qi_and_karma.abstracts.parsing_and_generating.the_tokenize_and_parse___function"></a><h5>
-<a name="id474360"></a>
+<a name="id479514"></a>
           <a href="parsing_and_generating.html#spirit.qi_and_karma.abstracts.parsing_and_generating.the_tokenize_and_parse___function">The
           tokenize_and_parse() function</a>
         </h5>
 <a name="spirit.qi_and_karma.abstracts.parsing_and_generating.the_tokenize_and_phrase_parse___function"></a><h5>
-<a name="id474392"></a>
+<a name="id479546"></a>
           <a href="parsing_and_generating.html#spirit.qi_and_karma.abstracts.parsing_and_generating.the_tokenize_and_phrase_parse___function">The
           tokenize_and_phrase_parse() function</a>
         </h5>

Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -46,7 +46,7 @@
 </dl>
 </div>
 <div class="table">
-<a name="id474732"></a><p class="title"><b>Table 4. Character Parsers</b></p>
+<a name="id479886"></a><p class="title"><b>Table 4. Character Parsers</b></p>
 <table class="table" summary="Character Parsers">
 <colgroup>
 <col>

Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -50,7 +50,7 @@
 <div class="titlepage"><div><div><h5 class="title">
 <a name="spirit.qi_and_karma.reference.concepts.parser"></a>Parser</h5></div></div></div>
 <a name="spirit.qi_and_karma.reference.concepts.parser.description"></a><h6>
-<a name="id475648"></a>
+<a name="id480802"></a>
             <a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.description">Description</a>
           </h6>
 <p>
@@ -66,7 +66,7 @@
 </dl>
 </div>
 <a name="spirit.qi_and_karma.reference.concepts.parser.valid_expressions"></a><h6>
-<a name="id475708"></a>
+<a name="id480862"></a>
             <a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.valid_expressions">Valid
             Expressions</a>
           </h6>
@@ -126,7 +126,7 @@
 </tr></tbody>
 </table></div>
 <a name="spirit.qi_and_karma.reference.concepts.parser.type_requirements"></a><h6>
-<a name="id475845"></a>
+<a name="id480999"></a>
             <a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.type_requirements">Type
             Requirements</a>
           </h6>
@@ -161,14 +161,14 @@
 </tr></tbody>
 </table></div>
 <a name="spirit.qi_and_karma.reference.concepts.parser.invariants"></a><h6>
-<a name="id475949"></a>
+<a name="id481103"></a>
             <a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.invariants">Invariants</a>
           </h6>
 <p>
             For any Parser xxx the following invariants always hold:
           </p>
 <a name="spirit.qi_and_karma.reference.concepts.parser.models"></a><h6>
-<a name="id475979"></a>
+<a name="id481133"></a>
             <a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.models">Models</a>
           </h6>
 <p>

Modified: trunk/libs/spirit/doc/qi_and_karma.qbk
==============================================================================
--- trunk/libs/spirit/doc/qi_and_karma.qbk (original)
+++ trunk/libs/spirit/doc/qi_and_karma.qbk 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -19,6 +19,7 @@
 [include qi_and_karma/num_list4.qbk]
 [include qi_and_karma/roman.qbk]
 [include qi_and_karma/employee.qbk]
+[include qi_and_karma/mini_xml.qbk]
 [endsect]
 
 [section Abstracts]

Added: trunk/libs/spirit/doc/qi_and_karma/mini_xml.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/qi_and_karma/mini_xml.qbk 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,220 @@
+[/==============================================================================
+ Copyright (C) 2001-2008 Joel de Guzman
+ Copyright (C) 2001-2008 Hartmut Kaiser
+
+ Distributed under 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)
+===============================================================================/]
+
+[section Mini XML - ASTs!]
+
+Stop and think about it... We've come very close to generating an AST in our
+last example. We parsed a single structure and generated an in-memory
+representation of it in the form of a struct: the `struct employee`. If we
+changed the implementation to parse one or more employees, the result would be a
+`std::vector<employee>`. We can go on and add more hierarchy: teams,
+departments, corporations. Then we'll have an AST representation of it all.
+
+In this example (actually two examples), we'll now explore parsers how to create
+ASTs. We will parse a minimalistic XML like language and compile the results
+into our data structures in the form of a tree.
+
+Along the way, we'll see new features:
+
+* Inherited attributes
+* Variant attributes
+* Local Variables
+
+The full cpp files for these examples can be found here:
+[@../../example/qi/mini_xml1.cpp] and here: [@../../example/qi/mini_xml2.cpp]
+
+There are a couple of sample toy-xml files in: [@../../example/qi/mini_xml_samples]
+for testing purposes. "4.toyxml" has an error in it.
+
+[import ../../example/qi/mini_xml1.cpp]
+[import ../../example/qi/mini_xml2.cpp]
+
+[heading First Cut]
+
+Without further delay, here's the first version of the XML grammar:
+
+[tutorial_xml1_grammar]
+
+Going bottom up, let's examine the `text` rule:
+
+ rule<Iterator, std::string(), space_type> text;
+
+and its definition:
+
+ text = lexeme[+(char_ - '<') [_val += _1]];
+
+The semantic action collects the chars and appends them (via +=) to the
+`std::string` attribute of the rule (represented by the placeholder `_val`).
+
+[heading Alternates]
+
+ rule<Iterator, mini_xml_node(), space_type> node;
+
+and its definition:
+
+ node = (xml | text) [_val = _1];
+
+We'll see what a `mini_xml_node` structure later. Looking at the rule
+definition, we see some alternation goiing on here. An xml `node` is
+either an `xml` OR `text`. Hmmm... hold on to that thought...
+
+ rule<Iterator, std::string(), space_type> start_tag;
+
+Again, with an attribute of `std::string`. Then, it's definition:
+
+ start_tag =
+ '<'
+ >> lexeme[+(char_ - '>') [_val += _1]]
+ >> '>'
+ ;
+
+Nothing special. Almost the same as the `text` rule apart from the added `'<'`
+and `'>'`.
+
+[heading Inherited Attribute]
+
+The `end_tag`:
+
+ rule<Iterator, void(std::string), space_type> end_tag;
+
+Ohh! Now we see an inherited attribute there: `std::string`. The `end_tag` does
+not have a synthesized attribute. Let's see its definition:
+
+ end_tag =
+ "</"
+ >> lit(_r1)
+ >> '>'
+ ;
+
+`_r1` is yet another __phoenix__ placeholder for the 1st inherited attribute (we
+have only one, use `_r2`, `_r3`, etc. if you have more).
+
+[heading A Lazy Lit]
+
+Check out how we used `lit` here, this time, not with a literal string, but with
+the value of the 1st inherited attribute, which is specified as `std::string` in
+our rule declaration.
+
+Finally, our `xml` rule:
+
+ rule<Iterator, mini_xml(), space_type> xml;
+
+`mini_xml` is our attribute here. We'll see later what it is. Let's see its
+definition:
+
+ xml =
+ start_tag [at_c<0>(_val) = _1]
+ >> *node [push_back(at_c<1>(_val), _1)]
+ >> end_tag(at_c<0>(_val))
+ ;
+
+Those who know __fusion__ now will notice `at_c<0>` and `at_c<1>`. This gives us
+a hint that `mini_xml` is a sort of a tuple - a fusion sequence. `at_c<N>` here
+is a lazy version of the tuple accessors, provided by __phoenix__.
+
+[heading How it all works]
+
+So, what's happening?
+
+# Upon parsing `start_tag`, the parsed start-tag string is placed in
+ `at_c<0>(_val)`.
+
+# Then we parse zero or more `node`s. At each step, we `push_back` the result
+ into `at_c<1>(_val)`.
+
+# Finally, we parse the `end_tag` giving it an inherited attribute: `at_c<0>(_val)`.
+ This is the string we obtained from the `start_tag`. Investigate `end_tag` above.
+ It will fail to parse if it gets something different from what we got from the
+ `start_tag`. This ensures that our tags are balanced.
+
+To give the last item some more light, what happens is this:
+
+ end_tag(at_c<0>(_val))
+
+calls:
+
+ end_tag =
+ "</"
+ >> lit(_r1)
+ >> '>'
+ ;
+
+passing in `at_c<0>(_val)`, the string from start tag. This is referred to in the
+`end_tag` body as `_r1`.
+
+[heading The Structures]
+
+Let's see our structures. It will definitely be hierarchical: xml is
+hierarchical. It will also be recursive: xml is recursive.
+
+[tutorial_xml1_structures]
+
+[heading Of Alternates and Variants]
+
+So that's how a `mini_xml_node` looks like. We had a hint that it is either
+a `string` or a `mini_xml`. For this, we use __boost_variant__. `boost::recursive_wrapper`
+wraps `mini_xml`, making it a recursive data structure.
+
+Yep, you got that right: the attribute of an alternate:
+
+ a | b
+
+is a
+
+ boost::variant<A, B>
+
+where `A` is the attribute of `a` and `B` is the attribute of `b`.
+
+[heading Adapting structs again]
+
+`mini_xml` is no brainier. It is a plain ol' struct. But as we've seen in our
+employee example, we can adapt that to be a __fusion__ sequence:
+
+[tutorial_xml1_adapt_structures]
+
+[heading One More Take]
+
+Here's another version. The AST structure remains the same, but this time,
+you'll see that we make use of auto-rules making the grammar semantic-action-
+less. Here it is:
+
+[tutorial_xml2_grammar]
+
+This one shouldn't be any more difficult to understand after going through the
+first xml parser example. The rules are almost the same, except that, we got rid
+of semantic actions and used auto-rules (see the employee example if you missed
+that). There are a couple of new stuff, though. It's all in the `xml` rule:
+
+[heading Local Variables]
+
+ rule<Iterator, mini_xml(), locals<std::string>, space_type> xml;
+
+Wow, we have four template parameters now. What's that `locals` guy doing there?
+Well, it declares that the rule `xml` will have one local variable: a `string`.
+Let's see how this is used in action:
+
+ xml %=
+ start_tag[_a = _1]
+ >> *node
+ >> end_tag(_a)
+ ;
+
+# Upon parsing `start_tag`, the parsed start-tag string is placed in
+ the local variable specified by (yet another) __phoenix__ placeholder:
+ `_a`. We have only one local variable. If we had more, these are designated
+ by `_b`..`z`.
+
+# Then we parse zero or more `node`s.
+
+# Finally, we parse the `end_tag` giving it an inherited attribute: `_a`, our
+ local variable.
+
+There are no actions involved in stuffing data into our `xml` attribute. It's
+all taken cared of thatnks to the auto-rule.
+
+[endsect]

Modified: trunk/libs/spirit/doc/spirit2.qbk
==============================================================================
--- trunk/libs/spirit/doc/spirit2.qbk (original)
+++ trunk/libs/spirit/doc/spirit2.qbk 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -50,7 +50,7 @@
 [def __re2c__ [@http://re2c.sourceforge.net/ re2c]]
 [def __ragel__ [@http://www.cs.queensu.ca/~thurston/ragel/ Ragel]]
 
-[def __boost_variant__ [@http://www.boost.org/doc/html/variant.html `boost::variant<>`]]
+[def __boost_variant__ [@http://www.boost.org/doc/html/variant.html `boost.variant<>`]]
 [def __boost_iterator_range__ [@http://www.boost.org/libs/range/doc/utility_class.html#iter_range `boost::iterator_range<>`]]
 [def __boost_bind__ [@http://www.boost.org/libs/bind/index.html Boost.Bind]]
 [def __boost_lambda__ [@http://www.boost.org/libs/lambda/index.html Boost.Lambda]]

Modified: trunk/libs/spirit/example/qi/mini_xml1.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/mini_xml1.cpp (original)
+++ trunk/libs/spirit/example/qi/mini_xml1.cpp 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -41,6 +41,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Our mini XML tree representation
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_xml1_structures
 struct mini_xml;
 
 typedef
@@ -55,14 +56,17 @@
     std::string name; // tag name
     std::vector<mini_xml_node> children; // children
 };
+//]
 
 // We need to tell fusion about our mini_xml struct
 // to make it a first-class fusion citizen
+//[tutorial_xml1_adapt_structures
 BOOST_FUSION_ADAPT_STRUCT(
     mini_xml,
     (std::string, name)
     (std::vector<mini_xml_node>, children)
 )
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Print out the mini xml tree
@@ -127,6 +131,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Our mini XML grammar definition
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_xml1_grammar
 template <typename Iterator>
 struct mini_xml_grammar : grammar<Iterator, mini_xml(), space_type>
 {
@@ -160,6 +165,7 @@
     rule<Iterator, std::string(), space_type> start_tag;
     rule<Iterator, void(std::string), space_type> end_tag;
 };
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program

Modified: trunk/libs/spirit/example/qi/mini_xml2.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/mini_xml2.cpp (original)
+++ trunk/libs/spirit/example/qi/mini_xml2.cpp 2008-07-12 09:15:27 EDT (Sat, 12 Jul 2008)
@@ -127,6 +127,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Our mini XML grammar definition
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_xml2_grammar
 template <typename Iterator>
 struct mini_xml_grammar
   : grammar<Iterator, mini_xml(), locals<std::string>, space_type>
@@ -162,6 +163,7 @@
     rule<Iterator, std::string(), space_type> start_tag;
     rule<Iterator, void(std::string), space_type> end_tag;
 };
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program


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