Boost logo

Boost-Commit :

From: joel_at_[hidden]
Date: 2008-07-12 04:39:29


Author: djowel
Date: 2008-07-12 04:39:26 EDT (Sat, 12 Jul 2008)
New Revision: 47334
URL: http://svn.boost.org/trac/boost/changeset/47334

Log:
tutorial updates
Added:
   trunk/libs/spirit/doc/qi_and_karma/employee.qbk (contents, props changed)
Text files modified:
   trunk/libs/spirit/doc/html/index.html | 8
   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 | 6
   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 | 425 ++++++++++++++++++++++++++++++++++++++++
   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/qi_and_karma/complex.qbk | 1
   trunk/libs/spirit/doc/qi_and_karma/roman.qbk | 3
   trunk/libs/spirit/doc/spirit2.qbk | 1
   trunk/libs/spirit/example/qi/employee.cpp | 6
   21 files changed, 486 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 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -68,6 +68,8 @@
         List Attribute - one more, with style</a></span></dt>
 <dt><span class="section"><a href="spirit/qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals">Roman
         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>
 </dl></dd>
 <dt><span class="section">Abstracts</span></dt>
 <dd><dl>
@@ -497,8 +499,8 @@
     </h3>
 <p>
       Please direct all questions to Spirit's mailing list. You can subscribe to
- the <a href="https://lists.sourceforge.net/lists/listinfo/spirit-general" target="_top">Spirit
- Mailing List</a>. The mailing list has a searchable archive. A search link
+ the <a href="http://www.nabble.com/The-Spirit-Parser-Library-f3430.html" target="_top">Spirit
+ General List</a>. The mailing list has a searchable archive. A search link
       to this archive is provided in Spirit's
       home page. You may also read and post messages to the mailing list through
       <a href="news://news.gmane.org/gmane.comp.spirit.general" target="_top">Spirit General
@@ -508,7 +510,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 05:15:37 GMT</small></p></td>
+<td align="left"><p><small>Last revised: July 12, 2008 at 08:35:15 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 04:39:26 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="id472482"></a>
+<a name="id476356"></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="id472834"></a>
+<a name="id476722"></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 04:39:26 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="id473345"></a>
+<a name="id477232"></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="id473734"></a>
+<a name="id477621"></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="id474246"></a>
+<a name="id478133"></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="id474950"></a>
+<a name="id478838"></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="id476093"></a>
+<a name="id479980"></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 04:39:26 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="id477173"></a>
+<a name="id481054"></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="id478130"></a>
+<a name="id482011"></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="id479590"></a>
+<a name="id483471"></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 04:39:26 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="id480180"></a>
+<a name="id484062"></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="id480747"></a>
+<a name="id484629"></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="id481254"></a>
+<a name="id485137"></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="id482642"></a>
+<a name="id486525"></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 04:39:26 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="id484124"></a>
+<a name="id488006"></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>
@@ -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="id484928"></a>
+<a name="id488816"></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="id485342"></a>
+<a name="id489230"></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 04:39:26 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="id489692"></a>
+<a name="id493582"></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="id489723"></a>
+<a name="id493613"></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="id489754"></a>
+<a name="id493644"></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 04:39:26 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="id487732"></a>
+<a name="id491622"></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="id488256"></a>
+<a name="id492146"></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 04:39:26 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="id486149"></a>
+<a name="id490038"></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="id486177"></a>
+<a name="id490066"></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 04:39:26 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="id489945"></a>
+<a name="id493835"></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="id489974"></a>
+<a name="id493864"></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="id490005"></a>
+<a name="id493895"></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="id490034"></a>
+<a name="id493924"></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 04:39:26 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="id491052"></a>
+<a name="id494940"></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 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -44,6 +44,8 @@
         List Attribute - one more, with style</a></span></dt>
 <dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals">Roman
         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>
 </dl></dd>
 <dt><span class="section">Abstracts</span></dt>
 <dd><dl>
@@ -103,6 +105,8 @@
         List Attribute - one more, with style</a></span></dt>
 <dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals">Roman
         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>
 </dl></div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h4 class="title">
@@ -1546,6 +1550,427 @@
           <span class="identifier">result</span></tt>, which will receive the
           parsed value.
         </p>
+<p>
+ The full cpp file for this example can be found here: ../../example/qi/roman.cpp
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs" title="Employee
+ - Parsing into structs">Employee
+ - Parsing into structs</a></h4></div></div></div>
+<p>
+ It's a common question in the <a href="http://www.nabble.com/The-Spirit-Parser-Library-f3430.html" target="_top">Spirit
+ General List</a>: how do I parse and place the results into a C++ struct?
+ Of course, at this point, you already know various ways to do it, using
+ semantic actions. There are many ways to skin a cat. Spirit2, being fully
+ attributed, makes it even easier. The next example demonstrates some features
+ of Spirit2 that makes this easy. In the process, you'll learn about:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ More about attributes
+ </li>
+<li>
+ Auto rules
+ </li>
+<li>
+ Some more built-in parsers
+ </li>
+<li>
+ Directives
+ </li>
+</ul></div>
+<p>
+ First, let's create a struct representing an employee:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">struct</span> <span class="identifier">employee</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">age</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">surname</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">forename</span><span class="special">;</span>
+ <span class="keyword">double</span> <span class="identifier">salary</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Then, we need to tell Fusion
+ about our employee struct to make it a first- class fusion citizen. If
+ you don't know fusion yet, it is a Boost
+ library for working with heterogenous collections of data, commonly referred
+ to as tuples. Spirit uses fusion extensively as part of its infrastructure.
+ </p>
+<p>
+ In fusion's view, a struct is just a form of a tuple. You can adapt any
+ struct to be a fully conforming fusion tuple:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">BOOST_FUSION_ADAPT_STRUCT</span><span class="special">(</span>
+ <span class="identifier">employee</span><span class="special">,</span>
+ <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">age</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">surname</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">forename</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="identifier">salary</span><span class="special">)</span>
+<span class="special">)</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Now we'll write a parser for our employee. Inputs will be of the form:
+ </p>
+<pre class="programlisting">
+<span class="identifier">employee</span><span class="special">{</span> <span class="identifier">age</span><span class="special">,</span> <span class="string">"surname"</span><span class="special">,</span> <span class="string">"forename"</span><span class="special">,</span> <span class="identifier">salary</span> <span class="special">}</span>
+</pre>
+<p>
+ Here goes:
+ </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">employee_parser</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">employee</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">employee_parser</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">employee_parser</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">start</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">quoted_string</span> <span class="special">%=</span> <span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">&gt;&gt;</span> <span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">'"'</span><span class="special">];</span>
+
+ <span class="identifier">start</span> <span class="special">%=</span>
+ <span class="identifier">lit</span><span class="special">(</span><span class="string">"employee"</span><span class="special">)</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'{'</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">int_</span> <span class="special">&gt;&gt;</span> <span class="char">','</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">quoted_string</span> <span class="special">&gt;&gt;</span> <span class="char">','</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">quoted_string</span> <span class="special">&gt;&gt;</span> <span class="char">','</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">double_</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'}'</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">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">quoted_string</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">employee</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">start</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ The full cpp file for this example can be found here: ../../example/qi/employee.cpp
+ </p>
+<p>
+ Let's walk through this one step at a time (not necessarily from top to
+ bottom).
+ </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">employee_parser</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">employee</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span>
+</pre>
+<p>
+ <tt class="computeroutput"><span class="identifier">employee_parser</span></tt> is a grammar.
+ Like before, we make it a template so that we can reuse it for different
+ iterator types. The grammar's signature is:
+ </p>
+<pre class="programlisting">
+<span class="identifier">employee</span><span class="special">()</span>
+</pre>
+<p>
+ meaning, the parser generates employee structs. <tt class="computeroutput"><span class="identifier">employee_parser</span></tt>
+ skips white spaces using <tt class="computeroutput"><span class="identifier">space_type</span></tt>
+ as its skip parser.
+ </p>
+<pre class="programlisting">
+<span class="identifier">employee_parser</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">employee_parser</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">start</span><span class="special">)</span>
+</pre>
+<p>
+ Initializes the base class.
+ </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">quoted_string</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">employee</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">start</span><span class="special">;</span>
+</pre>
+<p>
+ Declares two rules: <tt class="computeroutput"><span class="identifier">quoted_string</span></tt>
+ and <tt class="computeroutput"><span class="identifier">start</span></tt>. <tt class="computeroutput"><span class="identifier">start</span></tt> has the same template parameters
+ as the grammar itself. <tt class="computeroutput"><span class="identifier">quoted_string</span></tt>
+ has a <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt> attribute.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.lexeme"></a><h5>
+<a name="id471572"></a>
+ Lexeme
+ </h5>
+<pre class="programlisting">
+<span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">&gt;&gt;</span> <span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">'"'</span><span class="special">];</span>
+</pre>
+<p>
+ <tt class="computeroutput"><span class="identifier">lexeme</span></tt> inhibits space skipping
+ from the open brace to the closing brace. The expression parses quoted
+ strings.
+ </p>
+<pre class="programlisting">
+<span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span>
+</pre>
+<p>
+ parses one or more chars, except the double quote. It stops when it sees
+ a double quote.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.difference"></a><h5>
+<a name="id471735"></a>
+ Difference
+ </h5>
+<p>
+ The expression:
+ </p>
+<pre class="programlisting">
+<span class="identifier">a</span> <span class="special">-</span> <span class="identifier">b</span>
+</pre>
+<p>
+ parses <tt class="computeroutput"><span class="identifier">a</span></tt> but not <tt class="computeroutput"><span class="identifier">b</span></tt>. Its attribute is just <tt class="computeroutput"><span class="identifier">A</span></tt>, the attribute of <tt class="computeroutput"><span class="identifier">a</span></tt>.
+ <tt class="computeroutput"><span class="identifier">b</span></tt>'s attribute is ignored.
+ Hence, the attribute of:
+ </p>
+<pre class="programlisting">
+<span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span>
+</pre>
+<p>
+ is just <tt class="computeroutput"><span class="keyword">char</span></tt>.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.plus"></a><h5>
+<a name="id471899"></a>
+ Plus
+ </h5>
+<pre class="programlisting">
+<span class="special">+</span><span class="identifier">a</span>
+</pre>
+<p>
+ is the close kin of the kleene star we got so used to in our tutorial.
+ Like it's kin, the kleene star, its attribute is 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">A</span><span class="special">&gt;</span></tt> where <tt class="computeroutput"><span class="identifier">A</span></tt>
+ is the attribute of <tt class="computeroutput"><span class="identifier">a</span></tt>.
+ So, putting all these together, the attribute of
+ </p>
+<pre class="programlisting">
+<span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span>
+</pre>
+<p>
+ is then:
+ </p>
+<pre class="programlisting">
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">&gt;</span>
+</pre>
+<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.sequence_attribute"></a><h5>
+<a name="id472091"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.sequence_attribute">Sequence
+ Attribute</a>
+ </h5>
+<p>
+ Now what's the attribute of
+ </p>
+<pre class="programlisting">
+<span class="char">'"'</span> <span class="special">&gt;&gt;</span> <span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">'"'</span>
+</pre>
+<p>
+ ?
+ </p>
+<p>
+ Well, typically, the attribute of:
+ </p>
+<pre class="programlisting">
+<span class="identifier">a</span> <span class="special">&gt;&gt;</span> <span class="identifier">b</span> <span class="special">&gt;&gt;</span> <span class="identifier">c</span>
+</pre>
+<p>
+ is:
+ </p>
+<pre class="programlisting">
+<span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">,</span> <span class="identifier">C</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>, <tt class="computeroutput"><span class="identifier">B</span></tt>
+ is the attribute of <tt class="computeroutput"><span class="identifier">b</span></tt> and
+ <tt class="computeroutput"><span class="identifier">C</span></tt> is the attribute of
+ <tt class="computeroutput"><span class="identifier">c</span></tt>. What is <tt class="computeroutput"><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span></tt>? - a tuple.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td colspan="2" align="left" valign="top"><p>
+ If you don't know what I am talking about, see: <a href="http://tinyurl.com/6xun4j" target="_top">Fusion
+ Vector</a>. It might be a good idea to have a look into Fusion
+ at this point. You'll definitely see more of it in the coming pages.
+ </p></td></tr>
+</table></div>
+<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.attribute_collapsing"></a><h5>
+<a name="id472417"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.attribute_collapsing">Attribute
+ Collapsing</a>
+ </h5>
+<p>
+ Some parsers, especially those very little literal parsers you see, like
+ <tt class="computeroutput"><span class="char">'"'</span></tt>, do not have attributes.
+ </p>
+<p>
+ Nodes without attributes are disregarded. In a sequence, like above, all
+ nodes with no attributes are filtered out of the <tt class="computeroutput"><span class="identifier">fusion</span><span class="special">:</span><span class="identifier">vector</span></tt>.
+ So, since <tt class="computeroutput"><span class="char">'"'</span></tt> has no attribute,
+ and <tt class="computeroutput"><span class="special">+(</span><span class="identifier">char_</span>
+ <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span></tt> has 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="keyword">char</span><span class="special">&gt;</span></tt> attribute, the whole expression's attribute
+ should have been:
+ </p>
+<pre class="programlisting">
+<span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">&gt;</span> <span class="special">&gt;</span>
+</pre>
+<p>
+ But wait, there's one more collapsing rule: If after the attribute is a
+ single element <tt class="computeroutput"><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span></tt>, The element is stripped naked
+ from its container. So, to make a long story short, the attribute of the
+ expression:
+ </p>
+<pre class="programlisting">
+<span class="char">'"'</span> <span class="special">&gt;&gt;</span> <span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">'"'</span>
+</pre>
+<p>
+ is:
+ </p>
+<pre class="programlisting">
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">&gt;</span>
+</pre>
+<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.auto_rules"></a><h5>
+<a name="id472772"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.auto_rules">Auto
+ Rules</a>
+ </h5>
+<p>
+ It is typical to see rules like:
+ </p>
+<pre class="programlisting">
+<span class="identifier">r</span> <span class="special">=</span> <span class="identifier">p</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>
+ If you have a rule definition like above where the attribute of the RHS
+ (right hand side) of the rule is compatibe with the attribute of the LHS
+ (left hand side), then you can rewrite it as:
+ </p>
+<pre class="programlisting">
+<span class="identifier">r</span> <span class="special">%=</span> <span class="identifier">p</span><span class="special">;</span>
+</pre>
+<p>
+ The attribute of <tt class="computeroutput"><span class="identifier">p</span></tt> automatically
+ uses the attribute of <tt class="computeroutput"><span class="identifier">r</span></tt>.
+ </p>
+<p>
+ So, going back to our <tt class="computeroutput"><span class="identifier">quoted_string</span></tt>
+ rule:
+ </p>
+<pre class="programlisting">
+<span class="identifier">quoted_string</span> <span class="special">%=</span> <span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">&gt;&gt;</span> <span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">'"'</span><span class="special">];</span>
+</pre>
+<p>
+ is a simplified version of:
+ </p>
+<pre class="programlisting">
+<span class="identifier">quoted_string</span> <span class="special">=</span> <span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">&gt;&gt;</span> <span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">'"'</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 attribute of the <tt class="computeroutput"><span class="identifier">quoted_string</span></tt>
+ rule: <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt> <span class="bold"><b>is compatible</b></span>
+ with the attribute of the RHS: <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">&gt;</span></tt>. The RHS extracts the parsed attribute
+ directly into the rule's attribute, in-situ.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.finally"></a><h5>
+<a name="id473227"></a>
+ Finally
+ </h5>
+<p>
+ We're down to one rule, the start rule:
+ </p>
+<pre class="programlisting">
+<span class="identifier">start</span> <span class="special">%=</span>
+ <span class="identifier">lit</span><span class="special">(</span><span class="string">"employee"</span><span class="special">)</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'{'</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">int_</span> <span class="special">&gt;&gt;</span> <span class="char">','</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">quoted_string</span> <span class="special">&gt;&gt;</span> <span class="char">','</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">quoted_string</span> <span class="special">&gt;&gt;</span> <span class="char">','</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">double_</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'}'</span>
+ <span class="special">;</span>
+</pre>
+<p>
+ Applying our collapsing rules above, the RHS has an attribute of:
+ </p>
+<pre class="programlisting">
+<span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</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">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">double</span><span class="special">&gt;</span>
+</pre>
+<p>
+ These nodes do not have an attribute:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li><tt class="computeroutput"><span class="identifier">lit</span><span class="special">(</span><span class="string">"employee"</span><span class="special">)</span></tt></li>
+<li><tt class="computeroutput"><span class="char">'{'</span></tt></li>
+<li><tt class="computeroutput"><span class="char">'}'</span></tt></li>
+</ul></div>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td colspan="2" align="left" valign="top"><p>
+ In case you are wondering, <tt class="computeroutput"><span class="identifier">lit</span><span class="special">(</span><span class="string">"employee"</span><span class="special">)</span></tt> is the same as "employee".
+ We had to wrap it inside <tt class="computeroutput"><span class="identifier">lit</span></tt>
+ because immediately after it is <tt class="computeroutput"><span class="special">&gt;&gt;</span>
+ <span class="char">'{'</span></tt>. You can't right-shift a <tt class="computeroutput"><span class="keyword">char</span><span class="special">[]</span></tt>
+ and a <tt class="computeroutput"><span class="keyword">char</span></tt> - you know, C++
+ syntax rules.
+ </p></td></tr>
+</table></div>
+<p>
+ Recall that the attribute of <tt class="computeroutput"><span class="identifier">start</span></tt>
+ is the <tt class="computeroutput"><span class="identifier">employee</span></tt> struct:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">struct</span> <span class="identifier">employee</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">age</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">surname</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">forename</span><span class="special">;</span>
+ <span class="keyword">double</span> <span class="identifier">salary</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Now everything is clear, right? The <tt class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">employee</span></tt> <span class="bold"><b>IS</b></span>
+ compatible with <tt class="computeroutput"><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</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">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">double</span><span class="special">&gt;</span></tt>. So, the RHS of <tt class="computeroutput"><span class="identifier">start</span></tt>
+ uses start's attribute (a <tt class="computeroutput"><span class="keyword">struct</span>
+ <span class="identifier">employee</span></tt>) in-situ when it does
+ its work.
+ </p>
 </div>
 </div>
 </div>

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 04:39:26 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="id470217"></a>
+<a name="id474092"></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="id470249"></a>
+<a name="id474124"></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="id470278"></a>
+<a name="id474153"></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="id470305"></a>
+<a name="id474180"></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="id470334"></a>
+<a name="id474208"></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 04:39:26 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="id470392"></a>
+<a name="id474265"></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="id470427"></a>
+<a name="id474301"></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="id470457"></a>
+<a name="id474331"></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="id470486"></a>
+<a name="id474360"></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="id470518"></a>
+<a name="id474392"></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 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -46,7 +46,7 @@
 </dl>
 </div>
 <div class="table">
-<a name="id470857"></a><p class="title"><b>Table 4. Character Parsers</b></p>
+<a name="id474732"></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 04:39:26 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="id471774"></a>
+<a name="id475648"></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="id471834"></a>
+<a name="id475708"></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="id471970"></a>
+<a name="id475845"></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="id472074"></a>
+<a name="id475949"></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="id472104"></a>
+<a name="id475979"></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 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -18,6 +18,7 @@
 [include qi_and_karma/num_list3.qbk]
 [include qi_and_karma/num_list4.qbk]
 [include qi_and_karma/roman.qbk]
+[include qi_and_karma/employee.qbk]
 [endsect]
 
 [section Abstracts]

Modified: trunk/libs/spirit/doc/qi_and_karma/complex.qbk
==============================================================================
--- trunk/libs/spirit/doc/qi_and_karma/complex.qbk (original)
+++ trunk/libs/spirit/doc/qi_and_karma/complex.qbk 2008-07-12 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -35,7 +35,6 @@
 
 [import ../../example/qi/complex_number.cpp]
 
-
 Here goes, this time with actions:
 
 [tutorial_complex_number]

Added: trunk/libs/spirit/doc/qi_and_karma/employee.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/qi_and_karma/employee.qbk 2008-07-12 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,218 @@
+[/==============================================================================
+ 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 Employee - Parsing into structs]
+
+It's a common question in the __spirit_list__: how do I parse and place the
+results into a C++ struct? Of course, at this point, you already know various
+ways to do it, using semantic actions. There are many ways to skin a cat.
+Spirit2, being fully attributed, makes it even easier. The next example
+demonstrates some features of Spirit2 that makes this easy. In the process,
+you'll learn about:
+
+* More about attributes
+* Auto rules
+* Some more built-in parsers
+* Directives
+
+[import ../../example/qi/employee.cpp]
+
+First, let's create a struct representing an employee:
+
+[tutorial_employee_struct]
+
+Then, we need to tell __fusion__ about our employee struct to make it a first-
+class fusion citizen. If you don't know fusion yet, it is a __boost__ library
+for working with heterogenous collections of data, commonly referred to as
+tuples. Spirit uses fusion extensively as part of its infrastructure.
+
+In fusion's view, a struct is just a form of a tuple. You can adapt any struct
+to be a fully conforming fusion tuple:
+
+[tutorial_employee_adapt_struct]
+
+Now we'll write a parser for our employee. Inputs will be of the form:
+
+ employee{ age, "surname", "forename", salary }
+
+Here goes:
+
+[tutorial_employee_parser]
+
+The full cpp file for this example can be found here: [@../../example/qi/employee.cpp]
+
+Let's walk through this one step at a time (not necessarily from top to bottom).
+
+ template <typename Iterator>
+ struct employee_parser : grammar<Iterator, employee(), space_type>
+
+`employee_parser` is a grammar. Like before, we make it a template so that we can
+reuse it for different iterator types. The grammar's signature is:
+
+ employee()
+
+meaning, the parser generates employee structs. `employee_parser` skips white
+spaces using `space_type` as its skip parser.
+
+ employee_parser() : employee_parser::base_type(start)
+
+Initializes the base class.
+
+ rule<Iterator, std::string(), space_type> quoted_string;
+ rule<Iterator, employee(), space_type> start;
+
+Declares two rules: `quoted_string` and `start`. `start` has the same template
+parameters as the grammar itself. `quoted_string` has a `std::string` attribute.
+
+[heading Lexeme]
+
+ lexeme['"' >> +(char_ - '"') >> '"'];
+
+`lexeme` inhibits space skipping from the open brace to the closing brace.
+The expression parses quoted strings.
+
+ +(char_ - '"')
+
+parses one or more chars, except the double quote. It stops when it sees
+a double quote.
+
+[heading Difference]
+
+The expression:
+
+ a - b
+
+parses `a` but not `b`. Its attribute is just `A`, the attribute of `a`. `b`'s
+attribute is ignored. Hence, the attribute of:
+
+ char_ - '"'
+
+is just `char`.
+
+[heading Plus]
+
+ +a
+
+is the close kin of the kleene star we got so used to in our tutorial. Like it's
+kin, the kleene star, its attribute is a `std::vector<A>` where `A` is the
+attribute of `a`. So, putting all these together, the attribute of
+
+ +(char_ - '"')
+
+is then:
+
+ std::vector<char>
+
+[heading Sequence Attribute]
+
+Now what's the attribute of
+
+ '"' >> +(char_ - '"') >> '"'
+
+?
+
+Well, typically, the attribute of:
+
+ a >> b >> c
+
+is:
+
+ fusion::vector<A, B, C>
+
+where `A` is the attribute of `a`, `B` is the attribute of `b` and `C` is the
+attribute of `c`. What is `fusion::vector`? - a tuple.
+
+[note If you don't know what I am talking about, see: [@http://tinyurl.com/6xun4j
+Fusion Vector]. It might be a good idea to have a look into __fusion__ at this
+point. You'll definitely see more of it in the coming pages.]
+
+[heading Attribute Collapsing]
+
+Some parsers, especially those very little literal parsers you see, like `'"'`,
+do not have attributes.
+
+Nodes without attributes are disregarded. In a sequence, like above, all nodes
+with no attributes are filtered out of the `fusion:vector`. So, since `'"'` has
+no attribute, and `+(char_ - '"')` has a `std::vector<char>` attribute, the
+whole expression's attribute should have been:
+
+ fusion::vector<std::vector<char> >
+
+But wait, there's one more collapsing rule: If after the attribute is a single
+element `fusion::vector`, The element is stripped naked from its container. So,
+to make a long story short, the attribute of the expression:
+
+ '"' >> +(char_ - '"') >> '"'
+
+is:
+
+ std::vector<char>
+
+[heading Auto Rules]
+
+It is typical to see rules like:
+
+ r = p[_val = _1];
+
+If you have a rule definition like above where the attribute of the RHS (right
+hand side) of the rule is compatibe with the attribute of the LHS (left hand
+side), then you can rewrite it as:
+
+ r %= p;
+
+The attribute of `p` automatically uses the attribute of `r`.
+
+So, going back to our `quoted_string` rule:
+
+ quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
+
+is a simplified version of:
+
+ quoted_string = lexeme['"' >> +(char_ - '"') >> '"'][val_ = _1];
+
+The attribute of the `quoted_string` rule: `std::string` *is compatible* with
+the attribute of the RHS: `std::vector<char>`. The RHS extracts the parsed
+attribute directly into the rule's attribute, in-situ.
+
+[heading Finally]
+
+We're down to one rule, the start rule:
+
+ start %=
+ lit("employee")
+ >> '{'
+ >> int_ >> ','
+ >> quoted_string >> ','
+ >> quoted_string >> ','
+ >> double_
+ >> '}'
+ ;
+
+Applying our collapsing rules above, the RHS has an attribute of:
+
+ fusion::vector<int, std::string, std::string, double>
+
+These nodes do not have an attribute:
+
+* `lit("employee")`
+* `'{'`
+* `'}'`
+
+[note In case you are wondering, `lit("employee")` is the same as "employee". We
+had to wrap it inside `lit` because immediately after it is `>> '{'`. You can't
+right-shift a `char[]` and a `char` - you know, C++ syntax rules.]
+
+Recall that the attribute of `start` is the `employee` struct:
+
+[tutorial_employee_struct]
+
+Now everything is clear, right? The `struct employee` *IS* compatible with
+`fusion::vector<int, std::string, std::string, double>`. So, the RHS of `start`
+uses start's attribute (a `struct employee`) in-situ when it does its work.
+
+[endsect]

Modified: trunk/libs/spirit/doc/qi_and_karma/roman.qbk
==============================================================================
--- trunk/libs/spirit/doc/qi_and_karma/roman.qbk (original)
+++ trunk/libs/spirit/doc/qi_and_karma/roman.qbk 2008-07-12 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -164,4 +164,7 @@
 want to skip any spaces! We are also passing in an attribute, `unsigned result`,
 which will receive the parsed value.
 
+The full cpp file for this example can be found here: [@../../example/qi/roman.cpp]
+
+
 [endsect]

Modified: trunk/libs/spirit/doc/spirit2.qbk
==============================================================================
--- trunk/libs/spirit/doc/spirit2.qbk (original)
+++ trunk/libs/spirit/doc/spirit2.qbk 2008-07-12 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -24,6 +24,7 @@
 [/ Some links ]
 
 [def __spirit__ [@http://spirit.sourceforge.net Spirit]]
+[def __spirit_list__ [@http://www.nabble.com/The-Spirit-Parser-Library-f3430.html Spirit General List]]
 [def __phoenix__ [@../../phoenix/doc/html/index.html Phoenix]]
 [def __phoenix2__ [@../../phoenix/doc/html/index.html Phoenix2]]
 [def __fusion__ [@http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.html Fusion]]

Modified: trunk/libs/spirit/example/qi/employee.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/employee.cpp (original)
+++ trunk/libs/spirit/example/qi/employee.cpp 2008-07-12 04:39:26 EDT (Sat, 12 Jul 2008)
@@ -34,6 +34,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Our employee struct
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_employee_struct
 struct employee
 {
     int age;
@@ -41,9 +42,11 @@
     std::string forename;
     double salary;
 };
+//]
 
 // We need to tell fusion about our employee struct
 // to make it a first-class fusion citizen
+//[tutorial_employee_adapt_struct
 BOOST_FUSION_ADAPT_STRUCT(
     employee,
     (int, age)
@@ -51,10 +54,12 @@
     (std::string, forename)
     (double, salary)
 )
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Our employee parser
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_employee_parser
 template <typename Iterator>
 struct employee_parser : grammar<Iterator, employee(), space_type>
 {
@@ -76,6 +81,7 @@
     rule<Iterator, std::string(), space_type> quoted_string;
     rule<Iterator, employee(), space_type> start;
 };
+//]
 
 ////////////////////////////////////////////////////////////////////////////
 // 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