Boost logo

Boost-Commit :

From: joel_at_[hidden]
Date: 2008-07-12 01:23:55


Author: djowel
Date: 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
New Revision: 47333
URL: http://svn.boost.org/trac/boost/changeset/47333

Log:
tutorial updates
Added:
   trunk/libs/spirit/doc/html/spirit/
   trunk/libs/spirit/doc/html/spirit/__lex__/
   trunk/libs/spirit/doc/html/spirit/__lex__.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/
   trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_3___counting_words_using_a_parser.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_attributes.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_semantic_actions.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_states.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/parsing_using_a_lexer.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/the__static__lexer_model.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/tokenizing_input_data.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/quick_reference.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/reference/
   trunk/libs/spirit/doc/html/spirit/__lex__/reference.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/reference/lexer_class.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/reference/token_class.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/reference/tokendef_class.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/__lex__/reference/tokenset_class.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/acknowledgments.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/faq.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/introduction.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/notes/
   trunk/libs/spirit/doc/html/spirit/notes.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/notes/porting_from_spirit_1_8_x.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/notes/style_guide.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/notes/techniques.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/
   trunk/libs/spirit/doc/html/spirit/qi_and_karma.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/attributes.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/debugging.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/directives.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/error_handling.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/grammars.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/operators.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parse_trees_and_asts.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/primitives.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/rules.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/semantic_actions.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/action.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/auxiliary.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/binary.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/char.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/debug.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/directive.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/nonterminal.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/numeric.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/operators.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/stream.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/string.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/rationale.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/references.html (contents, props changed)
   trunk/libs/spirit/doc/html/spirit/what_s_new.html (contents, props changed)
Text files modified:
   trunk/libs/spirit/doc/html/index.html | 22 +++---
   trunk/libs/spirit/doc/qi_and_karma/roman.qbk | 111 +++++++++++++++++++++++++++++++++++++++
   trunk/libs/spirit/example/qi/calc1.cpp | 2
   trunk/libs/spirit/example/qi/calc2.cpp | 2
   trunk/libs/spirit/example/qi/calc2_ast.cpp | 2
   trunk/libs/spirit/example/qi/calc3.cpp | 2
   trunk/libs/spirit/example/qi/calc3_lexer.cpp | 2
   trunk/libs/spirit/example/qi/calc4.cpp | 2
   trunk/libs/spirit/example/qi/calc5.cpp | 2
   trunk/libs/spirit/example/qi/calc6/calc6b.hpp | 2
   trunk/libs/spirit/example/qi/calc6/calc6c.hpp | 2
   trunk/libs/spirit/example/qi/calc7/calc7b.hpp | 2
   trunk/libs/spirit/example/qi/calc7/calc7c.hpp | 2
   trunk/libs/spirit/example/qi/employee.cpp | 2
   trunk/libs/spirit/example/qi/mini_c/mini_c.hpp | 2
   trunk/libs/spirit/example/qi/mini_c/mini_cb.hpp | 2
   trunk/libs/spirit/example/qi/mini_c/mini_cc.hpp | 2
   trunk/libs/spirit/example/qi/mini_c/mini_cd.hpp | 2
   trunk/libs/spirit/example/qi/mini_xml1.cpp | 2
   trunk/libs/spirit/example/qi/mini_xml2.cpp | 2
   trunk/libs/spirit/example/qi/roman.cpp | 31 ++++++----
   21 files changed, 157 insertions(+), 43 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 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -34,7 +34,7 @@
 <div><p class="copyright">Copyright © 2001-2008 Joel de Guzman,
       Hartmut Kaiser</p></div>
 <div><div class="legalnotice">
-<a name="id385790"></a><p>
+<a name="id455998"></a><p>
         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)
       </p>
@@ -179,11 +179,11 @@
       </p>
 </blockquote></div>
 <a name="spirit.preface.history"></a><h3>
-<a name="id387005"></a>
+<a name="id385825"></a>
       <a href="index.html#spirit.preface.history">History</a>
     </h3>
 <a name="spirit.preface._emphasis_80s__emphasis_"></a><h3>
-<a name="id385807"></a>
+<a name="id385846"></a>
       <a href="index.html#spirit.preface._emphasis_80s__emphasis_"><span class="emphasis"><em>80s</em></span></a>
     </h3>
 <p>
@@ -197,7 +197,7 @@
       recursive-descent parser. This worked very well.
     </p>
 <a name="spirit.preface._emphasis_90s__emphasis_"></a><h3>
-<a name="id385846"></a>
+<a name="id386884"></a>
       <a href="index.html#spirit.preface._emphasis_90s__emphasis_"><span class="emphasis"><em>90s</em></span></a>
     </h3>
 <p>
@@ -242,7 +242,7 @@
       here: pre-Spirit.
     </p>
 <a name="spirit.preface._emphasis_2001_to_2006__emphasis_"></a><h3>
-<a name="id387238"></a>
+<a name="id387194"></a>
       <a href="index.html#spirit.preface._emphasis_2001_to_2006__emphasis_"><span class="emphasis"><em>2001
       to 2006</em></span></a>
     </h3>
@@ -272,7 +272,7 @@
       for design and implementation quality, robustness, and reusability.
     </p>
 <a name="spirit.preface._emphasis_2007__emphasis_"></a><h3>
-<a name="id387314"></a>
+<a name="id387270"></a>
       <a href="index.html#spirit.preface._emphasis_2007__emphasis_"><span class="emphasis"><em>2007</em></span></a>
     </h3>
 <p>
@@ -302,7 +302,7 @@
       Templates</a> library called -Boost.Proto-.
     </p>
 <a name="spirit.preface.new_ideas__spirit_v2"></a><h3>
-<a name="id387434"></a>
+<a name="id387389"></a>
       <a href="index.html#spirit.preface.new_ideas__spirit_v2">New Ideas: Spirit V2</a>
     </h3>
 <p>
@@ -340,7 +340,7 @@
       same underlying component library as for the parser and generator libraries.
     </p>
 <a name="spirit.preface.how_to_use_this_manual"></a><h3>
-<a name="id387536"></a>
+<a name="id387492"></a>
       <a href="index.html#spirit.preface.how_to_use_this_manual">How to use this manual</a>
     </h3>
 <p>
@@ -371,7 +371,7 @@
       icons precede some text to indicate:
     </p>
 <div class="table">
-<a name="id385325"></a><p class="title"><b>Table 1. Icons</b></p>
+<a name="id387578"></a><p class="title"><b>Table 1. Icons</b></p>
 <table class="table" summary="Icons">
 <colgroup>
 <col>
@@ -492,7 +492,7 @@
       Tools</a>.
     </p>
 <a name="spirit.preface.support"></a><h3>
-<a name="id385595"></a>
+<a name="id385560"></a>
       <a href="index.html#spirit.preface.support">Support</a>
     </h3>
 <p>
@@ -508,7 +508,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 10, 2008 at 15:45:10 GMT</small></p></td>
+<td align="left"><p><small>Last revised: July 12, 2008 at 05:15:37 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Added: trunk/libs/spirit/doc/html/spirit/__lex__.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,266 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Spirit.Lex</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="qi_and_karma/reference/debug.html" title="Debug">
+<link rel="next" href="__lex__/__lex___tutorials.html" title="Spirit.Lex
+ Tutorials">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="qi_and_karma/reference/debug.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="__lex__/__lex___tutorials.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.__lex__"></a>Spirit.Lex</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="__lex__.html#spirit.__lex__.introduction_to___lex__">Introduction
+ to <span class="emphasis"><em>Spirit.Lex</em></span></a></span></dt>
+<dt><span class="section"><a href="__lex__/__lex___tutorials.html"><span class="emphasis"><em>Spirit.Lex</em></span>
+ Tutorials</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="__lex__/__lex___tutorials.html#spirit.__lex__.__lex___tutorials.__lex___tutorials_overview"><span class="emphasis"><em>Spirit.Lex</em></span>
+ Tutorials Overview</a></span></dt>
+<dt><span class="section"><a href="__lex__/__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html">Quickstart
+ 1 - A word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a></span></dt>
+<dt><span class="section"><a href="__lex__/__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html">Quickstart
+ 2 - A better word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a></span></dt>
+<dt><span class="section"><a href="__lex__/__lex___tutorials/quickstart_3___counting_words_using_a_parser.html">Quickstart
+ 3 - Counting Words Using a Parser</a></span></dt>
+</dl></dd>
+<dt><span class="section">Abstracts</span></dt>
+<dd><dl>
+<dt><span class="section">Lexer Primitives</span></dt>
+<dt><span class="section"><a href="__lex__/abstracts/tokenizing_input_data.html">Tokenizing
+ Input Data</a></span></dt>
+<dt><span class="section"><a href="__lex__/abstracts/lexer_semantic_actions.html">Lexer
+ Semantic Actions</a></span></dt>
+<dt><span class="section"><a href="__lex__/abstracts/the__static__lexer_model.html">The
+ <span class="emphasis"><em>Static</em></span> Lexer Model</a></span></dt>
+<dt><span class="section"><a href="__lex__/abstracts/parsing_using_a_lexer.html">Parsing
+ using a Lexer</a></span></dt>
+<dt><span class="section">Lexer Attributes</span></dt>
+<dt><span class="section">Lexer States</span></dt>
+</dl></dd>
+<dt><span class="section">Quick Reference</span></dt>
+<dt><span class="section">Reference</span></dt>
+<dd><dl>
+<dt><span class="section">Concepts</span></dt>
+<dt><span class="section">Lexer Class</span></dt>
+<dt><span class="section">Token Class</span></dt>
+<dt><span class="section">TokenDef Class</span></dt>
+<dt><span class="section">TokenSet Class</span></dt>
+</dl></dd>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.__lex__.introduction_to___lex__"></a><a href="__lex__.html#spirit.__lex__.introduction_to___lex__" title="Introduction
+ to Spirit.Lex">Introduction
+ to <span class="emphasis"><em>Spirit.Lex</em></span></a></h3></div></div></div>
+<p>
+ Lexical scanning is the process of analyzing the stream of input characters
+ and separating it into strings called tokens, separated by whitespace. Most
+ compiler texts start here, and devote several chapters to discussing various
+ ways to build scanners. <span class="emphasis"><em>Spirit.Lex</em></span> is a library built
+ to take care of the complexities of creating a lexer for your grammar (in
+ this documentation we will use the terms 'lexical analyzer', 'lexer' and
+ 'scanner' interchangably). All it needs to create a lexer is to know the
+ set of patterns describing the different tokens you want to recognize in
+ the input. To make this a bit more formal, here are some definitions:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ A token is a sequence of consecutive characters having a collective meaning.
+ Tokens may have attributes specific to the token type, carrying additional
+ information about the matched character sequence.
+ </li>
+<li>
+ A pattern is a rule expressed as a regular expression and describing how
+ a particular token can be formed. For example, <tt class="literal">[A-Za-z][A-Za-z_0-9]*</tt>
+ is a pattern for a rule matching C++ identifiers.
+ </li>
+<li>
+ Characters between tokens are called whitespace; these include spaces,
+ tabs, newlines, and formfeeds. Many people also count comments as whitespace,
+ though since some tools such as lint look at comments, this conflation
+ is not perfect.
+ </li>
+</ul></div>
+<a name="spirit.__lex__.introduction_to___lex__.why_using_a_separate_lexer"></a><h4>
+<a name="id472482"></a>
+ <a href="__lex__.html#spirit.__lex__.introduction_to___lex__.why_using_a_separate_lexer">Why
+ Using a Separate Lexer</a>
+ </h4>
+<p>
+ Typically, lexical scanning is done in a separate module from the parser,
+ feeding the parser with a stream of input tokens only. Now, theoretically
+ it is not necessary to do this separation. In the end there is only one set
+ of syntactical rules defining the language, so in theory we could write the
+ whole parser in one module. In fact, <span class="emphasis"><em>Spirit.Qi</em></span> allows
+ to write parsers without using a lexer, parsing the input character stream
+ directly, and for the most part this is the way Spirit
+ has been used since its invention.
+ </p>
+<p>
+ However, the separation has both practical and theoretical bases and proves
+ to be very useful in practical applications. In 1956, Noam Chomsky defined
+ the "Chomsky Hierarchy" of grammars:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Type 0: Unrestricted grammars (e.g., natural languages)
+ </li>
+<li>
+ Type 1: Context-Sensitive grammars
+ </li>
+<li>
+ Type 2: Context-Free grammars
+ </li>
+<li>
+ Type 3: Regular grammars
+ </li>
+</ul></div>
+<p>
+ The complexity of these grammars increases from regular grammars being the
+ simplest to unrestricted grammars being the most complex. Similarily, the
+ complexity of the recognizers for these grammars increases. Although, a few
+ features of some programming languages (such as C++) are Type 1, fortunately
+ for the most part programming languages can be described using only the Types
+ 3 and 2. The neat part about these two types is that they are well known
+ and the ways to parse them are well understood. It has been shown that any
+ regular grammar can be parsed using a state machine (finite automaton). Similarly,
+ context-free grammars can always be parsed using a push-down automaton (essentially
+ a state machine augmented by a stack).
+ </p>
+<p>
+ In real programming languages and practical grammars the parts that can be
+ handled as regular expressions tend to be the lower-level parts, such as
+ the definition of an identifier or of an integer value:
+ </p>
+<pre class="programlisting">
+<span class="identifier">letter</span> <span class="special">:=</span> <span class="special">[</span><span class="identifier">a</span><span class="special">-</span><span class="identifier">zA</span><span class="special">-</span><span class="identifier">Z</span><span class="special">]</span>
+<span class="identifier">digit</span> <span class="special">:=</span> <span class="special">[</span><span class="number">0</span><span class="special">-</span><span class="number">9</span><span class="special">]</span>
+
+<span class="identifier">identifier</span> <span class="special">:=</span> <span class="identifier">letter</span> <span class="special">[</span> <span class="identifier">letter</span> <span class="special">|</span> <span class="identifier">digit</span> <span class="special">]*</span>
+<span class="identifier">integer</span> <span class="special">:=</span> <span class="identifier">digit</span><span class="special">*</span>
+</pre>
+<p>
+ Higher level parts of practical grammars tend to be more complex and can't
+ be implemented using plain regular expressions anymore. We need to store
+ information on the built-in hardware stack while recursing the grammar hierarchy,
+ and that in fact this is the preferred approach used for top-down parsing.
+ Since it takes a different kind of abstract machine to parse the two types
+ of grammars, it proved to be efficient to separate the lexical scanner into
+ a separate module which is built around the idea of a state machine. The
+ goal here is to use the simplest parsing technique needed for the job.
+ </p>
+<p>
+ Another, more practical reason for separating the scanner from the parser
+ is the need for backtracking during parsing. The input data is a stream of
+ characters, which is often thought to be processed left to right without
+ any backtracking. Unfortunately, in practice most of the time that isn't
+ possible. Almost every language has certain keywords such as IF, FOR, and
+ WHILE. The decision if a certain character sequence actually comprises a
+ keyword or just an identifier often can be made only after seeing the first
+ delimiter <span class="emphasis"><em>after</em></span> it. This already is a limited form of
+ backtracking, since we need to store the string long enough to be able to
+ make the decision. The same is true for more coarse grained language features
+ such as nested IF/ELSE statements, where the decision about to which IF belongs
+ the last ELSE statement can be made only after seeing the whole construct.
+ </p>
+<p>
+ So the structure of a conventional compiler often involves splitting up the
+ functions of the lower-level and higher-level parsing. The lexical scanner
+ deals with things at the character level, collecting characters into strings,
+ converting character sequence into different representations as integers,
+ etc., and passing them along to the parser proper as indivisible tokens.
+ It's also considered normal to let the scanner do additional jobs, such as
+ identifying keywords, storing identifiers in tables, etc.
+ </p>
+<p>
+ Now, Spirit follows this
+ structure, where <span class="emphasis"><em>Spirit.Lex</em></span> can be used to implement
+ state machine based recognizers, while <span class="emphasis"><em>Spirit.Qi</em></span> can
+ be used to build recognizers for context free grammars. Since both modules
+ are seemlessly integrated with each other and with the C++ target language
+ it is even possible to use the provided functionality to build more complex
+ grammar recognizers.
+ </p>
+<a name="spirit.__lex__.introduction_to___lex__.advantages_of_using__emphasis_spirit_lex__emphasis_"></a><h4>
+<a name="id472834"></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>
+<p>
+ The advantage of using <span class="emphasis"><em>Spirit.Lex</em></span> to create the lexical
+ analyzer over using more traditional tools such as Flex
+ is its carefully crafted integration with the Spirit
+ library and the C++ host language. You don't need any external tools to generate
+ the code, your lexer will be perfectly integrated with the rest of your program,
+ making it possible to freely access any context information and data structure.
+ Since the C++ compiler sees all the code it will generate optimal code nomatter
+ what configuration options have been chosen by the user. <span class="emphasis"><em>Spirit.Lex</em></span>
+ gives you all the features you could get from a similar Flex
+ program without the need to leave C++ as a host language:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ the definition of tokens is done using regular expressions (patterns)
+ </li>
+<li>
+ the token definitions can refer to special substitution string (pattern
+ macros) simplifying pattern definitions
+ </li>
+<li>
+ the generated lexical scanner may have multiple start states
+ </li>
+<li>
+ it is possible to attach code to any of the token definitions; this code
+ gets executed whenever the corresponding token pattern has been matched
+ </li>
+</ul></div>
+<p>
+ Even if it is possible to use <span class="emphasis"><em>Spirit.Lex</em></span> to generate
+ C++ code representing the lexical analyzer (we will refer to that as the
+ <span class="emphasis"><em>static</em></span> model, described in more detail in the section
+ <a href="__lex__/abstracts/the__static__lexer_model.html" title="The
+ Static Lexer Model">The <span class="emphasis"><em>Static</em></span>
+ Model</a>) - a model very similar to the way Flex
+ operates - we will mainly focus on the opposite, the <span class="emphasis"><em>dynamic</em></span>
+ model. You can directly integrate the token definitions into your C++ program,
+ building the lexical analyzer dynamicly at runtime. The dynamic model is
+ something not supported by Flex
+ or other lexical scanner generators (such as re2c,
+ Ragel, etc.).
+ But it is very flexible and allows to speed up the development of your application.
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="qi_and_karma/reference/debug.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="__lex__/__lex___tutorials.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,143 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Spirit.Lex
+ Tutorials</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../__lex__.html" title="Spirit.Lex">
+<link rel="prev" href="../__lex__.html" title="Spirit.Lex">
+<link rel="next" href="__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html" title="Quickstart
+ 1 - A word counter using Spirit.Lex">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../__lex__.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex__.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.__lex__.__lex___tutorials"></a><a href="__lex___tutorials.html" title="Spirit.Lex
+ Tutorials"><span class="emphasis"><em>Spirit.Lex</em></span>
+ Tutorials</a></h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="__lex___tutorials.html#spirit.__lex__.__lex___tutorials.__lex___tutorials_overview"><span class="emphasis"><em>Spirit.Lex</em></span>
+ Tutorials Overview</a></span></dt>
+<dt><span class="section"><a href="__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html">Quickstart
+ 1 - A word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a></span></dt>
+<dt><span class="section"><a href="__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html">Quickstart
+ 2 - A better word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a></span></dt>
+<dt><span class="section"><a href="__lex___tutorials/quickstart_3___counting_words_using_a_parser.html">Quickstart
+ 3 - Counting Words Using a Parser</a></span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.__lex___tutorials.__lex___tutorials_overview"></a><a href="__lex___tutorials.html#spirit.__lex__.__lex___tutorials.__lex___tutorials_overview" title="Spirit.Lex
+ Tutorials Overview"><span class="emphasis"><em>Spirit.Lex</em></span>
+ Tutorials Overview</a></h4></div></div></div>
+<p>
+ The <span class="emphasis"><em>Spirit.Lex</em></span> library implements several components
+ on top of possibly different lexer generator libraries. It exposes a pair
+ of iterators, which, when dereferenced, return a stream of tokens generated
+ from the underlying character stream. The generated tokens are based on
+ the token definitions supplied by the user.
+ </p>
+<p>
+ Currently, <span class="emphasis"><em>Spirit.Lex</em></span> is built on top of Ben Hansons
+ excellent Lexertl
+ library (which is a proposed Boost library). Lexertl
+ provides the necessary functionality to build state machines based on a
+ set of supplied regular expressions. But <span class="emphasis"><em>Spirit.Lex</em></span>
+ is not restricted to be used with Lexertl.
+ We expect it to be usable in conjunction with any other lexical scanner
+ generator library, all what needs to be implemented is a set of wrapper
+ objects exposing a well defined interface as described in this documentation.
+ </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>
+ For the sake of clarity all examples in this documentation assume <span class="emphasis"><em>Spirit.Lex</em></span>
+ to be used on top of Lexertl.
+ </p></td></tr>
+</table></div>
+<p>
+ Building a lexer using <span class="emphasis"><em>Spirit.Lex</em></span> is highly configurable,
+ where most of this configuration has to be done at compile time. Almost
+ all of the configurable parameters have generally useful default values,
+ though, which means that starting a project is easy and straightforward.
+ Here is a (non-complete) list of features you can tweak to adjust the generated
+ lexer instance to the actual needs:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Select and customize the token type to be generated by the lexer instance.
+ </li>
+<li>
+ Select and customize the token value types the generated token instances
+ will be able to hold.
+ </li>
+<li>
+ Select the iterator type of the underlying input stream, which will be
+ used as the source for the character stream to tokenize.
+ </li>
+<li>
+ Customize the iterator type returned by the lexer to enable debug support,
+ special handling of certain input sequences, etc.
+ </li>
+<li>
+ Select the <span class="emphasis"><em>dynamic</em></span> or the <span class="emphasis"><em>static</em></span>
+ runtime model for the lexical analyzer.
+ </li>
+</ul></div>
+<p>
+ Special care has been taken during the development of the library that
+ optimal code will be generated regardless of the configuration options
+ selected.
+ </p>
+<p>
+ The series of tutorial examples of this section will guide you through
+ some common use cases helping to understand the big picture. The first
+ two quick start examples (<a href="__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html" title="Quickstart
+ 1 - A word counter using Spirit.Lex">Lex
+ Quickstart 1 - A word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a>
+ and <a href="__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html" title="Quickstart
+ 2 - A better word counter using Spirit.Lex">Lex
+ Quickstart 2 - A better word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a>)
+ introduce the <span class="emphasis"><em>Spirit.Lex</em></span> library while building two
+ standalone applications, not being connected to or depending on any other
+ part of Spirit. The
+ section <a href="__lex___tutorials/quickstart_3___counting_words_using_a_parser.html" title="Quickstart
+ 3 - Counting Words Using a Parser">Lex
+ Quickstart 3 - Counting Words Using a Parser</a> demonstrates how to
+ use a lexer in conjunction with a parser (where certainly the parser is
+ built using <span class="emphasis"><em>Spirit.Qi</em></span>).
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../__lex__.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex__.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_1___a_word_counter_using___lex__.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,362 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Quickstart
+ 1 - A word counter using Spirit.Lex</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../__lex___tutorials.html" title="Spirit.Lex
+ Tutorials">
+<link rel="prev" href="../__lex___tutorials.html" title="Spirit.Lex
+ Tutorials">
+<link rel="next" href="quickstart_2___a_better_word_counter_using___lex__.html" title="Quickstart
+ 2 - A better word counter using Spirit.Lex">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../__lex___tutorials.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex___tutorials.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="quickstart_2___a_better_word_counter_using___lex__.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__"></a><a href="quickstart_1___a_word_counter_using___lex__.html" title="Quickstart
+ 1 - A word counter using Spirit.Lex">Quickstart
+ 1 - A word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a></h4></div></div></div>
+<p>
+ <span class="emphasis"><em>Spirit.Lex</em></span> is very modular, which follows the general
+ building principle of the Spirit
+ libraries. You never pay for features you don't use. It is nicely integrated
+ with the other parts of Spirit
+ but nevertheless can be used separately to build standalone lexical analyzers.
+ The first quick start example describes a standalone application: counting
+ characters, words and lines in a file, very similar to what the well known
+ Unix command <tt class="computeroutput"><span class="identifier">wc</span></tt> is doing
+ (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>
+ Prerequisites
+ </h5>
+<p>
+ The only required <tt class="computeroutput"><span class="preprocessor">#include</span></tt>
+ specific to <span class="emphasis"><em>Spirit.Lex</em></span> follows. It is a wrapper for
+ all necessary definitions to use <span class="emphasis"><em>Spirit.Lex</em></span> in a standalone
+ fashion, and on top of the Lexertl
+ library. Additionally we <tt class="computeroutput"><span class="preprocessor">#include</span></tt>
+ two of the Boost headers to define <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">()</span></tt> and <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">()</span></tt>.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">lex_lexer_lexertl</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">ref</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ To make all the code below more readable we introduce the following namespaces.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lex</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<a name="spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__.defining_tokens"></a><h5>
+<a name="id473734"></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>
+<p>
+ The most important step while creating a lexer using <span class="emphasis"><em>Spirit.Lex</em></span>
+ is to define the tokens to be recognized in the input sequence. This is
+ normally done by defining the regular expressions describing the matching
+ character sequences, and optionally their corresponding token ids. Additionally
+ the defined tokens need to be associated with an instance of a lexer object
+ as provided by the library. The following code snippet shows how this can
+ be done using <span class="emphasis"><em>Spirit.Lex</em></span>.
+ </p>
+<p>
+ </p>
+<p>
+ The template <tt class="computeroutput"><span class="identifier">word_count_tokens</span></tt>
+ defines three different tokens: <tt class="computeroutput"><span class="identifier">ID_WORD</span></tt>,
+ <tt class="computeroutput"><span class="identifier">ID_EOL</span></tt>, and <tt class="computeroutput"><span class="identifier">ID_CHAR</span></tt>, representing a word (anything
+ except a whitespace or a newline), a newline character, and any other
+ character (<tt class="computeroutput"><span class="identifier">ID_WORD</span></tt>,
+ <tt class="computeroutput"><span class="identifier">ID_EOL</span></tt>, and <tt class="computeroutput"><span class="identifier">ID_CHAR</span></tt> are enum values representing
+ the token ids, but could be anything else convertible to an integer as
+ well). The direct base class of any token definition class needs to be
+ the template <tt class="computeroutput"><span class="identifier">lexer_def</span><span class="special">&lt;&gt;</span></tt>, where the corresponding template
+ parameter (here: <tt class="computeroutput"><span class="identifier">lexertl_lexer</span><span class="special">&lt;</span><span class="identifier">BaseIterator</span><span class="special">&gt;</span></tt>) defines which underlying lexer engine
+ has to be used to provide the required state machine functionality. In
+ this example we use the Lexertl based lexer engine as the underlying
+ lexer type.
+ </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">Lexer</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">word_count_tokens</span> <span class="special">:</span> <span class="identifier">lexer_def</span><span class="special">&lt;</span><span class="identifier">Lexer</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Self</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <span class="identifier">def</span> <span class="special">(</span><span class="identifier">Self</span><span class="special">&amp;</span> <span class="identifier">self</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="comment">// define tokens (the regular expression to match and the corresponding
+</span> <span class="comment">// token id) and add them to the lexer
+</span> <span class="identifier">self</span><span class="special">.</span><span class="identifier">add</span>
+ <span class="special">(</span><span class="string">"[^ \t\n]+"</span><span class="special">,</span> <span class="identifier">ID_WORD</span><span class="special">)</span> <span class="comment">// words (anything except ' ', '\t' or '\n')
+</span> <span class="special">(</span><span class="string">"\n"</span><span class="special">,</span> <span class="identifier">ID_EOL</span><span class="special">)</span> <span class="comment">// newline characters
+</span> <span class="special">(</span><span class="string">"."</span><span class="special">,</span> <span class="identifier">ID_CHAR</span><span class="special">)</span> <span class="comment">// anything else is a plain character
+</span> <span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<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 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>
+<p>
+ We will use a setup, where we want the <span class="emphasis"><em>Spirit.Lex</em></span>
+ library to invoke a given function after any of of the generated tokens
+ is recognized. For this reason we need to implement a functor taking at
+ least the generated token as an argument and returning a boolean value
+ allowing to stop the tokenization process. The default token type used
+ in this example carries a token value of the type <tt class="computeroutput"><span class="identifier">iterator_range</span><span class="special">&lt;</span><span class="identifier">BaseIterator</span><span class="special">&gt;</span></tt> pointing to the matched range in the
+ underlying input sequence.
+ </p>
+<p>
+ </p>
+<p>
+ In this example the struct 'counter' is used as a functor counting the
+ characters, words and lines in the analyzed input sequence by identifying
+ the matched tokens as passed from the <span class="emphasis"><em>Spirit.Lex</em></span>
+ library.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">struct</span> <span class="identifier">counter</span>
+<span class="special">{</span>
+ <span class="comment">// the function operator gets called for each of the matched tokens
+</span> <span class="comment">// c, l, w are references to the counters used to keep track of the numbers
+</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Token</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Token</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">t</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&amp;</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&amp;</span> <span class="identifier">w</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">&amp;</span> <span class="identifier">l</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">switch</span> <span class="special">(</span><span class="identifier">t</span><span class="special">.</span><span class="identifier">id</span><span class="special">())</span> <span class="special">{</span>
+ <span class="keyword">case</span> <span class="identifier">ID_WORD</span><span class="special">:</span> <span class="comment">// matched a word
+</span> <span class="comment">// since we're using a default token type in this example, every
+</span> <span class="comment">// token instance contains a `iterator_range&lt;BaseIterator&gt;` as its
+</span> <span class="comment">// token value pointing to the matched character sequence in the input
+</span> <span class="special">++</span><span class="identifier">w</span><span class="special">;</span> <span class="identifier">c</span> <span class="special">+=</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">value</span><span class="special">().</span><span class="identifier">size</span><span class="special">();</span>
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="keyword">case</span> <span class="identifier">ID_EOL</span><span class="special">:</span> <span class="comment">// matched a newline character
+</span> <span class="special">++</span><span class="identifier">l</span><span class="special">;</span> <span class="special">++</span><span class="identifier">c</span><span class="special">;</span>
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="keyword">case</span> <span class="identifier">ID_CHAR</span><span class="special">:</span> <span class="comment">// matched something else
+</span> <span class="special">++</span><span class="identifier">c</span><span class="special">;</span>
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span> <span class="comment">// always continue to tokenize
+</span> <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ All what's left is to write some boilerplate code helping to tie together
+ the pieces described so far. To simplify this example we call the <tt class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">tokenize</span><span class="special">()</span></tt>
+ function implemented in <span class="emphasis"><em>Spirit.Lex</em></span> (for a more detailed
+ description of this function see here: <span class="bold"><b>FIXME</b></span>),
+ even if we could have written a loop to iterate over the lexer iterators
+ [<tt class="computeroutput"><span class="identifier">first</span></tt>, <tt class="computeroutput"><span class="identifier">last</span></tt>)
+ 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 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>
+<p>
+ </p>
+<p>
+ The main function simply loads the given file into memory (as a <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt>), instantiates an instance of
+ the token definition template using the correct iterator type (<tt class="computeroutput"><span class="identifier">word_count_tokens</span><span class="special">&lt;</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*&gt;</span></tt>), and finally calls <tt class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">tokenize</span></tt>, passing an instance of the
+ counter functor defined above. The return value of <tt class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">tokenize</span></tt>
+ will be <tt class="computeroutput"><span class="keyword">true</span></tt> if the whole
+ input sequence has been successfully tokenized, and <tt class="computeroutput"><span class="keyword">false</span></tt>
+ otherwise.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">argv</span><span class="special">[])</span>
+<span class="special">{</span>
+ <span class="comment">// these variables are used to count characters, words and lines
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">c</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">w</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+
+ <span class="comment">// read input from the given file
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span> <span class="special">(</span><span class="identifier">read_from_file</span><span class="special">(</span><span class="number">1</span> <span class="special">==</span> <span class="identifier">argc</span> <span class="special">?</span> <span class="string">"word_count.input"</span> <span class="special">:</span> <span class="identifier">argv</span><span class="special">[</span><span class="number">1</span><span class="special">]));</span>
+
+ <span class="comment">// create the token definition instance needed to invoke the lexical analyzer
+</span> <span class="identifier">word_count_tokens</span><span class="special">&lt;</span><span class="identifier">lexertl_lexer</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span> <span class="identifier">word_count_functor</span><span class="special">;</span>
+
+ <span class="comment">// tokenize the given string, the bound functor gets invoked for each of
+</span> <span class="comment">// the matched tokens
+</span> <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">first</span> <span class="special">=</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">c_str</span><span class="special">();</span>
+ <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">last</span> <span class="special">=</span> <span class="special">&amp;</span><span class="identifier">first</span><span class="special">[</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">size</span><span class="special">()];</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">lex</span><span class="special">::</span><span class="identifier">tokenize</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">make_lexer</span><span class="special">(</span><span class="identifier">word_count_functor</span><span class="special">),</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">counter</span><span class="special">(),</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">w</span><span class="special">),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">l</span><span class="special">)));</span>
+
+ <span class="comment">// print results
+</span> <span class="keyword">if</span> <span class="special">(</span><span class="identifier">r</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"lines: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">l</span> <span class="special">&lt;&lt;</span> <span class="string">", words: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">w</span>
+ <span class="special">&lt;&lt;</span> <span class="string">", characters: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">c</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">else</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">rest</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Lexical analysis failed\n"</span> <span class="special">&lt;&lt;</span> <span class="string">"stopped at: \""</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">rest</span> <span class="special">&lt;&lt;</span> <span class="string">"\"\n"</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<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 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>
+<p>
+ This example was deliberately chosen to be similar as much as possible
+ to the equivalent Flex
+ program (see below), which isn't too different from what has to be written
+ when using <span class="emphasis"><em>Spirit.Lex</em></span>.
+ </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>
+ Interestingly enough, performance comparisons of lexical analyzers written
+ using <span class="emphasis"><em>Spirit.Lex</em></span> with equivalent programs generated
+ by Flex show that both
+ have comparable execution speeds! Generally, thanks to the highly optimized
+ Lexertl library
+ and due its carefully designed integration with Spirit
+ the abstraction penalty to be paid for using <span class="emphasis"><em>Spirit.Lex</em></span>
+ is neglectible.
+ </p></td></tr>
+</table></div>
+<p>
+ The remaining examples in this tutorial will use more sophisticated features
+ of <span class="emphasis"><em>Spirit.Lex</em></span>, mainly to allow further simplification
+ of the code to be written, while maintaining the similarity with corresponding
+ features of Flex. <span class="emphasis"><em>Spirit.Lex</em></span>
+ has been designed to be as much as possible similar to Flex,
+ that is why this documentation will provide the corresponding Flex
+ code for the shown <span class="emphasis"><em>Spirit.Lex</em></span> examples almost everywhere.
+ So consequently, here is the Flex
+ code corresponding to the example as shown above.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="special">%{</span>
+ <span class="preprocessor">#define</span> <span class="identifier">ID_WORD</span> <span class="number">1000</span>
+ <span class="preprocessor">#define</span> <span class="identifier">ID_EOL</span> <span class="number">1001</span>
+ <span class="preprocessor">#define</span> <span class="identifier">ID_CHAR</span> <span class="number">1002</span>
+ <span class="keyword">int</span> <span class="identifier">c</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">w</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">%}</span>
+<span class="special">%%</span>
+<span class="special">[^</span> <span class="special">\</span><span class="identifier">t</span><span class="special">\</span><span class="identifier">n</span><span class="special">]+</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">ID_WORD</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">\</span><span class="identifier">n</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">ID_EOL</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">.</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">ID_CHAR</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">%%</span>
+<span class="keyword">bool</span> <span class="identifier">count</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">tok</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">switch</span> <span class="special">(</span><span class="identifier">tok</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">case</span> <span class="identifier">ID_WORD</span><span class="special">:</span> <span class="special">++</span><span class="identifier">w</span><span class="special">;</span> <span class="identifier">c</span> <span class="special">+=</span> <span class="identifier">yyleng</span><span class="special">;</span> <span class="keyword">break</span><span class="special">;</span>
+ <span class="keyword">case</span> <span class="identifier">ID_EOL</span><span class="special">:</span> <span class="special">++</span><span class="identifier">l</span><span class="special">;</span> <span class="special">++</span><span class="identifier">c</span><span class="special">;</span> <span class="keyword">break</span><span class="special">;</span>
+ <span class="keyword">case</span> <span class="identifier">ID_CHAR</span><span class="special">:</span> <span class="special">++</span><span class="identifier">c</span><span class="special">;</span> <span class="keyword">break</span><span class="special">;</span>
+ <span class="keyword">default</span><span class="special">:</span>
+ <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+<span class="keyword">void</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">tok</span> <span class="special">=</span> <span class="identifier">EOF</span><span class="special">;</span>
+ <span class="keyword">do</span> <span class="special">{</span>
+ <span class="identifier">tok</span> <span class="special">=</span> <span class="identifier">yylex</span><span class="special">();</span>
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">count</span><span class="special">(</span><span class="identifier">tok</span><span class="special">))</span>
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="special">}</span> <span class="keyword">while</span> <span class="special">(</span><span class="identifier">EOF</span> <span class="special">!=</span> <span class="identifier">tok</span><span class="special">);</span>
+ <span class="identifier">printf</span><span class="special">(</span><span class="string">"%d %d %d\n"</span><span class="special">,</span> <span class="identifier">l</span><span class="special">,</span> <span class="identifier">w</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../__lex___tutorials.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex___tutorials.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="quickstart_2___a_better_word_counter_using___lex__.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_2___a_better_word_counter_using___lex__.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,295 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Quickstart
+ 2 - A better word counter using Spirit.Lex</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../__lex___tutorials.html" title="Spirit.Lex
+ Tutorials">
+<link rel="prev" href="quickstart_1___a_word_counter_using___lex__.html" title="Quickstart
+ 1 - A word counter using Spirit.Lex">
+<link rel="next" href="quickstart_3___counting_words_using_a_parser.html" title="Quickstart
+ 3 - Counting Words Using a Parser">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="quickstart_1___a_word_counter_using___lex__.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex___tutorials.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="quickstart_3___counting_words_using_a_parser.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.__lex___tutorials.quickstart_2___a_better_word_counter_using___lex__"></a><a href="quickstart_2___a_better_word_counter_using___lex__.html" title="Quickstart
+ 2 - A better word counter using Spirit.Lex">Quickstart
+ 2 - A better word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a></h4></div></div></div>
+<p>
+ People knowing Flex will
+ probably complain about the example from the section <a href="quickstart_1___a_word_counter_using___lex__.html" title="Quickstart
+ 1 - A word counter using Spirit.Lex">Lex
+ Quickstart 1 - A word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a>
+ as being overly complex and not being written to leverage the possibilities
+ provided by this tool. In particular the previous example did not directly
+ use the lexer actions to count the lines, words and characters. So the
+ example provided in this step of the tutorial will show how to use semantic
+ actions in <span class="emphasis"><em>Spirit.Lex</em></span>. Even if it still will allow
+ to count text elements only it introduces other new concepts and configuration
+ 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>
+ Prerequisites
+ </h5>
+<p>
+ In addition to the only required <tt class="computeroutput"><span class="preprocessor">#include</span></tt>
+ specific to <span class="emphasis"><em>Spirit.Lex</em></span> this example needs to include
+ a couple of header files from the Phoenix2
+ library. This example shows how to attach functors to token definitions,
+ which could be done using any type of C++ technique resulting in a callable
+ object. Using Phoenix2
+ for this task simplifies things and avoids adding dependencies to other
+ libraries (Phoenix2
+ is already in use for Spirit
+ anyway).
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">support_argument</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">lex_lexer_lexertl</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_statement</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_algorithm</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ To make all the code below more readable we introduce the following namespaces.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lex</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ To give a preview at what to expect from this example, here is the flex
+ program which has been used as the starting point. The useful code is directly
+ included inside the actions associated with each of the token definitions.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="special">%{</span>
+ <span class="keyword">int</span> <span class="identifier">c</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">w</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">%}</span>
+<span class="special">%%</span>
+<span class="special">[^</span> <span class="special">\</span><span class="identifier">t</span><span class="special">\</span><span class="identifier">n</span><span class="special">]+</span> <span class="special">{</span> <span class="special">++</span><span class="identifier">w</span><span class="special">;</span> <span class="identifier">c</span> <span class="special">+=</span> <span class="identifier">yyleng</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">\</span><span class="identifier">n</span> <span class="special">{</span> <span class="special">++</span><span class="identifier">c</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">.</span> <span class="special">{</span> <span class="special">++</span><span class="identifier">c</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">%%</span>
+<span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">yylex</span><span class="special">();</span>
+ <span class="identifier">printf</span><span class="special">(</span><span class="string">"%d %d %d\n"</span><span class="special">,</span> <span class="identifier">l</span><span class="special">,</span> <span class="identifier">w</span><span class="special">,</span> <span class="identifier">c</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<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 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>
+<p>
+ <span class="emphasis"><em>Spirit.Lex</em></span> uses a very similar way of associating
+ actions with the token definitions (which should look familiar to anybody
+ knowlegdeable with Spirit
+ as well): specifying the operations to execute inside of a pair of <tt class="computeroutput"><span class="special">[]</span></tt> brackets. In order to be able to attach
+ semantic actions to token definitions for each of them there is defined
+ an instance of a <tt class="computeroutput"><span class="identifier">token_def</span><span class="special">&lt;&gt;</span></tt>.
+ </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">Lexer</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">word_count_tokens</span> <span class="special">:</span> <span class="identifier">lexer_def</span><span class="special">&lt;</span><span class="identifier">Lexer</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">word_count_tokens</span><span class="special">()</span>
+ <span class="special">:</span> <span class="identifier">c</span><span class="special">(</span><span class="number">0</span><span class="special">),</span> <span class="identifier">w</span><span class="special">(</span><span class="number">0</span><span class="special">),</span> <span class="identifier">l</span><span class="special">(</span><span class="number">0</span><span class="special">),</span>
+ <span class="identifier">word</span><span class="special">(</span><span class="string">"[^ \t\n]+"</span><span class="special">),</span> <span class="identifier">eol</span><span class="special">(</span><span class="string">"\n"</span><span class="special">),</span> <span class="identifier">any</span><span class="special">(</span><span class="string">"."</span><span class="special">)</span> <span class="comment">// define tokens
+</span> <span class="special">{}</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Self</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <span class="identifier">def</span> <span class="special">(</span><span class="identifier">Self</span><span class="special">&amp;</span> <span class="identifier">self</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">ref</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">distance</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">_1</span><span class="special">;</span>
+
+ <span class="comment">// associate tokens with the lexer
+</span> <span class="identifier">self</span> <span class="special">=</span> <span class="identifier">word</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">w</span><span class="special">),</span> <span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">_1</span><span class="special">)]</span>
+ <span class="special">|</span> <span class="identifier">eol</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">),</span> <span class="special">++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">l</span><span class="special">)]</span>
+ <span class="special">|</span> <span class="identifier">any</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)]</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">w</span><span class="special">,</span> <span class="identifier">l</span><span class="special">;</span>
+ <span class="identifier">token_def</span><span class="special">&lt;&gt;</span> <span class="identifier">word</span><span class="special">,</span> <span class="identifier">eol</span><span class="special">,</span> <span class="identifier">any</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ The semantics of the shown code is as follows. The code inside the <tt class="computeroutput"><span class="special">[]</span></tt> brackets will be executed whenever the
+ corresponding token has been matched by the lexical analyzer. This is very
+ similar to Flex, where
+ the action code associated with a token definition gets executed after
+ the recognition of a matching input sequence. The code above uses function
+ objects constructed using Phoenix2,
+ but it is possible to insert any C++ function or function object as long
+ as it exposes the interface:
+ </p>
+<pre class="programlisting">
+<span class="keyword">void</span> <span class="identifier">f</span> <span class="special">(</span><span class="identifier">Range</span> <span class="identifier">r</span><span class="special">,</span> <span class="identifier">Idtype</span> <span class="identifier">id</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">&amp;</span> <span class="identifier">matched</span><span class="special">,</span> <span class="identifier">Context</span><span class="special">&amp;</span> <span class="identifier">ctx</span><span class="special">);</span>
+</pre>
+<div class="variablelist">
+<p class="title"><b>where:</b></p>
+<dl>
+<dt><span class="term"><tt class="computeroutput"><span class="identifier">Range</span>
+ <span class="identifier">r</span></tt></span></dt>
+<dd><p>
+ This is a <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator_range</span></tt> holding two iterators
+ pointing to the matched range in the underlying input sequence. The
+ type of the held iterators is the same as specified while defining
+ the type of the <tt class="computeroutput"><span class="identifier">lexertl_lexer</span><span class="special">&lt;...&gt;</span></tt> (its first template parameter).
+ </p></dd>
+<dt><span class="term"><tt class="computeroutput"><span class="identifier">Idtype</span>
+ <span class="identifier">id</span></tt></span></dt>
+<dd><p>
+ This is the token id of the type <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></tt>
+ for the matched token.
+ </p></dd>
+<dt><span class="term"><tt class="computeroutput"><span class="keyword">bool</span><span class="special">&amp;</span> <span class="identifier">matched</span></tt></span></dt>
+<dd><p>
+ This boolean value is pre/initialized to <tt class="computeroutput"><span class="keyword">true</span></tt>.
+ If the functor sets it to <tt class="computeroutput"><span class="keyword">false</span></tt>
+ the lexer stops calling any semantic actions attached to this token
+ and behaves as if the token have not been matched in the first place.
+ </p></dd>
+<dt><span class="term"><tt class="computeroutput"><span class="identifier">Context</span><span class="special">&amp;</span> <span class="identifier">ctx</span></tt></span></dt>
+<dd><p>
+ This is a reference to a lexer specific, unspecified type, providing
+ the context for the current lexer state. It can be used to access different
+ internal data items and is needed for lexer state control from inside
+ a semantic action.
+ </p></dd>
+</dl>
+</div>
+<p>
+ When using a C++ function as the semantic action the following prototypes
+ are allowed as well:
+ </p>
+<pre class="programlisting">
+<span class="keyword">void</span> <span class="identifier">f</span> <span class="special">(</span><span class="identifier">Range</span> <span class="identifier">r</span><span class="special">,</span> <span class="identifier">Idtype</span> <span class="identifier">id</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">&amp;</span> <span class="identifier">matched</span><span class="special">);</span>
+<span class="keyword">void</span> <span class="identifier">f</span> <span class="special">(</span><span class="identifier">Range</span> <span class="identifier">r</span><span class="special">,</span> <span class="identifier">Idtype</span> <span class="identifier">id</span><span class="special">);</span>
+<span class="keyword">void</span> <span class="identifier">f</span> <span class="special">(</span><span class="identifier">Range</span> <span class="identifier">r</span><span class="special">);</span>
+</pre>
+<p>
+ Even if it is possible to write your own function object implementations
+ (i.e. using Boost.Lambda or Boost.Bind), the preferred way of defining
+ lexer semantic actions is to use Phoenix2.
+ In this case you can access the four parameters described in the table
+ above by using the predefined Spirit
+ placeholders: <tt class="computeroutput"><span class="identifier">_1</span></tt> for the
+ iterator range, <tt class="computeroutput"><span class="identifier">_2</span></tt> for
+ the token id, <tt class="computeroutput"><span class="identifier">_3</span></tt> for the
+ reference to the boolean value signaling the outcome of the semantic action,
+ and <tt class="computeroutput"><span class="identifier">_4</span></tt> for the reference
+ 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 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>
+<p>
+ If you compare the with the code from <a href="quickstart_1___a_word_counter_using___lex__.html" title="Quickstart
+ 1 - A word counter using Spirit.Lex">Lex
+ Quickstart 1 - A word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a>
+ with regard to the way how token definitions are associated with the lexer,
+ you will notice a different syntax being used here. If in the previous
+ example we have been using the <tt class="computeroutput"><span class="identifier">self</span><span class="special">.</span><span class="identifier">add</span><span class="special">()</span></tt> style of the API, then here we directly
+ assign the token definitions to <tt class="computeroutput"><span class="identifier">self</span></tt>,
+ combining the different token definitions using the <tt class="computeroutput"><span class="special">|</span></tt>
+ operator. Here is the code snippet again:
+ </p>
+<pre class="programlisting">
+<span class="identifier">self</span> <span class="special">=</span> <span class="identifier">word</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">w</span><span class="special">),</span> <span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">_1</span><span class="special">)]</span>
+ <span class="special">|</span> <span class="identifier">eol</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">),</span> <span class="special">++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">l</span><span class="special">)]</span>
+ <span class="special">|</span> <span class="identifier">any</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)]</span>
+ <span class="special">;</span>
+</pre>
+<p>
+ This way we have a very powerful and natural way of building the lexical
+ analyzer. If translated into English this may be read as: The lexical analyer
+ will recognize ('<tt class="computeroutput"><span class="special">=</span></tt>') tokens
+ as defined by any of ('<tt class="computeroutput"><span class="special">|</span></tt>')
+ the token definitions <tt class="computeroutput"><span class="identifier">word</span></tt>,
+ <tt class="computeroutput"><span class="identifier">eol</span></tt>, and <tt class="computeroutput"><span class="identifier">any</span></tt>.
+ </p>
+<p>
+ A second difference to the previous example is that we do not explicitly
+ specify any token ids to use for the separate tokens. Using semantic actions
+ to trigger some useful work free'd us from the need to define these. To
+ ensure every token gets assigned a id the <span class="emphasis"><em>Spirit.Lex</em></span>
+ library internally assigns unique numbers to the token definitions, starting
+ with the constant defined by <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lex</span><span class="special">::</span><span class="identifier">min_token_id</span></tt>.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="quickstart_1___a_word_counter_using___lex__.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex___tutorials.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="quickstart_3___counting_words_using_a_parser.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_3___counting_words_using_a_parser.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/__lex___tutorials/quickstart_3___counting_words_using_a_parser.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,461 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Quickstart
+ 3 - Counting Words Using a Parser</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../__lex___tutorials.html" title="Spirit.Lex
+ Tutorials">
+<link rel="prev" href="quickstart_2___a_better_word_counter_using___lex__.html" title="Quickstart
+ 2 - A better word counter using Spirit.Lex">
+<link rel="next" href="../abstracts.html" title="Abstracts">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="quickstart_2___a_better_word_counter_using___lex__.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex___tutorials.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../abstracts.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser"></a><a href="quickstart_3___counting_words_using_a_parser.html" title="Quickstart
+ 3 - Counting Words Using a Parser">Quickstart
+ 3 - Counting Words Using a Parser</a></h4></div></div></div>
+<p>
+ The whole purpose of integrating <span class="emphasis"><em>Spirit.Lex</em></span> as part
+ of the Spirit library
+ was to add a library allowing to merge lexical analysis with the parsing
+ process as defined by a Spirit
+ grammar. Spirit parsers
+ read their input from an input sequence accessed by iterators. So naturally,
+ we chose iterators to be used as the interface beween the lexer and the
+ parser. A second goal of the lexer/parser integration was to enable the
+ usage of possibly different lexical analyzer libraries. The utilization
+ of iterators seemed to be the right choice from this standpoint as well,
+ mainly because these can be used as an abstraction layer hiding implementation
+ specifics of the used lexer library. The <a href="quickstart_3___counting_words_using_a_parser.html#spirit.lex.flowcontrol" title="Figure 3. The common flow control implemented while parsing
+ combined with lexical analysis">picture</a>
+ below shows the common flow control implemented while parsing combined
+ with lexical analysis.
+ </p>
+<p>
+ </p>
+<div class="figure">
+<a name="spirit.lex.flowcontrol"></a><p class="title"><b>Figure 3. The common flow control implemented while parsing
+ combined with lexical analysis</b></p>
+<span class="inlinemediaobject"><img src="../../.././images/FlowOfControl.png" alt="The common flow
+ control implemented while parsing combined with lexical analysis"></span>
+</div>
+<p>
+ </p>
+<p>
+ Another problem related to the integration of the lexical analyzer with
+ the parser was to find a way how the defined tokens syntactically could
+ be blended with the grammar definition syntax of Spirit.
+ For tokens defined as instances of the <tt class="computeroutput"><span class="identifier">token_def</span><span class="special">&lt;&gt;</span></tt> class the most natural way of integration
+ was to allow to directly use these as parser components. Semantically these
+ parser components succeed matching their input whenever the corresponding
+ token type has been matched by the lexer. This quick start example will
+ demonstrate this (and more) by counting words again, simply by adding up
+ the numbers inside of semantic actions of a parser (for the full example
+ 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>
+ Prerequisites
+ </h5>
+<p>
+ This example uses two of the Spirit
+ library components: <span class="emphasis"><em>Spirit.Lex</em></span> and <span class="emphasis"><em>Spirit.Qi</em></span>,
+ consequently we have to <tt class="computeroutput"><span class="preprocessor">#include</span></tt>
+ the corresponding header files. Again, we need to include a couple of header
+ files from the Phoenix2
+ library. This example shows how to attach functors to parser components,
+ which could be done using any type of C++ technique resulting in a callable
+ object. Using Phoenix2
+ for this task simplifies things and avoids adding dependencies to other
+ libraries (Phoenix2
+ is already in use for Spirit
+ anyway).
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">lex_lexer_lexertl</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_statement</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_container</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ To make all the code below more readable we introduce the following namespaces.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lex</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<a name="spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser.defining_tokens"></a><h5>
+<a name="id480747"></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>
+<p>
+ If compared to the two previous quick start examples (<a href="quickstart_1___a_word_counter_using___lex__.html" title="Quickstart
+ 1 - A word counter using Spirit.Lex">Lex
+ Quickstart 1 - A word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a>
+ and <a href="quickstart_2___a_better_word_counter_using___lex__.html" title="Quickstart
+ 2 - A better word counter using Spirit.Lex">Lex
+ Quickstart 2 - A better word counter using <span class="emphasis"><em>Spirit.Lex</em></span></a>)
+ the token definition class for this example does not reveal any surprises.
+ However, it uses lexer token definition macros to simplify the composition
+ of the regular expressions, which will be described in more detail in the
+ section <span class="bold"><b>FIXME</b></span>. Generally, any token definition
+ is usable without modification either for a standalone lexical analyzer
+ or in conjunction with a parser.
+ </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">Lexer</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">word_count_tokens</span> <span class="special">:</span> <span class="identifier">lexer_def</span><span class="special">&lt;</span><span class="identifier">Lexer</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Self</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <span class="identifier">def</span> <span class="special">(</span><span class="identifier">Self</span><span class="special">&amp;</span> <span class="identifier">self</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="comment">// define patterns (lexer macros) to be used during token definition
+</span> <span class="comment">// below
+</span> <span class="identifier">self</span><span class="special">.</span><span class="identifier">add_pattern</span>
+ <span class="special">(</span><span class="string">"WORD"</span><span class="special">,</span> <span class="string">"[^ \t\n]+"</span><span class="special">)</span>
+ <span class="special">;</span>
+
+ <span class="comment">// define tokens and associate them with the lexer
+</span> <span class="identifier">word</span> <span class="special">=</span> <span class="string">"{WORD}"</span><span class="special">;</span> <span class="comment">// reference the pattern 'WORD' as defined above
+</span>
+ <span class="comment">// this lexer will recognize 3 token types: words, newlines, and
+</span> <span class="comment">// everything else
+</span> <span class="identifier">self</span><span class="special">.</span><span class="identifier">add</span>
+ <span class="special">(</span><span class="identifier">word</span><span class="special">)</span> <span class="comment">// no token id is needed here
+</span> <span class="special">(</span><span class="char">'\n'</span><span class="special">)</span> <span class="comment">// characters are usable as tokens as well
+</span> <span class="special">(</span><span class="string">"."</span><span class="special">,</span> <span class="identifier">IDANY</span><span class="special">)</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">token_def</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">word</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<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 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>
+<p>
+ While the integration of lexer and parser in the control flow is achieved
+ by using special iterators wrapping the lexical analyzer, we still nead
+ a means of expressing in the grammar what tokens to match and where. The
+ token definition class above uses three different ways of defining a token:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Using an instance of a <tt class="computeroutput"><span class="identifier">token_def</span><span class="special">&lt;&gt;</span></tt>, which is handy whenever you
+ need to specify a token attribute (for more information about lexer related
+ attributes please look here: <a href="../abstracts/lexer_attributes.html" title="Lexer Attributes">Lexer
+ Attributes</a>).
+ </li>
+<li>
+ Using a single character as the token, in this case the character represents
+ itself as a token, where the token id is the ASCII character value.
+ </li>
+<li>
+ Using a regular expression represented as a string, where the token id
+ needs to be specified explicitly to make the token accessible from the
+ grammar level.
+ </li>
+</ul></div>
+<p>
+ All three token definition methods require a different method of grammar
+ integration. But as you can see from the following code snippet, each of
+ this methods is straightforward and blends the corresponding token instance
+ naturally with the surrounding <span class="emphasis"><em>Spirit.Qi</em></span> grammar syntax.
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Token definition
+ </p>
+ </th>
+<th>
+ <p>
+ Parser integration
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">token_def</span><span class="special">&lt;&gt;</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ The <tt class="computeroutput"><span class="identifier">token_def</span><span class="special">&lt;&gt;</span></tt>
+ instance is directly usable as a parser component. Parsing of this
+ component will succeed if the regular expression used to define
+ this has been matched successfully.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ single character
+ </p>
+ </td>
+<td>
+ <p>
+ The single character is directly usable in the grammar, under certain
+ circumstances it needs to be wrapped by a <tt class="computeroutput"><span class="identifier">char_</span><span class="special">()</span></tt> parser component, though. Parsing
+ of this component will succeed if the single character has been
+ matched.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ explicit token id
+ </p>
+ </td>
+<td>
+ <p>
+ To use an explicit token id in a <span class="emphasis"><em>Spirit.Qi</em></span>
+ grammar you are required to wrap it with the special <tt class="computeroutput"><span class="identifier">token</span><span class="special">()</span></tt>
+ parser component. Parsing of this component will succeed if the
+ current token has the same token id as specified in the expression
+ <tt class="computeroutput"><span class="identifier">token</span><span class="special">(&lt;</span><span class="identifier">id</span><span class="special">&gt;)</span></tt>.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+ The grammar definition below uses each of the three types demonstrating
+ their usage.
+ </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">word_count_grammar</span> <span class="special">:</span> <span class="identifier">grammar_def</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">TokenDef</span><span class="special">&gt;</span>
+ <span class="identifier">word_count_grammar</span><span class="special">(</span><span class="identifier">TokenDef</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">tok</span><span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">c</span><span class="special">(</span><span class="number">0</span><span class="special">),</span> <span class="identifier">w</span><span class="special">(</span><span class="number">0</span><span class="special">),</span> <span class="identifier">l</span><span class="special">(</span><span class="number">0</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">ref</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">size</span><span class="special">;</span>
+
+ <span class="comment">// As documented in the Spirit.Qi documentation, any placeholders
+</span> <span class="comment">// (_1 et.al.) used in semantic actions inside a grammar need to be
+</span> <span class="comment">// imported from the namespace boost::spirit::arg_names, and not from
+</span> <span class="comment">// the corresponding namespace in Phoenix.
+</span> <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">_1</span><span class="special">;</span>
+
+ <span class="identifier">start</span> <span class="special">=</span> <span class="special">*(</span> <span class="identifier">tok</span><span class="special">.</span><span class="identifier">word</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">w</span><span class="special">),</span> <span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">size</span><span class="special">(</span><span class="identifier">_1</span><span class="special">)]</span>
+ <span class="special">|</span> <span class="identifier">char_</span><span class="special">(</span><span class="char">'\n'</span><span class="special">)</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">),</span> <span class="special">++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">l</span><span class="special">)]</span>
+ <span class="special">|</span> <span class="identifier">token</span><span class="special">(</span><span class="identifier">IDANY</span><span class="special">)</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)]</span>
+ <span class="special">)</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">w</span><span class="special">,</span> <span class="identifier">l</span><span class="special">;</span>
+ <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</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>
+ As already described (see: Attributes),
+ the <span class="emphasis"><em>Spirit.Qi</em></span> parser library builds upon a set of
+ of fully attributed parser components. Consequently, all the token definitions
+ do support the this attribute model as well. The most natural way of implementing
+ this was to use the token values as the attributes exposed by the parser
+ component corresponding to the token definition (you can read more about
+ this topic here: <a href="../abstracts.html#spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values" title="About
+ Tokens and Token Values">About
+ Tokens and Token Values</a>). The example above takes advantage of the
+ full integration of the token values as the <tt class="computeroutput"><span class="identifier">token_def</span><span class="special">&lt;&gt;</span></tt>'s parser attributes: the <tt class="computeroutput"><span class="identifier">word</span></tt> token definition is declared as
+ a <tt class="computeroutput"><span class="identifier">token_def</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></tt>,
+ making every instance of a <tt class="computeroutput"><span class="identifier">word</span></tt>
+ token carry the string representation of the matched input sequence as
+ its value. The semantic action attached to <tt class="computeroutput"><span class="identifier">tok</span><span class="special">.</span><span class="identifier">word</span></tt>
+ receives this string (represented by the <tt class="computeroutput"><span class="identifier">_1</span></tt>
+ placeholder) and uses it to calculate the number of matched characters:
+ <tt class="computeroutput"><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)</span> <span class="special">+=</span>
+ <span class="identifier">size</span><span class="special">(</span><span class="identifier">_1</span><span class="special">)</span></tt>.
+ </p>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td colspan="2" align="left" valign="top"><p>
+ All placeholders (<tt class="computeroutput"><span class="identifier">_1</span></tt>,
+ <tt class="computeroutput"><span class="identifier">_2</span></tt>, etc.) used in <span class="emphasis"><em>parser</em></span>
+ semantic actions in conjunction with functors created based on Phoenix2 need to be imported
+ from the <tt class="computeroutput"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">arg_names</span></tt>
+ (and <span class="bold"><b>not</b></span> <tt class="computeroutput"><span class="keyword">namespace</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">arg_names</span></tt>, which is different from
+ using placeholders in <span class="emphasis"><em>Spirit.Lex</em></span>). Using the wrong
+ placeholders leads to subtle compilation errors which are difficult to
+ backtrack to their cause.
+ </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 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>
+<p>
+ The main function needs to implement a bit more logic now as we have to
+ initialize and start not only the lexical analysis but the parsing process
+ as well. The three type definitions (<tt class="computeroutput"><span class="keyword">typedef</span></tt>
+ statements) simplify the creation of the lexical analyzer and the grammar.
+ After reading the contents of the given file into memory it calls the function
+ tokenize_and_parse()
+ to initialize the lexical analysis and parsing processes.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">argv</span><span class="special">[])</span>
+<span class="special">{</span>
+<span class="callout_bug"><a name="spirit4co" href="quickstart_3___counting_words_using_a_parser.html#spirit4"><img src="../../../images/callouts/1.png" alt="1" border="0"></a></span> <span class="keyword">typedef</span> <span class="identifier">lexertl_token</span><span class="special">&lt;</span>
+ <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</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">string</span><span class="special">&gt;</span>
+ <span class="special">&gt;</span> <span class="identifier">token_type</span><span class="special">;</span>
+
+<span class="callout_bug"><a name="spirit5co" href="quickstart_3___counting_words_using_a_parser.html#spirit5"><img src="../../../images/callouts/2.png" alt="2" border="0"></a></span> <span class="keyword">typedef</span> <span class="identifier">lexertl_lexer</span><span class="special">&lt;</span><span class="identifier">token_type</span><span class="special">&gt;</span> <span class="identifier">lexer_type</span><span class="special">;</span>
+
+<span class="callout_bug"><a name="spirit6co" href="quickstart_3___counting_words_using_a_parser.html#spirit6"><img src="../../../images/callouts/3.png" alt="3" border="0"></a></span> <span class="keyword">typedef</span> <span class="identifier">lexer_iterator</span><span class="special">&lt;</span><span class="identifier">word_count_tokens</span><span class="special">&lt;</span><span class="identifier">lexer_type</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">iterator_type</span><span class="special">;</span>
+
+ <span class="comment">// now we use the types defined above to create the lexer and grammar
+</span> <span class="comment">// object instances needed to invoke the parsing process
+</span> <span class="identifier">word_count_tokens</span><span class="special">&lt;</span><span class="identifier">lexer_type</span><span class="special">&gt;</span> <span class="identifier">word_count</span><span class="special">;</span> <span class="comment">// Our token definition
+</span> <span class="identifier">word_count_grammar</span><span class="special">&lt;</span><span class="identifier">iterator_type</span><span class="special">&gt;</span> <span class="identifier">def</span> <span class="special">(</span><span class="identifier">word_count</span><span class="special">);</span> <span class="comment">// Our grammar definition
+</span>
+ <span class="comment">// read in the file int memory
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span> <span class="special">(</span><span class="identifier">read_from_file</span><span class="special">(</span><span class="number">1</span> <span class="special">==</span> <span class="identifier">argc</span> <span class="special">?</span> <span class="string">"word_count.input"</span> <span class="special">:</span> <span class="identifier">argv</span><span class="special">[</span><span class="number">1</span><span class="special">]));</span>
+ <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">first</span> <span class="special">=</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">c_str</span><span class="special">();</span>
+ <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">last</span> <span class="special">=</span> <span class="special">&amp;</span><span class="identifier">first</span><span class="special">[</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">size</span><span class="special">()];</span>
+
+ <span class="comment">// Parsing is done based on the the token stream, not the character
+</span> <span class="comment">// stream read from the input. The function `tokenize_and_parse()` wraps
+</span> <span class="comment">// the passed iterator range `[first, last)` by the lexical analyzer and
+</span> <span class="comment">// uses its exposed iterators to parse the toke stream.
+</span> <span class="identifier">qi</span><span class="special">::</span><span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">word_count_grammar</span><span class="special">&lt;</span><span class="identifier">iterator_type</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">def</span><span class="special">);</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">tokenize_and_parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">make_lexer</span><span class="special">(</span><span class="identifier">word_count</span><span class="special">),</span> <span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">r</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"lines: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">def</span><span class="special">.</span><span class="identifier">l</span> <span class="special">&lt;&lt;</span> <span class="string">", words: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">def</span><span class="special">.</span><span class="identifier">w</span>
+ <span class="special">&lt;&lt;</span> <span class="string">", characters: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">def</span><span class="special">.</span><span class="identifier">c</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">else</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">rest</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cerr</span> <span class="special">&lt;&lt;</span> <span class="string">"Parsing failed\n"</span> <span class="special">&lt;&lt;</span> <span class="string">"stopped at: \""</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">rest</span> <span class="special">&lt;&lt;</span> <span class="string">"\"\n"</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ </p>
+<div class="calloutlist"><table border="0" summary="Callout list">
+<tr>
+<td width="5%" valign="top" align="left">
+<a name="spirit4"></a>1 </td>
+<td valign="top" align="left"><p> define the token type to be used: <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt>
+ is available as the type of the token value </p></td>
+</tr>
+<tr>
+<td width="5%" valign="top" align="left">
+<a name="spirit5"></a>2 </td>
+<td valign="top" align="left"><p> define the lexer type to
+ use implementing the state machine </p></td>
+</tr>
+<tr>
+<td width="5%" valign="top" align="left">
+<a name="spirit6"></a>3 </td>
+<td valign="top" align="left"><p> define the iterator type exposed by
+ the lexer type </p></td>
+</tr>
+</table></div>
+<p>
+ </p>
+<p>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="quickstart_2___a_better_word_counter_using___lex__.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex___tutorials.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../abstracts.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,412 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Abstracts</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../__lex__.html" title="Spirit.Lex">
+<link rel="prev" href="__lex___tutorials/quickstart_3___counting_words_using_a_parser.html" title="Quickstart
+ 3 - Counting Words Using a Parser">
+<link rel="next" href="abstracts/tokenizing_input_data.html" title="Tokenizing
+ Input Data">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="__lex___tutorials/quickstart_3___counting_words_using_a_parser.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex__.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="abstracts/tokenizing_input_data.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.__lex__.abstracts"></a>Abstracts</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Lexer Primitives</span></dt>
+<dt><span class="section"><a href="abstracts/tokenizing_input_data.html">Tokenizing
+ Input Data</a></span></dt>
+<dt><span class="section"><a href="abstracts/lexer_semantic_actions.html">Lexer
+ Semantic Actions</a></span></dt>
+<dt><span class="section"><a href="abstracts/the__static__lexer_model.html">The
+ <span class="emphasis"><em>Static</em></span> Lexer Model</a></span></dt>
+<dt><span class="section"><a href="abstracts/parsing_using_a_lexer.html">Parsing
+ using a Lexer</a></span></dt>
+<dt><span class="section">Lexer Attributes</span></dt>
+<dt><span class="section">Lexer States</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.abstracts.lexer_primitives"></a>Lexer Primitives</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.lexer_primitives">Lexer
+ Primitives</a></span></dt>
+<dt><span class="section"><a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values">About
+ Tokens and Token Values</a></span></dt>
+<dt><span class="section"><a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.ways_to_define_tokens">Ways
+ to define Tokens</a></span></dt>
+</dl></div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title">
+<a name="spirit.__lex__.abstracts.lexer_primitives.lexer_primitives"></a><a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.lexer_primitives" title="Lexer
+ Primitives">Lexer
+ Primitives</a></h5></div></div></div></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values"></a><a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values" title="About
+ Tokens and Token Values">About
+ Tokens and Token Values</a></h5></div></div></div>
+<p>
+ As already discussed, lexical scanning is the process of analyzing the
+ stream of input characters and separating it into strings called tokens,
+ most of the time separated by whitespace. The different token types recognized
+ by a lexical analyzer often get assigned unique integer token identifiers
+ (token ids). These token ids arenormally used by the parser to identifiy
+ the current token without having to look at the matched string again.
+ The <span class="emphasis"><em>Spirit.Lex</em></span> library is not different with respect
+ to this, as it uses the token ids as the main means of identification
+ of the different token types defined for a particular lexical analyzer.
+ However, it is different from commonly used lexical analyzers in the
+ sense that it returns (references to) instances of a (user defined) token
+ class to the user. The only real limitation posed on this token class
+ is consequently, that it has to carry at least the token id of the token
+ it represents. For more information about the interface a user defined
+ token type has to expose please look at the <a href="reference.html#spirit.__lex__.reference.concepts.token" title="Token">Token
+ Reference</a> reference. The library provides a default token type
+ based on the Lexertl
+ library which should be sufficient in most use cases: the lexertl_token<>
+ type. This section focusses on the description of general features a
+ token class may implement and how this integrates with the other parts
+ 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 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>
+<p>
+ It is very important to understand the difference between a token definition
+ (represented by the token_def<>
+ template) and a token itself (for instance represented by the lexertl_token<>
+ template).
+ </p>
+<p>
+ The token definition is used to describe the main features of a particular
+ token type, especially:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ to simplify the definition of a token type using a regular expression
+ pattern applied while matching this token type,
+ </li>
+<li>
+ to associate a token type with a particular lexer state,
+ </li>
+<li>
+ to optionally assign a token id to a token type,
+ </li>
+<li>
+ to optionally associate some code to execute whenever an instance of
+ this token type has been matched,
+ </li>
+<li>
+ and to optionally specify the attribute type of the token value.
+ </li>
+</ul></div>
+<p>
+ The token itself is a data structure returned by the lexer iterators.
+ Dereferencing a lexer iterator returns a reference to the last matched
+ token instance. It encapsulates the part of the underlying input sequence
+ matched by the regular expression used during the definiton of this token
+ type. Incrementing the lexer iterator invokes the lexical analyzer to
+ match the next token by advancing the underlying input stream. The token
+ data structure contains at least the token id of the matched token type,
+ allowing to identify the matched character sequence. Optionally, the
+ token instance may contain a token value and/or the lexer state this
+ token instance was matched in. The following figure
+ shows the schematic structure of a token.
+ </p>
+<p>
+ </p>
+<div class="figure">
+<a name="spirit.lex.tokenstructure"></a><p class="title"><b>Figure 4. The structure of a token</b></p>
+<span class="inlinemediaobject"><img src="../.././images/TokenStructure.png" alt="The
+ structure of a token"></span>
+</div>
+<p>
+ </p>
+<p>
+ The token value and the token state may be omitted for optimization reasons,
+ avoiding the token to carry more data than actually required. This configuration
+ can be achieved by supplying appropriate template parameters for the
+ lexertl_token<> template while defining
+ the token type.
+ </p>
+<p>
+ 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<>.
+ 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
+ for this token instance.
+ </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 the lexical analyzer is used in conjunction with a <span class="emphasis"><em>Spirit.Qi</em></span>
+ parser, the stored boost::iterator_range<>
+ 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<>
+ 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
+ during parser backtracking.
+ </p></td></tr>
+</table></div>
+<p>
+ Here is the template prototype of the lexertl_token<>
+ template:
+ </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">=</span> <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*,</span>
+ <span class="keyword">typename</span> <span class="identifier">AttributeTypes</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector0</span><span class="special">&lt;&gt;,</span>
+ <span class="keyword">typename</span> <span class="identifier">HasState</span> <span class="special">=</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span>
+<span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">lexertl_token</span><span class="special">;</span>
+</pre>
+<div class="variablelist">
+<p class="title"><b>where:</b></p>
+<dl>
+<dt><span class="term">Iterator</span></dt>
+<dd><p>
+ This is the type of the iterator used to access the underlying input
+ stream. It defaults to a plain <tt class="computeroutput"><span class="keyword">char</span>
+ <span class="keyword">const</span><span class="special">*</span></tt>.
+ </p></dd>
+<dt><span class="term">AttributeTypes</span></dt>
+<dd><p>
+ This is either a mpl sequence containing all attribute types used
+ for the token definitions or the type <tt class="computeroutput"><span class="identifier">omitted</span></tt>.
+ If the mpl sequence is empty (which is the default), all token instances
+ will store a <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator_range</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;</span></tt> pointing to the start and the
+ end of the matched section in the input stream. If the type is <tt class="computeroutput"><span class="identifier">omitted</span></tt>, the generated tokens will
+ contain no token value (attribute) at all.
+ </p></dd>
+<dt><span class="term">HasState</span></dt>
+<dd><p>
+ This is either <tt class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></tt>
+ or <tt class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></tt>, allowing to control whether
+ the generated token instances will contain the lexer state they were
+ generated in. The default is mpl::true_, so all token instances will
+ contain the lexer state.
+ </p></dd>
+</dl>
+</div>
+<p>
+ Normally, during its construction, a token instance always holds the
+ boost::iterator_range<>
+ as its token value (except, if it has been defined using the <tt class="computeroutput"><span class="identifier">omitted</span></tt> token value type). This iterator
+ range then is converted in place to the requested token value type (attribute)
+ 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 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>
+<p>
+ The token definitions (represented by the token_def<>
+ template) are normally used as part of the definition of the lexical
+ analyzer. At the same time a token definition instance may be used as
+ a parser component in <span class="emphasis"><em>Spirit.Qi</em></span>.
+ </p>
+<p>
+ The template prototype of this class is shown here:
+ </p>
+<pre class="programlisting">
+<span class="keyword">template</span><span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">Attribute</span> <span class="special">=</span> <span class="identifier">unused_type</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">Char</span> <span class="special">=</span> <span class="keyword">char</span>
+<span class="special">&gt;</span>
+<span class="keyword">class</span> <span class="identifier">token_def</span><span class="special">;</span>
+</pre>
+<div class="variablelist">
+<p class="title"><b>where:</b></p>
+<dl>
+<dt><span class="term">Attribute</span></dt>
+<dd><p>
+ This is the type of the token value (attribute) supported by token
+ instances representing this token type. This attribute type is exposed
+ to the <span class="emphasis"><em>Spirit.Qi</em></span> library, whenever this token
+ definition is used as a parser component. The default attribute type
+ is <tt class="computeroutput"><span class="identifier">unused_type</span></tt>, which
+ means the token instance holds a boost::iterator_range<>
+ pointing to the start and the end of the matched section in the input
+ stream. If the attribute is <tt class="computeroutput"><span class="identifier">omitted</span></tt>
+ the token instance will expose no token type at all. Any other type
+ will be used directly as the token value type.
+ </p></dd>
+<dt><span class="term">Char</span></dt>
+<dd><p>
+ This is the value type of the iterator for the underlying input sequence.
+ It defaults to <tt class="computeroutput"><span class="keyword">char</span></tt>.
+ </p></dd>
+</dl>
+</div>
+<p>
+ The semantics of the template parameters for the token type and the token
+ definition type are very similar and interdependent. As a rule of thumb
+ you can think of the token definition type as the means of specifying
+ everything related to a single specific token type (such as <tt class="computeroutput"><span class="identifier">identifier</span></tt> or <tt class="computeroutput"><span class="identifier">integer</span></tt>).
+ On the other hand the token type is used to define the general proerties
+ of all token instances generated by the <span class="emphasis"><em>Spirit.Lex</em></span>
+ library.
+ </p>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td colspan="2" align="left" valign="top">
+<p>
+ If you don't list any token value types in the token type definition
+ declaration (resulting in the usage of the default boost::iterator_range<>
+ token type) everything will compile and work just fine, just a bit
+ less efficient. This is because the token value will be converted from
+ the matched input sequence every time it is requested.
+ </p>
+<p>
+ But as soon as you specify at least one token value type while defining
+ the token type you'll have to list all value types used for token_def<>
+ declarations in the token definition class, otherwise compilation errors
+ will occur.
+ </p>
+</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 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>
+<p>
+ Let's start with some examples. We refer to one of the <span class="emphasis"><em>Spirit.Lex</em></span>
+ examples (for the full source code of this example please see example4.cpp).
+ </p>
+<p>
+ The first code snippet shows an excerpt of the token definition class,
+ the definition of a couple of token types. Some of the token types do
+ not expose a special token value (<tt class="computeroutput"><span class="identifier">if_</span></tt>,
+ <tt class="computeroutput"><span class="identifier">else_</span></tt>, and <tt class="computeroutput"><span class="identifier">while_</span></tt>). Their token value will always
+ hold the iterator range of the matched input sequence only. The token
+ definitions for the <tt class="computeroutput"><span class="identifier">identifier</span></tt>
+ and the integer <tt class="computeroutput"><span class="identifier">constant</span></tt>
+ are specialized to expose an explicit token type each: <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt> and <tt class="computeroutput"><span class="keyword">unsigned</span>
+ <span class="keyword">int</span></tt>.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="comment">// these tokens expose the iterator_range of the matched input sequence
+</span><span class="identifier">token_def</span><span class="special">&lt;&gt;</span> <span class="identifier">if_</span><span class="special">,</span> <span class="identifier">else_</span><span class="special">,</span> <span class="identifier">while_</span><span class="special">;</span>
+
+<span class="comment">// The following two tokens have an associated value type, 'identifier'
+</span><span class="comment">// carries a string (the identifier name) and 'constant' carries the
+</span><span class="comment">// matched integer value.
+</span><span class="comment">//
+</span><span class="comment">// Note: any token value type specified explicitly during a token_def&lt;&gt;
+</span><span class="comment">// declaration needs to be listed during token type definition as
+</span><span class="comment">// well (see the typedef for the token_type below).
+</span><span class="comment">//
+</span><span class="comment">// The conversion of the matched input to an instance of this type occurs
+</span><span class="comment">// once (on first access), which makes token values as efficient as
+</span><span class="comment">// possible. Moreover, token instances are constructed once by the lexer
+</span><span class="comment">// library. From this point on tokens are passed by reference only,
+</span><span class="comment">// avoiding tokens being copied around.
+</span><span class="identifier">token_def</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">identifier</span><span class="special">;</span>
+<span class="identifier">token_def</span><span class="special">&lt;</span><span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">constant</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ As the parsers generated by <span class="emphasis"><em>Spirit.Qi</em></span> are fully
+ attributed, any <span class="emphasis"><em>Spirit.Qi</em></span> parser component needs
+ to expose a certain type as its parser attribute. Naturally, the token_def<> exposes the token value
+ type as its parser attribute, enabling a smooth integration with <span class="emphasis"><em>Spirit.Qi</em></span>.
+ </p>
+<p>
+ The next code snippet demonstrates how the required token value types
+ are specified while defining the token type to use. All of the token
+ value types used for at least one of the token definitions have to be
+ re-iterated for the token definition as well.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="comment">// This is the lexer token type to use. The second template parameter lists
+</span><span class="comment">// all attribute types used for token_def's during token definition (see
+</span><span class="comment">// calculator_tokens&lt;&gt; above). Here we use the predefined lexertl token
+</span><span class="comment">// type, but any compatible token type may be used instead.
+</span><span class="comment">//
+</span><span class="comment">// If you don't list any token value types in the following declaration
+</span><span class="comment">// (or just use the default token type: lexertl_token&lt;base_iterator_type&gt;)
+</span><span class="comment">// it will compile and work just fine, just a bit less efficient. This is
+</span><span class="comment">// because the token value will be generated from the matched input
+</span><span class="comment">// sequence every time it is requested. But as soon as you specify at
+</span><span class="comment">// least one token value type you'll have to list all value types used
+</span><span class="comment">// for token_def&lt;&gt; declarations in the token definition class above,
+</span><span class="comment">// otherwise compilation errors will occur.
+</span><span class="keyword">typedef</span> <span class="identifier">lexertl_token</span><span class="special">&lt;</span>
+ <span class="identifier">base_iterator_type</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">unsigned</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">&gt;</span>
+<span class="special">&gt;</span> <span class="identifier">token_type</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ To avoid the token to have a token value at all, the special tag <tt class="computeroutput"><span class="identifier">omitted</span></tt> can be used: <tt class="computeroutput"><span class="identifier">token_def</span><span class="special">&lt;</span><span class="identifier">omitted</span><span class="special">&gt;</span></tt>
+ and <tt class="computeroutput"><span class="identifier">lexertl_token</span><span class="special">&lt;</span><span class="identifier">base_iterator_type</span><span class="special">,</span>
+ <span class="identifier">omitted</span><span class="special">&gt;</span></tt>.
+ </p>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title">
+<a name="spirit.__lex__.abstracts.lexer_primitives.ways_to_define_tokens"></a><a href="abstracts.html#spirit.__lex__.abstracts.lexer_primitives.ways_to_define_tokens" title="Ways
+ to define Tokens">Ways
+ to define Tokens</a></h5></div></div></div></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="__lex___tutorials/quickstart_3___counting_words_using_a_parser.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex__.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="abstracts/tokenizing_input_data.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_attributes.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_attributes.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Lexer Attributes</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="parsing_using_a_lexer.html" title="Parsing
+ using a Lexer">
+<link rel="next" href="lexer_states.html" title="Lexer States">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="parsing_using_a_lexer.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="lexer_states.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.abstracts.lexer_attributes"></a>Lexer Attributes</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="parsing_using_a_lexer.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="lexer_states.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_semantic_actions.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_semantic_actions.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,46 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Lexer
+ Semantic Actions</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="tokenizing_input_data.html" title="Tokenizing
+ Input Data">
+<link rel="next" href="the__static__lexer_model.html" title="The
+ Static Lexer Model">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tokenizing_input_data.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="the__static__lexer_model.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.abstracts.lexer_semantic_actions"></a><a href="lexer_semantic_actions.html" title="Lexer
+ Semantic Actions">Lexer
+ Semantic Actions</a></h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tokenizing_input_data.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="the__static__lexer_model.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_states.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/lexer_states.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,58 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Lexer States</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="lexer_attributes.html" title="Lexer Attributes">
+<link rel="next" href="../quick_reference.html" title="Quick Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="lexer_attributes.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../quick_reference.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<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 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 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 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>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="lexer_attributes.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../quick_reference.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/parsing_using_a_lexer.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/parsing_using_a_lexer.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Parsing
+ using a Lexer</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="the__static__lexer_model.html" title="The
+ Static Lexer Model">
+<link rel="next" href="lexer_attributes.html" title="Lexer Attributes">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="the__static__lexer_model.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="lexer_attributes.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.abstracts.parsing_using_a_lexer"></a><a href="parsing_using_a_lexer.html" title="Parsing
+ using a Lexer">Parsing
+ using a Lexer</a></h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="the__static__lexer_model.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="lexer_attributes.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/the__static__lexer_model.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/the__static__lexer_model.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,338 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>The
+ Static Lexer Model</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="lexer_semantic_actions.html" title="Lexer
+ Semantic Actions">
+<link rel="next" href="parsing_using_a_lexer.html" title="Parsing
+ using a Lexer">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="lexer_semantic_actions.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="parsing_using_a_lexer.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.abstracts.the__static__lexer_model"></a><a href="the__static__lexer_model.html" title="The
+ Static Lexer Model">The
+ <span class="emphasis"><em>Static</em></span> Lexer Model</a></h4></div></div></div>
+<p>
+ The documentation of <span class="emphasis"><em>Spirit.Lex</em></span> so far mostly was
+ about describing the features of the <span class="emphasis"><em>dynamic</em></span> model,
+ where the tables needed for lexical analysis are generated from the regular
+ expressions at runtime. The big advantage of the dynamic model is its flexibility,
+ and its integration with the Spirit
+ library and the C++ host language. Its big disadvantage is the need to
+ spend additional runtime to generate the tables, which especially might
+ be a limitation for larger lexical analyers. The <span class="emphasis"><em>static</em></span>
+ model strives to build upon the smooth integration with Spirit
+ and C++, and reuses large parts of the <span class="emphasis"><em>Spirit.Lex</em></span>
+ library as described so far, while overcoming the additional runtime requirements
+ by using pre-generated tables and tokenizer routines. To make the code
+ generation as simple as possible, it is possible reuse the token definition
+ types developed using the <span class="emphasis"><em>dynamic</em></span> model without any
+ changes. As will be shown in this section, building a code generator based
+ on an existing token definition type is a matter of writing 3 lines of
+ code.
+ </p>
+<p>
+ Assuming you already built a dynamic lexer for your problem, there are
+ two more steps needed to create a static lexical analyzer using <span class="emphasis"><em>Spirit.Lex</em></span>:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ generating the C++ code for the static analyzer (including the tokenization
+ function and corresponding tables), and
+ </li>
+<li>
+ modifying the dynamic lexical anlyzer to use the generated code.
+ </li>
+</ol></div>
+<p>
+ Both steps are described in more detail in the two sections below (for
+ the full source code used in this example see the code here: <a href="../../../../../example/lex/static_lexer/word_count_tokens.hpp" target="_top">the
+ common token definition</a>, <a href="../../../../../example/lex/static_lexer/word_count_generate.cpp" target="_top">the
+ code generator</a>, <a href="../../../../../example/lex/static_lexer/word_count_static.hpp" target="_top">the
+ generated code</a>, and <a href="../../../../../example/lex/static_lexer/word_count_static.cpp" target="_top">the
+ static lexical analyzer</a>).
+ </p>
+<p>
+ But first we provide the code snippets needed to understand the further
+ descriptions. Both, the definition of the used token identifier and the
+ of the token definition class in this example are put into a separate header
+ file to make these available to the code generator and the static lexical
+ analyzer.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">enum</span> <span class="identifier">tokenids</span>
+<span class="special">{</span>
+ <span class="identifier">IDANY</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lex</span><span class="special">::</span><span class="identifier">min_token_id</span> <span class="special">+</span> <span class="number">1</span><span class="special">,</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ The important point here is, that the token definition class is not different
+ from a similar class to be used for a dynamic lexical analyzer. The library
+ has been designed in a way, that all components (dynamic lexical analyzer,
+ code generator, and static lexical analyzer) can reuse the very same token
+ definition syntax.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="comment">// This token definition class can be used without any change for all three
+</span><span class="comment">// possible use cases: a dynamic lexical analyzer, a code generator, and a
+</span><span class="comment">// static lexical analyzer.
+</span><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">BaseLexer</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">word_count_tokens</span> <span class="special">:</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lex</span><span class="special">::</span><span class="identifier">lexer_def</span><span class="special">&lt;</span><span class="identifier">BaseLexer</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Self</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <span class="identifier">def</span> <span class="special">(</span><span class="identifier">Self</span><span class="special">&amp;</span> <span class="identifier">self</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="comment">// define tokens and associate them with the lexer
+</span> <span class="identifier">word</span> <span class="special">=</span> <span class="string">"[^ \t\n]+"</span><span class="special">;</span>
+ <span class="identifier">self</span> <span class="special">=</span> <span class="identifier">word</span> <span class="special">|</span> <span class="char">'\n'</span> <span class="special">|</span> <span class="identifier">token_def</span><span class="special">&lt;&gt;(</span><span class="string">"."</span><span class="special">,</span> <span class="identifier">IDANY</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lex</span><span class="special">::</span><span class="identifier">token_def</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">word</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ The only thing changing between the three different use cases is the template
+ parameter used to instantiate a concrete token definition. Fot the dynamic
+ model and the code generator you probably will use the lexertl_lexer<>
+ template, where for the static model you will use the lexertl_static_lexer<>
+ type as the template parameter.
+ </p>
+<p>
+ This example not only shows how to build a static lexer, but it additionally
+ demonstrates, how such a lexer can be used for parsing in conjunction with
+ a <span class="emphasis"><em>Spirit.Qi</em></span> grammar. For completeness we provide the
+ simple grammar used in this example. As you can see, this grammar does
+ not have any dependencies on the static lexical analyzer, and for this
+ reason it is not different from a grammar used either without a lexer or
+ using a dynamic lexical analyzer as described before.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="comment">// This is an ordinary grammar definition following the rules defined by
+</span><span class="comment">// Spirit.Qi. There is nothing specific about it, except it gets the token
+</span><span class="comment">// definition class instance passed to the constructor to allow accessing the
+</span><span class="comment">// embedded token_def&lt;&gt; instances.
+</span><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">word_count_grammar</span> <span class="special">:</span> <span class="identifier">grammar_def</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">TokenDef</span><span class="special">&gt;</span>
+ <span class="identifier">word_count_grammar</span><span class="special">(</span><span class="identifier">TokenDef</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">tok</span><span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">c</span><span class="special">(</span><span class="number">0</span><span class="special">),</span> <span class="identifier">w</span><span class="special">(</span><span class="number">0</span><span class="special">),</span> <span class="identifier">l</span><span class="special">(</span><span class="number">0</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">::</span><span class="identifier">_1</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">ref</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">::</span><span class="identifier">size</span><span class="special">;</span>
+
+ <span class="comment">// associate the defined tokens with the lexer, at the same time
+</span> <span class="comment">// defining the actions to be executed
+</span> <span class="identifier">start</span> <span class="special">=</span> <span class="special">*(</span> <span class="identifier">tok</span><span class="special">.</span><span class="identifier">word</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">w</span><span class="special">),</span> <span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">size</span><span class="special">(</span><span class="identifier">_1</span><span class="special">)]</span>
+ <span class="special">|</span> <span class="identifier">char_</span><span class="special">(</span><span class="char">'\n'</span><span class="special">)</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">l</span><span class="special">),</span> <span class="special">++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)]</span>
+ <span class="special">|</span> <span class="identifier">token</span><span class="special">(</span><span class="identifier">IDANY</span><span class="special">)</span> <span class="special">[++</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">c</span><span class="special">)]</span>
+ <span class="special">)</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">w</span><span class="special">,</span> <span class="identifier">l</span><span class="special">;</span> <span class="comment">// counter for characters, words, and lines
+</span> <span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;</span> <span class="identifier">start</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<a name="spirit.__lex__.abstracts.the__static__lexer_model.generating_the_static_analyzer"></a><h5>
+<a name="id487732"></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>
+<p>
+ The first additional step to perform in order to create a static lexical
+ analyzer is to create a small standalone program for creating the lexer
+ tables and the corresponding tokenization function. For this purpose the
+ <span class="emphasis"><em>Spirit.Lex</em></span> library exposes a special API - the function
+ generate_static().
+ It implements the whole code generator, no further code is needed. All
+ what it takes to invoke this function is to supply a token definition instance,
+ an output stream to use to generate the code to, and an optional string
+ to be used as a prefix for the name of the generated function. All in all
+ just a couple lines of code.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">argv</span><span class="special">[])</span>
+<span class="special">{</span>
+ <span class="comment">// create the lexer object instance needed to invoke the generator
+</span> <span class="identifier">word_count_tokens</span><span class="special">&lt;</span><span class="identifier">lexertl_lexer</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span> <span class="identifier">word_count</span><span class="special">;</span> <span class="comment">// the token definition
+</span>
+ <span class="comment">// open the output file, where the generated tokenizer function will be
+</span> <span class="comment">// written to
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ofstream</span> <span class="identifier">out</span><span class="special">(</span><span class="identifier">argc</span> <span class="special">&lt;</span> <span class="number">2</span> <span class="special">?</span> <span class="string">"word_count_static.hpp"</span> <span class="special">:</span> <span class="identifier">argv</span><span class="special">[</span><span class="number">1</span><span class="special">]);</span>
+
+ <span class="comment">// invoke the generator, passing the token definition, the output stream
+</span> <span class="comment">// and the name prefix of the tokenizing function to be generated
+</span> <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">function_name</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">argc</span> <span class="special">&lt;</span> <span class="number">3</span> <span class="special">?</span> <span class="string">""</span> <span class="special">:</span> <span class="identifier">argv</span><span class="special">[</span><span class="number">2</span><span class="special">]);</span>
+ <span class="keyword">return</span> <span class="identifier">generate_static</span><span class="special">(</span><span class="identifier">make_lexer</span><span class="special">(</span><span class="identifier">word_count</span><span class="special">),</span> <span class="identifier">out</span><span class="special">,</span> <span class="identifier">function_name</span><span class="special">)</span> <span class="special">?</span> <span class="number">0</span> <span class="special">:</span> <span class="special">-</span><span class="number">1</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ The shown code generator will generate output, which should be stored in
+ a file for later inclusion into the static lexical analzyer as shown in
+ 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 href="the__static__lexer_model.html#spirit.__lex__.abstracts.the__static__lexer_model.modifying_the_dynamic_analyzer">Modifying
+ the Dynamic Analyzer</a>
+ </h5>
+<p>
+ The second required step to convert an existing dynamic lexer into a static
+ one is to change your main program at two places. First, you need to change
+ the type of the used lexer (that is the template parameter used while instantiating
+ your token definition class). While in the dynamic model we have been using
+ the lexertl_lexer<>
+ template, we now need to change that to the lexertl_static_lexer<>
+ type. The second change is tightly related to the first one and involves
+ correcting the corresponding <tt class="computeroutput"><span class="preprocessor">#include</span></tt>
+ statement to:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">lex_lexer_static_lexertl</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Otherwise the main program is not different from an equivalent program
+ using the dynamic model. This feature makes it really easy for instance
+ to develop the lexer in dynamic mode and to switch to the static mode after
+ the code has been stabilized. The simple generator application showed above
+ enables the integration of the code generator into any existing build process.
+ The following code snippet provides the overall main function, highlighting
+ the code to be changed.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">argv</span><span class="special">[])</span>
+<span class="special">{</span>
+ <span class="comment">// Define the token type to be used: 'std::string' is available as the type
+</span> <span class="comment">// of the token value.
+</span> <span class="keyword">typedef</span> <span class="identifier">lexertl_token</span><span class="special">&lt;</span>
+ <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</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">string</span><span class="special">&gt;</span>
+ <span class="special">&gt;</span> <span class="identifier">token_type</span><span class="special">;</span>
+
+ <span class="comment">// Define the lexer type to be used as the base class for our token
+</span> <span class="comment">// definition.
+</span> <span class="comment">//
+</span> <span class="comment">// This is the only place where the code is different from an equivalent
+</span> <span class="comment">// dynamic lexical analyzer. We use the `lexertl_static_lexer&lt;&gt;` instead of
+</span> <span class="comment">// the `lexertl_lexer&lt;&gt;` as the base class for our token defintion type.
+</span> <span class="comment">//
+</span> <span class="keyword">typedef</span> <span class="identifier">lexertl_static_lexer</span><span class="special">&lt;</span><span class="identifier">token_type</span><span class="special">&gt;</span> <span class="identifier">lexer_type</span><span class="special">;</span>
+
+ <span class="comment">// Define the iterator type exposed by the lexer.
+</span> <span class="keyword">typedef</span> <span class="identifier">lexer_iterator</span><span class="special">&lt;</span><span class="identifier">word_count_tokens</span><span class="special">&lt;</span><span class="identifier">lexer_type</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">iterator_type</span><span class="special">;</span>
+
+ <span class="comment">// Now we use the types defined above to create the lexer and grammar
+</span> <span class="comment">// object instances needed to invoke the parsing process.
+</span> <span class="identifier">word_count_tokens</span><span class="special">&lt;</span><span class="identifier">lexer_type</span><span class="special">&gt;</span> <span class="identifier">word_count</span><span class="special">;</span> <span class="comment">// Our token definition
+</span> <span class="identifier">word_count_grammar</span><span class="special">&lt;</span><span class="identifier">iterator_type</span><span class="special">&gt;</span> <span class="identifier">def</span> <span class="special">(</span><span class="identifier">word_count</span><span class="special">);</span> <span class="comment">// Our grammar definition
+</span>
+ <span class="comment">// Read in the file into memory.
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span> <span class="special">(</span><span class="identifier">read_from_file</span><span class="special">(</span><span class="number">1</span> <span class="special">==</span> <span class="identifier">argc</span> <span class="special">?</span> <span class="string">"word_count.input"</span> <span class="special">:</span> <span class="identifier">argv</span><span class="special">[</span><span class="number">1</span><span class="special">]));</span>
+ <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">first</span> <span class="special">=</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">c_str</span><span class="special">();</span>
+ <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">last</span> <span class="special">=</span> <span class="special">&amp;</span><span class="identifier">first</span><span class="special">[</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">size</span><span class="special">()];</span>
+
+ <span class="comment">// Parsing is done based on the the token stream, not the character stream.
+</span> <span class="identifier">qi</span><span class="special">::</span><span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">word_count_grammar</span><span class="special">&lt;</span><span class="identifier">iterator_type</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">def</span><span class="special">);</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">tokenize_and_parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">make_lexer</span><span class="special">(</span><span class="identifier">word_count</span><span class="special">),</span> <span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">r</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// success
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"lines: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">def</span><span class="special">.</span><span class="identifier">l</span> <span class="special">&lt;&lt;</span> <span class="string">", words: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">def</span><span class="special">.</span><span class="identifier">w</span>
+ <span class="special">&lt;&lt;</span> <span class="string">", characters: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">def</span><span class="special">.</span><span class="identifier">c</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">else</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">rest</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cerr</span> <span class="special">&lt;&lt;</span> <span class="string">"Parsing failed\n"</span> <span class="special">&lt;&lt;</span> <span class="string">"stopped at: \""</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">rest</span> <span class="special">&lt;&lt;</span> <span class="string">"\"\n"</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="lexer_semantic_actions.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="parsing_using_a_lexer.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/tokenizing_input_data.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/abstracts/tokenizing_input_data.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tokenizing
+ Input Data</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="../abstracts.html" title="Abstracts">
+<link rel="next" href="lexer_semantic_actions.html" title="Lexer
+ Semantic Actions">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../abstracts.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="lexer_semantic_actions.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.abstracts.tokenizing_input_data"></a><a href="tokenizing_input_data.html" title="Tokenizing
+ 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 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 href="tokenizing_input_data.html#spirit.__lex__.abstracts.tokenizing_input_data.the_generate_static___function">The
+ generate_static() function</a>
+ </h5>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../abstracts.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="lexer_semantic_actions.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/quick_reference.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/quick_reference.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Quick Reference</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../__lex__.html" title="Spirit.Lex">
+<link rel="prev" href="abstracts/lexer_states.html" title="Lexer States">
+<link rel="next" href="reference.html" title="Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="abstracts/lexer_states.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex__.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.__lex__.quick_reference"></a>Quick Reference</h3></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="abstracts/lexer_states.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex__.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/reference.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/reference.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Reference</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../__lex__.html" title="Spirit.Lex">
+<link rel="prev" href="quick_reference.html" title="Quick Reference">
+<link rel="next" href="reference/lexer_class.html" title="Lexer Class">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="quick_reference.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex__.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference/lexer_class.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.__lex__.reference"></a>Reference</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Concepts</span></dt>
+<dt><span class="section">Lexer Class</span></dt>
+<dt><span class="section">Token Class</span></dt>
+<dt><span class="section">TokenDef Class</span></dt>
+<dt><span class="section">TokenSet Class</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.reference.concepts"></a>Concepts</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Lexer</span></dt>
+<dt><span class="section">Token</span></dt>
+<dt><span class="section">TokenDef</span></dt>
+<dt><span class="section">TokenSet</span></dt>
+</dl></div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title">
+<a name="spirit.__lex__.reference.concepts.lexer"></a>Lexer</h5></div></div></div></div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title">
+<a name="spirit.__lex__.reference.concepts.token"></a>Token</h5></div></div></div></div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title">
+<a name="spirit.__lex__.reference.concepts.tokendef"></a>TokenDef</h5></div></div></div></div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title">
+<a name="spirit.__lex__.reference.concepts.tokenset"></a>TokenSet</h5></div></div></div></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="quick_reference.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../__lex__.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference/lexer_class.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/reference/lexer_class.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/reference/lexer_class.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,63 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Lexer Class</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="../reference.html" title="Reference">
+<link rel="next" href="token_class.html" title="Token Class">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="token_class.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<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 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 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 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 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>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="token_class.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/reference/token_class.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/reference/token_class.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Token Class</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="lexer_class.html" title="Lexer Class">
+<link rel="next" href="tokendef_class.html" title="TokenDef Class">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="lexer_class.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="tokendef_class.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.reference.token_class"></a>Token Class</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="lexer_class.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="tokendef_class.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/reference/tokendef_class.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/reference/tokendef_class.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>TokenDef Class</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="token_class.html" title="Token Class">
+<link rel="next" href="tokenset_class.html" title="TokenSet Class">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="token_class.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="tokenset_class.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.reference.tokendef_class"></a>TokenDef Class</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="token_class.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="tokenset_class.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/__lex__/reference/tokenset_class.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/__lex__/reference/tokenset_class.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>TokenSet Class</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="tokendef_class.html" title="TokenDef Class">
+<link rel="next" href="../../faq.html" title="FAQ">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tokendef_class.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../faq.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.__lex__.reference.tokenset_class"></a>TokenSet Class</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tokendef_class.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../faq.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/acknowledgments.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/acknowledgments.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,239 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Acknowledgments</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="rationale.html" title="Rationale">
+<link rel="next" href="references.html" title="References">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="rationale.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="references.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.acknowledgments"></a>Acknowledgments</h2></div></div></div>
+<p>
+ This version of Spirit is a complete rewrite of the <span class="emphasis"><em>classic</em></span>
+ Spirit many people have been contributing to (see below). But there are a couple
+ of people who already managed to help significantly during this rewrite. We
+ would like to express our special acknowledgement to:
+ </p>
+<p>
+ <span class="bold"><b>Eric Niebler</b></span> for writing Boost.Proto, without
+ which this rewrite wouldn't have been possible, and helping with examples,
+ advices, and suggestions on how to use Boost.Proto in the best possible way.
+ </p>
+<p>
+ <span class="bold"><b>Ben Hanson</b></span> for providing us with an early
+ version of his Lexertl library, which is proposed to be included into Boost
+ (as Boost.Lexer), but at the time of this writing the Boost review for this
+ library is still pending.
+ </p>
+<p>
+ <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 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>
+<p>
+ Special thanks for working on Spirit <span class="emphasis"><em>classic</em></span> to:
+ </p>
+<p>
+ <span class="bold"><b>Dan Nuffer</b></span> for his work on lexers, parse trees,
+ ASTs, XML parsers, the multi-pass iterator as well as administering Spirit's
+ site, editing, maintaining the CVS and doing the releases plus a zillion of
+ other chores that were almost taken for granted.
+ </p>
+<p>
+ <span class="bold"><b>Hartmut Kaiser</b></span> for his work on the C parser,
+ the work on the C/C++ preprocessor, utility parsers, the original port to Intel
+ 5.0, various work on Phoenix, porting to v1.5, the meta-parsers, the grouping-parsers,
+ extensive testing and painstaking attention to details.
+ </p>
+<p>
+ <span class="bold"><b>Martin Wille</b></span> who improved grammar multi thread
+ safety, contributed the eol_p parser, the dynamic parsers, documentation and
+ for taking an active role in almost every aspect from brainstorming and design
+ to coding. And, as always, helps keep the regression tests for g++ on Linux
+ as green as ever :-).
+ </p>
+<p>
+ <span class="bold"><b>Martijn W. Van Der Lee</b></span> our Web site administrator
+ and for contributing the RFC821 parser.
+ </p>
+<p>
+ <span class="bold"><b>Giovanni Bajo</b></span> for last minute tweaks of Spirit
+ 1.8.0 for CodeWarrior 8.3. Actually, I'm ashamed Giovanni was not in this list
+ already. He's done a lot since Spirit 1.5, the first Boost.Spirit release.
+ He's instrumental in the porting of the Spirit iterators stuff to the new Boost
+ Iterators Library (version 2). He also did various bug fixes and wrote some
+ tests here and there.
+ </p>
+<p>
+ <span class="bold"><b>Juan Carlos Arevalo-Baeza (JCAB)*</b></span> for his
+ work on the C++ parser, the position iterator, ports to v1.5 and keeping the
+ mailing list discussions alive and kicking.
+ </p>
+<p>
+ <span class="bold"><b>Vaclav Vesely</b></span>, lots of stuff, the no_actions
+ directive, various patches fixes, the distinct parsers, the lazy parser, some
+ phoenix tweaks and add-ons (e.g. new_). Also, *Stefan Slapeta] and wife for
+ editing Vaclav's distinct parser doc.
+ </p>
+<p>
+ <span class="bold"><b>Raghavendra Satish</b></span> for doing the original
+ v1.3 port to VC++ and his work on Phoenix.
+ </p>
+<p>
+ <span class="bold"><b>Noah Stein</b></span> for following up and helping Ragav
+ on the VC++ ports.
+ </p>
+<p>
+ <span class="bold"><b>Hakki Dogusan</b></span>, for his original v1.0 Pascal
+ parser.
+ </p>
+<p>
+ <span class="bold"><b>John (EBo) David</b></span> for his work on the VM and
+ watching over my shoulder as I code giving the impression of distance eXtreme
+ programming.
+ </p>
+<p>
+ <span class="bold"><b>Chris Uzdavinis</b></span> for feeding in comments and
+ valuable suggestions as well as editing the documentation.
+ </p>
+<p>
+ <span class="bold"><b>Carsten Stoll</b></span>, for his work on dynamic parsers.
+ </p>
+<p>
+ <span class="bold"><b>Andy Elvey</b></span> and his conifer parser.
+ </p>
+<p>
+ <span class="bold"><b>Bruce Florman</b></span>, who did the original v1.0 port
+ to VC++.
+ </p>
+<p>
+ <span class="bold"><b>Jeff Westfahl</b></span> for porting the loop parsers
+ to v1.5 and contributing the file iterator.
+ </p>
+<p>
+ <span class="bold"><b>Peter Simons</b></span> for the RFC date parser example
+ and tutorial plus helping out with some nitty gritty details.
+ </p>
+<p>
+ <span class="bold"><b>Markus Schöpflin</b></span> for suggesting the end_p parser
+ and lots of other nifty things and his active presence in the mailing list.
+ </p>
+<p>
+ <span class="bold"><b>Doug Gregor</b></span> for mentoring and his ability
+ to see things that others don't.
+ </p>
+<p>
+ <span class="bold"><b>David Abrahams</b></span> for giving Joel a job that
+ allows him to still work on Spirit, plus countless advice and help on C++ and
+ specifically template metaprogramming.
+ </p>
+<p>
+ <span class="bold"><b>Aleksey Gurtovoy</b></span> for his MPL library from
+ which we stole many metaprogramming tricks especially for less conforming compilers
+ such as Borland and VC6/7.
+ </p>
+<p>
+ <span class="bold"><b>Gustavo Guerra</b></span> for his last minute review
+ of Spirit and constant feedback, plus patches here and there (e.g. proposing
+ the new dot behavior of the real numerics parsers).
+ </p>
+<p>
+ <span class="bold"><b>Nicola Musatti</b></span>, <span class="bold"><b>Paul
+ Snively</b></span>, <span class="bold"><b>Alisdair Meredith</b></span> and
+ <span class="bold"><b>Hugo Duncan</b></span> for testing and sending in various
+ patches.
+ </p>
+<p>
+ <span class="bold"><b>Steve Rowe</b></span> for his splendid work on the TSTs
+ that will soon be taken into Spirit.
+ </p>
+<p>
+ <span class="bold"><b>Jonathan de Halleux</b></span> for his work on actors.
+ </p>
+<p>
+ <span class="bold"><b>Angus Leeming</b></span> for last minute editing work
+ on the 1.8.0 release documentation, his work on Phoenix and his active presence
+ in the Spirit mailing list.
+ </p>
+<p>
+ <span class="bold"><b>Joao Abecasis</b></span> for his active presence in the
+ Spirit mailing list, providing user support, participating in the discussions
+ and so on.
+ </p>
+<p>
+ <span class="bold"><b>Guillaume Melquiond</b></span> for a last minute patch
+ to multi_pass for 1.8.1.
+ </p>
+<p>
+ <span class="bold"><b>Peder Holt</b></span> for his porting work on Phoenix,
+ Fusion and Spirit to VC6.
+ </p>
+<p>
+ To Joels wife Mariel who did the graphics in this document.
+ </p>
+<p>
+ My, there's a lot in this list! And it's a continuing list. We add people to
+ this list everytime. We hope we did not forget anyone. If we missed someone
+ you know who has helped in any way, please inform us.
+ </p>
+<p>
+ Special thanks also to people who gave feedback and valuable comments, particularly
+ members of Boost and Spirit mailing lists. This includes all those who participated
+ in the review:
+ </p>
+<p>
+ <span class="bold"><b>John Maddock</b></span>, our review manager, <span class="bold"><b>Aleksey Gurtovoy</b></span>, <span class="bold"><b>Andre Hentz</b></span>,
+ <span class="bold"><b>Beman Dawes</b></span>, <span class="bold"><b>Carl Daniel</b></span>,
+ <span class="bold"><b>Christopher Currie</b></span>, <span class="bold"><b>Dan
+ Gohman</b></span>, <span class="bold"><b>Dan Nuffer</b></span>, <span class="bold"><b>Daryle
+ Walker</b></span>, <span class="bold"><b>David Abrahams</b></span>, <span class="bold"><b>David B. Held</b></span>, <span class="bold"><b>Dirk Gerrits</b></span>,
+ <span class="bold"><b>Douglas Gregor</b></span>, <span class="bold"><b>Hartmut
+ Kaiser</b></span>, <span class="bold"><b>Iain K.Hanson</b></span>, <span class="bold"><b>Juan Carlos Arevalo-Baeza</b></span>, <span class="bold"><b>Larry
+ Evans</b></span>, <span class="bold"><b>Martin Wille</b></span>, <span class="bold"><b>Mattias Flodin</b></span>, <span class="bold"><b>Noah Stein</b></span>,
+ <span class="bold"><b>Nuno Lucas</b></span>, <span class="bold"><b>Peter Dimov</b></span>,
+ <span class="bold"><b>Peter Simons</b></span>, <span class="bold"><b>Petr Kocmid</b></span>,
+ <span class="bold"><b>Ross Smith</b></span>, <span class="bold"><b>Scott Kirkwood</b></span>,
+ <span class="bold"><b>Steve Cleary</b></span>, <span class="bold"><b>Thorsten
+ Ottosen</b></span>, <span class="bold"><b>Tom Wenisch</b></span>, <span class="bold"><b>Vladimir Prus</b></span>
+ </p>
+<p>
+ Finally thanks to SourceForge for hosting the Spirit project and Boost: a C++
+ community comprised of extremely talented library authors who participate in
+ the discussion and peer review of well crafted C++ libraries.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="rationale.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="references.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/faq.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/faq.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>FAQ</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="__lex__/reference/tokenset_class.html" title="TokenSet Class">
+<link rel="next" href="notes.html" title="Notes">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="__lex__/reference/tokenset_class.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="notes.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.faq"></a>FAQ</h2></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="__lex__/reference/tokenset_class.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="notes.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/introduction.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/introduction.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,464 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Introduction</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="what_s_new.html" title="What's New">
+<link rel="next" href="qi_and_karma.html" title="Qi and Karma">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="what_s_new.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_and_karma.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.introduction"></a>Introduction</h2></div></div></div>
+<p>
+ Boost Spirit is an object oriented, recursive-descent parser and output generation
+ library for C++. It allows to write grammars and format descriptions using
+ a format very similar to EBNF (Extended Backus Naur Form, see [4]) directly
+ in C++. These inline grammar specifications can mix freely with other C++ code
+ and, thanks to the generative power of C++ templates, are immediately executable.
+ In retrospect, conventional compiler-compilers or parser-generators have to
+ perform an additional translation step from the source EBNF code to C or C++
+ code.
+ </p>
+<p>
+ The syntax and semantics of the libraries API directly form domain specific
+ embedded languages (DSEL). In fact, Spirit exposes 3 different DSEL's to the
+ user:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ one for creating parser grammars,
+ </li>
+<li>
+ one for the specification of the required tokens to be used for parsing,
+ </li>
+<li>
+ and one for the description of the required output formats.
+ </li>
+</ul></div>
+<p>
+ Since the target input grammars and output formats are written entirely in
+ C++ we do not need any separate tools to compile, preprocess, or integrate
+ those into the build process. Spirit
+ allows seamless integration of the parsing and output generation process with
+ other C++ code. Often this allows for simpler and more efficient code.
+ </p>
+<p>
+ Both, the created parsers and generators, are fully attributed which allows
+ to easily build and handle hierarchical data structures in memory. These data
+ structures resemble the structure of the input data and can directly be used
+ to generate arbitrarily formatted output.
+ </p>
+<p>
+ The figure below depicts the
+ overall structure of the Boost Spirit library. The library consists out of
+ 4 major parts:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="emphasis"><em>Spirit.Classic</em></span>: This is the almost unchanged code base
+ taken from the former Boost Spirit V1.8 distribution. It has been moved into
+ the namespace boost::spirit::classic. A special compatibility layer has been
+ added to ensure complete compatibility with existing code using Spirit V1.8.
+ </li>
+<li>
+<span class="emphasis"><em>Spirit.Qi</em></span>: This is the parser library allowing to build
+ recursive descent parsers. The exposed domain specific language can be used
+ to describe the grammars to implement, and the rules for storing the parsed
+ information.
+ </li>
+<li>
+<span class="emphasis"><em>Spirit.Lex</em></span>: This is the library usable to create tokinizers
+ (lexers). The domain specific language exposed by <span class="emphasis"><em>Spirit.Lex</em></span>
+</li>
+<li>
+<span class="emphasis"><em>Spirit.Karma</em></span>: This is the generator library allowing
+ to create code for recursive descent, data type driven output formatting.
+ The exposed domain specific language is almost equivalent to the parser description
+ language used in <span class="emphasis"><em>Spirit.Qi</em></span>, except that it is used to
+ describe the required output format to generate from a given data structure.
+ </li>
+</ul></div>
+<p>
+ </p>
+<div class="figure">
+<a name="spirit.spiritstructure"></a><p class="title"><b>Figure 1. The overall structure of the Boost Spirit library</b></p>
+<span class="inlinemediaobject"><img src=".././images/spiritstructure.png" alt="The
+ overall structure of the Boost Spirit library"></span>
+</div>
+<p>
+ </p>
+<p>
+ The separate sublibraries <span class="emphasis"><em>Spirit.Qi</em></span>, <span class="emphasis"><em>Spirit.Karma</em></span>
+ and <span class="emphasis"><em>Spirit.Lex</em></span> are well integrated with any of the other
+ parts. Because of their similar structure and identical underlying technology
+ these are usable either separately or together at the same time. For instance
+ is it possible to directly feed the hierarchical data structures generated
+ by <span class="emphasis"><em>Spirit.Qi</em></span> into output generators created using <span class="emphasis"><em>Spirit.Karma</em></span>;
+ or to use the token sequence generated by <span class="emphasis"><em>Spirit.Lex</em></span> as
+ the input for a parser generated by <span class="emphasis"><em>Spirit.Qi</em></span>.
+ </p>
+<p>
+ The <a href="introduction.html#spirit.spiritkarmaflow" title="Figure 2. The place of Spirit.Qi and Spirit.Karma
+ in a data transformation flow of a typical application">figure</a> below shows the typical
+ data flow of some input being converted to some internal representation. After
+ some (optional) transformation this data is converted back into some different,
+ external representation. The picture highlights Spirit's the place in this
+ data transformation flow.
+ </p>
+<p>
+ </p>
+<div class="figure">
+<a name="spirit.spiritkarmaflow"></a><p class="title"><b>Figure 2. The place of <span class="emphasis"><em>Spirit.Qi</em></span> and <span class="emphasis"><em>Spirit.Karma</em></span>
+ in a data transformation flow of a typical application</b></p>
+<span class="inlinemediaobject"><img src=".././images/spiritkarmaflow.png" alt="The
+ place of Spirit.Qi and Spirit.Karma
+ in a data transformation flow of a typical application"></span>
+</div>
+<p>
+ </p>
+<a name="spirit.introduction.a_quick_overview_about_parsing_with__emphasis_spirit_qi__emphasis_"></a><h3>
+<a name="id456629"></a>
+ <a href="introduction.html#spirit.introduction.a_quick_overview_about_parsing_with__emphasis_spirit_qi__emphasis_">A
+ quick overview about Parsing with <span class="emphasis"><em>Spirit.Qi</em></span></a>
+ </h3>
+<p>
+ <span class="emphasis"><em>Spirit.Qi</em></span> is Spirit's sublibrary dealing with generating
+ parsers based on a given target grammar (essentially a format description of
+ the input data to read).
+ </p>
+<p>
+ A simple EBNF grammar snippet:
+ </p>
+<pre class="programlisting">
+<span class="identifier">group</span> <span class="special">::=</span> <span class="char">'('</span> <span class="identifier">expression</span> <span class="char">')'</span>
+<span class="identifier">factor</span> <span class="special">::=</span> <span class="identifier">integer</span> <span class="special">|</span> <span class="identifier">group</span>
+<span class="identifier">term</span> <span class="special">::=</span> <span class="identifier">factor</span> <span class="special">((</span><span class="char">'*'</span> <span class="identifier">factor</span><span class="special">)</span> <span class="special">|</span> <span class="special">(</span><span class="char">'/'</span> <span class="identifier">factor</span><span class="special">))*</span>
+<span class="identifier">expression</span> <span class="special">::=</span> <span class="identifier">term</span> <span class="special">((</span><span class="char">'+'</span> <span class="identifier">term</span><span class="special">)</span> <span class="special">|</span> <span class="special">(</span><span class="char">'-'</span> <span class="identifier">term</span><span class="special">))*</span>
+</pre>
+<p>
+ is approximated using facilities of Spirit's <span class="emphasis"><em>Qi</em></span> sublibrary
+ as seen in this code snippet:
+ </p>
+<pre class="programlisting">
+<span class="identifier">group</span> <span class="special">=</span> <span class="char">'('</span> <span class="special">&gt;&gt;</span> <span class="identifier">expression</span> <span class="special">&gt;&gt;</span> <span class="char">')'</span><span class="special">;</span>
+<span class="identifier">factor</span> <span class="special">=</span> <span class="identifier">integer</span> <span class="special">|</span> <span class="identifier">group</span><span class="special">;</span>
+<span class="identifier">term</span> <span class="special">=</span> <span class="identifier">factor</span> <span class="special">&gt;&gt;</span> <span class="special">*((</span><span class="char">'*'</span> <span class="special">&gt;&gt;</span> <span class="identifier">factor</span><span class="special">)</span> <span class="special">|</span> <span class="special">(</span><span class="char">'/'</span> <span class="special">&gt;&gt;</span> <span class="identifier">factor</span><span class="special">));</span>
+<span class="identifier">expression</span> <span class="special">=</span> <span class="identifier">term</span> <span class="special">&gt;&gt;</span> <span class="special">*((</span><span class="char">'+'</span> <span class="special">&gt;&gt;</span> <span class="identifier">term</span><span class="special">)</span> <span class="special">|</span> <span class="special">(</span><span class="char">'-'</span> <span class="special">&gt;&gt;</span> <span class="identifier">term</span><span class="special">));</span>
+</pre>
+<p>
+ Through the magic of expression templates, this is perfectly valid and executable
+ C++ code. The production rule <tt class="computeroutput"><span class="identifier">expression</span></tt>
+ is in fact an object that has a member function parse that does the work given
+ a source code written in the grammar that we have just declared. Yes, it's
+ a calculator. We shall simplify for now by skipping the type declarations and
+ the definition of the rule integer invoked by factor. Now, the production rule
+ <tt class="computeroutput"><span class="identifier">expression</span></tt> in our grammar specification,
+ traditionally called the start symbol, can recognize inputs such as:
+ </p>
+<pre class="programlisting">
+<span class="number">12345</span>
+<span class="special">-</span><span class="number">12345</span>
+<span class="special">+</span><span class="number">12345</span>
+<span class="number">1</span> <span class="special">+</span> <span class="number">2</span>
+<span class="number">1</span> <span class="special">*</span> <span class="number">2</span>
+<span class="number">1</span><span class="special">/</span><span class="number">2</span> <span class="special">+</span> <span class="number">3</span><span class="special">/</span><span class="number">4</span>
+<span class="number">1</span> <span class="special">+</span> <span class="number">2</span> <span class="special">+</span> <span class="number">3</span> <span class="special">+</span> <span class="number">4</span>
+<span class="number">1</span> <span class="special">*</span> <span class="number">2</span> <span class="special">*</span> <span class="number">3</span> <span class="special">*</span> <span class="number">4</span>
+<span class="special">(</span><span class="number">1</span> <span class="special">+</span> <span class="number">2</span><span class="special">)</span> <span class="special">*</span> <span class="special">(</span><span class="number">3</span> <span class="special">+</span> <span class="number">4</span><span class="special">)</span>
+<span class="special">(-</span><span class="number">1</span> <span class="special">+</span> <span class="number">2</span><span class="special">)</span> <span class="special">*</span> <span class="special">(</span><span class="number">3</span> <span class="special">+</span> <span class="special">-</span><span class="number">4</span><span class="special">)</span>
+<span class="number">1</span> <span class="special">+</span> <span class="special">((</span><span class="number">6</span> <span class="special">*</span> <span class="number">200</span><span class="special">)</span> <span class="special">-</span> <span class="number">20</span><span class="special">)</span> <span class="special">/</span> <span class="number">6</span>
+<span class="special">(</span><span class="number">1</span> <span class="special">+</span> <span class="special">(</span><span class="number">2</span> <span class="special">+</span> <span class="special">(</span><span class="number">3</span> <span class="special">+</span> <span class="special">(</span><span class="number">4</span> <span class="special">+</span> <span class="number">5</span><span class="special">))))</span>
+</pre>
+<p>
+ Certainly we have done some modifications to the original EBNF syntax. This
+ is done to conform to C++ syntax rules. Most notably we see the abundance of
+ shift &gt;&gt; operators. Since there are no 'empty' operators in C++, it is
+ simply not possible to write something like:
+ </p>
+<pre class="programlisting">
+<span class="identifier">a</span> <span class="identifier">b</span>
+</pre>
+<p>
+ as seen in math syntax, for example, to mean multiplication or, in our case,
+ as seen in EBNF syntax to mean sequencing (b should follow a). Spirit uses
+ the shift <tt class="computeroutput"><span class="special">&gt;&gt;</span></tt> operator instead
+ for this purpose. We take the <tt class="computeroutput"><span class="special">&gt;&gt;</span></tt>
+ operator, with arrows pointing to the right, to mean "is followed by".
+ Thus we write:
+ </p>
+<pre class="programlisting">
+<span class="identifier">a</span> <span class="special">&gt;&gt;</span> <span class="identifier">b</span>
+</pre>
+<p>
+ The alternative operator <tt class="computeroutput"><span class="special">|</span></tt> and
+ the parentheses <tt class="computeroutput"><span class="special">()</span></tt> remain as is.
+ The assignment operator <tt class="computeroutput"><span class="special">=</span></tt> is used
+ in place of EBNF's <tt class="computeroutput"><span class="special">::=</span></tt>. Last but
+ not least, the Kleene star <tt class="computeroutput"><span class="special">*</span></tt> which
+ used to be a postfix operator in EBNF becomes a prefix. Instead of:
+ </p>
+<pre class="programlisting">
+<span class="identifier">a</span><span class="special">*</span> <span class="comment">//... in EBNF syntax,
+</span></pre>
+<p>
+ we write:
+ </p>
+<pre class="programlisting">
+<span class="special">*</span><span class="identifier">a</span> <span class="comment">//... in Spirit.
+</span></pre>
+<p>
+ since there are no postfix stars, <tt class="computeroutput"><span class="special">*</span></tt>,
+ in C/C++. Finally, we terminate each rule with the ubiquitous semi-colon,
+ <tt class="computeroutput"><span class="special">;</span></tt>.
+ </p>
+<a name="spirit.introduction.a_quick_overview_about_output_generation_with__emphasis_spirit_karma__emphasis_"></a><h3>
+<a name="id457889"></a>
+ <a href="introduction.html#spirit.introduction.a_quick_overview_about_output_generation_with__emphasis_spirit_karma__emphasis_">A
+ quick overview about Output Generation with <span class="emphasis"><em>Spirit.Karma</em></span></a>
+ </h3>
+<p>
+ Spirit not only allows to describe the structure of the input. Starting with
+ Version 2.0 it enables the specification of the output format for your data
+ in a very similar way, and based on a single syntax and compatible semantics.
+ </p>
+<p>
+ Let's assume we need to generate a textual representation from a simple data
+ structure as 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">int</span><span class="special">&gt;</span></tt>. Conventional
+ code probably would look like:
+ </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">int</span><span class="special">&gt;</span> <span class="identifier">v</span> <span class="special">(</span><span class="identifier">initialize_and_fill</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="keyword">int</span><span class="special">&gt;::</span><span class="identifier">iterator</span> <span class="identifier">end</span> <span class="special">=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+<span class="keyword">for</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="keyword">int</span><span class="special">&gt;::</span><span class="identifier">iterator</span> <span class="identifier">it</span> <span class="special">=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> <span class="identifier">it</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">;</span> <span class="special">++</span><span class="identifier">it</span><span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="special">*</span><span class="identifier">it</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</pre>
+<p>
+ which is not very flexible and quite difficult to maintain when it comes to
+ changing the required output format. Spirit's sublibrary <span class="emphasis"><em>Karma</em></span>
+ allows to specify output formats for arbitrary data structures in a very flexible
+ way. following snippet is the <span class="emphasis"><em>Karma</em></span> format description
+ used to create the very The same output as the traditional code above:
+ </p>
+<pre class="programlisting">
+<span class="special">*(</span><span class="identifier">int_</span> <span class="special">&lt;&lt;</span> <span class="identifier">eol</span><span class="special">)</span>
+</pre>
+<p>
+ Here are some more examples of format descriptions for different output representations
+ of the same <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">int</span><span class="special">&gt;</span></tt>:
+ </p>
+<div class="table">
+<a name="id458364"></a><p class="title"><b>Table 2. Different output formats for `std::vector&lt;int&gt;`</b></p>
+<table class="table" summary="Different output formats for `std::vector&lt;int&gt;`">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Format
+ </p>
+ </th>
+<th>
+ <p>
+ Example
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="char">'['</span> <span class="special">&lt;&lt;</span>
+ <span class="special">*(</span><span class="identifier">int_</span>
+ <span class="special">&lt;&lt;</span> <span class="char">','</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="char">']'</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="special">[</span><span class="number">1</span><span class="special">,</span><span class="number">8</span><span class="special">,</span><span class="number">10</span><span class="special">,]</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ Comma separated list of integers
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="special">*(</span><span class="char">'('</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">int_</span>
+ <span class="special">&lt;&lt;</span> <span class="char">')'</span>
+ <span class="special">&lt;&lt;</span> <span class="char">','</span><span class="special">)</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="special">(</span><span class="number">1</span><span class="special">),(</span><span class="number">8</span><span class="special">),(</span><span class="number">10</span><span class="special">),]</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ Comma separated list of integers in parenthesis
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="special">*</span><span class="identifier">hex</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="number">18</span><span class="identifier">a</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ A list of hexadecimal numbers
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="special">*(</span><span class="identifier">double_</span>
+ <span class="special">&lt;&lt;</span> <span class="char">','</span><span class="special">)</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="number">1.0</span><span class="special">,</span><span class="number">8.0</span><span class="special">,</span><span class="number">10.0</span><span class="special">,</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ A list of floating point numbers
+ </p>
+ </td>
+</tr>
+</tbody>
+</table>
+</div>
+<p>
+ The syntax is very similar to <span class="emphasis"><em>Qi</em></span> with the exception that
+ we use the <tt class="computeroutput"><span class="special">&lt;&lt;</span></tt> operator for
+ output concatenation. This should be easy to understand as it follows the conventions
+ used in the Standard's I/O streams.
+ </p>
+<p>
+ Another important feature of <span class="emphasis"><em>karma</em></span> is to allow to fully
+ decouple the data type from the output format. You can use the same output
+ format with different data types as long as these conforma conceptually. The
+ next table gives some related examples.
+ </p>
+<div class="table">
+<a name="id458834"></a><p class="title"><b>Table 3. Different data types usable with the output format
+ `(*int_ &lt;&lt; eol)`</b></p>
+<table class="table" summary="Different data types usable with the output format
+ `(*int_ &lt;&lt; eol)`">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Data type
+ </p>
+ </th>
+<td class="auto-generated"> </td>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="keyword">int</span> <span class="identifier">i</span><span class="special">[</span><span class="number">4</span><span class="special">]</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ C style arrays
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <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">int</span><span class="special">&gt;</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ Standard vector
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ Standard list
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span><span class="special">&lt;</span><span class="keyword">long</span><span class="special">,</span> <span class="number">20</span><span class="special">&gt;</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ Boost array
+ </p>
+ </td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="what_s_new.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_and_karma.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/notes.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/notes.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,53 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Notes</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="faq.html" title="FAQ">
+<link rel="next" href="notes/porting_from_spirit_1_8_x.html" title="Porting from
+ Spirit 1.8.x">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="faq.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="notes/porting_from_spirit_1_8_x.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.notes"></a>Notes</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Portability</span></dt>
+<dt><span class="section"><a href="notes/porting_from_spirit_1_8_x.html">Porting from
+ Spirit 1.8.x</a></span></dt>
+<dt><span class="section">Style Guide</span></dt>
+<dt><span class="section">Techniques</span></dt>
+</dl></div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.notes.portability"></a>Portability</h3></div></div></div></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="faq.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="notes/porting_from_spirit_1_8_x.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/notes/porting_from_spirit_1_8_x.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/notes/porting_from_spirit_1_8_x.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Porting from
+ Spirit 1.8.x</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../notes.html" title="Notes">
+<link rel="prev" href="../notes.html" title="Notes">
+<link rel="next" href="style_guide.html" title="Style Guide">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../notes.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../notes.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="style_guide.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.notes.porting_from_spirit_1_8_x"></a><a href="porting_from_spirit_1_8_x.html" title="Porting from
+ Spirit 1.8.x">Porting from
+ Spirit 1.8.x</a></h3></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../notes.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../notes.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="style_guide.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/notes/style_guide.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/notes/style_guide.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,151 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Style Guide</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../notes.html" title="Notes">
+<link rel="prev" href="porting_from_spirit_1_8_x.html" title="Porting from
+ Spirit 1.8.x">
+<link rel="next" href="techniques.html" title="Techniques">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="porting_from_spirit_1_8_x.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../notes.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="techniques.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.notes.style_guide"></a>Style Guide</h3></div></div></div>
+<p>
+ At some point, especially when there are lots of semantic actions attached
+ to various points, the grammar tends to be quite difficult to follow. In
+ order to keep an easy-to-read, consistent en aesthetically pleasing look
+ to the Spirit code, the following coding styleguide is advised.
+ </p>
+<p>
+ This coding style is adapted and extended from the ANTLR/PCCTS style (Terrence
+ Parr) and <a href="http://groups.yahoo.com/group/boost/files/coding_guidelines.html" target="_top">Boost
+ coding guidelines</a> (David Abrahams and Nathan Myers) and is the combined
+ work of Joel de Guzman, Chris Uzdavinis and Hartmut Kaiser.
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Rule names use std C++ (Boost) convention. The rule name may be very long.
+ </li>
+<li>
+ The '=' is neatly indented 4 spaces below. Like in Boost, use spaces instead
+ of tabs.
+ </li>
+<li>
+ Breaking the operands into separate lines puts the semantic actions neatly
+ to the right.
+ </li>
+<li>
+ Semicolon at the last line terminates the rule.
+ </li>
+<li>
+ The adjacent parts of a sequence should be indented accordingly to have
+ all, what belongs to one level, at one indentation level.
+ </li>
+</ul></div>
+<pre class="programlisting">
+<span class="identifier">program</span>
+ <span class="special">=</span> <span class="identifier">program_heading</span> <span class="special">[</span><span class="identifier">heading_action</span><span class="special">]</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">block</span> <span class="special">[</span><span class="identifier">block_action</span><span class="special">]</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'.'</span>
+ <span class="special">|</span> <span class="identifier">another_sequence</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">etc</span>
+ <span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Prefer literals in the grammar instead of identifiers. e.g. <tt class="computeroutput"><span class="string">"program"</span></tt> instead of <tt class="computeroutput"><span class="identifier">PROGRAM</span></tt>, <tt class="computeroutput"><span class="char">'&gt;='</span></tt>
+ instead of <tt class="computeroutput"><span class="identifier">GTE</span></tt> and <tt class="computeroutput"><span class="char">'.'</span></tt> instead of <tt class="computeroutput"><span class="identifier">DOT</span></tt>.
+ This makes it much easier to read. If this isn't possible (for instance
+ where the used tokens must be identified through integers) capitalized
+ identifiers should be used instead.
+ </li>
+<li>
+ Breaking the operands may not be needed for short expressions. e.g. <tt class="computeroutput"><span class="special">*(</span><span class="char">','</span> <span class="special">&gt;&gt;</span>
+ <span class="identifier">file_identifier</span><span class="special">)</span></tt>
+ as long as the line does not exceed 80 characters.
+ </li>
+<li>
+ If a sequence fits on one line, put spaces inside the parentheses to clearly
+ separate them from the rules.
+ </li>
+</ul></div>
+<pre class="programlisting">
+<span class="identifier">program_heading</span>
+ <span class="special">=</span> <span class="identifier">no_case</span><span class="special">[</span><span class="string">"program"</span><span class="special">]</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">identifier</span>
+ <span class="special">&gt;&gt;</span> <span class="char">'('</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">file_identifier</span>
+ <span class="special">&gt;&gt;</span> <span class="special">*(</span> <span class="char">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">file_identifier</span> <span class="special">)</span>
+ <span class="special">&gt;&gt;</span> <span class="char">')'</span>
+ <span class="special">&gt;&gt;</span> <span class="char">';'</span>
+ <span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+ Nesting directives: If a rule does not fit on one line (80 characters)
+ it should be continued on the next line intended by one level. The brackets
+ of directives, semantic expressions (using Phoenix or LL lambda expressions)
+ or parsers should be placed as follows.
+ </li></ul></div>
+<pre class="programlisting">
+<span class="identifier">identifier</span>
+ <span class="special">=</span> <span class="identifier">no_case</span>
+ <span class="special">[</span>
+ <span class="identifier">lexeme</span>
+ <span class="special">[</span>
+ <span class="identifier">alpha</span> <span class="special">&gt;&gt;</span> <span class="special">*(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)</span> <span class="special">[</span><span class="identifier">id_action</span><span class="special">]</span>
+ <span class="special">]</span>
+ <span class="special">]</span>
+ <span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+ Nesting unary operators (e.g.Kleene star): Unary rule operators (Kleene
+ star, <tt class="computeroutput"><span class="char">'!'</span></tt>, <tt class="computeroutput"><span class="char">'+'</span></tt>
+ etc.) should be moved out one space before the corresponding indentation
+ level, if this rule has a body or a sequence after it, which does not fit
+ on on line. This makes the formatting more consistent and moves the rule
+ 'body' at the same indentation level as the rule itself, highlighting the
+ unary operator.
+ </li></ul></div>
+<pre class="programlisting">
+<span class="identifier">block</span>
+ <span class="special">=</span> <span class="special">*(</span> <span class="identifier">label_declaration_part</span>
+ <span class="special">|</span> <span class="identifier">constant_definition_part</span>
+ <span class="special">|</span> <span class="identifier">type_definition_part</span>
+ <span class="special">|</span> <span class="identifier">variable_declaration_part</span>
+ <span class="special">|</span> <span class="identifier">procedure_and_function_declaration_part</span>
+ <span class="special">)</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">statement_part</span>
+ <span class="special">;</span>
+</pre>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="porting_from_spirit_1_8_x.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../notes.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="techniques.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/notes/techniques.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/notes/techniques.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Techniques</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../notes.html" title="Notes">
+<link rel="prev" href="style_guide.html" title="Style Guide">
+<link rel="next" href="../rationale.html" title="Rationale">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="style_guide.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../notes.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../rationale.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.notes.techniques"></a>Techniques</h3></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="style_guide.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../notes.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../rationale.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,1566 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Qi and Karma</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="introduction.html" title="Introduction">
+<link rel="next" href="qi_and_karma/abstracts.html" title="Abstracts">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="introduction.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_and_karma/abstracts.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.qi_and_karma"></a>Qi and Karma</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Tutorials</span></dt>
+<dd><dl>
+<dt><span class="section">Quick Start</span></dt>
+<dt><span class="section">Warming up</span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.semantic_actions">Semantic
+ Actions</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.complex___our_first_complex_parser">Complex
+ - Our first complex parser</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.sum___adding_numbers">Sum
+ - adding numbers</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list___stuffing_numbers_into_a_std__vector">Number
+ List - stuffing numbers into a std::vector</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list_redux___list_syntax">Number
+ List Redux - list syntax</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list_attribute___one_more__with_style">Number
+ 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>
+</dl></dd>
+<dt><span class="section">Abstracts</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="qi_and_karma/abstracts.html#spirit.qi_and_karma.abstracts.parsing_expression_grammar">Parsing
+ Expression Grammar</a></span></dt>
+<dt><span class="section">Parsing</span></dt>
+<dt><span class="section"><a href="qi_and_karma/abstracts/parsing_and_generating.html">Parsing
+ and Generating</a></span></dt>
+<dt><span class="section">Primitives</span></dt>
+<dt><span class="section">Operators</span></dt>
+<dt><span class="section">Attributes</span></dt>
+<dt><span class="section"><a href="qi_and_karma/abstracts/semantic_actions.html">Semantic
+ Actions</a></span></dt>
+<dt><span class="section">Directives</span></dt>
+<dt><span class="section">Rules</span></dt>
+<dt><span class="section">Grammars</span></dt>
+<dt><span class="section">Debugging</span></dt>
+<dt><span class="section"><a href="qi_and_karma/abstracts/error_handling.html">Error
+ Handling</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma/abstracts/parse_trees_and_asts.html">Parse
+ Trees and ASTs</a></span></dt>
+</dl></dd>
+<dt><span class="section">Quick Reference</span></dt>
+<dt><span class="section">Reference</span></dt>
+<dd><dl>
+<dt><span class="section">Concepts</span></dt>
+<dt><span class="section">Char</span></dt>
+<dt><span class="section">String</span></dt>
+<dt><span class="section">Numeric</span></dt>
+<dt><span class="section">Binary</span></dt>
+<dt><span class="section">Directive</span></dt>
+<dt><span class="section">Action</span></dt>
+<dt><span class="section">Nonterminal</span></dt>
+<dt><span class="section">Operators</span></dt>
+<dt><span class="section">Stream</span></dt>
+<dt><span class="section">Auxiliary</span></dt>
+<dt><span class="section">Debug</span></dt>
+</dl></dd>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.qi_and_karma.tutorials"></a>Tutorials</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Quick Start</span></dt>
+<dt><span class="section">Warming up</span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.semantic_actions">Semantic
+ Actions</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.complex___our_first_complex_parser">Complex
+ - Our first complex parser</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.sum___adding_numbers">Sum
+ - adding numbers</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list___stuffing_numbers_into_a_std__vector">Number
+ List - stuffing numbers into a std::vector</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list_redux___list_syntax">Number
+ List Redux - list syntax</a></span></dt>
+<dt><span class="section"><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list_attribute___one_more__with_style">Number
+ 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>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.quick_start"></a>Quick Start</h4></div></div></div>
+<a name="spirit.qi_and_karma.tutorials.quick_start.why_would_you_want_to_use_spirit_qi_"></a><h5>
+<a name="id459151"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.quick_start.why_would_you_want_to_use_spirit_qi_">Why
+ would you want to use Spirit.Qi?</a>
+ </h5>
+<p>
+ Spirit.Qi is designed to be a practical parsing tool. The ability to generate
+ a fully-working parser from a formal EBNF specification inlined in C++
+ significantly reduces development time. Programmers typically approach
+ parsing using ad hoc hacks with primitive tools such as scanf. Even regular-expression
+ libraries (such as boost regex) or scanners (such as Boost tokenizer) do
+ not scale well when we need to write more elaborate parsers. Attempting
+ to write even a moderately-complex parser using these tools leads to code
+ that is hard to understand and maintain.
+ </p>
+<p>
+ One prime objective is to make the tool easy to use. When one thinks of
+ a parser generator, the usual reaction is "it must be big and complex
+ with a steep learning curve." Not so. Spirit is designed to be fully
+ scalable. The framework is structured in layers. This permits learning
+ on an as-needed basis, after only learning the minimal core and basic concepts.
+ </p>
+<p>
+ For development simplicity and ease in deployment, the entire framework
+ consists of only header files, with no libraries to link against or build.
+ Just put the spirit distribution in your include path, compile and run.
+ Code size? -very tight -essentially comparable to hand written recursive
+ descent code.
+ </p>
+<p>
+ Our tutorials will walk you through the simplest Spirit examples, incrementally
+ building on top of the earlier examples as we expose more and more features
+ and techniques. We will try to be as gentle as possible with the learning
+ curve. We will present the tutorials in a cookbook style approach. This
+ style of presentation is based on our BoostCon '07 and BoostCon '08 slides.
+ </p>
+<p>
+ Have fun!
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.warming_up"></a>Warming up</h4></div></div></div>
+<p>
+ We'll start by showing examples of parser expressions to give you a feel
+ on how to build parsers from the simplest parser, building up as we go.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.warming_up.trivial_example__1_parsing_a_number"></a><h5>
+<a name="id459523"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.warming_up.trivial_example__1_parsing_a_number">Trivial
+ Example #1 Parsing a number</a>
+ </h5>
+<p>
+ Create a parser that will parse a floating-point number.
+ </p>
+<pre class="programlisting">
+<span class="identifier">double_</span>
+</pre>
+<p>
+ (You've got to admit, that's trivial!) The above code actually generates
+ a Spirit floating point parser (a built-in parser). Spirit has many pre-defined
+ parsers and consistent naming conventions help you keep from going insane!
+ </p>
+<a name="spirit.qi_and_karma.tutorials.warming_up.trivial_example__2_parsing_two_numbers"></a><h5>
+<a name="id385053"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.warming_up.trivial_example__2_parsing_two_numbers">Trivial
+ Example #2 Parsing two numbers</a>
+ </h5>
+<p>
+ Create a parser that will accept a line consisting of two floating-point
+ numbers.
+ </p>
+<pre class="programlisting">
+<span class="identifier">double_</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span>
+</pre>
+<p>
+ Here you see the familiar floating-point numeric parser <tt class="computeroutput"><span class="identifier">double_</span></tt>
+ used twice, once for each number. What's that <tt class="computeroutput"><span class="special">&gt;&gt;</span></tt>
+ operator doing in there? Well, they had to be separated by something, and
+ this was chosen as the "followed by" sequence operator. The above
+ program creates a parser from two simpler parsers, glueing them together
+ with the sequence operator. The result is a parser that is a composition
+ of smaller parsers. Whitespace between numbers can implicitly be consumed
+ depending on how the parser is invoked (see below).
+ </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>
+ When we combine parsers, we end up with a "bigger" parser,
+ but it's still a parser. Parsers can get bigger and bigger, nesting more
+ and more, but whenever you glue two parsers together, you end up with
+ one bigger parser. This is an important concept.
+ </p></td></tr>
+</table></div>
+<a name="spirit.qi_and_karma.tutorials.warming_up.trivial_example__3_parsing_one_or_more_numbers"></a><h5>
+<a name="id385164"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.warming_up.trivial_example__3_parsing_one_or_more_numbers">Trivial
+ Example #3 Parsing one or more numbers</a>
+ </h5>
+<p>
+ Create a parser that will accept one or more floating-point numbers.
+ </p>
+<pre class="programlisting">
+<span class="special">*</span><span class="identifier">double_</span>
+</pre>
+<p>
+ This is like a regular-expression Kleene Star, though the syntax might
+ look a bit odd for a C++ programmer not used to seeing the <tt class="computeroutput"><span class="special">*</span></tt> operator overloaded like this. Actually,
+ if you know regular expressions it may look odd too since the star is before
+ the expression it modifies. C'est la vie. Blame it on the fact that we
+ must work with the syntax rules of C++.
+ </p>
+<p>
+ Any expression that evaluates to a parser may be used with the Kleene Star.
+ Keep in mind, though, that due to C++ operator precedence rules you may
+ need to put the expression in parentheses for complex expressions. The
+ Kleene Star is also known as a Kleene Closure, but we call it the Star
+ in most places.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.warming_up.trivial_example__4_parsing_a_comma_delimited_list_of_numbers"></a><h5>
+<a name="id459640"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.warming_up.trivial_example__4_parsing_a_comma_delimited_list_of_numbers">Trivial
+ Example #4 Parsing a comma-delimited list of numbers</a>
+ </h5>
+<p>
+ This example will create a parser that accepts a comma-delimited list of
+ numbers.
+ </p>
+<pre class="programlisting">
+<span class="identifier">double_</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="identifier">double_</span><span class="special">)</span>
+</pre>
+<p>
+ Notice <tt class="computeroutput"><span class="identifier">char_</span><span class="special">(</span><span class="char">','</span><span class="special">)</span></tt>. It is
+ a literal character parser that can recognize the comma <tt class="computeroutput"><span class="char">','</span></tt>.
+ In this case, the Kleene Star is modifying a more complex parser, namely,
+ the one generated by the expression:
+ </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> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">)</span>
+</pre>
+<p>
+ Note that this is a case where the parentheses are necessary. The Kleene
+ star encloses the complete expression above.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.warming_up.let_s_parse_"></a><h5>
+<a name="id459835"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.warming_up.let_s_parse_">Let's
+ Parse!</a>
+ </h5>
+<p>
+ We're done with defining the parser. So the next step is now invoking this
+ parser to do its work. There are a couple of ways to do this. For now,
+ we will use the <tt class="computeroutput"><span class="identifier">phrase_parse</span></tt>
+ function. One overload of this function accepts four arguments:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ An iterator pointing to the start of the input
+ </li>
+<li>
+ An iterator pointing to one past the end of the input
+ </li>
+<li>
+ The parser object
+ </li>
+<li>
+ Another parser called the skip parser
+ </li>
+</ol></div>
+<p>
+ In our example, we wish to skip spaces and tabs. Another parser named
+ <tt class="computeroutput"><span class="identifier">space</span></tt> is included in Spirit's
+ repertoire of predefined parsers. It is a very simple parser that simply
+ recognizes whitespace. We will use <tt class="computeroutput"><span class="identifier">space</span></tt>
+ as our skip parser. The skip parser is the one responsible for skipping
+ characters in between parser elements such as the <tt class="computeroutput"><span class="identifier">double_</span></tt>
+ and <tt class="computeroutput"><span class="identifier">char_</span></tt>.
+ </p>
+<p>
+ Ok, so now let's parse!
+ </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">bool</span> <span class="identifier">parse_numbers</span><span class="special">(</span><span class="identifier">Iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iterator</span> <span class="identifier">last</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">phrase_parse</span><span class="special">(</span>
+ <span class="identifier">first</span><span class="special">,</span> <span class="callout_bug"><a name="spirit0co" href="qi_and_karma.html#spirit0"><img src="../images/callouts/1.png" alt="1" border="0"></a></span>
+ <span class="identifier">last</span><span class="special">,</span> <span class="callout_bug"><a name="spirit1co" href="qi_and_karma.html#spirit1"><img src="../images/callouts/2.png" alt="2" border="0"></a></span>
+ <span class="identifier">double_</span> <span class="special">&gt;&gt;</span> <span class="special">*(</span><span class="char">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">),</span> <span class="callout_bug"><a name="spirit2co" href="qi_and_karma.html#spirit2"><img src="../images/callouts/3.png" alt="3" border="0"></a></span>
+ <span class="identifier">space</span> <span class="callout_bug"><a name="spirit3co" href="qi_and_karma.html#spirit3"><img src="../images/callouts/4.png" alt="4" border="0"></a></span>
+ <span class="special">);</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">r</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ </p>
+<div class="calloutlist"><table border="0" summary="Callout list">
+<tr>
+<td width="5%" valign="top" align="left">
+<a name="spirit0"></a>1 </td>
+<td valign="top" align="left"><p> start iterator </p></td>
+</tr>
+<tr>
+<td width="5%" valign="top" align="left">
+<a name="spirit1"></a>2 </td>
+<td valign="top" align="left"><p> end iterator </p></td>
+</tr>
+<tr>
+<td width="5%" valign="top" align="left">
+<a name="spirit2"></a>3 </td>
+<td valign="top" align="left"><p> the parser </p></td>
+</tr>
+<tr>
+<td width="5%" valign="top" align="left">
+<a name="spirit3"></a>4 </td>
+<td valign="top" align="left"><p> the skip-parser </p></td>
+</tr>
+</table></div>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ The parse function returns <tt class="computeroutput"><span class="keyword">true</span></tt>
+ or <tt class="computeroutput"><span class="keyword">false</span></tt> depending on the
+ result of the parse. The first iterator is passed by reference. On a successful
+ parse, this iterator is repositioned to the rightmost position consumed
+ by the parser. If this becomes equal to str.end(), then we have a full
+ match. If not, then we have a partial match. A partial match happens when
+ the parser is only able to parse a portion of the input.
+ </p>
+<p>
+ Note that we inlined the parser directly in the call to parse. Upon calling
+ parse, the expression evaluates into a temporary, unnamed parser which
+ is passed into the parse() function, used, and then destroyed.
+ </p>
+<p>
+ Here, we opted to make the parser generic by making it a template, parameterized
+ by the iterator type. By doing so, it can take in data coming from any
+ STL conforming sequence as long as the iterators conform to a forward iterator.
+ </p>
+<p>
+ You can find the full cpp file here: ../../example/qi/num_list1.cpp
+ </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>
+ <tt class="computeroutput"><span class="keyword">char</span></tt> and <tt class="computeroutput"><span class="keyword">wchar_t</span></tt>
+ operands
+ </p>
+<p>
+ The careful reader may notice that the parser expression has <tt class="computeroutput"><span class="char">','</span></tt> instead of <tt class="computeroutput"><span class="identifier">char_</span><span class="special">(</span><span class="char">','</span><span class="special">)</span></tt>
+ as the previous examples did. This is ok due to C++ syntax rules of conversion.
+ There are <tt class="computeroutput"><span class="special">&gt;&gt;</span></tt> operators
+ that are overloaded to accept a <tt class="computeroutput"><span class="keyword">char</span></tt>
+ or <tt class="computeroutput"><span class="keyword">wchar_t</span></tt> argument on its
+ left or right (but not both). An operator may be overloaded if at least
+ one of its parameters is a user-defined type. In this case, the <tt class="computeroutput"><span class="identifier">double_</span></tt> is the 2nd argument to <tt class="computeroutput"><span class="keyword">operator</span><span class="special">&gt;&gt;</span></tt>,
+ and so the proper overload of <tt class="computeroutput"><span class="special">&gt;&gt;</span></tt>
+ is used, converting <tt class="computeroutput"><span class="char">','</span></tt> into
+ a character literal parser.
+ </p>
+<p>
+ The problem with omiting the <tt class="computeroutput"><span class="identifier">char_</span></tt>
+ should be obvious: <tt class="computeroutput"><span class="char">'a'</span> <span class="special">&gt;&gt;</span>
+ <span class="char">'b'</span></tt> is not a spirit parser, it is
+ a numeric expression, right-shifting the ASCII (or another encoding)
+ value of <tt class="computeroutput"><span class="char">'a'</span></tt> by the ASCII value
+ of <tt class="computeroutput"><span class="char">'b'</span></tt>. However, both <tt class="computeroutput"><span class="identifier">char_</span><span class="special">(</span><span class="char">'a'</span><span class="special">)</span> <span class="special">&gt;&gt;</span>
+ <span class="char">'b'</span></tt> and <tt class="computeroutput"><span class="char">'a'</span>
+ <span class="special">&gt;&gt;</span> <span class="identifier">char_</span><span class="special">(</span><span class="char">'b'</span><span class="special">)</span></tt>
+ are Spirit sequence parsers for the letter <tt class="computeroutput"><span class="char">'a'</span></tt>
+ followed by <tt class="computeroutput"><span class="char">'b'</span></tt>. You'll get
+ used to it, sooner or later.
+ </p>
+</td></tr>
+</table></div>
+<p>
+ Finally, take note that we test for a full match (i.e. the parser fully
+ parsed the input) by checking if the first iterator, after parsing, is
+ equal to the end iterator. You may strike out this part if partial matches
+ are to be allowed.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.semantic_actions"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.semantic_actions" title="Semantic
+ Actions">Semantic
+ Actions</a></h4></div></div></div>
+<p>
+ Our parser above is really nothing but a recognizer. It answers the question
+ "did the input match our grammar?", but it does not do anything
+ other than that. It does not extract any information from what was parsed.
+ For example, whenever we parse a real number, we wish to store the parsed
+ number after a successful match.
+ </p>
+<p>
+ Enter Semantic actions. Semantic actions may be attached to any point in
+ the grammar specification. These actions are C++ functions or function
+ objects that are called whenever a part of the parser successfully recognizes
+ a portion of the input. Say you have a parser <tt class="computeroutput"><span class="identifier">P</span></tt>,
+ and a C++ function <tt class="computeroutput"><span class="identifier">F</span></tt>, you
+ can make the parser call <tt class="computeroutput"><span class="identifier">F</span></tt>
+ whenever it matches an input by attaching <tt class="computeroutput"><span class="identifier">F</span></tt>:
+ </p>
+<pre class="programlisting">
+<span class="identifier">P</span><span class="special">[</span><span class="identifier">F</span><span class="special">]</span>
+</pre>
+<p>
+ The expression above links <tt class="computeroutput"><span class="identifier">F</span></tt>
+ to the parser, <tt class="computeroutput"><span class="identifier">P</span></tt>.
+ </p>
+<p>
+ The function/function object signature depends on the type of the parser
+ to which it is attached. The parser <tt class="computeroutput"><span class="identifier">double_</span></tt>
+ passes the parsed number. Thus, if we were to attach a function <tt class="computeroutput"><span class="identifier">F</span></tt> to <tt class="computeroutput"><span class="identifier">double_</span></tt>,
+ we need <tt class="computeroutput"><span class="identifier">F</span></tt> to be declared
+ as:
+ </p>
+<pre class="programlisting">
+<span class="keyword">void</span> <span class="identifier">F</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">n</span><span class="special">);</span>
+</pre>
+<p>
+ There are actually 2 more arguments being passed (the parser context and
+ a reference to a boolean 'hit' parameter). We don't need these, for now,
+ but we'll see more on these other arguments later. Spirit.Qi allows us
+ to bind a single argument function, like above. The other arguments are
+ simply ignored.
+ </p>
+<p>
+ Presented are various ways to attach semantic actions:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Using plain function pointer
+ </li>
+<li>
+ Using simple function object
+ </li>
+<li>
+ Using Boost.Bind
+ with a plain function
+ </li>
+<li>
+ Using Boost.Bind
+ with a member function
+ </li>
+<li>
+ Using Boost.Lambda
+</li>
+</ul></div>
+<p>
+ Given:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="comment">// A plain function
+</span><span class="keyword">void</span> <span class="identifier">write</span><span class="special">(</span><span class="keyword">int</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">i</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">i</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="comment">// A member function
+</span><span class="keyword">struct</span> <span class="identifier">writer</span>
+<span class="special">{</span>
+ <span class="keyword">void</span> <span class="identifier">print</span><span class="special">(</span><span class="keyword">int</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">i</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">i</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="comment">// A function object
+</span><span class="keyword">struct</span> <span class="identifier">write_action</span>
+<span class="special">{</span>
+ <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">int</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">unused_type</span><span class="special">,</span> <span class="identifier">unused_type</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">i</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Take note that with function objects, we need to have an <tt class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></tt>
+ with 3 arguments. Since we don't care about the other two, we can use
+ <tt class="computeroutput"><span class="identifier">unused_type</span></tt> for these.
+ We'll see more of <tt class="computeroutput"><span class="identifier">unused_type</span></tt>
+ elsewhere. Get used to it. <tt class="computeroutput"><span class="identifier">unused_type</span></tt>
+ is a Spirit supplied support class.
+ </p>
+<p>
+ All examples parse inputs of the form:
+ </p>
+<pre class="programlisting">
+<span class="string">"{integer}"</span>
+</pre>
+<p>
+ An integer inside the curly braces.
+ </p>
+<p>
+ The first example shows how to attach a plain function:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="char">'{'</span> <span class="special">&gt;&gt;</span> <span class="identifier">int_</span><span class="special">[&amp;</span><span class="identifier">write</span><span class="special">]</span> <span class="special">&gt;&gt;</span> <span class="char">'}'</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ What's new? Well <tt class="computeroutput"><span class="identifier">int_</span></tt> is
+ the sibbling of <tt class="computeroutput"><span class="identifier">double_</span></tt>.
+ I'm sure you can guess what this parser does.
+ </p>
+<p>
+ The next example shows how to attach a simple function object:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="char">'{'</span> <span class="special">&gt;&gt;</span> <span class="identifier">int_</span><span class="special">[</span><span class="identifier">write_action</span><span class="special">()]</span> <span class="special">&gt;&gt;</span> <span class="char">'}'</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ We can use Boost.Bind
+ to 'bind' member functions:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">writer</span> <span class="identifier">w</span><span class="special">;</span>
+<span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="char">'{'</span> <span class="special">&gt;&gt;</span> <span class="identifier">int_</span><span class="special">[</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&amp;</span><span class="identifier">writer</span><span class="special">::</span><span class="identifier">print</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">w</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)]</span> <span class="special">&gt;&gt;</span> <span class="char">'}'</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Likewise, we can also use Boost.Bind
+ to 'bind' plain functions:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="char">'{'</span> <span class="special">&gt;&gt;</span> <span class="identifier">int_</span><span class="special">[</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&amp;</span><span class="identifier">write</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)]</span> <span class="special">&gt;&gt;</span> <span class="char">'}'</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Yep, we can also use Boost.Lambda:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="char">'{'</span> <span class="special">&gt;&gt;</span> <span class="identifier">int_</span><span class="special">[</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">_1</span> <span class="special">&lt;&lt;</span> <span class="char">'\n'</span><span class="special">]</span> <span class="special">&gt;&gt;</span> <span class="char">'}'</span><span class="special">);</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ There are more ways to bind semantic action functions, but the examples
+ above are the most common. Attaching semantic actions is the first hurdle
+ one has to tackle when getting started with parsing with Spirit. Familiarize
+ yourself with this task and get intimate with the tools behind it such
+ as Boost.Bind
+ and Boost.Lambda.
+ </p>
+<p>
+ The examples above can be found here: ../../example/qi/actions.cpp
+ </p>
+<a name="spirit.qi_and_karma.tutorials.semantic_actions.phoenix"></a><h5>
+<a name="id462372"></a>
+ Phoenix
+ </h5>
+<p>
+ Phoenix, a companion
+ library bundled with Spirit, is specifically suited for binding semantic
+ actions. It is like Boost.Lambda
+ in steroids, with special custom features that make it easy to integrate
+ semantic actions with Spirit. If your requirements go beyond simple to
+ moderate parsing, I suggest you use this library. Examples presented henceforth
+ shall be using the library exclusively
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.complex___our_first_complex_parser"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.complex___our_first_complex_parser" title="Complex
+ - Our first complex parser">Complex
+ - Our first complex parser</a></h4></div></div></div>
+<p>
+ Well, not really a complex parser, but a parser that parses complex numbers.
+ This time, we're using Phoenix
+ to do the semantic actions.
+ </p>
+<p>
+ Here's a simple parser expression for complex numbers:
+ </p>
+<pre class="programlisting">
+ <span class="char">'('</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span> <span class="special">&gt;&gt;</span> <span class="special">-(</span><span class="char">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">)</span> <span class="special">&gt;&gt;</span> <span class="char">')'</span>
+<span class="special">|</span> <span class="identifier">double_</span>
+</pre>
+<p>
+ What's new? Well, we have:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ Alternates: e.g. <tt class="computeroutput"><span class="identifier">a</span> <span class="special">|</span>
+ <span class="identifier">b</span></tt>. Try <tt class="computeroutput"><span class="identifier">a</span></tt>
+ first. If it succeeds, good. If not, try the next alternative, <tt class="computeroutput"><span class="identifier">b</span></tt>.
+ </li>
+<li>
+ Optionals: e.g. -p. Match the parser p zero or one time.
+ </li>
+</ol></div>
+<p>
+ The complex parser presented above reads as:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ One or two real number in parantheses, separated by comma (the second
+ number is optional)
+ </li>
+<li>
+<span class="bold"><b>OR</b></span> a single real number.
+ </li>
+</ul></div>
+<p>
+ This parser can parse complex numbers of the form:
+ </p>
+<pre class="programlisting">
+<span class="special">(</span><span class="number">123.45</span><span class="special">,</span> <span class="number">987.65</span><span class="special">)</span>
+<span class="special">(</span><span class="number">123.45</span><span class="special">)</span>
+<span class="number">123.45</span>
+</pre>
+<p>
+ Here goes, this time with actions:
+ </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">bool</span> <span class="identifier">parse_complex</span><span class="special">(</span><span class="identifier">Iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;&amp;</span> <span class="identifier">c</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">rN</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+ <span class="keyword">double</span> <span class="identifier">iN</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">phrase_parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span>
+
+ <span class="comment">// Begin grammar
+</span> <span class="special">(</span>
+ <span class="char">'('</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">[</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">rN</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="char">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">[</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">iN</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="char">')'</span>
+ <span class="special">|</span> <span class="identifier">double_</span><span class="special">[</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">rN</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
+ <span class="special">),</span>
+ <span class="comment">// End grammar
+</span>
+ <span class="identifier">space</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">r</span> <span class="special">||</span> <span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="identifier">c</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;(</span><span class="identifier">rN</span><span class="special">,</span> <span class="identifier">iN</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="identifier">r</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/complex_number.cpp
+ </p>
+<p>
+ The <tt class="computeroutput"><span class="identifier">double_</span></tt> parser attaches
+ this action:
+ </p>
+<pre class="programlisting">
+<span class="identifier">ref</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">_1</span>
+</pre>
+<p>
+ This assigns the parsed result (actually, the attribute of <tt class="computeroutput"><span class="identifier">double_</span></tt>) to n. <tt class="computeroutput"><span class="identifier">ref</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></tt>
+ tells Phoenix that <tt class="computeroutput"><span class="identifier">n</span></tt> is
+ a mutable reference. <tt class="computeroutput"><span class="identifier">_1</span></tt>
+ is a Phoenix placeholder for the parsed result attribute.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.sum___adding_numbers"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.sum___adding_numbers" title="Sum
+ - adding numbers">Sum
+ - adding numbers</a></h4></div></div></div>
+<p>
+ Here's a parser that sums a comma-separated list of numbers.
+ </p>
+<p>
+ Ok we've glossed over some details in our previous examples. First, our
+ includes:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">phoenix_operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Then some using directives:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">phoenix</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">arg_names</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Namespace
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ boost::phoenix
+ </p>
+ </td>
+<td>
+ <p>
+ All of phoenix
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ boost::spirit
+ </p>
+ </td>
+<td>
+ <p>
+ All of spirit
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ boost::spirit::qi
+ </p>
+ </td>
+<td>
+ <p>
+ All of spirit.qi
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ boost::spirit::ascii
+ </p>
+ </td>
+<td>
+ <p>
+ ASCII version of <tt class="computeroutput"><span class="identifier">char_</span></tt>
+ and all char related parsers. Other encodings are also provided
+ (e.g. also an ISO8859.1)
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ boost::spirit::arg_names
+ </p>
+ </td>
+<td>
+ <p>
+ Special phoenix placeholders for spirit
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></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>
+ If you feel uneasy with using whole namespaces, feel free to qualify
+ your code, use namespace aliases, etc. For the purpose of this tutorial,
+ we will be presenting unqualified names for both Spirit and Phoenix.
+ No worries, we will always present the full working code, so you won't
+ get lost. In fact, all examples in this tutorial have a corresponding
+ cpp file that QuickBook (the documentation tool we are using) imports
+ in here as code snippets.
+ </p></td></tr>
+</table></div>
+<p>
+ Now the actual parser:
+ </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">bool</span> <span class="identifier">adder</span><span class="special">(</span><span class="identifier">Iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">double</span><span class="special">&amp;</span> <span class="identifier">n</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">phrase_parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span>
+
+ <span class="comment">// Begin grammar
+</span> <span class="special">(</span>
+ <span class="identifier">double_</span><span class="special">[</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">n</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="char">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">[</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">_1</span><span class="special">])</span>
+ <span class="special">)</span>
+ <span class="special">,</span>
+ <span class="comment">// End grammar
+</span>
+ <span class="identifier">space</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">r</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/actions.cpp
+ </p>
+<p>
+ This is almost like our original numbers list example. We're incrementally
+ building on top of our examples. This time though, like in the complex
+ number example, we'll be adding the smarts. There's an accumulator (`double&amp;
+ n) that adds the numbers parsed. On a successful parse, this number is
+ the sum of all the parsed numbers.
+ </p>
+<p>
+ The first <tt class="computeroutput"><span class="identifier">double_</span></tt> parser
+ attaches this action:
+ </p>
+<pre class="programlisting">
+<span class="identifier">ref</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">_1</span>
+</pre>
+<p>
+ This assigns the parsed result (actually, the attribute of <tt class="computeroutput"><span class="identifier">double_</span></tt>) to <tt class="computeroutput"><span class="identifier">n</span></tt>.
+ <tt class="computeroutput"><span class="identifier">ref</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span></tt> tells
+ Phoenix that <tt class="computeroutput"><span class="identifier">n</span></tt> is a mutable reference. <tt class="computeroutput"><span class="identifier">_1</span></tt> is a Phoenix
+ placeholder for the parsed result attribute.
+ </p>
+<p>
+ The second <tt class="computeroutput"><span class="identifier">double_</span></tt> parser
+ attaches this action:
+ </p>
+<pre class="programlisting">
+<span class="identifier">ref</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+=</span> <span class="identifier">_1</span>
+</pre>
+<p>
+ So, subsequent numbers add into <tt class="computeroutput"><span class="identifier">n</span></tt>.
+ </p>
+<p>
+ That wasn't too bad, was it :-) ?
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.number_list___stuffing_numbers_into_a_std__vector"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list___stuffing_numbers_into_a_std__vector" title="Number
+ List - stuffing numbers into a std::vector">Number
+ List - stuffing numbers into a std::vector</a></h4></div></div></div>
+<p>
+ This sample demontrates a parser for a comma separated list of numbers.
+ The numbers are inserted in a vector using phoenix.
+ </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">bool</span> <span class="identifier">parse_numbers</span><span class="special">(</span><span class="identifier">Iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iterator</span> <span class="identifier">last</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="keyword">double</span><span class="special">&gt;&amp;</span> <span class="identifier">v</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">phrase_parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span>
+
+ <span class="comment">// Begin grammar
+</span> <span class="special">(</span>
+ <span class="identifier">double_</span><span class="special">[</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">v</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="char">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">[</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">v</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">)])</span>
+ <span class="special">)</span>
+ <span class="special">,</span>
+ <span class="comment">// End grammar
+</span>
+ <span class="identifier">space</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">r</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/num_list2.cpp
+ </p>
+<p>
+ This, again, is the same parser as before. This time, instead of summing
+ up the numbers, we stuff them in a <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></tt>.
+ <tt class="computeroutput"><span class="identifier">push_back</span></tt> is supplied by
+ Phoenix. The expression:
+ </p>
+<pre class="programlisting">
+<span class="identifier">push_back</span><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">v</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">)</span>
+</pre>
+<p>
+ appends the parsed number. Like before, <tt class="computeroutput"><span class="identifier">_1</span></tt>
+ is a Phoenix placeholder
+ for the parsed result attribute. Also, like before, <tt class="computeroutput"><span class="identifier">ref</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span></tt>
+ tells Phoenix that
+ <tt class="computeroutput"><span class="identifier">v</span></tt>, the <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></tt>,
+ is a mutable reference.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.number_list_redux___list_syntax"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list_redux___list_syntax" title="Number
+ List Redux - list syntax">Number
+ List Redux - list syntax</a></h4></div></div></div>
+<p>
+ So far, we've been using the syntax:
+ </p>
+<pre class="programlisting">
+<span class="identifier">double_</span> <span class="special">&gt;&gt;</span> <span class="special">*(</span><span class="char">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">)</span>
+</pre>
+<p>
+ to parse a comma-delimited list of numbers. Such lists are common in parsing
+ and Spirit provides a simpler shortcut for them. The expression above can
+ be simplified to:
+ </p>
+<pre class="programlisting">
+<span class="identifier">double_</span> <span class="special">%</span> <span class="char">','</span>
+</pre>
+<p>
+ read as: a list of doubles separated by <tt class="computeroutput"><span class="char">','</span></tt>.
+ </p>
+<p>
+ This sample, again a variation of our previous example, demonstrates just
+ that:
+ </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">bool</span> <span class="identifier">parse_numbers</span><span class="special">(</span><span class="identifier">Iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iterator</span> <span class="identifier">last</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="keyword">double</span><span class="special">&gt;&amp;</span> <span class="identifier">v</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">phrase_parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span>
+
+ <span class="comment">// Begin grammar
+</span> <span class="special">(</span>
+ <span class="identifier">double_</span><span class="special">[</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">v</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">)]</span> <span class="special">%</span> <span class="char">','</span>
+ <span class="special">)</span>
+ <span class="special">,</span>
+ <span class="comment">// End grammar
+</span>
+ <span class="identifier">space</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">r</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/num_list3.cpp
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.number_list_attribute___one_more__with_style"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.number_list_attribute___one_more__with_style" title="Number
+ List Attribute - one more, with style">Number
+ List Attribute - one more, with style</a></h4></div></div></div>
+<p>
+ You've seen that the <tt class="computeroutput"><span class="identifier">double_</span></tt>
+ parser has a <tt class="computeroutput"><span class="keyword">double</span></tt> attribute.
+ All parsers have an attribute, even complex parsers, those that are composed
+ from primitives using operators, like the list parser, also have an attribute.
+ It so happens that the the attribute of a list parser:
+ </p>
+<pre class="programlisting">
+<span class="identifier">p</span> <span class="special">%</span> <span class="identifier">d</span>
+</pre>
+<p>
+ is a <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></tt> of the attribute of <tt class="computeroutput"><span class="identifier">p</span></tt>. So, for our parser:
+ </p>
+<pre class="programlisting">
+<span class="identifier">double_</span> <span class="special">%</span> <span class="char">','</span>
+</pre>
+<p>
+ we'll have an attribute of:
+ </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">double</span><span class="special">&gt;</span>
+</pre>
+<p>
+ So, what does this give us? Well, we can simply pass in 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">double</span><span class="special">&gt;</span></tt>
+ to our number list parser and it will happily churn out our result in our
+ vector. For that to happen, we'll use a variation of the <tt class="computeroutput"><span class="identifier">phrase_parse</span></tt> with an additional argument:
+ the parser's attribute:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ An iterator pointing to the start of the input
+ </li>
+<li>
+ An iterator pointing to one past the end of the input
+ </li>
+<li>
+ The parser object
+ </li>
+<li>
+ The parser's attribute
+ </li>
+<li>
+ Another parser called the skip parser
+ </li>
+</ol></div>
+<p>
+ So, our parser now is further simplified to:
+ </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">bool</span> <span class="identifier">parse_numbers</span><span class="special">(</span><span class="identifier">Iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iterator</span> <span class="identifier">last</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="keyword">double</span><span class="special">&gt;&amp;</span> <span class="identifier">v</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">phrase_parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span>
+
+ <span class="comment">// Begin grammar
+</span> <span class="special">(</span>
+ <span class="identifier">double_</span> <span class="special">%</span> <span class="char">','</span>
+ <span class="special">)</span>
+ <span class="special">,</span>
+ <span class="comment">// End grammar
+</span>
+ <span class="identifier">v</span><span class="special">,</span> <span class="identifier">space</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">r</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/num_list4.cpp
+ </p>
+<p>
+ <span class="bold"><b>Hey, no more actions!!!</b></span> Now we're entering
+ the realm of attribute grammars. Cool eh?
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.tutorials.roman_numerals"></a><a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals" title="Roman
+ Numerals">Roman
+ Numerals</a></h4></div></div></div>
+<p>
+ This example demonstrates:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ symbol table
+ </li>
+<li>
+ rule
+ </li>
+<li>
+ grammar
+ </li>
+</ul></div>
+<a name="spirit.qi_and_karma.tutorials.roman_numerals.symbol_table"></a><h5>
+<a name="id466741"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals.symbol_table">Symbol
+ Table</a>
+ </h5>
+<p>
+ The symbol table holds a dictionary of symbols where each symbol is a sequence
+ of characters (a <tt class="computeroutput"><span class="keyword">char</span></tt>, <tt class="computeroutput"><span class="keyword">wchar_t</span></tt>, <tt class="computeroutput"><span class="keyword">int</span></tt>,
+ enumeration etc.) . The template class, parameterized by the character
+ type, can work efficiently with 8, 16, 32 and even 64 bit characters. Mutable
+ data of type T is associated with each symbol.
+ </p>
+<p>
+ Traditionally, symbol table management is maintained seperately outside
+ the BNF grammar through semantic actions. Contrary to standard practice,
+ the Spirit symbol table class symbols is-a parser. An object of which may
+ be used anywhere in the EBNF grammar specification. It is an example of
+ a dynamic parser. A dynamic parser is characterized by its ability to modify
+ its behavior at run time. Initially, an empty symbols object matches nothing.
+ At any time, symbols may be added or removed, thus, dynamically altering
+ its behavior.
+ </p>
+<p>
+ Each entry in a symbol table has an associated mutable data slot. In this
+ regard, one can view the symbol table as an associative container (or map)
+ of key-value pairs where the keys are strings.
+ </p>
+<p>
+ The symbols class expects two template parameters. The first parameter
+ specifies the character type of the symbols. The second specifies the data
+ type associated with each symbol: its attribute.
+ </p>
+<p>
+ Here's a parser for roman hundreds (100..900) using the symbol table. Keep
+ in mind that the data associated with each slot is the parser's attribute
+ (which is passed to attached semantic actions).
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">struct</span> <span class="identifier">hundreds_</span> <span class="special">:</span> <span class="identifier">symbols</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">hundreds_</span><span class="special">()</span>
+ <span class="special">{</span>
+ <span class="identifier">add</span>
+ <span class="special">(</span><span class="string">"C"</span> <span class="special">,</span> <span class="number">100</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"CC"</span> <span class="special">,</span> <span class="number">200</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"CCC"</span> <span class="special">,</span> <span class="number">300</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"CD"</span> <span class="special">,</span> <span class="number">400</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"D"</span> <span class="special">,</span> <span class="number">500</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"DC"</span> <span class="special">,</span> <span class="number">600</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"DCC"</span> <span class="special">,</span> <span class="number">700</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"DCCC"</span> <span class="special">,</span> <span class="number">800</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"CM"</span> <span class="special">,</span> <span class="number">900</span><span class="special">)</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+<span class="special">}</span> <span class="identifier">hundreds</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Here's a parser for roman tens (10..90):
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">struct</span> <span class="identifier">tens_</span> <span class="special">:</span> <span class="identifier">symbols</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">tens_</span><span class="special">()</span>
+ <span class="special">{</span>
+ <span class="identifier">add</span>
+ <span class="special">(</span><span class="string">"X"</span> <span class="special">,</span> <span class="number">10</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"XX"</span> <span class="special">,</span> <span class="number">20</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"XXX"</span> <span class="special">,</span> <span class="number">30</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"XL"</span> <span class="special">,</span> <span class="number">40</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"L"</span> <span class="special">,</span> <span class="number">50</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"LX"</span> <span class="special">,</span> <span class="number">60</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"LXX"</span> <span class="special">,</span> <span class="number">70</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"LXXX"</span> <span class="special">,</span> <span class="number">80</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"XC"</span> <span class="special">,</span> <span class="number">90</span><span class="special">)</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+<span class="special">}</span> <span class="identifier">tens</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ and, finally, for ones (1..9):
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">struct</span> <span class="identifier">ones_</span> <span class="special">:</span> <span class="identifier">symbols</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">ones_</span><span class="special">()</span>
+ <span class="special">{</span>
+ <span class="identifier">add</span>
+ <span class="special">(</span><span class="string">"I"</span> <span class="special">,</span> <span class="number">1</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"II"</span> <span class="special">,</span> <span class="number">2</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"III"</span> <span class="special">,</span> <span class="number">3</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"IV"</span> <span class="special">,</span> <span class="number">4</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"V"</span> <span class="special">,</span> <span class="number">5</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"VI"</span> <span class="special">,</span> <span class="number">6</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"VII"</span> <span class="special">,</span> <span class="number">7</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"VIII"</span> <span class="special">,</span> <span class="number">8</span><span class="special">)</span>
+ <span class="special">(</span><span class="string">"IX"</span> <span class="special">,</span> <span class="number">9</span><span class="special">)</span>
+ <span class="special">;</span>
+ <span class="special">}</span>
+
+<span class="special">}</span> <span class="identifier">ones</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ Now we can use <tt class="computeroutput"><span class="identifier">hundreds</span></tt>,
+ <tt class="computeroutput"><span class="identifier">tens</span></tt> and <tt class="computeroutput"><span class="identifier">ones</span></tt> anywhere in our parser expressions.
+ They are all parsers.
+ </p>
+<a name="spirit.qi_and_karma.tutorials.roman_numerals.rules"></a><h5>
+<a name="id468029"></a>
+ Rules
+ </h5>
+<p>
+ Up until now, we've been inlining our parser expressions, passing them
+ directly to the <tt class="computeroutput"><span class="identifier">phrase_parse</span></tt>
+ function. The expression evaluates into a temporary, unnamed parser which
+ is passed into the <tt class="computeroutput"><span class="identifier">phrase_parse</span></tt>
+ function, used, and then destroyed. This is fine for small parsers. When
+ the expressions get complicated, you'd want to break the expressions into
+ smaller easier to understand pieces, name them, and refer to them from
+ other parser expressions by name.
+ </p>
+<p>
+ A parser expression can be assigned to, what is called, a "rule".
+ There are various ways to declare rules. The simplest form is:
+ </p>
+<pre class="programlisting">
+<span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">&gt;</span> <span class="identifier">r</span><span class="special">;</span>
+</pre>
+<p>
+ At the very least, the rule needs to know the iterator type it will be
+ working on. This rule cannot be used with <tt class="computeroutput"><span class="identifier">phrase_parse</span></tt>.
+ It can only be used with the <tt class="computeroutput"><span class="identifier">parse</span></tt>
+ function -- a version that does not do white space skipping (does not have
+ the skipper argument). If you want to have it skip white spaces, you need
+ to pass in the type skip parser, as in the next form:
+ </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">Skipper</span><span class="special">&gt;</span> <span class="identifier">r</span><span class="special">;</span>
+</pre>
+<p>
+ Example:
+ </p>
+<pre class="programlisting">
+<span class="identifier">rule</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">space_type</span><span class="special">&gt;</span> <span class="identifier">r</span><span class="special">;</span>
+</pre>
+<p>
+ This type of rule can be used for both <tt class="computeroutput"><span class="identifier">phrase_parse</span></tt>
+ and <tt class="computeroutput"><span class="identifier">parse</span></tt>.
+ </p>
+<p>
+ For our next example, there's one more rule form you should know about:
+ </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">Signature</span><span class="special">&gt;</span> <span class="identifier">r</span><span class="special">;</span>
+</pre>
+<p>
+ or
+ </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">Signature</span><span class="special">,</span> <span class="identifier">Skipper</span><span class="special">&gt;</span> <span class="identifier">r</span><span class="special">;</span>
+</pre>
+<div class="tip"><table border="0" summary="Tip">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../images/tip.png"></td>
+<th align="left">Tip</th>
+</tr>
+<tr><td colspan="2" align="left" valign="top"><p>
+ All rule template arguments after Iterator can be supplied in any order.
+ </p></td></tr>
+</table></div>
+<p>
+ The Signature specifies the attributes of the rule. You've seen that our
+ parsers can have an attribute. Recall that the <tt class="computeroutput"><span class="identifier">double_</span></tt>
+ parser has an attribute of <tt class="computeroutput"><span class="keyword">double</span></tt>.
+ To be precise, these are <span class="emphasis"><em>synthesized</em></span> attributes. The
+ parser "synthesizes" the attribute value. Think of them as function
+ return values.
+ </p>
+<p>
+ There's another type of attribute called "inherited" attribute.
+ We won't need them for now, but it's good that you be aware of such attributes.
+ You can think of them as function arguments. And, rightly so, the rule
+ signature is a function signature of the form:
+ </p>
+<pre class="programlisting">
+<span class="identifier">result</span><span class="special">(</span><span class="identifier">argN</span><span class="special">,</span> <span class="identifier">argN</span><span class="special">,...,</span> <span class="identifier">argN</span><span class="special">)</span>
+</pre>
+<p>
+ After having declared a rule, you can now assign any parser expression
+ to it. Example:
+ </p>
+<pre class="programlisting">
+<span class="identifier">r</span> <span class="special">=</span> <span class="identifier">double_</span> <span class="special">&gt;&gt;</span> <span class="special">*(</span><span class="char">','</span> <span class="special">&gt;&gt;</span> <span class="identifier">double_</span><span class="special">);</span>
+</pre>
+<a name="spirit.qi_and_karma.tutorials.roman_numerals.grammars"></a><h5>
+<a name="id468623"></a>
+ Grammars
+ </h5>
+<p>
+ A grammar encapsulates one or more rules. It has the same template parameters
+ as the rule. You declare a grammar by:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ deriving a struct (or class) from the <tt class="computeroutput"><span class="identifier">grammar</span></tt>
+ class template
+ </li>
+<li>
+ declare one or more rules as member variables
+ </li>
+<li>
+ initialize the base grammar class by giving it the start rule (its the
+ first rule that gets called when the grammar starts parsing)
+ </li>
+<li>
+ initialize your rules in your constructor
+ </li>
+</ol></div>
+<p>
+ The roman numeral grammar is a very nice and simple example of a 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">roman</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="keyword">unsigned</span><span class="special">()&gt;</span>
+<span class="special">{</span>
+ <span class="identifier">roman</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">roman</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">start</span> <span class="special">=</span> <span class="identifier">eps</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">=</span> <span class="number">0</span><span class="special">]</span> <span class="special">&gt;&gt;</span>
+ <span class="special">(</span>
+ <span class="special">+</span><span class="identifier">char_</span><span class="special">(</span><span class="char">'M'</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">+=</span> <span class="number">1000</span><span class="special">]</span>
+ <span class="special">||</span> <span class="identifier">hundreds</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">||</span> <span class="identifier">tens</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">||</span> <span class="identifier">ones</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">)</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="keyword">unsigned</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>
+ Things to take notice of:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ The grammar and start rule signature is <tt class="computeroutput"><span class="keyword">unsigned</span><span class="special">()</span></tt>. It has a synthesized attribute (return
+ value) of type <tt class="computeroutput"><span class="keyword">unsigned</span></tt>
+ with no inherited attributes (arguments).
+ </li>
+<li>
+ We did not specify a skip-parser. We don't want to skip in between the
+ numerals.
+ </li>
+<li>
+<tt class="computeroutput"><span class="identifier">roman</span><span class="special">::</span><span class="identifier">base_type</span></tt> is a typedef for <tt class="computeroutput"><span class="identifier">grammar</span><span class="special">&lt;</span><span class="identifier">Iterator</span><span class="special">,</span>
+ <span class="keyword">unsigned</span><span class="special">()&gt;</span></tt>.
+ If <tt class="computeroutput"><span class="identifier">roman</span></tt> was not a template,
+ you can simply write: base_type(start)
+ </li>
+<li>
+ But it's best to make your grammar templates, so that they can be reused
+ for different iterator types.
+ </li>
+<li>
+<tt class="computeroutput"><span class="identifier">_val</span></tt> is another Phoenix placeholder representing
+ the rule's synthesized attribute.
+ </li>
+<li>
+<tt class="computeroutput"><span class="identifier">eps</span></tt> is a special spirit
+ parser that consumes no input but is always successful. We use it to
+ initialize <tt class="computeroutput"><span class="identifier">_val</span></tt>, the
+ rule's synthesized attribute, to zero before anything else. The actual
+ parser starts at <tt class="computeroutput"><span class="special">+</span><span class="identifier">char_</span><span class="special">(</span><span class="char">'M'</span><span class="special">)</span></tt>,
+ parsing roman thousands. Using <tt class="computeroutput"><span class="identifier">eps</span></tt>
+ this way is good for doing pre and post initializations.
+ </li>
+<li>
+ The expression <tt class="computeroutput"><span class="identifier">a</span> <span class="special">||</span>
+ <span class="identifier">b</span></tt> reads: match a or b and in
+ sequence. That is, if both <tt class="computeroutput"><span class="identifier">a</span></tt>
+ and <tt class="computeroutput"><span class="identifier">b</span></tt> match, it must
+ be in sequence; this is equivalent to <tt class="computeroutput"><span class="identifier">a</span>
+ <span class="special">&gt;&gt;</span> <span class="special">!</span><span class="identifier">b</span> <span class="special">|</span> <span class="identifier">b</span></tt>, but more efficient.
+ </li>
+</ul></div>
+<a name="spirit.qi_and_karma.tutorials.roman_numerals.let_s_parse_"></a><h5>
+<a name="id469487"></a>
+ <a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals.let_s_parse_">Let's
+ Parse!</a>
+ </h5>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">parse</span><span class="special">(</span><span class="identifier">iter</span><span class="special">,</span> <span class="identifier">end</span><span class="special">,</span> <span class="identifier">roman_parser</span><span class="special">,</span> <span class="identifier">result</span><span class="special">);</span>
+
+<span class="keyword">if</span> <span class="special">(</span><span class="identifier">r</span> <span class="special">&amp;&amp;</span> <span class="identifier">iter</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"-------------------------\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Parsing succeeded\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"result = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">result</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"-------------------------\n"</span><span class="special">;</span>
+<span class="special">}</span>
+<span class="keyword">else</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">rest</span><span class="special">(</span><span class="identifier">iter</span><span class="special">,</span> <span class="identifier">end</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"-------------------------\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Parsing failed\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"stopped at: \": "</span> <span class="special">&lt;&lt;</span> <span class="identifier">rest</span> <span class="special">&lt;&lt;</span> <span class="string">"\"\n"</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"-------------------------\n"</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ <tt class="computeroutput"><span class="identifier">roman_parser</span></tt> is an object
+ of type <tt class="computeroutput"><span class="identifier">roman</span></tt> -our roman
+ numeral parser. This time around, we are using the no-skipping version
+ of the parse functions. We do not want to skip any spaces! We are also
+ passing in an attribute, <tt class="computeroutput"><span class="keyword">unsigned</span>
+ <span class="identifier">result</span></tt>, which will receive the
+ parsed value.
+ </p>
+</div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="introduction.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_and_karma/abstracts.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,67 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Abstracts</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../qi_and_karma.html" title="Qi and Karma">
+<link rel="prev" href="../qi_and_karma.html" title="Qi and Karma">
+<link rel="next" href="abstracts/parsing.html" title="Parsing">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../qi_and_karma.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_and_karma.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="abstracts/parsing.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.qi_and_karma.abstracts"></a>Abstracts</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="abstracts.html#spirit.qi_and_karma.abstracts.parsing_expression_grammar">Parsing
+ Expression Grammar</a></span></dt>
+<dt><span class="section">Parsing</span></dt>
+<dt><span class="section"><a href="abstracts/parsing_and_generating.html">Parsing
+ and Generating</a></span></dt>
+<dt><span class="section">Primitives</span></dt>
+<dt><span class="section">Operators</span></dt>
+<dt><span class="section">Attributes</span></dt>
+<dt><span class="section"><a href="abstracts/semantic_actions.html">Semantic
+ Actions</a></span></dt>
+<dt><span class="section">Directives</span></dt>
+<dt><span class="section">Rules</span></dt>
+<dt><span class="section">Grammars</span></dt>
+<dt><span class="section">Debugging</span></dt>
+<dt><span class="section"><a href="abstracts/error_handling.html">Error
+ Handling</a></span></dt>
+<dt><span class="section"><a href="abstracts/parse_trees_and_asts.html">Parse
+ Trees and ASTs</a></span></dt>
+</dl></div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.parsing_expression_grammar"></a><a href="abstracts.html#spirit.qi_and_karma.abstracts.parsing_expression_grammar" title="Parsing
+ Expression Grammar">Parsing
+ Expression Grammar</a></h4></div></div></div></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../qi_and_karma.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_and_karma.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="abstracts/parsing.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/attributes.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/attributes.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Attributes</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="operators.html" title="Operators">
+<link rel="next" href="semantic_actions.html" title="Semantic
+ Actions">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="operators.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="semantic_actions.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.attributes"></a>Attributes</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="operators.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="semantic_actions.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/debugging.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/debugging.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Debugging</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="grammars.html" title="Grammars">
+<link rel="next" href="error_handling.html" title="Error
+ Handling">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="grammars.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="error_handling.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.debugging"></a>Debugging</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="grammars.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="error_handling.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/directives.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/directives.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Directives</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="semantic_actions.html" title="Semantic
+ Actions">
+<link rel="next" href="rules.html" title="Rules">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="semantic_actions.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="rules.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.directives"></a>Directives</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="semantic_actions.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="rules.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/error_handling.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/error_handling.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Error
+ Handling</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="debugging.html" title="Debugging">
+<link rel="next" href="parse_trees_and_asts.html" title="Parse
+ Trees and ASTs">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="debugging.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="parse_trees_and_asts.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.error_handling"></a><a href="error_handling.html" title="Error
+ Handling">Error
+ Handling</a></h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="debugging.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="parse_trees_and_asts.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/grammars.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/grammars.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Grammars</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="rules.html" title="Rules">
+<link rel="next" href="debugging.html" title="Debugging">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="rules.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="debugging.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.grammars"></a>Grammars</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="rules.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="debugging.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/operators.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/operators.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Operators</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="primitives.html" title="Primitives">
+<link rel="next" href="attributes.html" title="Attributes">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="primitives.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="attributes.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.operators"></a>Operators</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="primitives.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="attributes.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parse_trees_and_asts.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parse_trees_and_asts.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Parse
+ Trees and ASTs</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="error_handling.html" title="Error
+ Handling">
+<link rel="next" href="../quick_reference.html" title="Quick Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="error_handling.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../quick_reference.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.parse_trees_and_asts"></a><a href="parse_trees_and_asts.html" title="Parse
+ Trees and ASTs">Parse
+ Trees and ASTs</a></h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="error_handling.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../quick_reference.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,98 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Parsing</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="../abstracts.html" title="Abstracts">
+<link rel="next" href="parsing_and_generating.html" title="Parsing
+ and Generating">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../abstracts.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="parsing_and_generating.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.parsing"></a>Parsing</h4></div></div></div>
+<p>
+ Central to the library is the parser. The parser does the actual work of
+ recognizing a linear input stream of data read sequentially from start
+ to end by the supplied iterators. The parser attempts to match the input
+ following a well-defined set of specifications known as grammar rules.
+ The parser returns a <tt class="computeroutput"><span class="keyword">bool</span></tt>
+ to report the success or failure. When successful, the parser calls a client-supplied
+ semantic action, if there is one. The semantic action extracts structural
+ information depending on the data passed by the parser and the hierarchical
+ context of the parser it is attached to.
+ </p>
+<p>
+ Parsers come in different flavors. The Spirit library comes bundled with
+ an extensive set of pre-defined parsers that perform various parsing tasks
+ from the trivial to the complex. The parser, as a concept, has a public
+ conceptual interface contract. Following the contract, anyone can write
+ a conforming parser that will play along well with the library's predefined
+ components. We shall provide a blueprint detailing the conceptual interface
+ of the parser later.
+ </p>
+<p>
+ Clients of the library generally do not need to write their own hand-coded
+ parsers at all. Spirit has an immense repertoire of pre-defined parsers
+ covering all aspects of syntax and semantic analysis. We shall examine
+ this repertoire of parsers in the following sections. In the rare case
+ where a specific functionality is not available, it is extremely easy to
+ write a user-defined parser. The ease in writing a parser entity is the
+ 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 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 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 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 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 href="parsing.html#spirit.qi_and_karma.abstracts.parsing.the_tokenize_and_phrase_parse___function">The
+ tokenize_and_phrase_parse() function</a>
+ </h5>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../abstracts.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="parsing_and_generating.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,71 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Parsing
+ and Generating</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="parsing.html" title="Parsing">
+<link rel="next" href="primitives.html" title="Primitives">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="parsing.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="primitives.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.parsing_and_generating"></a><a href="parsing_and_generating.html" title="Parsing
+ 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 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 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 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 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 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>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="parsing.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="primitives.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/primitives.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/primitives.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Primitives</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="parsing_and_generating.html" title="Parsing
+ and Generating">
+<link rel="next" href="operators.html" title="Operators">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="parsing_and_generating.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="operators.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.primitives"></a>Primitives</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="parsing_and_generating.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="operators.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/rules.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/rules.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Rules</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="directives.html" title="Directives">
+<link rel="next" href="grammars.html" title="Grammars">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="directives.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="grammars.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.rules"></a>Rules</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="directives.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="grammars.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/semantic_actions.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/semantic_actions.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Semantic
+ Actions</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../abstracts.html" title="Abstracts">
+<link rel="prev" href="attributes.html" title="Attributes">
+<link rel="next" href="directives.html" title="Directives">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="attributes.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="directives.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.abstracts.semantic_actions"></a><a href="semantic_actions.html" title="Semantic
+ Actions">Semantic
+ Actions</a></h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="attributes.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../abstracts.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="directives.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,364 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Quick Reference</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../qi_and_karma.html" title="Qi and Karma">
+<link rel="prev" href="abstracts/parse_trees_and_asts.html" title="Parse
+ Trees and ASTs">
+<link rel="next" href="reference.html" title="Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="abstracts/parse_trees_and_asts.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_and_karma.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.qi_and_karma.quick_reference"></a>Quick Reference</h3></div></div></div>
+<p>
+ The following tables use some conventions to encode the attribute type exposed
+ by a component
+ </p>
+<div class="variablelist">
+<p class="title"><b></b></p>
+<dl>
+<dt><span class="term"><tt class="computeroutput"><span class="identifier">attribute_of</span><span class="special">(</span><span class="identifier">P</span><span class="special">)</span></tt></span></dt>
+<dd><p>
+ The component exposes the same attribute as the component 'P' used as
+ part of the overall construct
+ </p></dd>
+<dt><span class="term"><tt class="computeroutput"><span class="identifier">value_type</span><span class="special">(</span><span class="identifier">I</span><span class="special">)</span></tt></span></dt>
+<dd><p>
+ The component exposes the value_type of the underlying iterator 'I' as
+ its attribute type
+ </p></dd>
+</dl>
+</div>
+<div class="table">
+<a name="id470857"></a><p class="title"><b>Table 4. Character Parsers</b></p>
+<table class="table" summary="Character Parsers">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Component
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+<th>
+ <p>
+ Attribute
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">char_</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="keyword">char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">wchar</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="keyword">wchar_t</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">lit</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">unused</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">wlit</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">unused</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="char">'x'</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">unused</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">L</span><span class="char">'x'</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">unused</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">alnum</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">alpha</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">blank</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">cntrl</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">digit</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">graph</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">print</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">punct</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">space</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">xdigit</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">Char</span></tt>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="special">~</span><span class="identifier">P</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ </p>
+ </td>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">attribute_of</span><span class="special">(</span><span class="identifier">P</span><span class="special">)</span></tt>
+ </p>
+ </td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="abstracts/parse_trees_and_asts.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_and_karma.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,196 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Reference</title>
+<link rel="stylesheet" href="../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../index.html" title="Spirit 2.0">
+<link rel="up" href="../qi_and_karma.html" title="Qi and Karma">
+<link rel="prev" href="quick_reference.html" title="Quick Reference">
+<link rel="next" href="reference/char.html" title="Char">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="quick_reference.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_and_karma.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference/char.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit.qi_and_karma.reference"></a>Reference</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Concepts</span></dt>
+<dt><span class="section">Char</span></dt>
+<dt><span class="section">String</span></dt>
+<dt><span class="section">Numeric</span></dt>
+<dt><span class="section">Binary</span></dt>
+<dt><span class="section">Directive</span></dt>
+<dt><span class="section">Action</span></dt>
+<dt><span class="section">Nonterminal</span></dt>
+<dt><span class="section">Operators</span></dt>
+<dt><span class="section">Stream</span></dt>
+<dt><span class="section">Auxiliary</span></dt>
+<dt><span class="section">Debug</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.concepts"></a>Concepts</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Parser</span></dt>
+<dt><span class="section">Generator</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<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>
+ Description
+ </h6>
+<p>
+ Description of Parser concept
+ </p>
+<div class="variablelist">
+<p class="title"><b>Notation</b></p>
+<dl>
+<dt><span class="term"><tt class="computeroutput"><span class="identifier">p</span></tt></span></dt>
+<dd><p>
+ A Parser
+ </p></dd>
+</dl>
+</div>
+<a name="spirit.qi_and_karma.reference.concepts.parser.valid_expressions"></a><h6>
+<a name="id471834"></a>
+ <a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.valid_expressions">Valid
+ Expressions</a>
+ </h6>
+<p>
+ For any Parser the following expressions must be valid:
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Expression
+ </p>
+ </th>
+<th>
+ <p>
+ Semantics
+ </p>
+ </th>
+<th>
+ <p>
+ Return type
+ </p>
+ </th>
+<th>
+ <p>
+ Complexity
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">xxx</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ Semantics of <tt class="computeroutput"><span class="identifier">xxx</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ Parser
+ </p>
+ </td>
+<td>
+ <p>
+ Constant
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+<a name="spirit.qi_and_karma.reference.concepts.parser.type_requirements"></a><h6>
+<a name="id471970"></a>
+ <a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.type_requirements">Type
+ Requirements</a>
+ </h6>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Expression
+ </p>
+ </th>
+<th>
+ <p>
+ Requirements
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+ <tt class="computeroutput"><span class="identifier">xxx</span></tt>
+ </p>
+ </td>
+<td>
+ <p>
+ Requirements for <tt class="computeroutput"><span class="identifier">xxx</span></tt>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+<a name="spirit.qi_and_karma.reference.concepts.parser.invariants"></a><h6>
+<a name="id472074"></a>
+ Invariants
+ </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>
+ Models
+ </h6>
+<p>
+ Links to models of Parser concept
+ </p>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title">
+<a name="spirit.qi_and_karma.reference.concepts.generator"></a>Generator</h5></div></div></div></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="quick_reference.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_and_karma.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="reference/char.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/action.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/action.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Action</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="directive.html" title="Directive">
+<link rel="next" href="nonterminal.html" title="Nonterminal">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="directive.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="nonterminal.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.action"></a>Action</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="directive.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="nonterminal.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/auxiliary.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/auxiliary.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Auxiliary</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="stream.html" title="Stream">
+<link rel="next" href="debug.html" title="Debug">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="stream.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="debug.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.auxiliary"></a>Auxiliary</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="stream.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="debug.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/binary.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/binary.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Binary</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="numeric.html" title="Numeric">
+<link rel="next" href="directive.html" title="Directive">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="numeric.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="directive.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.binary"></a>Binary</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="numeric.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="directive.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/char.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/char.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Char</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="../reference.html" title="Reference">
+<link rel="next" href="string.html" title="String">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="string.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.char"></a>Char</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="string.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/debug.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/debug.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Debug</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="auxiliary.html" title="Auxiliary">
+<link rel="next" href="../../__lex__.html" title="Spirit.Lex">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="auxiliary.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../__lex__.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.debug"></a>Debug</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="auxiliary.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../__lex__.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/directive.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/directive.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Directive</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="binary.html" title="Binary">
+<link rel="next" href="action.html" title="Action">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="binary.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="action.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.directive"></a>Directive</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="binary.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="action.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/nonterminal.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/nonterminal.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Nonterminal</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="action.html" title="Action">
+<link rel="next" href="operators.html" title="Operators">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="action.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="operators.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.nonterminal"></a>Nonterminal</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="action.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="operators.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/numeric.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/numeric.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Numeric</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="string.html" title="String">
+<link rel="next" href="binary.html" title="Binary">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="string.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="binary.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.numeric"></a>Numeric</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="string.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="binary.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/operators.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/operators.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Operators</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="nonterminal.html" title="Nonterminal">
+<link rel="next" href="stream.html" title="Stream">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="nonterminal.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="stream.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.operators"></a>Operators</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="nonterminal.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="stream.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/stream.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/stream.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Stream</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="operators.html" title="Operators">
+<link rel="next" href="auxiliary.html" title="Auxiliary">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="operators.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="auxiliary.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.stream"></a>Stream</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="operators.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="auxiliary.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/string.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference/string.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>String</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../../../index.html" title="Spirit 2.0">
+<link rel="up" href="../reference.html" title="Reference">
+<link rel="prev" href="char.html" title="Char">
+<link rel="next" href="numeric.html" title="Numeric">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="char.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="numeric.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title">
+<a name="spirit.qi_and_karma.reference.string"></a>String</h4></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="char.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="numeric.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/rationale.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/rationale.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Rationale</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="notes/techniques.html" title="Techniques">
+<link rel="next" href="acknowledgments.html" title="Acknowledgments">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="notes/techniques.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgments.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.rationale"></a>Rationale</h2></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="notes/techniques.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledgments.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/references.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/references.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,490 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>References</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="acknowledgments.html" title="Acknowledgments">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="acknowledgments.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.references"></a>References</h2></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ </p>
+ </th>
+<th>
+ <p>
+ Authors
+ </p>
+ </th>
+<th>
+ <p>
+ Title, Publisher/link, Date Published
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ 1.
+ </p>
+ </td>
+<td>
+ <p>
+ Todd Veldhuizen
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.extreme.indiana.edu/%7Etveldhui/papers/Expression-Templates/exprtmpl.html" target="_top">"Expression
+ Templates"</a>. C++ Report, June 1995.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 2.
+ </p>
+ </td>
+<td>
+ <p>
+ Peter Naur (ed.)
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.masswerk.at/algol60/report.htm" target="_top">"Report
+ on the Algorithmic Language ALGOL 60"</a>. CACM, May 1960.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 3.
+ </p>
+ </td>
+<td>
+ <p>
+ ISO/IEC
+ </p>
+ </td>
+<td>
+ <p>
+ "ISO-EBNF",
+ ISO/IEC 14977: 1996(E).
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 4.
+ </p>
+ </td>
+<td>
+ <p>
+ Richard J.Botting, Ph.D.
+ </p>
+ </td>
+<td>
+ <p>
+ "XBNF"
+ (citing Leu-Weiner, 1973). California State University, San Bernardino,
+ 1998.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 5.
+ </p>
+ </td>
+<td>
+ <p>
+ James Coplien.
+ </p>
+ </td>
+<td>
+ <p>
+ "Curiously Recurring Template Pattern". C++ Report, Feb.
+ 1995.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 6.
+ </p>
+ </td>
+<td>
+ <p>
+ Thierry Geraud and Alexandre Duret-Lutz
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.coldewey.com/europlop2000/papers/geraud%2Bduret.zip" target="_top">Generic
+ Programming Redesign of Patterns</a> Proceedings of the 5th European
+ Conference on Pattern Languages of Programs(EuroPLoP'2000) Irsee, Germany,
+ July 2000.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 7.
+ </p>
+ </td>
+<td>
+ <p>
+ Geoffrey Furnish
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.adtmag.com/joop/carticle.aspx?ID=627" target="_top">"Disambiguated
+ Glommable Expression Templates Reintroduced"</a> C++ Report,
+ May 2000
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 8.
+ </p>
+ </td>
+<td>
+ <p>
+ Erich Gamma, Richard Helm, Ralph Jhonson, and John Vlissides
+ </p>
+ </td>
+<td>
+ <p>
+ Design Patterns, Elements of Reusable Object-Oriented Software. Addison-Wesley,
+ 1995.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 9.
+ </p>
+ </td>
+<td>
+ <p>
+ Alfred V. Aho, Revi Sethi, Feffrey D. Ulman
+ </p>
+ </td>
+<td>
+ <p>
+ Compilers, Principles, Techniques and Tools Addison-Wesley, June 1987.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 10.
+ </p>
+ </td>
+<td>
+ <p>
+ Dick Grune and Ceriel Jacobs
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.cs.vu.nl/%7Edick/PTAPG.html" target="_top">Parsing Techniques:
+ A Practical Guide.</a> Ellis Horwood Ltd.: West Sussex, England,
+ 1990. (electronic copy, 1998).
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 11.
+ </p>
+ </td>
+<td>
+ <p>
+ T. J. Parr, H. G. Dietz, and W. E. Cohen
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://citeseer.ist.psu.edu/6885.html" target="_top">PCCTS Reference
+ Manual (Version 1.00)</a>. School of Electrical Engineering, Purdue
+ University, West Lafayette, August 1991.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 12.
+ </p>
+ </td>
+<td>
+ <p>
+ Adrian Johnstone and Elizabeth Scott.
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="ftp://ftp.cs.rhul.ac.uk/pub/rdp" target="_top">RDP, A Recursive Descent
+ Compiler Compiler</a>. Technical Report CSD TR 97 25, Dept. of
+ Computer Science, Egham, Surrey, England, Dec. 20, 1997.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 13.
+ </p>
+ </td>
+<td>
+ <p>
+ Adrian Johnstone
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.cs.rhul.ac.uk/research/languages/projects/lookahead_backtrack.shtml" target="_top">Languages
+ and Architectures, Parser generators with backtrack or extended lookahead
+ capability</a> Department of Computer Science, Royal Holloway,
+ University of London, Egham, Surrey, England
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 14.
+ </p>
+ </td>
+<td>
+ <p>
+ Damian Conway
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.csse.monash.edu.au/%7Edamian/papers/#Embedded_Input_Parsing_for_C" target="_top">Parsing
+ with C++ Classes</a>. ACM SIGPLAN Notices, 29:1, 1994.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 15.
+ </p>
+ </td>
+<td>
+ <p>
+ Joel de Guzman
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/index.html" target="_top">"Spirit
+ Version 1.8"</a>, 1998-2003.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 16.
+ </p>
+ </td>
+<td>
+ <p>
+ S. Doaitse Swierstra and Luc Duponcheel
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://citeseer.ist.psu.edu/448665.html" target="_top">Deterministic,
+ Error-Correcting Combinator Parsers</a> Dept. of Computer Science,
+ Utrecht University P.O.Box 80.089, 3508 TB Utrecht, The Netherland
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 17.
+ </p>
+ </td>
+<td>
+ <p>
+ Bjarne Stroustrup
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.research.att.com/%7Ebs/whitespace98.pdf" target="_top">Generalizing
+ Overloading for C++2000</a> Overload, Issue 25. April 1, 1998.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 18.
+ </p>
+ </td>
+<td>
+ <p>
+ Dr. John Maddock
+ </p>
+ </td>
+<td>
+ <p>
+ Regex++ Documentation
+ http://www.boost.org/libs/regex/index.htm
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 19.
+ </p>
+ </td>
+<td>
+ <p>
+ Anonymous Edited by Graham Hutton
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.cs.nott.ac.uk/~gmh//faq.html" target="_top">Frequently Asked
+ Questions for comp.lang.functional</a>. Edited by Graham Hutton,
+ University of Nottingham.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 20.
+ </p>
+ </td>
+<td>
+ <p>
+ Hewlett-Packard
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.sgi.com/tech/stl/" target="_top">Standard Template Library
+ Programmer's Guide.</a>, Hewlett-Packard Company, 1994
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 21.
+ </p>
+ </td>
+<td>
+ <p>
+ Boost Libraries
+ </p>
+ </td>
+<td>
+ <p>
+ Boost Libraries Documentation.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 22.
+ </p>
+ </td>
+<td>
+ <p>
+ Brian McNamara and Yannis Smaragdakis
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="http://www.cc.gatech.edu/~yannis/fc++/" target="_top">FC++:Functional
+ Programming in C++</a>.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ 23.
+ </p>
+ </td>
+<td>
+ <p>
+ Todd Veldhuizen
+ </p>
+ </td>
+<td>
+ <p>
+ <a href="ftp://ftp.cs.indiana.edu/pub/techreports/TR542.pdf" target="_top">Techniques
+ for Scientic C++.</a>
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="acknowledgments.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>

Added: trunk/libs/spirit/doc/html/spirit/what_s_new.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/doc/html/spirit/what_s_new.html 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -0,0 +1,84 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>What's New</title>
+<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
+<link rel="start" href="../index.html" title="Spirit 2.0">
+<link rel="up" href="../index.html" title="Spirit 2.0">
+<link rel="prev" href="../index.html" title="Spirit 2.0">
+<link rel="next" href="introduction.html" title="Introduction">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="introduction.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="spirit.what_s_new"></a>What's New</h2></div></div></div>
+<a name="spirit.what_s_new.spirit_classic"></a><h3>
+<a name="id456029"></a>
+ Spirit Classic
+ </h3>
+<p>
+ The Spirit V1.8.x code base has been integrated with Spirit V2. It is now called
+ <span class="emphasis"><em>Spirit.Classic</em></span>. Even if the directory structure has changed
+ (the Spirit Classic headers are now moved to the $BOOST_ROOT/boost/spirit/home/classic directory), we created forwarding
+ headers allowing to compile existing applications without any change. These
+ forwarding headers are deprecated, though, which will result in corresponding
+ warnings generated for each of the headers starting with Boost V1.38. The forwarding
+ headers are expected to be removed in the future.
+ </p>
+<p>
+ The recommended way of using Spirit Classic now is to include header files
+ from the directory $BOOST_ROOT/boost/spirit/include. All files of Spirit Classic in this directory have a 'classic_'
+ prefixed to their name. For example the include
+ </p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">core</span><span class="special">/</span><span class="identifier">core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<p>
+ now should be written as:
+ </p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">classic_core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<p>
+ To avoid namespace conflicts with the new Spirit V2 library we moved Spirit
+ Classic into the namespace <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">classic</span></tt>.
+ All references to the former namespace <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span></tt>
+ need to be adjusted as soon as the header names are corrected as described
+ above. As an alternative you can define the preprocessor constant <tt class="computeroutput"><span class="identifier">BOOST_SPIRIT_USE_OLD_NAMESPACE</span></tt>, which will
+ force the Spirit Classic code to be in the namespace <tt class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span></tt>
+ as before. This is not recommended, though, as it may result in naming clashes.
+ </p>
+<p>
+ The change of the namespace will be automatically deactivated whenever the
+ deprecated include files are being used. This ensures full backwards compatibility
+ for existing applications.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2008 Joel de Guzman,
+ Hartmut Kaiser<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="introduction.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

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 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -17,14 +17,14 @@
 [heading Symbol Table]
 
 The symbol table holds a dictionary of symbols where each symbol is a sequence
-of characters (a `char`, `wchar\_t`, `int`, enumeration etc.) . The template
+of characters (a `char`, `wchar_t`, `int`, enumeration etc.) . The template
 class, parameterized by the character type, can work efficiently with 8, 16, 32
 and even 64 bit characters. Mutable data of type T is associated with each
 symbol.
 
 Traditionally, symbol table management is maintained seperately outside the BNF
 grammar through semantic actions. Contrary to standard practice, the Spirit
-symbol table class symbols is-a parser. An instance of which may be used
+symbol table class symbols is-a parser. An object of which may be used
 anywhere in the EBNF grammar specification. It is an example of a dynamic
 parser. A dynamic parser is characterized by its ability to modify its behavior
 at run time. Initially, an empty symbols object matches nothing. At any time,
@@ -57,4 +57,111 @@
 Now we can use `hundreds`, `tens` and `ones` anywhere in our parser expressions.
 They are all parsers.
 
+[heading Rules]
+
+Up until now, we've been inlining our parser expressions, passing them directly
+to the `phrase_parse` function. The expression evaluates into a temporary,
+unnamed parser which is passed into the `phrase_parse` function, used, and then
+destroyed. This is fine for small parsers. When the expressions get complicated,
+you'd want to break the expressions into smaller easier to understand pieces,
+name them, and refer to them from other parser expressions by name.
+
+A parser expression can be assigned to, what is called, a "rule". There are
+various ways to declare rules. The simplest form is:
+
+ rule<Iterator> r;
+
+At the very least, the rule needs to know the iterator type it will be working
+on. This rule cannot be used with `phrase_parse`. It can only be used with the
+`parse` function -- a version that does not do white space skipping (does not
+have the skipper argument). If you want to have it skip white spaces, you need
+to pass in the type skip parser, as in the next form:
+
+ rule<Iterator, Skipper> r;
+
+Example:
+
+ rule<std::string::iterator, space_type> r;
+
+This type of rule can be used for both `phrase_parse` and `parse`.
+
+For our next example, there's one more rule form you should know about:
+
+ rule<Iterator, Signature> r;
+
+or
+
+ rule<Iterator, Signature, Skipper> r;
+
+[tip All rule template arguments after Iterator can be supplied in any order.]
+
+The Signature specifies the attributes of the rule. You've seen that our parsers
+can have an attribute. Recall that the `double_` parser has an attribute of
+`double`. To be precise, these are /synthesized/ attributes. The parser
+"synthesizes" the attribute value. Think of them as function return values.
+
+There's another type of attribute called "inherited" attribute. We won't need
+them for now, but it's good that you be aware of such attributes. You can think
+of them as function arguments. And, rightly so, the rule signature is a function
+signature of the form:
+
+ result(argN, argN,..., argN)
+
+After having declared a rule, you can now assign any parser expression to it.
+Example:
+
+ r = double_ >> *(',' >> double_);
+
+[heading Grammars]
+
+A grammar encapsulates one or more rules. It has the same template parameters as
+the rule. You declare a grammar by:
+
+# deriving a struct (or class) from the `grammar` class template
+# declare one or more rules as member variables
+# initialize the base grammar class by giving it the start rule (its the first
+ rule that gets called when the grammar starts parsing)
+# initialize your rules in your constructor
+
+The roman numeral grammar is a very nice and simple example of a grammar:
+
+[tutorial_roman_grammar]
+
+Things to take notice of:
+
+* The grammar and start rule signature is `unsigned()`. It has a synthesized
+ attribute (return value) of type `unsigned` with no inherited attributes
+ (arguments).
+
+* We did not specify a skip-parser. We don't want to skip in between the
+ numerals.
+
+* `roman::base_type` is a typedef for `grammar<Iterator, unsigned()>`. If
+ `roman` was not a template, you can simply write: base_type(start)
+
+* But it's best to make your grammar templates, so that they can be reused
+ for different iterator types.
+
+* `_val` is another __phoenix__ placeholder representing the rule's synthesized
+ attribute.
+
+* `eps` is a special spirit parser that consumes no input but is always
+ successful. We use it to initialize `_val`, the rule's synthesized
+ attribute, to zero before anything else. The actual parser starts at
+ `+char_('M')`, parsing roman thousands. Using `eps` this way is good
+ for doing pre and post initializations.
+
+* The expression `a || b` reads: match a or b and in sequence. That is, if both
+ `a` and `b` match, it must be in sequence; this is equivalent to `a >> !b | b`,
+ but more efficient.
+
+[heading Let's Parse!]
+
+[tutorial_roman_grammar_parse]
+
+`roman_parser` is an object of type `roman` -our roman numeral parser. This time
+around, we are using the no-skipping version of the parse functions. We do not
+want to skip any spaces! We are also passing in an attribute, `unsigned result`,
+which will receive the parsed value.
+
 [endsect]

Modified: trunk/libs/spirit/example/qi/calc1.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc1.cpp (original)
+++ trunk/libs/spirit/example/qi/calc1.cpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -29,7 +29,7 @@
 template <typename Iterator>
 struct calculator : grammar<Iterator, space_type>
 {
- calculator() : grammar<Iterator, space_type>(expression)
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term

Modified: trunk/libs/spirit/example/qi/calc2.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc2.cpp (original)
+++ trunk/libs/spirit/example/qi/calc2.cpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -44,7 +44,7 @@
 template <typename Iterator>
 struct calculator : grammar<Iterator, space_type>
 {
- calculator() : grammar<Iterator, space_type>(expression)
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term

Modified: trunk/libs/spirit/example/qi/calc2_ast.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc2_ast.cpp (original)
+++ trunk/libs/spirit/example/qi/calc2_ast.cpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -132,7 +132,7 @@
 template <typename Iterator>
 struct calculator : grammar<Iterator, expression_ast(), space_type>
 {
- calculator() : grammar<Iterator, expression_ast(), space_type>(expression)
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]

Modified: trunk/libs/spirit/example/qi/calc3.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc3.cpp (original)
+++ trunk/libs/spirit/example/qi/calc3.cpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -33,7 +33,7 @@
 template <typename Iterator>
 struct calculator : grammar<Iterator, int(), space_type>
 {
- calculator() : grammar<Iterator, int(), space_type>(expression)
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]

Modified: trunk/libs/spirit/example/qi/calc3_lexer.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc3_lexer.cpp (original)
+++ trunk/libs/spirit/example/qi/calc3_lexer.cpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -92,7 +92,7 @@
 {
     template <typename TokenDef>
     calculator(TokenDef const& tok)
- : grammar<Iterator, int(), typename Lexer::token_set>(expression)
+ : calculator::base_type(expression)
     {
         // grammar
         expression =

Modified: trunk/libs/spirit/example/qi/calc4.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc4.cpp (original)
+++ trunk/libs/spirit/example/qi/calc4.cpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -35,7 +35,7 @@
 template <typename Iterator>
 struct calculator : grammar<Iterator, int(), space_type>
 {
- calculator() : grammar<Iterator, int(), space_type>(expression)
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]

Modified: trunk/libs/spirit/example/qi/calc5.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc5.cpp (original)
+++ trunk/libs/spirit/example/qi/calc5.cpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -117,7 +117,7 @@
 struct calculator : grammar<Iterator, space_type>
 {
     calculator(std::vector<int>& code)
- : grammar<Iterator, space_type>(expression)
+ : calculator::base_type(expression)
       , code(code)
     {
         expression =

Modified: trunk/libs/spirit/example/qi/calc6/calc6b.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc6/calc6b.hpp (original)
+++ trunk/libs/spirit/example/qi/calc6/calc6b.hpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -14,7 +14,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 expression<Iterator>::expression(std::vector<int>& code, symbols<char, int>& vars)
- : grammar<Iterator, space_type>(expr)
+ : expression::base_type(expr)
   , code(code)
   , vars(vars)
   , op(code)

Modified: trunk/libs/spirit/example/qi/calc6/calc6c.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc6/calc6c.hpp (original)
+++ trunk/libs/spirit/example/qi/calc6/calc6c.hpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -14,7 +14,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 statement<Iterator>::statement(std::vector<int>& code)
- : grammar<Iterator, space_type>(start)
+ : statement::base_type(start)
   , code(code)
   , nvars(0)
   , expr(code, vars)

Modified: trunk/libs/spirit/example/qi/calc7/calc7b.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc7/calc7b.hpp (original)
+++ trunk/libs/spirit/example/qi/calc7/calc7b.hpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -14,7 +14,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 expression<Iterator>::expression(std::vector<int>& code, symbols<char, int>& vars)
- : grammar<Iterator, space_type>(expr)
+ : expression::base_type(expr)
   , code(code)
   , vars(vars)
   , op(code)

Modified: trunk/libs/spirit/example/qi/calc7/calc7c.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/calc7/calc7c.hpp (original)
+++ trunk/libs/spirit/example/qi/calc7/calc7c.hpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -14,7 +14,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 statement<Iterator>::statement(std::vector<int>& code)
- : grammar<Iterator, space_type>(statement_list)
+ : statement::base_type(statement_list)
   , code(code)
   , nvars(0)
   , expr(code, vars)

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 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -58,7 +58,7 @@
 template <typename Iterator>
 struct employee_parser : grammar<Iterator, employee(), space_type>
 {
- employee_parser() : grammar<Iterator, employee(), space_type>(start)
+ employee_parser() : employee_parser::base_type(start)
     {
         quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
 

Modified: trunk/libs/spirit/example/qi/mini_c/mini_c.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/mini_c/mini_c.hpp (original)
+++ trunk/libs/spirit/example/qi/mini_c/mini_c.hpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -248,7 +248,7 @@
 template <typename Iterator>
 struct white_space : grammar<Iterator>
 {
- white_space() : grammar<Iterator>(start)
+ white_space() : white_space::base_type(start)
     {
         start =
                 space // tab/space/cr/lf

Modified: trunk/libs/spirit/example/qi/mini_c/mini_cb.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/mini_c/mini_cb.hpp (original)
+++ trunk/libs/spirit/example/qi/mini_c/mini_cb.hpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -17,7 +17,7 @@
     std::vector<int>& code
   , symbols<char, int>& vars
   , symbols<char, function_info>& functions)
- : grammar<Iterator, white_space>(expr)
+ : expression::base_type(expr)
   , code(code)
   , vars(vars)
   , functions(functions)

Modified: trunk/libs/spirit/example/qi/mini_c/mini_cc.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/mini_c/mini_cc.hpp (original)
+++ trunk/libs/spirit/example/qi/mini_c/mini_cc.hpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -15,7 +15,7 @@
 template <typename Iterator>
 statement<Iterator>::statement(
     std::vector<int>& code, symbols<char, function_info>& functions)
- : grammar<Iterator, white_space>(statement_list)
+ : statement::base_type(statement_list)
   , code(code)
   , functions(functions)
   , nvars(0)

Modified: trunk/libs/spirit/example/qi/mini_c/mini_cd.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/mini_c/mini_cd.hpp (original)
+++ trunk/libs/spirit/example/qi/mini_c/mini_cd.hpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -14,7 +14,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 program<Iterator>::program(std::vector<int>& code)
- : grammar<Iterator, white_space>(start)
+ : program::base_type(start)
   , code(code)
   , statement(code, functions)
   , add_function(function_adder(functions))

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 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -130,7 +130,7 @@
 template <typename Iterator>
 struct mini_xml_grammar : grammar<Iterator, mini_xml(), space_type>
 {
- mini_xml_grammar() : grammar<Iterator, mini_xml(), space_type>(xml)
+ mini_xml_grammar() : mini_xml_grammar::base_type(xml)
     {
         text = lexeme[+(char_ - '<') [_val += _1]];
         node = (xml | text) [_val = _1];

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 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -132,7 +132,7 @@
   : grammar<Iterator, mini_xml(), locals<std::string>, space_type>
 {
     mini_xml_grammar()
- : grammar<Iterator, mini_xml(), locals<std::string>, space_type>(xml)
+ : mini_xml_grammar::base_type(xml)
     {
         text %= lexeme[+(char_ - '<')];
         node %= xml | text;

Modified: trunk/libs/spirit/example/qi/roman.cpp
==============================================================================
--- trunk/libs/spirit/example/qi/roman.cpp (original)
+++ trunk/libs/spirit/example/qi/roman.cpp 2008-07-12 01:23:48 EDT (Sat, 12 Jul 2008)
@@ -103,26 +103,31 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 // roman (numerals) grammar
+//
+// Note the use of the || operator. The expression
+// a || b reads match a or b and in sequence. Try
+// defining the roman numerals grammar in YACC or
+// PCCTS. Spirit rules! :-)
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_roman_grammar
 template <typename Iterator>
 struct roman : grammar<Iterator, unsigned()>
 {
- roman() : grammar<Iterator, unsigned()>(start)
+ roman() : roman::base_type(start)
     {
- start
- = +char_('M') [_val += 1000]
- || hundreds [_val += _1]
- || tens [_val += _1]
- || ones [_val += _1];
-
- // Note the use of the || operator. The expression
- // a || b reads match a or b and in sequence. Try
- // defining the roman numerals grammar in YACC or
- // PCCTS. Spirit rules! :-)
+ start = eps [_val = 0] >>
+ (
+ +char_('M') [_val += 1000]
+ || hundreds [_val += _1]
+ || tens [_val += _1]
+ || ones [_val += _1]
+ )
+ ;
     }
 
     rule<Iterator, unsigned()> start;
 };
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -149,7 +154,8 @@
 
         std::string::const_iterator iter = str.begin();
         std::string::const_iterator end = str.end();
- bool r = parse(iter, end, roman_parser[ref(result) = _1]);
+ //[tutorial_roman_grammar_parse
+ bool r = parse(iter, end, roman_parser, result);
 
         if (r && iter == end)
         {
@@ -166,6 +172,7 @@
             std::cout << "stopped at: \": " << rest << "\"\n";
             std::cout << "-------------------------\n";
         }
+ //]
     }
 
     std::cout << "Bye... :-) \n\n";


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