|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50369 - in trunk/libs/spirit/doc: . html html/spirit html/spirit/lex html/spirit/lex/abstracts html/spirit/lex/reference html/spirit/lex/tutorials html/spirit/notes html/spirit/qi_and_karma html/spirit/qi_and_karma/abstracts
From: joel_at_[hidden]
Date: 2008-12-23 04:39:12
Author: djowel
Date: 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
New Revision: 50369
URL: http://svn.boost.org/trac/boost/changeset/50369
Log:
doc updates
Text files modified:
trunk/libs/spirit/doc/concepts_template.qbk | 92 ++++----
trunk/libs/spirit/doc/html/index.html | 25 +-
trunk/libs/spirit/doc/html/spirit/acknowledgments.html | 2
trunk/libs/spirit/doc/html/spirit/introduction.html | 133 ++++++-------
trunk/libs/spirit/doc/html/spirit/lex.html | 58 +++---
trunk/libs/spirit/doc/html/spirit/lex/abstracts.html | 20 -
trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_states.html | 6
trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_static_model.html | 22 -
trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_tokenizing.html | 4
trunk/libs/spirit/doc/html/spirit/lex/reference/lexer_class.html | 8
trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart1.html | 28 +-
trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart2.html | 27 +-
trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart3.html | 25 +-
trunk/libs/spirit/doc/html/spirit/notes/style_guide.html | 12
trunk/libs/spirit/doc/html/spirit/qi_and_karma.html | 373 ++++++++++++++-------------------------
trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/mini_xml___error_handling.html | 30 +--
trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html | 10
trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html | 10
trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html | 2
trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html | 10
trunk/libs/spirit/doc/html/spirit/what_s_new.html | 8
trunk/libs/spirit/doc/introduction.qbk | 68 +++---
trunk/libs/spirit/doc/reference_template.qbk | 112 ++++++------
23 files changed, 466 insertions(+), 619 deletions(-)
Modified: trunk/libs/spirit/doc/concepts_template.qbk
==============================================================================
--- trunk/libs/spirit/doc/concepts_template.qbk (original)
+++ trunk/libs/spirit/doc/concepts_template.qbk 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -1,46 +1,46 @@
-[/==============================================================================
- Copyright (C) 2001-2008 Joel de Guzman
- Copyright (C) 2001-2008 Hartmut Kaiser
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-===============================================================================/]
-
-[section XXX]
-
-[heading Description]
-
-Description of XXX concept
-
-[variablelist Notation
- [[`xxx`] [An XXX]]
-]
-
-[heading Valid Expressions]
-
-(For any Forward Sequence the following expressions must be valid:)
-
-In addition to the requirements defined in _XXX-Basic_concept_, for any
-XXX the following must be met:
-
-[table
- [[Expression] [Semantics] [Return type] [Complexity]]
- [[`xxx`] [Semantics of `xxx`] [XXX] [Constant]]
-]
-
-[heading Type Requirements]
-
-[table
- [[Expression] [Requirements]]
- [[`xxx`] [Requirements for `xxx`]]
-]
-
-[heading Invariants]
-
-For any XXX xxx the following invariants always hold:
-
-[heading Models]
-
-Links to models of XXX concept
-
-[endsect]
+[/==============================================================================
+ Copyright (C) 2001-2008 Joel de Guzman
+ Copyright (C) 2001-2008 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+===============================================================================/]
+
+[section XXX]
+
+[heading Description]
+
+Description of XXX concept
+
+[variablelist Notation
+ [[`xxx`] [An XXX]]
+]
+
+[heading Valid Expressions]
+
+(For any Forward Sequence the following expressions must be valid:)
+
+In addition to the requirements defined in _XXX-Basic_concept_, for any
+XXX the following must be met:
+
+[table
+ [[Expression] [Semantics] [Return type] [Complexity]]
+ [[`xxx`] [Semantics of `xxx`] [XXX] [Constant]]
+]
+
+[heading Type Requirements]
+
+[table
+ [[Expression] [Requirements]]
+ [[`xxx`] [Requirements for `xxx`]]
+]
+
+[heading Invariants]
+
+For any XXX xxx the following invariants always hold:
+
+[heading Models]
+
+Links to models of XXX concept
+
+[endsect]
Modified: trunk/libs/spirit/doc/html/index.html
==============================================================================
--- trunk/libs/spirit/doc/html/index.html (original)
+++ trunk/libs/spirit/doc/html/index.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 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="id616212"></a><p>
+<a name="id386666"></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>
@@ -184,11 +184,11 @@
</p>
</blockquote></div>
<a name="spirit.preface.history"></a><h3>
-<a name="id616266"></a>
+<a name="id388764"></a>
<a href="index.html#spirit.preface.history">History</a>
</h3>
<a name="spirit.preface._emphasis_80s__emphasis_"></a><h3>
-<a name="id616279"></a>
+<a name="id386336"></a>
<a href="index.html#spirit.preface._emphasis_80s__emphasis_"><span class="emphasis"><em>80s</em></span></a>
</h3>
<p>
@@ -202,7 +202,7 @@
recursive-descent parser. This worked very well.
</p>
<a name="spirit.preface._emphasis_90s__emphasis_"></a><h3>
-<a name="id616297"></a>
+<a name="id386375"></a>
<a href="index.html#spirit.preface._emphasis_90s__emphasis_"><span class="emphasis"><em>90s</em></span></a>
</h3>
<p>
@@ -238,8 +238,7 @@
version was implemented with run-time polymorphic classes. A parser is generated
at run time by feeding in production rule strings such as:
</p>
-<pre class="programlisting">
-<span class="string">"prod ::= {'A' | 'B'} 'C';"</span>
+<pre class="programlisting"><span class="string">"prod ::= {'A' | 'B'} 'C';"</span>
</pre>
<p>
A compile function compiled the parser, dynamically creating a hierarchy of
@@ -247,7 +246,7 @@
here: pre-Spirit.
</p>
<a name="spirit.preface._emphasis_2001_to_2006__emphasis_"></a><h3>
-<a name="id616340"></a>
+<a name="id388110"></a>
<a href="index.html#spirit.preface._emphasis_2001_to_2006__emphasis_"><span class="emphasis"><em>2001
to 2006</em></span></a>
</h3>
@@ -277,7 +276,7 @@
for design and implementation quality, robustness, and reusability.
</p>
<a name="spirit.preface._emphasis_2007__emphasis_"></a><h3>
-<a name="id616375"></a>
+<a name="id387263"></a>
<a href="index.html#spirit.preface._emphasis_2007__emphasis_"><span class="emphasis"><em>2007</em></span></a>
</h3>
<p>
@@ -307,7 +306,7 @@
Templates</a> library called -Boost.Proto-.
</p>
<a name="spirit.preface.new_ideas__spirit_v2"></a><h3>
-<a name="id616441"></a>
+<a name="id387382"></a>
<a href="index.html#spirit.preface.new_ideas__spirit_v2">New Ideas: Spirit V2</a>
</h3>
<p>
@@ -345,7 +344,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="id616491"></a>
+<a name="id387485"></a>
<a href="index.html#spirit.preface.how_to_use_this_manual">How to use this manual</a>
</h3>
<p>
@@ -376,7 +375,7 @@
icons precede some text to indicate:
</p>
<div class="table">
-<a name="id616539"></a><p class="title"><b>Table 1. Icons</b></p>
+<a name="id387571"></a><p class="title"><b>Table 1. Icons</b></p>
<table class="table" summary="Icons">
<colgroup>
<col>
@@ -497,7 +496,7 @@
Tools</a>.
</p>
<a name="spirit.preface.support"></a><h3>
-<a name="id616780"></a>
+<a name="id386631"></a>
<a href="index.html#spirit.preface.support">Support</a>
</h3>
<p>
@@ -513,7 +512,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: July 16, 2008 at 03:04:03 GMT</small></p></td>
+<td align="left"><p><small>Last revised: December 23, 2008 at 09:37:55 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: trunk/libs/spirit/doc/html/spirit/acknowledgments.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/acknowledgments.html (original)
+++ trunk/libs/spirit/doc/html/spirit/acknowledgments.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -46,7 +46,7 @@
<span class="bold"><b>FIXME</b></span>: Add more people
</p>
<a name="spirit.acknowledgments.acknowledgements_from_the_spirit_v1__emphasis_classic__emphasis__documentation"></a><h3>
-<a name="id665442"></a>
+<a name="id506650"></a>
<a href="acknowledgments.html#spirit.acknowledgments.acknowledgements_from_the_spirit_v1__emphasis_classic__emphasis__documentation">Acknowledgements
from the Spirit V1 <span class="emphasis"><em>classic</em></span> Documentation</a>
</h3>
Modified: trunk/libs/spirit/doc/html/spirit/introduction.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/introduction.html (original)
+++ trunk/libs/spirit/doc/html/spirit/introduction.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -26,18 +26,18 @@
<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.
+ Boost Spirit is an object-oriented, recursive-descent parser and output generation
+ library for C++. It allows you to write grammars and format descriptions using
+ a format 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
+ The syntax and semantics of the libraries' API directly form domain-specific
+ embedded languages (DSEL). In fact, Spirit exposes 3 different DSELs to the
user:
</p>
<div class="itemizedlist"><ul type="disc">
@@ -53,43 +53,43 @@
</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
+ 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
+ Both the created parsers and generators are fully attributed which allows you
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.
+ 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:
+ overall structure of the Boost Spirit library. The library consists 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
+<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.
+<span class="emphasis"><em>Spirit.Qi</em></span>: This is the parser library allowing you 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>
+<span class="emphasis"><em>Spirit.Lex</em></span>: This is the library usable to create tokenizers
+ (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
+ you 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>
@@ -117,9 +117,9 @@
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.
+ some (optional) transformation these data are converted back into some different,
+ external representation. The picture highlights Spirit's place in this data
+ transformation flow.
</p>
<p>
</p>
@@ -132,10 +132,10 @@
</div>
<p>
</p>
-<a name="spirit.introduction.a_quick_overview_about_parsing_with__emphasis_spirit_qi__emphasis_"></a><h3>
-<a name="id617238"></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>
+<a name="spirit.introduction.a_quick_overview_of_parsing_with__emphasis_spirit_qi__emphasis_"></a><h3>
+<a name="id457695"></a>
+ <a href="introduction.html#spirit.introduction.a_quick_overview_of_parsing_with__emphasis_spirit_qi__emphasis_">A
+ Quick Overview of 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
@@ -145,8 +145,7 @@
<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>
+<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>
@@ -155,8 +154,7 @@
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">>></span> <span class="identifier">expression</span> <span class="special">>></span> <span class="char">')'</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">group</span> <span class="special">=</span> <span class="char">'('</span> <span class="special">>></span> <span class="identifier">expression</span> <span class="special">>></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">>></span> <span class="special">*((</span><span class="char">'*'</span> <span class="special">>></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">>></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="special">*((</span><span class="char">'+'</span> <span class="special">>></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">>></span> <span class="identifier">term</span><span class="special">));</span>
@@ -164,15 +162,16 @@
<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:
+ is, in fact, an object that has a member function <tt class="computeroutput"><span class="identifier">parse</span></tt>
+ 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 <tt class="computeroutput"><span class="identifier">integer</span></tt>
+ invoked by <tt class="computeroutput"><span class="identifier">factor</span></tt>. Now, the
+ production rule <tt class="computeroutput"><span class="identifier">expression</span></tt>
+ in our grammar specification, traditionally called the <tt class="computeroutput"><span class="identifier">start</span></tt>
+ symbol, can recognize inputs such as:
</p>
-<pre class="programlisting">
-<span class="number">12345</span>
+<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>
@@ -191,8 +190,7 @@
shift >> 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 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,
@@ -202,8 +200,7 @@
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">>></span> <span class="identifier">b</span>
+<pre class="programlisting"><span class="identifier">a</span> <span class="special">>></span> <span class="identifier">b</span>
</pre>
<p>
The alternative operator <tt class="computeroutput"><span class="special">|</span></tt> and
@@ -213,37 +210,34 @@
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,
+<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.
+<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="id620086"></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>
+<a name="spirit.introduction.a_quick_overview_of_output_generation_with__emphasis_spirit_karma__emphasis_"></a><h3>
+<a name="id458990"></a>
+ <a href="introduction.html#spirit.introduction.a_quick_overview_of_output_generation_with__emphasis_spirit_karma__emphasis_">A
+ Quick Overview of 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.
+ Spirit not only allows you 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 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"><</span><span class="keyword">int</span><span class="special">></span></tt>. Conventional
+ structure such as a <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></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"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span> <span class="special">(</span><span class="identifier">initialize_and_fill</span><span class="special">());</span>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></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"><</span><span class="keyword">int</span><span class="special">>::</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"><</span><span class="keyword">int</span><span class="special">>::</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"><<</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">endl</span><span class="special">;</span>
@@ -251,19 +245,18 @@
<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:
+ allows you to specify output formats for arbitrary data structures in a very
+ flexible way. The following snippet is the <span class="emphasis"><em>Karma</em></span> format
+ description used to create the same output as the traditional code above:
</p>
-<pre class="programlisting">
-<span class="special">*(</span><span class="identifier">int_</span> <span class="special"><<</span> <span class="identifier">eol</span><span class="special">)</span>
+<pre class="programlisting"><span class="special">*(</span><span class="identifier">int_</span> <span class="special"><<</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"><</span><span class="keyword">int</span><span class="special">></span></tt>:
</p>
<div class="table">
-<a name="id620430"></a><p class="title"><b>Table 2. Different output formats for `std::vector<int>`</b></p>
+<a name="id459465"></a><p class="title"><b>Table 2. Different output formats for `std::vector<int>`</b></p>
<table class="table" summary="Different output formats for `std::vector<int>`">
<colgroup>
<col>
@@ -366,19 +359,19 @@
</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"><<</span></tt> operator for
+ The syntax is similar to <span class="emphasis"><em>Qi</em></span> with the exception that we
+ use the <tt class="computeroutput"><span class="special"><<</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
+ Another important feature of <span class="emphasis"><em>karma</em></span> allows you 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
+ format with different data types as long as these conform conceptually. The
next table gives some related examples.
</p>
<div class="table">
-<a name="id620803"></a><p class="title"><b>Table 3. Different data types usable with the output format
+<a name="id459935"></a><p class="title"><b>Table 3. Different data types usable with the output format
`(*int_ << eol)`</b></p>
<table class="table" summary="Different data types usable with the output format
`(*int_ << eol)`">
Modified: trunk/libs/spirit/doc/html/spirit/lex.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -96,23 +96,23 @@
is not perfect.
</li>
</ul></div>
-<a name="spirit.lex.lexer_introduction.why_using_a_separate_lexer"></a><h4>
-<a name="id648365"></a>
- <a href="lex.html#spirit.lex.lexer_introduction.why_using_a_separate_lexer">Why
- Using a Separate Lexer</a>
+<a name="spirit.lex.lexer_introduction.why_use_a_separate_lexer_"></a><h4>
+<a name="id488039"></a>
+ <a href="lex.html#spirit.lex.lexer_introduction.why_use_a_separate_lexer_">Why
+ Use 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
+ feeding the parser with a stream of input tokens only. Theoretically it is
+ not necessary implement this separation as 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
+ you 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
+ However, this 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>
@@ -147,25 +147,24 @@
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>
+<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>
+<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.
+ be implemented using plain regular expressions. 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
+ 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
@@ -197,7 +196,7 @@
grammar recognizers.
</p>
<a name="spirit.lex.lexer_introduction.advantages_of_using__emphasis_spirit_lex__emphasis_"></a><h4>
-<a name="id648579"></a>
+<a name="id488369"></a>
<a href="lex.html#spirit.lex.lexer_introduction.advantages_of_using__emphasis_spirit_lex__emphasis_">Advantages
of using <span class="emphasis"><em>Spirit.Lex</em></span></a>
</h4>
@@ -210,22 +209,22 @@
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:
+ gives you the vast majority of 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)
+ The definition of tokens is done using regular expressions (patterns)
</li>
<li>
- the token definitions can refer to special substitution string (pattern
+ The token definitions can refer to special substitution strings (pattern
macros) simplifying pattern definitions
</li>
<li>
- the generated lexical scanner may have multiple start states
+ 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
+ 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>
@@ -238,14 +237,15 @@
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
+ building the lexical analyzer dynamically at runtime. The dynamic model is
something not supported by Flex
or other lexical scanner generators (such as re2c,
<a href="http://www.cs.queensu.ca/~thurston/ragel/" target="_top">Ragel</a>, etc.).
- But it is very flexible and allows to speed up the development of your application.
+ But it is very flexible and allows you to speed up the development of your
+ application.
</p>
<a name="spirit.lex.lexer_introduction.the_library_structure_of__emphasis_spirit_lex__emphasis_"></a><h4>
-<a name="id648682"></a>
+<a name="id488543"></a>
<a href="lex.html#spirit.lex.lexer_introduction.the_library_structure_of__emphasis_spirit_lex__emphasis_">The
Library Structure of <span class="emphasis"><em>Spirit.Lex</em></span></a>
</h4>
Modified: trunk/libs/spirit/doc/html/spirit/lex/abstracts.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex/abstracts.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex/abstracts.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -84,7 +84,7 @@
of the <span class="emphasis"><em>Spirit.Lex</em></span> library.
</p>
<a name="spirit.lex.abstracts.lexer_primitives.lexer_token_values.the_anatomy_of_a_token"></a><h6>
-<a name="id658935"></a>
+<a name="id499645"></a>
<a href="abstracts.html#spirit.lex.abstracts.lexer_primitives.lexer_token_values.the_anatomy_of_a_token">The
Anatomy of a Token</a>
</h6>
@@ -134,7 +134,7 @@
</p>
<div class="figure">
<a name="spirit.lex.tokenstructure"></a><p class="title"><b>Figure 5. The structure of a token</b></p>
-<span class="inlinemediaobject"><img src="../.././images/TokenStructure.png" alt="The
+<span class="inlinemediaobject"><img src="../.././images/tokenstructure.png" alt="The
structure of a token"></span>
</div>
<p>
@@ -178,8 +178,7 @@
Here is the template prototype of the lexertl_token<>
template:
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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"><>,</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>
@@ -222,7 +221,7 @@
when it is requested for the first time.
</p>
<a name="spirit.lex.abstracts.lexer_primitives.lexer_token_values.the_physiognomy_of_a_token_definition"></a><h6>
-<a name="id659461"></a>
+<a name="id500459"></a>
<a href="abstracts.html#spirit.lex.abstracts.lexer_primitives.lexer_token_values.the_physiognomy_of_a_token_definition">The
Physiognomy of a Token Definition</a>
</h6>
@@ -235,8 +234,7 @@
<p>
The template prototype of this class is shown here:
</p>
-<pre class="programlisting">
-<span class="keyword">template</span><span class="special"><</span>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</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">></span>
@@ -296,7 +294,7 @@
</td></tr>
</table></div>
<a name="spirit.lex.abstracts.lexer_primitives.lexer_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="id659718"></a>
+<a name="id500867"></a>
<a href="abstracts.html#spirit.lex.abstracts.lexer_primitives.lexer_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>
@@ -320,8 +318,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="comment">// these tokens expose the iterator_range of the matched input sequence
+<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"><></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'
@@ -361,8 +358,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="comment">// This is the lexer token type to use. The second template parameter lists
+<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<> above). Here we use the predefined lexertl token
</span><span class="comment">// type, but any compatible token type may be used instead.
Modified: trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_states.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_states.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_states.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -26,17 +26,17 @@
<div class="titlepage"><div><div><h4 class="title">
<a name="spirit.lex.abstracts.lexer_states"></a> Lexer States</h4></div></div></div>
<a name="spirit.lex.abstracts.lexer_states.controlling_the_lexer_state_from_lexer_semantic_actions"></a><h5>
-<a name="id664594"></a>
+<a name="id505296"></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="id664607"></a>
+<a name="id505327"></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="id664620"></a>
+<a name="id505358"></a>
<a href="lexer_states.html#spirit.lex.abstracts.lexer_states.using_a_lexer_state_for_the_skip_parser">Using
a Lexer State for the Skip Parser</a>
</h5>
Modified: trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_static_model.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_static_model.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_static_model.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -82,8 +82,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">enum</span> <span class="identifier">tokenids</span>
+<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>
@@ -104,8 +103,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="comment">// This token definition class can be used without any change for all three
+<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"><</span><span class="keyword">typename</span> <span class="identifier">BaseLexer</span><span class="special">></span>
@@ -147,8 +145,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="comment">// This is an ordinary grammar definition following the rules defined by
+<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<> instances.
@@ -181,7 +178,7 @@
<p>
</p>
<a name="spirit.lex.abstracts.lexer_static_model.generating_the_static_analyzer"></a><h5>
-<a name="id662050"></a>
+<a name="id503276"></a>
<a href="lexer_static_model.html#spirit.lex.abstracts.lexer_static_model.generating_the_static_analyzer">Generating
the Static Analyzer</a>
</h5>
@@ -202,8 +199,7 @@
<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>
+<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"><</span><span class="identifier">lexertl_lexer</span><span class="special"><></span> <span class="special">></span> <span class="identifier">word_count</span><span class="special">;</span> <span class="comment">// the token definition
@@ -228,7 +224,7 @@
the next topic (the full generated code can be viewed here).
</p>
<a name="spirit.lex.abstracts.lexer_static_model.modifying_the_dynamic_analyzer"></a><h5>
-<a name="id662419"></a>
+<a name="id503799"></a>
<a href="lexer_static_model.html#spirit.lex.abstracts.lexer_static_model.modifying_the_dynamic_analyzer">Modifying
the Dynamic Analyzer</a>
</h5>
@@ -248,8 +244,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="preprocessor">#include</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">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">></span>
+<pre class="programlisting"><span class="preprocessor">#include</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">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">></span>
</pre>
<p>
</p>
@@ -269,8 +264,7 @@
<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>
+<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.
Modified: trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_tokenizing.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_tokenizing.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex/abstracts/lexer_tokenizing.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -30,12 +30,12 @@
Input Data"> Tokenizing
Input Data</a></h4></div></div></div>
<a name="spirit.lex.abstracts.lexer_tokenizing.the_tokenize___function"></a><h5>
-<a name="id660244"></a>
+<a name="id501672"></a>
<a href="lexer_tokenizing.html#spirit.lex.abstracts.lexer_tokenizing.the_tokenize___function">The
tokenize() function</a>
</h5>
<a name="spirit.lex.abstracts.lexer_tokenizing.the_generate_static___function"></a><h5>
-<a name="id660261"></a>
+<a name="id501700"></a>
<a href="lexer_tokenizing.html#spirit.lex.abstracts.lexer_tokenizing.the_generate_static___function">The
generate_static() function</a>
</h5>
Modified: trunk/libs/spirit/doc/html/spirit/lex/reference/lexer_class.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex/reference/lexer_class.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex/reference/lexer_class.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -26,22 +26,22 @@
<div class="titlepage"><div><div><h4 class="title">
<a name="spirit.lex.reference.lexer_class"></a>Lexer Class</h4></div></div></div>
<a name="spirit.lex.reference.lexer_class.the_lexertl_lexer_class_implementing_the_dynamic_model"></a><h5>
-<a name="id664720"></a>
+<a name="id505548"></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="id664733"></a>
+<a name="id505576"></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="id664746"></a>
+<a name="id505606"></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="id664759"></a>
+<a name="id505637"></a>
<a href="lexer_class.html#spirit.lex.reference.lexer_class.the_lexertl_static_actor_lexer_class_implementing_the_static_model">The
lexertl_static_actor_lexer Class Implementing the Static Model</a>
</h5>
Modified: trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart1.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart1.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart1.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -43,7 +43,7 @@
(for the full example code see here: word_count_functor.cpp).
</p>
<a name="spirit.lex.tutorials.lexer_quickstart1.prerequisites"></a><h5>
-<a name="id648951"></a>
+<a name="id488986"></a>
<a href="lexer_quickstart1.html#spirit.lex.tutorials.lexer_quickstart1.prerequisites">Prerequisites</a>
</h5>
<p>
@@ -59,8 +59,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="preprocessor">#include</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">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">></span>
+<pre class="programlisting"><span class="preprocessor">#include</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">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">></span>
<span class="preprocessor">#include</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">hpp</span><span class="special">></span>
<span class="preprocessor">#include</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">hpp</span><span class="special">></span>
</pre>
@@ -76,8 +75,7 @@
<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>
+<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>
@@ -85,7 +83,7 @@
<p>
</p>
<a name="spirit.lex.tutorials.lexer_quickstart1.defining_tokens"></a><h5>
-<a name="id649646"></a>
+<a name="id489371"></a>
<a href="lexer_quickstart1.html#spirit.lex.tutorials.lexer_quickstart1.defining_tokens">Defining
Tokens</a>
</h5>
@@ -120,8 +118,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Lexer</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Lexer</span><span class="special">></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"><</span><span class="identifier">Lexer</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Self</span><span class="special">></span>
@@ -142,7 +139,7 @@
<p>
</p>
<a name="spirit.lex.tutorials.lexer_quickstart1.doing_the_useful_work"></a><h5>
-<a name="id649992"></a>
+<a name="id489877"></a>
<a href="lexer_quickstart1.html#spirit.lex.tutorials.lexer_quickstart1.doing_the_useful_work">Doing
the Useful Work</a>
</h5>
@@ -168,8 +165,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">struct</span> <span class="identifier">counter</span>
+<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
@@ -208,7 +204,7 @@
as well.
</p>
<a name="spirit.lex.tutorials.lexer_quickstart1.pulling_everything_together"></a><h5>
-<a name="id650494"></a>
+<a name="id490577"></a>
<a href="lexer_quickstart1.html#spirit.lex.tutorials.lexer_quickstart1.pulling_everything_together">Pulling
Everything Together</a>
</h5>
@@ -227,8 +223,7 @@
<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>
+<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>
@@ -264,7 +259,7 @@
<p>
</p>
<a name="spirit.lex.tutorials.lexer_quickstart1.comparing__emphasis_spirit_lex__emphasis__with__ulink_url__http___flex_sourceforge_net___flex__ulink_"></a><h5>
-<a name="id651326"></a>
+<a name="id491716"></a>
<a href="lexer_quickstart1.html#spirit.lex.tutorials.lexer_quickstart1.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>
@@ -306,8 +301,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="special">%{</span>
+<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>
Modified: trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart2.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart2.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart2.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -45,7 +45,7 @@
options along the lines (for the full example code see here: word_count_lexer.cpp).
</p>
<a name="spirit.lex.tutorials.lexer_quickstart2.prerequisites"></a><h5>
-<a name="id652117"></a>
+<a name="id492776"></a>
<a href="lexer_quickstart2.html#spirit.lex.tutorials.lexer_quickstart2.prerequisites">Prerequisites</a>
</h5>
<p>
@@ -65,8 +65,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">support_argument</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre class="programlisting"><span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">support_argument</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</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">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">></span>
<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">phoenix_operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">phoenix_statement</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
@@ -85,8 +84,7 @@
<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>
+<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>
@@ -103,8 +101,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="special">%{</span>
+<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>
@@ -123,7 +120,7 @@
<p>
</p>
<a name="spirit.lex.tutorials.lexer_quickstart2.semantic_actions_in__emphasis_spirit_lex__emphasis_"></a><h5>
-<a name="id652815"></a>
+<a name="id493728"></a>
<a href="lexer_quickstart2.html#spirit.lex.tutorials.lexer_quickstart2.semantic_actions_in__emphasis_spirit_lex__emphasis_">Semantic
Actions in <span class="emphasis"><em>Spirit.Lex</em></span></a>
</h5>
@@ -140,8 +137,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Lexer</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Lexer</span><span class="special">></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"><</span><span class="identifier">Lexer</span><span class="special">></span>
<span class="special">{</span>
<span class="identifier">word_count_tokens</span><span class="special">()</span>
@@ -181,8 +177,7 @@
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">&</span> <span class="identifier">matched</span><span class="special">,</span> <span class="identifier">Context</span><span class="special">&</span> <span class="identifier">ctx</span><span class="special">);</span>
+<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">&</span> <span class="identifier">matched</span><span class="special">,</span> <span class="identifier">Context</span><span class="special">&</span> <span class="identifier">ctx</span><span class="special">);</span>
</pre>
<div class="variablelist">
<p class="title"><b>where:</b></p>
@@ -221,8 +216,7 @@
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">&</span> <span class="identifier">matched</span><span class="special">);</span>
+<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">&</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>
@@ -240,7 +234,7 @@
to the internal lexer context.
</p>
<a name="spirit.lex.tutorials.lexer_quickstart2.associating_token_definitions_with_the_lexer"></a><h5>
-<a name="id653861"></a>
+<a name="id495186"></a>
<a href="lexer_quickstart2.html#spirit.lex.tutorials.lexer_quickstart2.associating_token_definitions_with_the_lexer">Associating
Token Definitions with the Lexer</a>
</h5>
@@ -255,8 +249,7 @@
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>
+<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>
Modified: trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart3.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart3.html (original)
+++ trunk/libs/spirit/doc/html/spirit/lex/tutorials/lexer_quickstart3.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -52,7 +52,7 @@
<div class="figure">
<a name="spirit.lex.flowcontrol"></a><p class="title"><b>Figure 4. 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
+<span class="inlinemediaobject"><img src="../../.././images/flowofcontrol.png" alt="The common flow
control implemented while parsing combined with lexical analysis"></span>
</div>
<p>
@@ -70,7 +70,7 @@
code see here: word_count.cpp).
</p>
<a name="spirit.lex.tutorials.lexer_quickstart3.prerequisites"></a><h5>
-<a name="id655484"></a>
+<a name="id495762"></a>
<a href="lexer_quickstart3.html#spirit.lex.tutorials.lexer_quickstart3.prerequisites">Prerequisites</a>
</h5>
<p>
@@ -92,8 +92,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">qi</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre class="programlisting"><span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">qi</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</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">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">></span>
<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">phoenix_operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">phoenix_statement</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
@@ -111,8 +110,7 @@
<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>
+<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>
@@ -121,7 +119,7 @@
<p>
</p>
<a name="spirit.lex.tutorials.lexer_quickstart3.defining_tokens"></a><h5>
-<a name="id655884"></a>
+<a name="id496323"></a>
<a href="lexer_quickstart3.html#spirit.lex.tutorials.lexer_quickstart3.defining_tokens">Defining
Tokens</a>
</h5>
@@ -144,8 +142,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Lexer</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Lexer</span><span class="special">></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"><</span><span class="identifier">Lexer</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Self</span><span class="special">></span>
@@ -177,7 +174,7 @@
<p>
</p>
<a name="spirit.lex.tutorials.lexer_quickstart3.using_token_definition_instances_as_parsers"></a><h5>
-<a name="id656242"></a>
+<a name="id496819"></a>
<a href="lexer_quickstart3.html#spirit.lex.tutorials.lexer_quickstart3.using_token_definition_instances_as_parsers">Using
Token Definition Instances as Parsers</a>
</h5>
@@ -285,8 +282,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">word_count_grammar</span> <span class="special">:</span> <span class="identifier">grammar</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">TokenDef</span><span class="special">></span>
@@ -355,7 +351,7 @@
</p></td></tr>
</table></div>
<a name="spirit.lex.tutorials.lexer_quickstart3.pulling_everything_together"></a><h5>
-<a name="id657239"></a>
+<a name="id498236"></a>
<a href="lexer_quickstart3.html#spirit.lex.tutorials.lexer_quickstart3.pulling_everything_together">Pulling
Everything Together</a>
</h5>
@@ -373,8 +369,7 @@
<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>
+<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="lexer_quickstart3.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"><</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"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">></span>
Modified: trunk/libs/spirit/doc/html/spirit/notes/style_guide.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/notes/style_guide.html (original)
+++ trunk/libs/spirit/doc/html/spirit/notes/style_guide.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -58,8 +58,7 @@
all, what belongs to one level, at one indentation level.
</li>
</ul></div>
-<pre class="programlisting">
-<span class="identifier">program</span>
+<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">>></span> <span class="identifier">block</span> <span class="special">[</span><span class="identifier">block_action</span><span class="special">]</span>
<span class="special">>></span> <span class="char">'.'</span>
@@ -85,8 +84,7 @@
separate them from the rules.
</li>
</ul></div>
-<pre class="programlisting">
-<span class="identifier">program_heading</span>
+<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">>></span> <span class="identifier">identifier</span>
<span class="special">>></span> <span class="char">'('</span>
@@ -102,8 +100,7 @@
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>
+<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>
@@ -122,8 +119,7 @@
'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>
+<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>
Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -120,7 +120,7 @@
<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="id621042"></a>
+<a name="id460252"></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>
@@ -167,15 +167,14 @@
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="id621087"></a>
+<a name="id460361"></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 class="programlisting"><span class="identifier">double_</span>
</pre>
<p>
(You've got to admit, that's trivial!) The above code actually generates
@@ -183,7 +182,7 @@
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="id621117"></a>
+<a name="id460416"></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>
@@ -191,8 +190,7 @@
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">>></span> <span class="identifier">double_</span>
+<pre class="programlisting"><span class="identifier">double_</span> <span class="special">>></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>
@@ -217,15 +215,14 @@
</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="id621180"></a>
+<a name="id460526"></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 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
@@ -242,7 +239,7 @@
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="id621225"></a>
+<a name="id460609"></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>
@@ -250,8 +247,7 @@
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">>></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">>></span> <span class="identifier">double_</span><span class="special">)</span>
+<pre class="programlisting"><span class="identifier">double_</span> <span class="special">>></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">>></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
@@ -259,15 +255,14 @@
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">>></span> <span class="identifier">double_</span><span class="special">)</span>
+<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">>></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="id621358"></a>
+<a name="id460803"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.warming_up.let_s_parse_">Let's
Parse!</a>
</h5>
@@ -308,8 +303,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></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>
@@ -442,8 +436,7 @@
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 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>
@@ -456,8 +449,7 @@
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 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
@@ -496,8 +488,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="comment">// A plain function
+<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">&</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"><<</span> <span class="identifier">i</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -536,8 +527,7 @@
<p>
All examples parse inputs of the form:
</p>
-<pre class="programlisting">
-<span class="string">"{integer}"</span>
+<pre class="programlisting"><span class="string">"{integer}"</span>
</pre>
<p>
An integer inside the curly braces.
@@ -550,8 +540,7 @@
<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">>></span> <span class="identifier">int_</span><span class="special">[&</span><span class="identifier">write</span><span class="special">]</span> <span class="special">>></span> <span class="char">'}'</span><span class="special">);</span>
+<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">>></span> <span class="identifier">int_</span><span class="special">[&</span><span class="identifier">write</span><span class="special">]</span> <span class="special">>></span> <span class="char">'}'</span><span class="special">);</span>
</pre>
<p>
</p>
@@ -570,8 +559,7 @@
<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">>></span> <span class="identifier">int_</span><span class="special">[</span><span class="identifier">write_action</span><span class="special">()]</span> <span class="special">>></span> <span class="char">'}'</span><span class="special">);</span>
+<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">>></span> <span class="identifier">int_</span><span class="special">[</span><span class="identifier">write_action</span><span class="special">()]</span> <span class="special">>></span> <span class="char">'}'</span><span class="special">);</span>
</pre>
<p>
</p>
@@ -586,8 +574,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="identifier">writer</span> <span class="identifier">w</span><span class="special">;</span>
+<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">>></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">(&</span><span class="identifier">writer</span><span class="special">::</span><span class="identifier">print</span><span class="special">,</span> <span class="special">&</span><span class="identifier">w</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>
</pre>
<p>
@@ -603,8 +590,7 @@
<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">>></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">(&</span><span class="identifier">write</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>
+<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">>></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">(&</span><span class="identifier">write</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>
</pre>
<p>
</p>
@@ -618,8 +604,7 @@
<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">>></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"><<</span> <span class="identifier">_1</span> <span class="special"><<</span> <span class="char">'\n'</span><span class="special">]</span> <span class="special">>></span> <span class="char">'}'</span><span class="special">);</span>
+<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">>></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"><<</span> <span class="identifier">_1</span> <span class="special"><<</span> <span class="char">'\n'</span><span class="special">]</span> <span class="special">>></span> <span class="char">'}'</span><span class="special">);</span>
</pre>
<p>
</p>
@@ -637,7 +622,7 @@
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="id623150"></a>
+<a name="id463328"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.semantic_actions.phoenix">Phoenix</a>
</h5>
<p>
@@ -663,8 +648,7 @@
<p>
Here's a simple parser expression for complex numbers:
</p>
-<pre class="programlisting">
- <span class="char">'('</span> <span class="special">>></span> <span class="identifier">double_</span> <span class="special">>></span> <span class="special">-(</span><span class="char">','</span> <span class="special">>></span> <span class="identifier">double_</span><span class="special">)</span> <span class="special">>></span> <span class="char">')'</span>
+<pre class="programlisting"> <span class="char">'('</span> <span class="special">>></span> <span class="identifier">double_</span> <span class="special">>></span> <span class="special">-(</span><span class="char">','</span> <span class="special">>></span> <span class="identifier">double_</span><span class="special">)</span> <span class="special">>></span> <span class="char">')'</span>
<span class="special">|</span> <span class="identifier">double_</span>
</pre>
<p>
@@ -695,8 +679,7 @@
<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>
+<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>
@@ -708,8 +691,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></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"><</span><span class="keyword">double</span><span class="special">>&</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>
@@ -743,8 +725,7 @@
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 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>
@@ -770,8 +751,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">qi</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre class="programlisting"><span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">qi</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">phoenix_core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">phoenix_operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
@@ -789,8 +769,7 @@
<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>
+<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>
@@ -905,8 +884,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></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">&</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>
@@ -943,8 +921,7 @@
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 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>.
@@ -956,8 +933,7 @@
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 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>.
@@ -980,8 +956,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></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"><</span><span class="keyword">double</span><span class="special">>&</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>
@@ -1014,8 +989,7 @@
<tt class="computeroutput"><span class="identifier">push_back</span></tt> is supplied by
<a href="../../../phoenix/doc/html/index.html" target="_top">Phoenix</a>. 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 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>
@@ -1034,16 +1008,14 @@
<p>
So far, we've been using the syntax:
</p>
-<pre class="programlisting">
-<span class="identifier">double_</span> <span class="special">>></span> <span class="special">*(</span><span class="char">','</span> <span class="special">>></span> <span class="identifier">double_</span><span class="special">)</span>
+<pre class="programlisting"><span class="identifier">double_</span> <span class="special">>></span> <span class="special">*(</span><span class="char">','</span> <span class="special">>></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 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>.
@@ -1057,8 +1029,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></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"><</span><span class="keyword">double</span><span class="special">>&</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>
@@ -1097,20 +1068,17 @@
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 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 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"><</span><span class="keyword">double</span><span class="special">></span>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></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"><</span><span class="keyword">double</span><span class="special">></span></tt>
@@ -1143,8 +1111,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></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"><</span><span class="keyword">double</span><span class="special">>&</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>
@@ -1195,7 +1162,7 @@
</li>
</ul></div>
<a name="spirit.qi_and_karma.tutorials.roman_numerals.symbol_table"></a><h5>
-<a name="id627428"></a>
+<a name="id467678"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals.symbol_table">Symbol
Table</a>
</h5>
@@ -1236,8 +1203,7 @@
<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"><</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">></span>
+<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"><</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">></span>
<span class="special">{</span>
<span class="identifier">hundreds_</span><span class="special">()</span>
<span class="special">{</span>
@@ -1268,8 +1234,7 @@
<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"><</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">></span>
+<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"><</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">></span>
<span class="special">{</span>
<span class="identifier">tens_</span><span class="special">()</span>
<span class="special">{</span>
@@ -1300,8 +1265,7 @@
<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"><</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">></span>
+<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"><</span><span class="keyword">char</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">></span>
<span class="special">{</span>
<span class="identifier">ones_</span><span class="special">()</span>
<span class="special">{</span>
@@ -1330,7 +1294,7 @@
They are all parsers.
</p>
<a name="spirit.qi_and_karma.tutorials.roman_numerals.rules"></a><h5>
-<a name="id628936"></a>
+<a name="id468962"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals.rules">Rules</a>
</h5>
<p>
@@ -1347,8 +1311,7 @@
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"><</span><span class="identifier">Iterator</span><span class="special">></span> <span class="identifier">r</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">></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
@@ -1358,14 +1321,12 @@
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"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">Skipper</span><span class="special">></span> <span class="identifier">r</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">Skipper</span><span class="special">></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"><</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">></span> <span class="identifier">r</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">space_type</span><span class="special">></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>
@@ -1374,14 +1335,12 @@
<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"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">Signature</span><span class="special">></span> <span class="identifier">r</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">Signature</span><span class="special">></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"><</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">></span> <span class="identifier">r</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</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">></span> <span class="identifier">r</span><span class="special">;</span>
</pre>
<div class="tip"><table border="0" summary="Tip">
<tr>
@@ -1406,18 +1365,16 @@
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 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">>></span> <span class="special">*(</span><span class="char">','</span> <span class="special">>></span> <span class="identifier">double_</span><span class="special">);</span>
+<pre class="programlisting"><span class="identifier">r</span> <span class="special">=</span> <span class="identifier">double_</span> <span class="special">>></span> <span class="special">*(</span><span class="char">','</span> <span class="special">>></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="id629337"></a>
+<a name="id469547"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals.grammars">Grammars</a>
</h5>
<p>
@@ -1448,8 +1405,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">roman</span> <span class="special">:</span> <span class="identifier">grammar</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="keyword">unsigned</span><span class="special">()></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>
@@ -1517,7 +1473,7 @@
</li>
</ul></div>
<a name="spirit.qi_and_karma.tutorials.roman_numerals.let_s_parse_"></a><h5>
-<a name="id629952"></a>
+<a name="id470410"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.roman_numerals.let_s_parse_">Let's
Parse!</a>
</h5>
@@ -1526,8 +1482,7 @@
<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>
+<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">&&</span> <span class="identifier">iter</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">)</span>
<span class="special">{</span>
@@ -1597,8 +1552,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">struct</span> <span class="identifier">employee</span>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">employee</span>
<span class="special">{</span>
<span class="keyword">int</span> <span class="identifier">age</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">surname</span><span class="special">;</span>
@@ -1626,8 +1580,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="identifier">BOOST_FUSION_ADAPT_STRUCT</span><span class="special">(</span>
+<pre class="programlisting"><span class="identifier">BOOST_FUSION_ADAPT_STRUCT</span><span class="special">(</span>
<span class="identifier">employee</span><span class="special">,</span>
<span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">age</span><span class="special">)</span>
<span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">surname</span><span class="special">)</span>
@@ -1642,8 +1595,7 @@
<p>
Now we'll write a parser for our employee. Inputs will be of the form:
</p>
-<pre class="programlisting">
-<span class="identifier">employee</span><span class="special">{</span> <span class="identifier">age</span><span class="special">,</span> <span class="string">"surname"</span><span class="special">,</span> <span class="string">"forename"</span><span class="special">,</span> <span class="identifier">salary</span> <span class="special">}</span>
+<pre class="programlisting"><span class="identifier">employee</span><span class="special">{</span> <span class="identifier">age</span><span class="special">,</span> <span class="string">"surname"</span><span class="special">,</span> <span class="string">"forename"</span><span class="special">,</span> <span class="identifier">salary</span> <span class="special">}</span>
</pre>
<p>
Here goes:
@@ -1653,8 +1605,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">employee_parser</span> <span class="special">:</span> <span class="identifier">grammar</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">employee</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span>
<span class="special">{</span>
<span class="identifier">employee_parser</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">employee_parser</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">start</span><span class="special">)</span>
@@ -1687,8 +1638,7 @@
Let's walk through this one step at a time (not necessarily from top to
bottom).
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">employee_parser</span> <span class="special">:</span> <span class="identifier">grammar</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">employee</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span>
</pre>
<p>
@@ -1696,22 +1646,19 @@
Like before, we make it a template so that we can reuse it for different
iterator types. The grammar's signature is:
</p>
-<pre class="programlisting">
-<span class="identifier">employee</span><span class="special">()</span>
+<pre class="programlisting"><span class="identifier">employee</span><span class="special">()</span>
</pre>
<p>
meaning, the parser generates employee structs. <tt class="computeroutput"><span class="identifier">employee_parser</span></tt>
skips white spaces using <tt class="computeroutput"><span class="identifier">space_type</span></tt>
as its skip parser.
</p>
-<pre class="programlisting">
-<span class="identifier">employee_parser</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">employee_parser</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">start</span><span class="special">)</span>
+<pre class="programlisting"><span class="identifier">employee_parser</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">employee_parser</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">start</span><span class="special">)</span>
</pre>
<p>
Initializes the base class.
</p>
-<pre class="programlisting">
-<span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">quoted_string</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">quoted_string</span><span class="special">;</span>
<span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">employee</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">start</span><span class="special">;</span>
</pre>
<p>
@@ -1721,51 +1668,46 @@
has a <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt> attribute.
</p>
<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.lexeme"></a><h5>
-<a name="id632030"></a>
+<a name="id472484"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.lexeme">Lexeme</a>
</h5>
-<pre class="programlisting">
-<span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span><span class="special">];</span>
+<pre class="programlisting"><span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span><span class="special">];</span>
</pre>
<p>
<tt class="computeroutput"><span class="identifier">lexeme</span></tt> inhibits space skipping
from the open brace to the closing brace. The expression parses quoted
strings.
</p>
-<pre class="programlisting">
-<span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span>
+<pre class="programlisting"><span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span>
</pre>
<p>
parses one or more chars, except the double quote. It stops when it sees
a double quote.
</p>
<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.difference"></a><h5>
-<a name="id632141"></a>
+<a name="id472645"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.difference">Difference</a>
</h5>
<p>
The expression:
</p>
-<pre class="programlisting">
-<span class="identifier">a</span> <span class="special">-</span> <span class="identifier">b</span>
+<pre class="programlisting"><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">b</span>
</pre>
<p>
parses <tt class="computeroutput"><span class="identifier">a</span></tt> but not <tt class="computeroutput"><span class="identifier">b</span></tt>. Its attribute is just <tt class="computeroutput"><span class="identifier">A</span></tt>, the attribute of <tt class="computeroutput"><span class="identifier">a</span></tt>.
<tt class="computeroutput"><span class="identifier">b</span></tt>'s attribute is ignored.
Hence, the attribute of:
</p>
-<pre class="programlisting">
-<span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span>
+<pre class="programlisting"><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span>
</pre>
<p>
is just <tt class="computeroutput"><span class="keyword">char</span></tt>.
</p>
<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.plus"></a><h5>
-<a name="id632246"></a>
+<a name="id472806"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.plus">Plus</a>
</h5>
-<pre class="programlisting">
-<span class="special">+</span><span class="identifier">a</span>
+<pre class="programlisting"><span class="special">+</span><span class="identifier">a</span>
</pre>
<p>
is the close kin of the kleene star we got so used to in our tutorial.
@@ -1773,25 +1715,22 @@
is the attribute of <tt class="computeroutput"><span class="identifier">a</span></tt>.
So, putting all these together, the attribute of
</p>
-<pre class="programlisting">
-<span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span>
+<pre class="programlisting"><span class="special">+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'"'</span><span class="special">)</span>
</pre>
<p>
is then:
</p>
-<pre class="programlisting">
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span>
</pre>
<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.sequence_attribute"></a><h5>
-<a name="id632373"></a>
+<a name="id472994"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.sequence_attribute">Sequence
Attribute</a>
</h5>
<p>
Now what's the attribute of
</p>
-<pre class="programlisting">
-<span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span>
+<pre class="programlisting"><span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span>
</pre>
<p>
?
@@ -1799,14 +1738,12 @@
<p>
Well, typically, the attribute of:
</p>
-<pre class="programlisting">
-<span class="identifier">a</span> <span class="special">>></span> <span class="identifier">b</span> <span class="special">>></span> <span class="identifier">c</span>
+<pre class="programlisting"><span class="identifier">a</span> <span class="special">>></span> <span class="identifier">b</span> <span class="special">>></span> <span class="identifier">c</span>
</pre>
<p>
is:
</p>
-<pre class="programlisting">
-<span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">,</span> <span class="identifier">C</span><span class="special">></span>
+<pre class="programlisting"><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">,</span> <span class="identifier">C</span><span class="special">></span>
</pre>
<p>
where <tt class="computeroutput"><span class="identifier">A</span></tt> is the attribute
@@ -1827,7 +1764,7 @@
</p></td></tr>
</table></div>
<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.attribute_collapsing"></a><h5>
-<a name="id632599"></a>
+<a name="id473317"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.attribute_collapsing">Attribute
Collapsing</a>
</h5>
@@ -1843,8 +1780,7 @@
<span class="special">-</span> <span class="char">'"'</span><span class="special">)</span></tt> has a <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span></tt> attribute, the whole expression's attribute
should have been:
</p>
-<pre class="programlisting">
-<span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span> <span class="special">></span>
+<pre class="programlisting"><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span> <span class="special">></span>
</pre>
<p>
But wait, there's one more collapsing rule: If after the attribute is a
@@ -1852,33 +1788,29 @@
from its container. So, to make a long story short, the attribute of the
expression:
</p>
-<pre class="programlisting">
-<span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span>
+<pre class="programlisting"><span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span>
</pre>
<p>
is:
</p>
-<pre class="programlisting">
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span>
</pre>
<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.auto_rules"></a><h5>
-<a name="id632839"></a>
+<a name="id473668"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.auto_rules">Auto
Rules</a>
</h5>
<p>
It is typical to see rules like:
</p>
-<pre class="programlisting">
-<span class="identifier">r</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">[</span><span class="identifier">_val</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">];</span>
+<pre class="programlisting"><span class="identifier">r</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">[</span><span class="identifier">_val</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">];</span>
</pre>
<p>
If you have a rule definition like above where the attribute of the RHS
(right hand side) of the rule is compatibe with the attribute of the LHS
(left hand side), then you can rewrite it as:
</p>
-<pre class="programlisting">
-<span class="identifier">r</span> <span class="special">%=</span> <span class="identifier">p</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">r</span> <span class="special">%=</span> <span class="identifier">p</span><span class="special">;</span>
</pre>
<p>
The attribute of <tt class="computeroutput"><span class="identifier">p</span></tt> automatically
@@ -1888,14 +1820,12 @@
So, going back to our <tt class="computeroutput"><span class="identifier">quoted_string</span></tt>
rule:
</p>
-<pre class="programlisting">
-<span class="identifier">quoted_string</span> <span class="special">%=</span> <span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span><span class="special">];</span>
+<pre class="programlisting"><span class="identifier">quoted_string</span> <span class="special">%=</span> <span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span><span class="special">];</span>
</pre>
<p>
is a simplified version of:
</p>
-<pre class="programlisting">
-<span class="identifier">quoted_string</span> <span class="special">=</span> <span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span><span class="special">][</span><span class="identifier">val_</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">];</span>
+<pre class="programlisting"><span class="identifier">quoted_string</span> <span class="special">=</span> <span class="identifier">lexeme</span><span class="special">[</span><span class="char">'"'</span> <span class="special">>></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">>></span> <span class="char">'"'</span><span class="special">][</span><span class="identifier">val_</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">];</span>
</pre>
<p>
The attribute of the <tt class="computeroutput"><span class="identifier">quoted_string</span></tt>
@@ -1904,14 +1834,13 @@
directly into the rule's attribute, in-situ.
</p>
<a name="spirit.qi_and_karma.tutorials.employee___parsing_into_structs.finally"></a><h5>
-<a name="id634319"></a>
+<a name="id474119"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.employee___parsing_into_structs.finally">Finally</a>
</h5>
<p>
We're down to one rule, the start rule:
</p>
-<pre class="programlisting">
-<span class="identifier">start</span> <span class="special">%=</span>
+<pre class="programlisting"><span class="identifier">start</span> <span class="special">%=</span>
<span class="identifier">lit</span><span class="special">(</span><span class="string">"employee"</span><span class="special">)</span>
<span class="special">>></span> <span class="char">'{'</span>
<span class="special">>></span> <span class="identifier">int_</span> <span class="special">>></span> <span class="char">','</span>
@@ -1924,8 +1853,7 @@
<p>
Applying our collapsing rules above, the RHS has an attribute of:
</p>
-<pre class="programlisting">
-<span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">double</span><span class="special">></span>
+<pre class="programlisting"><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">double</span><span class="special">></span>
</pre>
<p>
These nodes do not have an attribute:
@@ -1958,8 +1886,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">struct</span> <span class="identifier">employee</span>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">employee</span>
<span class="special">{</span>
<span class="keyword">int</span> <span class="identifier">age</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">surname</span><span class="special">;</span>
@@ -2028,7 +1955,7 @@
for testing purposes. "4.toyxml" has an error in it.
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.first_cut"></a><h5>
-<a name="id634972"></a>
+<a name="id475029"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.first_cut">First
Cut</a>
</h5>
@@ -2040,8 +1967,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">mini_xml_grammar</span> <span class="special">:</span> <span class="identifier">grammar</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span>
<span class="special">{</span>
<span class="identifier">mini_xml_grammar</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">mini_xml_grammar</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">xml</span><span class="special">)</span>
@@ -2084,14 +2010,12 @@
Going bottom up, let's examine the <tt class="computeroutput"><span class="identifier">text</span></tt>
rule:
</p>
-<pre class="programlisting">
-<span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">text</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">text</span><span class="special">;</span>
</pre>
<p>
and its definition:
</p>
-<pre class="programlisting">
-<span class="identifier">text</span> <span class="special">=</span> <span class="identifier">lexeme</span><span class="special">[+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'<'</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">+=</span> <span class="identifier">_1</span><span class="special">]];</span>
+<pre class="programlisting"><span class="identifier">text</span> <span class="special">=</span> <span class="identifier">lexeme</span><span class="special">[+(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="char">'<'</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">+=</span> <span class="identifier">_1</span><span class="special">]];</span>
</pre>
<p>
The semantic action collects the chars and appends them (via +=) to the
@@ -2099,17 +2023,15 @@
by the placeholder <tt class="computeroutput"><span class="identifier">_val</span></tt>).
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.alternates"></a><h5>
-<a name="id635930"></a>
+<a name="id476318"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.alternates">Alternates</a>
</h5>
-<pre class="programlisting">
-<span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml_node</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">node</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml_node</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">node</span><span class="special">;</span>
</pre>
<p>
and its definition:
</p>
-<pre class="programlisting">
-<span class="identifier">node</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">xml</span> <span class="special">|</span> <span class="identifier">text</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">];</span>
+<pre class="programlisting"><span class="identifier">node</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">xml</span> <span class="special">|</span> <span class="identifier">text</span><span class="special">)</span> <span class="special">[</span><span class="identifier">_val</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">];</span>
</pre>
<p>
We'll see what a <tt class="computeroutput"><span class="identifier">mini_xml_node</span></tt>
@@ -2117,15 +2039,13 @@
goiing on here. An xml <tt class="computeroutput"><span class="identifier">node</span></tt>
is either an <tt class="computeroutput"><span class="identifier">xml</span></tt> OR <tt class="computeroutput"><span class="identifier">text</span></tt>. Hmmm... hold on to that thought...
</p>
-<pre class="programlisting">
-<span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">start_tag</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">start_tag</span><span class="special">;</span>
</pre>
<p>
Again, with an attribute of <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt>.
Then, it's definition:
</p>
-<pre class="programlisting">
-<span class="identifier">start_tag</span> <span class="special">=</span>
+<pre class="programlisting"><span class="identifier">start_tag</span> <span class="special">=</span>
<span class="char">'<'</span>
<span class="special">>></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">>></span> <span class="identifier">lexeme</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">[</span><span class="identifier">_val</span> <span class="special">+=</span> <span class="identifier">_1</span><span class="special">]]</span>
@@ -2133,7 +2053,7 @@
<span class="special">;</span>
</pre>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.not_predicate"></a><h5>
-<a name="id636269"></a>
+<a name="id476781"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.not_predicate">Not
Predicate</a>
</h5>
@@ -2143,8 +2063,7 @@
the added <tt class="computeroutput"><span class="char">'<'</span></tt> and <tt class="computeroutput"><span class="char">'>'</span></tt>. But wait, to make sure that the <tt class="computeroutput"><span class="identifier">start_tag</span></tt> does not parse <tt class="computeroutput"><span class="identifier">end_tag</span></tt>s too, we add: <tt class="computeroutput"><span class="special">!</span><span class="identifier">char_</span><span class="special">(</span><span class="char">'/'</span><span class="special">)</span></tt>. This
is a "Not Predicate":
</p>
-<pre class="programlisting">
-<span class="special">!</span><span class="identifier">p</span>
+<pre class="programlisting"><span class="special">!</span><span class="identifier">p</span>
</pre>
<p>
It will try the parser, <tt class="computeroutput"><span class="identifier">p</span></tt>.
@@ -2154,31 +2073,28 @@
any input though. It will always rewind the iterator position to where
it was upon entry. So, 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>
+<pre class="programlisting"><span class="special">!</span><span class="identifier">char_</span><span class="special">(</span><span class="char">'/'</span><span class="special">)</span>
</pre>
<p>
basically says: we should not have a <tt class="computeroutput"><span class="char">'/'</span></tt>
at this point.
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.inherited_attribute"></a><h5>
-<a name="id637111"></a>
+<a name="id477026"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.inherited_attribute">Inherited
Attribute</a>
</h5>
<p>
The <tt class="computeroutput"><span class="identifier">end_tag</span></tt>:
</p>
-<pre class="programlisting">
-<span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="keyword">void</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">end_tag</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="keyword">void</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">end_tag</span><span class="special">;</span>
</pre>
<p>
Ohh! Now we see an inherited attribute there: <tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></tt>.
The <tt class="computeroutput"><span class="identifier">end_tag</span></tt> does not have
a synthesized attribute. Let's see its definition:
</p>
-<pre class="programlisting">
-<span class="identifier">end_tag</span> <span class="special">=</span>
+<pre class="programlisting"><span class="identifier">end_tag</span> <span class="special">=</span>
<span class="string">"</"</span>
<span class="special">>></span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">_r1</span><span class="special">)</span>
<span class="special">>></span> <span class="char">'>'</span>
@@ -2190,7 +2106,7 @@
<tt class="computeroutput"><span class="identifier">_r3</span></tt>, etc. if you have more).
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.a_lazy_lit"></a><h5>
-<a name="id637309"></a>
+<a name="id477308"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.a_lazy_lit">A
Lazy Lit</a>
</h5>
@@ -2203,15 +2119,13 @@
<p>
Finally, our <tt class="computeroutput"><span class="identifier">xml</span></tt> rule:
</p>
-<pre class="programlisting">
-<span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">xml</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">xml</span><span class="special">;</span>
</pre>
<p>
<tt class="computeroutput"><span class="identifier">mini_xml</span></tt> is our attribute
here. We'll see later what it is. Let's see its definition:
</p>
-<pre class="programlisting">
-<span class="identifier">xml</span> <span class="special">=</span>
+<pre class="programlisting"><span class="identifier">xml</span> <span class="special">=</span>
<span class="identifier">start_tag</span> <span class="special">[</span><span class="identifier">at_c</span><span class="special"><</span><span class="number">0</span><span class="special">>(</span><span class="identifier">_val</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
<span class="special">>></span> <span class="special">*</span><span class="identifier">node</span> <span class="special">[</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">at_c</span><span class="special"><</span><span class="number">1</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">end_tag</span><span class="special">(</span><span class="identifier">at_c</span><span class="special"><</span><span class="number">0</span><span class="special">>(</span><span class="identifier">_val</span><span class="special">))</span>
@@ -2226,7 +2140,7 @@
accessors, provided by Phoenix.
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.how_it_all_works"></a><h5>
-<a name="id637650"></a>
+<a name="id477789"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.how_it_all_works">How
it all works</a>
</h5>
@@ -2256,14 +2170,12 @@
<p>
To give the last item some more light, what happens is this:
</p>
-<pre class="programlisting">
-<span class="identifier">end_tag</span><span class="special">(</span><span class="identifier">at_c</span><span class="special"><</span><span class="number">0</span><span class="special">>(</span><span class="identifier">_val</span><span class="special">))</span>
+<pre class="programlisting"><span class="identifier">end_tag</span><span class="special">(</span><span class="identifier">at_c</span><span class="special"><</span><span class="number">0</span><span class="special">>(</span><span class="identifier">_val</span><span class="special">))</span>
</pre>
<p>
calls:
</p>
-<pre class="programlisting">
-<span class="identifier">end_tag</span> <span class="special">=</span>
+<pre class="programlisting"><span class="identifier">end_tag</span> <span class="special">=</span>
<span class="string">"</"</span>
<span class="special">>></span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">_r1</span><span class="special">)</span>
<span class="special">>></span> <span class="char">'>'</span>
@@ -2275,7 +2187,7 @@
as <tt class="computeroutput"><span class="identifier">_r1</span></tt>.
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.the_structures"></a><h5>
-<a name="id637956"></a>
+<a name="id478235"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.the_structures">The
Structures</a>
</h5>
@@ -2288,8 +2200,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">struct</span> <span class="identifier">mini_xml</span><span class="special">;</span>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">mini_xml</span><span class="special">;</span>
<span class="keyword">typedef</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">variant</span><span class="special"><</span>
@@ -2309,7 +2220,7 @@
<p>
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.of_alternates_and_variants"></a><h5>
-<a name="id638154"></a>
+<a name="id478508"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.of_alternates_and_variants">Of
Alternates and Variants</a>
</h5>
@@ -2324,21 +2235,19 @@
<p>
Yep, you got that right: the attribute of an alternate:
</p>
-<pre class="programlisting">
-<span class="identifier">a</span> <span class="special">|</span> <span class="identifier">b</span>
+<pre class="programlisting"><span class="identifier">a</span> <span class="special">|</span> <span class="identifier">b</span>
</pre>
<p>
is a
</p>
-<pre class="programlisting">
-<span class="identifier">boost</span><span class="special">::</span><span class="identifier">variant</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">></span>
+<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variant</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">></span>
</pre>
<p>
where <tt class="computeroutput"><span class="identifier">A</span></tt> is the attribute
of <tt class="computeroutput"><span class="identifier">a</span></tt> and <tt class="computeroutput"><span class="identifier">B</span></tt> is the attribute of <tt class="computeroutput"><span class="identifier">b</span></tt>.
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.adapting_structs_again"></a><h5>
-<a name="id638331"></a>
+<a name="id478778"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.adapting_structs_again">Adapting
structs again</a>
</h5>
@@ -2353,8 +2262,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="identifier">BOOST_FUSION_ADAPT_STRUCT</span><span class="special">(</span>
+<pre class="programlisting"><span class="identifier">BOOST_FUSION_ADAPT_STRUCT</span><span class="special">(</span>
<span class="identifier">mini_xml</span><span class="special">,</span>
<span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">name</span><span class="special">)</span>
<span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">mini_xml_node</span><span class="special">>,</span> <span class="identifier">children</span><span class="special">)</span>
@@ -2365,7 +2273,7 @@
<p>
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.one_more_take"></a><h5>
-<a name="id638460"></a>
+<a name="id478959"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.one_more_take">One
More Take</a>
</h5>
@@ -2379,8 +2287,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">mini_xml_grammar</span>
<span class="special">:</span> <span class="identifier">grammar</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">locals</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>,</span> <span class="identifier">space_type</span><span class="special">></span>
<span class="special">{</span>
@@ -2429,12 +2336,11 @@
in the <tt class="computeroutput"><span class="identifier">xml</span></tt> rule:
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___asts_.local_variables"></a><h5>
-<a name="id639176"></a>
+<a name="id479925"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___asts_.local_variables">Local
Variables</a>
</h5>
-<pre class="programlisting">
-<span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">locals</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>,</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">xml</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">rule</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">locals</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>,</span> <span class="identifier">space_type</span><span class="special">></span> <span class="identifier">xml</span><span class="special">;</span>
</pre>
<p>
Wow, we have four template parameters now. What's that <tt class="computeroutput"><span class="identifier">locals</span></tt>
@@ -2442,8 +2348,7 @@
will have one local variable: a <tt class="computeroutput"><span class="identifier">string</span></tt>.
Let's see how this is used in action:
</p>
-<pre class="programlisting">
-<span class="identifier">xml</span> <span class="special">%=</span>
+<pre class="programlisting"><span class="identifier">xml</span> <span class="special">%=</span>
<span class="identifier">start_tag</span><span class="special">[</span><span class="identifier">_a</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
<span class="special">>></span> <span class="special">*</span><span class="identifier">node</span>
<span class="special">>></span> <span class="identifier">end_tag</span><span class="special">(</span><span class="identifier">_a</span><span class="special">)</span>
@@ -2494,8 +2399,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">mini_xml_grammar</span>
<span class="special">:</span> <span class="identifier">grammar</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">locals</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>,</span> <span class="identifier">space_type</span><span class="special">></span>
<span class="special">{</span>
@@ -2558,28 +2462,26 @@
What's new?
</p>
<a name="spirit.qi_and_karma.tutorials.mini_xml___error_handling.readable_names"></a><h5>
-<a name="id641568"></a>
+<a name="id481710"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___error_handling.readable_names">Readable
Names</a>
</h5>
<p>
First, when we call the base class, we give the grammar a name:
</p>
-<pre class="programlisting">
-<span class="special">:</span> <span class="identifier">mini_xml_grammar</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">xml</span><span class="special">,</span> <span class="string">"xml"</span><span class="special">)</span>
+<pre class="programlisting"><span class="special">:</span> <span class="identifier">mini_xml_grammar</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">xml</span><span class="special">,</span> <span class="string">"xml"</span><span class="special">)</span>
</pre>
<p>
Then, we name all our rules:
</p>
-<pre class="programlisting">
-<span class="identifier">xml</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"xml"</span><span class="special">);</span>
+<pre class="programlisting"><span class="identifier">xml</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"xml"</span><span class="special">);</span>
<span class="identifier">node</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"node"</span><span class="special">);</span>
<span class="identifier">text</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"text"</span><span class="special">);</span>
<span class="identifier">start_tag</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"start_tag"</span><span class="special">);</span>
<span class="identifier">end_tag</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"end_tag"</span><span class="special">);</span>
</pre>
<a name="spirit.qi_and_karma.tutorials.mini_xml___error_handling.on_error"></a><h5>
-<a name="id641748"></a>
+<a name="id481964"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___error_handling.on_error">On
Error</a>
</h5>
@@ -2587,15 +2489,13 @@
<tt class="computeroutput"><span class="identifier">on_error</span></tt> declares our error
handler:
</p>
-<pre class="programlisting">
-<span class="identifier">on_error</span><span class="special"><</span><span class="identifier">Action</span><span class="special">>(</span><span class="identifier">rule</span><span class="special">,</span> <span class="identifier">handler</span><span class="special">)</span>
+<pre class="programlisting"><span class="identifier">on_error</span><span class="special"><</span><span class="identifier">Action</span><span class="special">>(</span><span class="identifier">rule</span><span class="special">,</span> <span class="identifier">handler</span><span class="special">)</span>
</pre>
<p>
This will specify what we will do when we get an error. We will print out
an error message using phoenix:
</p>
-<pre class="programlisting">
-<span class="identifier">on_error</span><span class="special"><</span><span class="identifier">fail</span><span class="special">></span>
+<pre class="programlisting"><span class="identifier">on_error</span><span class="special"><</span><span class="identifier">fail</span><span class="special">></span>
<span class="special">(</span>
<span class="identifier">xml</span>
<span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
@@ -2759,7 +2659,7 @@
</tbody>
</table></div>
<a name="spirit.qi_and_karma.tutorials.mini_xml___error_handling.expectation_points"></a><h5>
-<a name="id642260"></a>
+<a name="id482635"></a>
<a href="qi_and_karma.html#spirit.qi_and_karma.tutorials.mini_xml___error_handling.expectation_points">Expectation
Points</a>
</h5>
@@ -2767,8 +2667,7 @@
You might not have noticed it, but some of our expressions changed from
using the <tt class="computeroutput"><span class="special">>></span></tt> to <tt class="computeroutput"><span class="special">></span></tt>. Look, for example:
</p>
-<pre class="programlisting">
-<span class="identifier">end_tag</span> <span class="special">=</span>
+<pre class="programlisting"><span class="identifier">end_tag</span> <span class="special">=</span>
<span class="string">"</"</span>
<span class="special">></span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">_r1</span><span class="special">)</span>
<span class="special">></span> <span class="char">'>'</span>
@@ -2791,14 +2690,12 @@
You can find some examples in: ../../example/qi/mini_xml_samples
for testing purposes. "4.toyxml" has an error in it:
</p>
-<pre class="programlisting">
-<span class="special"><</span><span class="identifier">foo</span><span class="special">><</span><span class="identifier">bar</span><span class="special">></</span><span class="identifier">foo</span><span class="special">></</span><span class="identifier">bar</span><span class="special">></span>
+<pre class="programlisting"><span class="special"><</span><span class="identifier">foo</span><span class="special">><</span><span class="identifier">bar</span><span class="special">></</span><span class="identifier">foo</span><span class="special">></</span><span class="identifier">bar</span><span class="special">></span>
</pre>
<p>
Running the example with this gives you:
</p>
-<pre class="programlisting">
-<span class="identifier">Error</span><span class="special">!</span> <span class="identifier">Expecting</span> <span class="string">"bar"</span> <span class="identifier">here</span><span class="special">:</span> <span class="string">"foo></bar>"</span>
+<pre class="programlisting"><span class="identifier">Error</span><span class="special">!</span> <span class="identifier">Expecting</span> <span class="string">"bar"</span> <span class="identifier">here</span><span class="special">:</span> <span class="string">"foo></bar>"</span>
<span class="identifier">Error</span><span class="special">!</span> <span class="identifier">Expecting</span> <span class="identifier">end_tag</span> <span class="identifier">here</span><span class="special">:</span> <span class="string">"<bar></foo></bar>"</span>
<span class="special">-------------------------</span>
<span class="identifier">Parsing</span> <span class="identifier">failed</span>
Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/mini_xml___error_handling.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/mini_xml___error_handling.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/mini_xml___error_handling.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -47,8 +47,7 @@
<p>
</p>
-<pre class="programlisting">
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">mini_xml_grammar</span>
<span class="special">:</span> <span class="identifier">grammar</span><span class="special"><</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">mini_xml</span><span class="special">(),</span> <span class="identifier">locals</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">>,</span> <span class="identifier">space_type</span><span class="special">></span>
<span class="special">{</span>
@@ -111,28 +110,26 @@
What's new?
</p>
<a name="spirit.qi_and_karma.abstracts.mini_xml___error_handling.readable_names"></a><h5>
-<a name="id644389"></a>
+<a name="id484998"></a>
<a href="mini_xml___error_handling.html#spirit.qi_and_karma.abstracts.mini_xml___error_handling.readable_names">Readable
Names</a>
</h5>
<p>
First, when we call the base class, we give the grammar a name:
</p>
-<pre class="programlisting">
-<span class="special">:</span> <span class="identifier">mini_xml_grammar</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">xml</span><span class="special">,</span> <span class="string">"xml"</span><span class="special">)</span>
+<pre class="programlisting"><span class="special">:</span> <span class="identifier">mini_xml_grammar</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">xml</span><span class="special">,</span> <span class="string">"xml"</span><span class="special">)</span>
</pre>
<p>
Then, we name all our rules:
</p>
-<pre class="programlisting">
-<span class="identifier">xml</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"xml"</span><span class="special">);</span>
+<pre class="programlisting"><span class="identifier">xml</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"xml"</span><span class="special">);</span>
<span class="identifier">node</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"node"</span><span class="special">);</span>
<span class="identifier">text</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"text"</span><span class="special">);</span>
<span class="identifier">start_tag</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"start_tag"</span><span class="special">);</span>
<span class="identifier">end_tag</span><span class="special">.</span><span class="identifier">name</span><span class="special">(</span><span class="string">"end_tag"</span><span class="special">);</span>
</pre>
<a name="spirit.qi_and_karma.abstracts.mini_xml___error_handling.on_error"></a><h5>
-<a name="id644569"></a>
+<a name="id485249"></a>
<a href="mini_xml___error_handling.html#spirit.qi_and_karma.abstracts.mini_xml___error_handling.on_error">On
Error</a>
</h5>
@@ -140,15 +137,13 @@
<tt class="computeroutput"><span class="identifier">on_error</span></tt> declares our error
handler:
</p>
-<pre class="programlisting">
-<span class="identifier">on_error</span><span class="special"><</span><span class="identifier">Action</span><span class="special">>(</span><span class="identifier">rule</span><span class="special">,</span> <span class="identifier">handler</span><span class="special">)</span>
+<pre class="programlisting"><span class="identifier">on_error</span><span class="special"><</span><span class="identifier">Action</span><span class="special">>(</span><span class="identifier">rule</span><span class="special">,</span> <span class="identifier">handler</span><span class="special">)</span>
</pre>
<p>
This will specify what we will do when we get an error. We will print out
an error message using phoenix:
</p>
-<pre class="programlisting">
-<span class="identifier">on_error</span><span class="special"><</span><span class="identifier">fail</span><span class="special">></span>
+<pre class="programlisting"><span class="identifier">on_error</span><span class="special"><</span><span class="identifier">fail</span><span class="special">></span>
<span class="special">(</span>
<span class="identifier">xml</span>
<span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
@@ -312,7 +307,7 @@
</tbody>
</table></div>
<a name="spirit.qi_and_karma.abstracts.mini_xml___error_handling.expectation_points"></a><h5>
-<a name="id645080"></a>
+<a name="id485914"></a>
<a href="mini_xml___error_handling.html#spirit.qi_and_karma.abstracts.mini_xml___error_handling.expectation_points">Expectation
Points</a>
</h5>
@@ -320,8 +315,7 @@
You might not have noticed it, but some of our expressions changed from
using the <tt class="computeroutput"><span class="special">>></span></tt> to <tt class="computeroutput"><span class="special">></span></tt>. Look, for example:
</p>
-<pre class="programlisting">
-<span class="identifier">end_tag</span> <span class="special">=</span>
+<pre class="programlisting"><span class="identifier">end_tag</span> <span class="special">=</span>
<span class="string">"</"</span>
<span class="special">></span> <span class="identifier">lit</span><span class="special">(</span><span class="identifier">_r1</span><span class="special">)</span>
<span class="special">></span> <span class="char">'>'</span>
@@ -344,14 +338,12 @@
You can find some examples in: ../../example/qi/mini_xml_samples
for testing purposes. "4.toyxml" has an error in it:
</p>
-<pre class="programlisting">
-<span class="special"><</span><span class="identifier">foo</span><span class="special">><</span><span class="identifier">bar</span><span class="special">></</span><span class="identifier">foo</span><span class="special">></</span><span class="identifier">bar</span><span class="special">></span>
+<pre class="programlisting"><span class="special"><</span><span class="identifier">foo</span><span class="special">><</span><span class="identifier">bar</span><span class="special">></</span><span class="identifier">foo</span><span class="special">></</span><span class="identifier">bar</span><span class="special">></span>
</pre>
<p>
Running the example with this gives you:
</p>
-<pre class="programlisting">
-<span class="identifier">Error</span><span class="special">!</span> <span class="identifier">Expecting</span> <span class="string">"bar"</span> <span class="identifier">here</span><span class="special">:</span> <span class="string">"foo></bar>"</span>
+<pre class="programlisting"><span class="identifier">Error</span><span class="special">!</span> <span class="identifier">Expecting</span> <span class="string">"bar"</span> <span class="identifier">here</span><span class="special">:</span> <span class="string">"foo></bar>"</span>
<span class="identifier">Error</span><span class="special">!</span> <span class="identifier">Expecting</span> <span class="identifier">end_tag</span> <span class="identifier">here</span><span class="special">:</span> <span class="string">"<bar></foo></bar>"</span>
<span class="special">-------------------------</span>
<span class="identifier">Parsing</span> <span class="identifier">failed</span>
Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -56,27 +56,27 @@
main reason for Spirit's extensibility.
</p>
<a name="spirit.qi_and_karma.abstracts.parsing.the_api_functions_exposed_by__emphasis_spirit_qi__emphasis__"></a><h5>
-<a name="id643120"></a>
+<a name="id483114"></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="id643140"></a>
+<a name="id483146"></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="id643157"></a>
+<a name="id483175"></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="id643170"></a>
+<a name="id483202"></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="id643183"></a>
+<a name="id483232"></a>
<a href="parsing.html#spirit.qi_and_karma.abstracts.parsing.the_tokenize_and_phrase_parse___function">The
tokenize_and_phrase_parse() function</a>
</h5>
Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/abstracts/parsing_and_generating.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -29,27 +29,27 @@
and Generating">Parsing
and Generating</a></h4></div></div></div>
<a name="spirit.qi_and_karma.abstracts.parsing_and_generating.the_api_functions_exposed_by__emphasis_spirit_qi__emphasis__"></a><h5>
-<a name="id643207"></a>
+<a name="id483289"></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="id643224"></a>
+<a name="id483324"></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="id643237"></a>
+<a name="id483355"></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="id643250"></a>
+<a name="id483384"></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="id643264"></a>
+<a name="id483415"></a>
<a href="parsing_and_generating.html#spirit.qi_and_karma.abstracts.parsing_and_generating.the_tokenize_and_phrase_parse___function">The
tokenize_and_phrase_parse() function</a>
</h5>
Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/quick_reference.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -46,7 +46,7 @@
</dl>
</div>
<div class="table">
-<a name="id647160"></a><p class="title"><b>Table 4. Character Parsers</b></p>
+<a name="id486409"></a><p class="title"><b>Table 4. Character Parsers</b></p>
<table class="table" summary="Character Parsers">
<colgroup>
<col>
Modified: trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html (original)
+++ trunk/libs/spirit/doc/html/spirit/qi_and_karma/reference.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -50,7 +50,7 @@
<div class="titlepage"><div><div><h5 class="title">
<a name="spirit.qi_and_karma.reference.concepts.parser"></a>Parser</h5></div></div></div>
<a name="spirit.qi_and_karma.reference.concepts.parser.description"></a><h6>
-<a name="id647891"></a>
+<a name="id487325"></a>
<a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.description">Description</a>
</h6>
<p>
@@ -66,7 +66,7 @@
</dl>
</div>
<a name="spirit.qi_and_karma.reference.concepts.parser.valid_expressions"></a><h6>
-<a name="id647940"></a>
+<a name="id487386"></a>
<a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.valid_expressions">Valid
Expressions</a>
</h6>
@@ -126,7 +126,7 @@
</tr></tbody>
</table></div>
<a name="spirit.qi_and_karma.reference.concepts.parser.type_requirements"></a><h6>
-<a name="id648053"></a>
+<a name="id487523"></a>
<a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.type_requirements">Type
Requirements</a>
</h6>
@@ -161,14 +161,14 @@
</tr></tbody>
</table></div>
<a name="spirit.qi_and_karma.reference.concepts.parser.invariants"></a><h6>
-<a name="id648138"></a>
+<a name="id487627"></a>
<a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.invariants">Invariants</a>
</h6>
<p>
For any Parser xxx the following invariants always hold:
</p>
<a name="spirit.qi_and_karma.reference.concepts.parser.models"></a><h6>
-<a name="id648159"></a>
+<a name="id487659"></a>
<a href="reference.html#spirit.qi_and_karma.reference.concepts.parser.models">Models</a>
</h6>
<p>
Modified: trunk/libs/spirit/doc/html/spirit/what_s_new.html
==============================================================================
--- trunk/libs/spirit/doc/html/spirit/what_s_new.html (original)
+++ trunk/libs/spirit/doc/html/spirit/what_s_new.html 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -26,7 +26,7 @@
<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="id616833"></a>
+<a name="id457100"></a>
<a href="what_s_new.html#spirit.what_s_new.spirit_classic">Spirit Classic</a>
</h3>
<p>
@@ -43,14 +43,12 @@
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"><</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">></span>
+<pre class="programlisting"><span class="preprocessor">#include</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">core</span><span class="special">/</span><span class="identifier">core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
</pre>
<p>
now should be written as:
</p>
-<pre class="programlisting">
-<span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">classic_core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre class="programlisting"><span class="preprocessor">#include</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">include</span><span class="special">/</span><span class="identifier">classic_core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
</pre>
<p>
To avoid namespace conflicts with the new Spirit V2 library we moved Spirit
Modified: trunk/libs/spirit/doc/introduction.qbk
==============================================================================
--- trunk/libs/spirit/doc/introduction.qbk (original)
+++ trunk/libs/spirit/doc/introduction.qbk 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -8,17 +8,17 @@
[section Introduction]
-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
+Boost Spirit is an object-oriented, recursive-descent parser and output generation
+library for C++. It allows you to write grammars and format descriptions using a
+format 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.
-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
+The syntax and semantics of the libraries' API directly form domain-specific
+embedded languages (DSEL). In fact, Spirit exposes 3 different DSELs to the
user:
* one for creating parser grammars,
@@ -26,31 +26,31 @@
* and one for the description of the required output formats.
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
+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.
-Both, the created parsers and generators, are fully attributed which allows to
+Both the created parsers and generators are fully attributed which allows you 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.
+generate arbitrarily-formatted output.
The [link spirit.spiritstructure figure] below depicts the overall structure
-of the Boost Spirit library. The library consists out of 4 major parts:
+of the Boost Spirit library. The library consists of 4 major parts:
-* __classic__: This is the almost unchanged code base taken from the
+* __classic__: 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.
-* __qi__: This is the parser library allowing to build recursive
- descent parsers. The exposed domain specific language can be used to describe
+* __qi__: This is the parser library allowing you 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.
-* __lex__: This is the library usable to create tokinizers (lexers). The domain
- specific language exposed by __lex__
-* __karma__: 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
+* __lex__: This is the library usable to create tokenizers (lexers). The
+ domain-specific language exposed by __lex__
+* __karma__: This is the generator library allowing you 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 __qi__, except that it is used to describe the required output
format to generate from a given data structure.
@@ -67,13 +67,13 @@
The [link spirit.spiritkarmaflow figure] 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
+(optional) transformation these data are converted back into some different,
+external representation. The picture highlights Spirit's place in this data
transformation flow.
[fig ./images/spiritkarmaflow.png..The place of __qi__ and __karma__ in a data transformation flow of a typical application..spirit.spiritkarmaflow]
-[heading A quick overview about Parsing with __qi__]
+[heading A Quick Overview of Parsing with __qi__]
__qi__ is Spirit's sublibrary dealing with generating parsers based on a given
target grammar (essentially a format description of the input data to read).
@@ -94,12 +94,12 @@
expression = term >> *(('+' >> term) | ('-' >> term));
Through the magic of expression templates, this is perfectly valid and
-executable C++ code. The production rule `expression` is in fact an object that
-has a member function parse that does the work given a source code written in
+executable C++ code. The production rule `expression` 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 `expression` in our
-grammar specification, traditionally called the start symbol, can recognize
+rule `integer` invoked by `factor`. Now, the production rule `expression` in our
+grammar specification, traditionally called the `start` symbol, can recognize
inputs such as:
12345
@@ -144,14 +144,14 @@
rule with the ubiquitous semi-colon, `;`.
-[heading A quick overview about Output Generation with __karma__]
+[heading A Quick Overview of Output Generation with __karma__]
-Spirit not only allows to describe the structure of the input. Starting with
+Spirit not only allows you 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.
+in a similar way, and based on a single syntax and compatible semantics.
Let's assume we need to generate a textual representation from a simple data
-structure as a `std::vector<int>`. Conventional code probably would look like:
+structure such as a `std::vector<int>`. Conventional code probably would look like:
std::vector<int> v (initialize_and_fill());
std::vector<int>::iterator end = v.end();
@@ -159,10 +159,10 @@
std::cout << *it << std::endl;
which is not very flexible and quite difficult to maintain when it comes to
-changing the required output format. Spirit's sublibrary /Karma/ allows to
+changing the required output format. Spirit's sublibrary /Karma/ allows you to
specify output formats for arbitrary data structures in a very flexible way.
-following snippet is the /Karma/ format description used to create the very
-The same output as the traditional code above:
+The following snippet is the /Karma/ format description used to create the
+same output as the traditional code above:
*(int_ << eol)
@@ -177,13 +177,13 @@
[ [`*(double_ << ',')`] [`1.0,8.0,10.0,`] [A list of floating point numbers] ]
]
-The syntax is very similar to /Qi/ with the exception that we use the `<<`
+The syntax is similar to /Qi/ with the exception that we use the `<<`
operator for output concatenation. This should be easy to understand as it
follows the conventions used in the Standard's I/O streams.
-Another important feature of /karma/ is to allow to fully decouple the data
+Another important feature of /karma/ allows you 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
+data types as long as these conform conceptually. The next table gives some
related examples.
[table Different data types usable with the output format `(*int_ << eol)`
Modified: trunk/libs/spirit/doc/reference_template.qbk
==============================================================================
--- trunk/libs/spirit/doc/reference_template.qbk (original)
+++ trunk/libs/spirit/doc/reference_template.qbk 2008-12-23 04:39:09 EST (Tue, 23 Dec 2008)
@@ -1,56 +1,56 @@
-[/==============================================================================
- Copyright (C) 2001-2008 Joel de Guzman
- Copyright (C) 2001-2008 Hartmut Kaiser
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-===============================================================================/]
-
-[section XXX]
-
-[heading Description]
-
-Description of XXX
-
-[heading Header]
-
- #include <boost/spirit/xxx.hpp>
-
-[heading Synopsis]
-
- template <typename T>
- struct XXX;
-
-[heading Template parameters]
-
-[table
- [[Parameter] [Description] [Default]]
- [[`T`] [What is T] []]
-]
-
-[heading Model of]
-
-Link to concept
-
-[heading Objects]
-
-Objects provided by the library
-
-[variablelist Notation
- [[`xxx`] [An XXX]]
-]
-
-Semantics of an expression is defined only where it differs from, or is not
-defined in _concept-of_XXX_.
-
-[table
- [[Expression] [Semantics] [Return type] [Complexity]]
- [[`xxx`] [Semantics of `xxx`] [XXX] [Constant]]
-]
-
-[heading Example]
-
-Real example code. Use Quickbook import mechanism to link to actual
-working code snippets here.
-
-[endsect]
+[/==============================================================================
+ Copyright (C) 2001-2008 Joel de Guzman
+ Copyright (C) 2001-2008 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+===============================================================================/]
+
+[section XXX]
+
+[heading Description]
+
+Description of XXX
+
+[heading Header]
+
+ #include <boost/spirit/xxx.hpp>
+
+[heading Synopsis]
+
+ template <typename T>
+ struct XXX;
+
+[heading Template parameters]
+
+[table
+ [[Parameter] [Description] [Default]]
+ [[`T`] [What is T] []]
+]
+
+[heading Model of]
+
+Link to concept
+
+[heading Objects]
+
+Objects provided by the library
+
+[variablelist Notation
+ [[`xxx`] [An XXX]]
+]
+
+Semantics of an expression is defined only where it differs from, or is not
+defined in _concept-of_XXX_.
+
+[table
+ [[Expression] [Semantics] [Return type] [Complexity]]
+ [[`xxx`] [Semantics of `xxx`] [XXX] [Constant]]
+]
+
+[heading Example]
+
+Real example code. Use Quickbook import mechanism to link to actual
+working code snippets here.
+
+[endsect]
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