|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55302 - in trunk/libs/spirit/repository/doc/html/spirit_repository: . karma_components/karma_generator_directives qi_components qi_components/directives qi_components/primitive qi_components/qi_parser_directives qi_components/qi_parser_primitives
From: hartmut.kaiser_at_[hidden]
Date: 2009-07-30 21:12:23
Author: hkaiser
Date: 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
New Revision: 55302
URL: http://svn.boost.org/trac/boost/changeset/55302
Log:
Spirit: repository doc update
Added:
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html (contents, props changed)
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html (contents, props changed)
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html (contents, props changed)
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html (contents, props changed)
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html (contents, props changed)
Removed:
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_directives.html
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_directives/qi_distinct_parser.html
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_primitives.html
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_primitives/qi_flush_multi_pass_parser.html
Text files modified:
trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components.html | 6 +++---
trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/karma_generator_directives/karma_confix_generator.html | 18 +++++++++---------
trunk/libs/spirit/repository/doc/html/spirit_repository/preface.html | 8 ++++----
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components.html | 26 +++++++++++++++-----------
4 files changed, 31 insertions(+), 27 deletions(-)
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
<link rel="home" href="../index.html" title="Spirit Repository 0.1">
<link rel="up" href="../index.html" title="Spirit Repository 0.1">
-<link rel="prev" href="qi_components/qi_parser_directives/qi_distinct_parser.html" title="Qi Distinct Parser">
+<link rel="prev" href="qi_components/directives/distinct.html" title="Qi Distinct Parser Directive">
<link rel="next" href="karma_components/karma_generator_directives.html" title="Karma Generator Directives">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="qi_components/qi_parser_directives/qi_distinct_parser.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="karma_components/karma_generator_directives.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="qi_components/directives/distinct.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="karma_components/karma_generator_directives.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" title="Karma Components">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -44,7 +44,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="qi_components/qi_parser_directives/qi_distinct_parser.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="karma_components/karma_generator_directives.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="qi_components/directives/distinct.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="karma_components/karma_generator_directives.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/karma_generator_directives/karma_confix_generator.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/karma_generator_directives/karma_confix_generator.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/karma_generator_directives/karma_confix_generator.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -27,7 +27,7 @@
Confix Generator</a>
</h4></div></div></div>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.description"></a><h6>
-<a name="id1033422"></a>
+<a name="id1026383"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.description">Description</a>
</h6>
<p>
@@ -92,20 +92,20 @@
tag using a simple: <code class="computeroutput"><span class="identifier">ol</span><span class="special">[</span><span class="string">"Some text"</span><span class="special">]</span></code> (which results in <code class="computeroutput"><span class="special"><</span><span class="identifier">ol</span><span class="special">></span><span class="identifier">Some</span> <span class="identifier">text</span><span class="special"></</span><span class="identifier">ol</span><span class="special">></span></code>).
</p>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.header"></a><h6>
-<a name="id1034319"></a>
+<a name="id1027280"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.header">Header</a>
</h6>
<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/karma/confix.hpp>
</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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma_confix</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
</pre>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.synopsis"></a><h6>
-<a name="id1034392"></a>
+<a name="id1027353"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.synopsis">Synopsis</a>
</h6>
<pre class="programlisting"><span class="identifier">confix</span><span class="special">(</span><span class="identifier">prefix</span><span class="special">,</span> <span class="identifier">suffix</span><span class="special">)[</span><span class="identifier">subject</span><span class="special">]</span>
</pre>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.parameters"></a><h6>
-<a name="id1034440"></a>
+<a name="id1028498"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.parameters">Parameters</a>
</h6>
<div class="informaltable"><table class="table">
@@ -174,7 +174,7 @@
All three parameters can be arbitrary complex generators themselves.
</p>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.attribute"></a><h6>
-<a name="id1034598"></a>
+<a name="id1028656"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.attribute">Attribute</a>
</h6>
<p>
@@ -201,7 +201,7 @@
</p></td></tr>
</table></div>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.example"></a><h6>
-<a name="id1034774"></a>
+<a name="id1028832"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.example">Example</a>
</h6>
<p>
@@ -210,7 +210,7 @@
styles and a function prototype (for the full example code see here: confix.cpp)
</p>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.prerequisites"></a><h6>
-<a name="id1034804"></a>
+<a name="id1028862"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.prerequisites">Prerequisites</a>
</h6>
<p>
@@ -248,7 +248,7 @@
<p>
</p>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.generating_different_comment_styles"></a><h6>
-<a name="id1035047"></a>
+<a name="id1029105"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.generating_different_comment_styles">Generating
Different Comment Styles</a>
</h6>
@@ -300,7 +300,7 @@
*/</span> </code>.
</p>
<a name="spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.generating_a_function_prototype"></a><h6>
-<a name="id1035348"></a>
+<a name="id1029406"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.karma_generator_directives.karma_confix_generator.generating_a_function_prototype">Generating
a Function Prototype</a>
</h6>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/preface.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/preface.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/preface.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -27,7 +27,7 @@
<a name="spirit_repository.preface"></a><a class="link" href="preface.html" title="Preface">Preface</a>
</h2></div></div></div>
<a name="spirit_repository.preface.the_spirit_repository"></a><h4>
-<a name="id1026305"></a>
+<a name="id1015201"></a>
<a class="link" href="preface.html#spirit_repository.preface.the_spirit_repository">The Spirit
Repository</a>
</h4>
@@ -40,7 +40,7 @@
General List</a>.
</p>
<a name="spirit_repository.preface.how_to_use_this_manual"></a><h4>
-<a name="id1026340"></a>
+<a name="id1015236"></a>
<a class="link" href="preface.html#spirit_repository.preface.how_to_use_this_manual">How to use
this manual</a>
</h4>
@@ -49,7 +49,7 @@
icons precede some text to indicate:
</p>
<div class="table">
-<a name="id1026353"></a><p class="title"><b>Table 1. Icons</b></p>
+<a name="id1015249"></a><p class="title"><b>Table 1. Icons</b></p>
<div class="table-contents"><table class="table" summary="Icons">
<colgroup>
<col>
@@ -170,7 +170,7 @@
Tools</a>.
</p>
<a name="spirit_repository.preface.support"></a><h4>
-<a name="id1026594"></a>
+<a name="id1015490"></a>
<a class="link" href="preface.html#spirit_repository.preface.support">Support</a>
</h4>
<p>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -7,7 +7,7 @@
<link rel="home" href="../index.html" title="Spirit Repository 0.1">
<link rel="up" href="../index.html" title="Spirit Repository 0.1">
<link rel="prev" href="preface.html" title="Preface">
-<link rel="next" href="qi_components/qi_parser_primitives.html" title="Qi Parser Primitives">
+<link rel="next" href="qi_components/primitive.html" title="Qi Parser Primitives">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,21 +20,25 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="preface.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_components/qi_parser_primitives.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="preface.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_components/primitive.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" title="Qi Components">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="spirit_repository.qi_components"></a><a class="link" href="qi_components.html" title="Qi Components">Qi Components</a>
</h2></div></div></div>
<div class="toc"><dl>
-<dt><span class="section"><a href="qi_components/qi_parser_primitives.html">Qi
- Parser Primitives</a></span></dt>
-<dd><dl><dt><span class="section"><a href="qi_components/qi_parser_primitives/qi_flush_multi_pass_parser.html">Qi
- flush_multi_pass parser</a></span></dt></dl></dd>
-<dt><span class="section"><a href="qi_components/qi_parser_directives.html">Qi
- Parser Directives</a></span></dt>
-<dd><dl><dt><span class="section"><a href="qi_components/qi_parser_directives/qi_distinct_parser.html">Qi
- Distinct Parser</a></span></dt></dl></dd>
+<dt><span class="section"><a href="qi_components/primitive.html"> Qi Parser
+ Primitives</a></span></dt>
+<dd><dl><dt><span class="section"><a href="qi_components/primitive/flush_multi_pass.html">
+ Qi flush_multi_pass parser</a></span></dt></dl></dd>
+<dt><span class="section"><a href="qi_components/directives.html"> Qi Parser
+ Directives</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="qi_components/directives/confix.html">
+ Qi Confix Parser Directive</a></span></dt>
+<dt><span class="section"><a href="qi_components/directives/distinct.html">
+ Qi Distinct Parser Directive</a></span></dt>
+</dl></dd>
</dl></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
@@ -48,7 +52,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="preface.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_components/qi_parser_primitives.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="preface.html"><img src="../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_components/primitive.html"><img src="../../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Added: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -0,0 +1,51 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Qi Parser Directives</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
+<link rel="home" href="../../index.html" title="Spirit Repository 0.1">
+<link rel="up" href="../qi_components.html" title="Qi Components">
+<link rel="prev" href="primitive/flush_multi_pass.html" title="Qi flush_multi_pass parser">
+<link rel="next" href="directives/confix.html" title="Qi Confix Parser Directive">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="primitive/flush_multi_pass.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="directives/confix.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Qi Parser Directives">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit_repository.qi_components.directives"></a><a class="link" href="directives.html" title="Qi Parser Directives"> Qi Parser
+ Directives</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="directives/confix.html">
+ Qi Confix Parser Directive</a></span></dt>
+<dt><span class="section"><a href="directives/distinct.html">
+ Qi Distinct Parser Directive</a></span></dt>
+</dl></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
+ de Guzman, Hartmut Kaiser<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="primitive/flush_multi_pass.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="directives/confix.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -0,0 +1,358 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Qi Confix Parser Directive</title>
+<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
+<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
+<link rel="up" href="../directives.html" title="Qi Parser Directives">
+<link rel="prev" href="../directives.html" title="Qi Parser Directives">
+<link rel="next" href="distinct.html" title="Qi Distinct Parser Directive">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../directives.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directives.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="distinct.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Qi Confix Parser Directive">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit_repository.qi_components.directives.confix"></a><a class="link" href="confix.html" title="Qi Confix Parser Directive">
+ Qi Confix Parser Directive</a>
+</h4></div></div></div>
+<a name="spirit_repository.qi_components.directives.confix.description"></a><h6>
+<a name="id1019560"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.description">Description</a>
+ </h6>
+<p>
+ The <span class="emphasis"><em>Spirit.Qi</em></span> <code class="computeroutput"><span class="identifier">confix</span></code>
+ directive is a unary parser component allowing to embed a parser (the subject)
+ inside an opening (the prefix) and a closing (the suffix):
+ </p>
+<pre class="programlisting"><span class="identifier">confix</span><span class="special">(</span><span class="identifier">prefix</span><span class="special">,</span> <span class="identifier">suffix</span><span class="special">)[</span><span class="identifier">subject</span><span class="special">]</span>
+</pre>
+<p>
+ This results in a parser that is equivalent to the sequence
+ </p>
+<pre class="programlisting"><span class="identifier">omit</span><span class="special">[</span><span class="identifier">prefix</span><span class="special">]</span> <span class="special">>></span> <span class="identifier">subject</span> <span class="special">>></span> <span class="identifier">omit</span><span class="special">[</span><span class="identifier">suffix</span><span class="special">]</span>
+</pre>
+<p>
+ A simple example is a parser for non-nested comments which can now be written
+ as:
+ </p>
+<pre class="programlisting"><span class="identifier">confix</span><span class="special">(</span><span class="string">"/*"</span><span class="special">,</span> <span class="string">"*/"</span><span class="special">)[*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="string">"*/"</span><span class="special">)]</span> <span class="comment">// C style comment
+</span><span class="identifier">confix</span><span class="special">(</span><span class="string">"//"</span><span class="special">,</span> <span class="identifier">eol</span><span class="special">)[*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)]</span> <span class="comment">// C++ style comment
+</span></pre>
+<p>
+ Using the <code class="computeroutput"><span class="identifier">confix</span></code> directive
+ instead of the explicit sequence has the advantage of being able to encapsulate
+ the prefix and the suffix into a separate construct. The following code
+ snippet illustrates the idea:
+ </p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">spirit</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="keyword">namespace</span> <span class="identifier">repo</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">repository</span><span class="special">;</span>
+
+<span class="comment">// Define a metafunction allowing to compute the type
+</span><span class="comment">// of the confix() construct
+</span><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Prefix</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Suffix</span> <span class="special">=</span> <span class="identifier">Prefix</span><span class="special">></span>
+<span class="keyword">struct</span> <span class="identifier">confix_spec</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">terminal</span><span class="special"><</span>
+ <span class="identifier">repo</span><span class="special">::</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">confix</span><span class="special">(</span><span class="identifier">Prefix</span><span class="special">,</span> <span class="identifier">Suffix</span><span class="special">)</span>
+ <span class="special">>::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="identifier">confix_spec</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">type</span> <span class="keyword">const</span> <span class="identifier">c_comment</span> <span class="special">=</span> <span class="identifier">repo</span><span class="special">::</span><span class="identifier">confix</span><span class="special">(</span><span class="string">"/*"</span><span class="special">,</span> <span class="string">"*/"</span><span class="special">);</span>
+<span class="identifier">confix_spec</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">type</span> <span class="keyword">const</span> <span class="identifier">cpp_comment</span> <span class="special">=</span> <span class="identifier">repo</span><span class="special">::</span><span class="identifier">confix</span><span class="special">(</span><span class="string">"//"</span><span class="special">,</span> <span class="string">"\n"</span><span class="special">);</span>
+</pre>
+<p>
+ Now, the comment parsers can be written as
+ </p>
+<pre class="programlisting"><span class="identifier">c_comment</span><span class="special">[*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="string">"*/"</span><span class="special">)]</span> <span class="comment">// C style comment
+</span><span class="identifier">cpp_comment</span><span class="special">[*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)]</span> <span class="comment">// C++ style comment
+</span></pre>
+<div class="note" title="Note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ While the <code class="computeroutput"><span class="identifier">confix_p</span><span class="special">(</span><span class="identifier">prefix</span><span class="special">,</span> <span class="identifier">subject</span><span class="special">,</span>
+ <span class="identifier">suffix</span><span class="special">)</span></code>
+ parser in <span class="emphasis"><em>Spirit.Classic</em></span> was equivalent to the sequence
+ <code class="computeroutput"><span class="identifier">prefix</span> <span class="special">>></span>
+ <span class="special">(</span><span class="identifier">subject</span>
+ <span class="special">-</span> <span class="identifier">suffix</span><span class="special">)</span> <span class="special">>></span> <span class="identifier">suffix</span><span class="special">,</span> <span class="identifier">the</span> <span class="emphasis"><em>Spirit.Qi</em></span> </code>confix`
+ directive will not perform this refactoring any more. This simplifies
+ the code and makes things more explicit.
+ </p></td></tr>
+</table></div>
+<a name="spirit_repository.qi_components.directives.confix.header"></a><h6>
+<a name="id1020328"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.header">Header</a>
+ </h6>
+<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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_confix</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<a name="spirit_repository.qi_components.directives.confix.synopsis"></a><h6>
+<a name="id1020403"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.synopsis">Synopsis</a>
+ </h6>
+<pre class="programlisting"><span class="identifier">confix</span><span class="special">(</span><span class="identifier">prefix</span><span class="special">,</span> <span class="identifier">suffix</span><span class="special">)[</span><span class="identifier">subject</span><span class="special">]</span>
+</pre>
+<a name="spirit_repository.qi_components.directives.confix.parameters"></a><h6>
+<a name="id1020456"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parameters">Parameters</a>
+ </h6>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Parameter
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">prefix</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The parser for the opening (the prefix).
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">suffix</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The parser for the ending (the suffix).
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">subject</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The parser for the input sequence between the <code class="computeroutput"><span class="identifier">prefix</span></code>
+ and <code class="computeroutput"><span class="identifier">suffix</span></code> parts.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+ All three parameters can be arbitrarily complex parsers themselves.
+ </p>
+<a name="spirit_repository.qi_components.directives.confix.attribute"></a><h6>
+<a name="id1020597"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.attribute">Attribute</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="identifier">confix</span></code> directive exposes
+ the attribute type of its subject as its own attribute type. If the <code class="computeroutput"><span class="identifier">subject</span></code> does not expose any attribute
+ (the type is <code class="computeroutput"><span class="identifier">unused_type</span></code>),
+ then the <code class="computeroutput"><span class="identifier">confix</span></code> does not
+ expose any attribute either.
+ </p>
+<pre class="programlisting"><span class="identifier">a</span><span class="special">:</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">p</span><span class="special">:</span> <span class="identifier">P</span><span class="special">,</span> <span class="identifier">s</span><span class="special">:</span> <span class="identifier">S</span><span class="special">:</span> <span class="special">--></span> <span class="identifier">confix</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">s</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">A</span>
+</pre>
+<div class="note" title="Note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ This notation is used all over the Spirit documentation and reads as:
+ Given, <code class="computeroutput"><span class="identifier">a</span></code>, <code class="computeroutput"><span class="identifier">p</span></code>, and <code class="computeroutput"><span class="identifier">s</span></code>
+ are parsers, and <code class="computeroutput"><span class="identifier">A</span></code>,
+ <code class="computeroutput"><span class="identifier">P</span></code>, and <code class="computeroutput"><span class="identifier">S</span></code> are the types of their attributes,
+ then the type of the attribute exposed by <code class="computeroutput"><span class="identifier">confix</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">s</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]</span></code> will be <code class="computeroutput"><span class="identifier">A</span></code>.
+ </p></td></tr>
+</table></div>
+<a name="spirit_repository.qi_components.directives.confix.example"></a><h6>
+<a name="id1020835"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.example">Example</a>
+ </h6>
+<p>
+ The following example shows simple use cases of the <code class="computeroutput"><span class="identifier">confix</span></code>
+ directive. We will illustrate its usage by generating parsers for different
+ comment styles and for some simple tagged data (for the full example code
+ see confix.cpp)
+ </p>
+<a name="spirit_repository.qi_components.directives.confix.prerequisites"></a><h6>
+<a name="id1020870"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.prerequisites">Prerequisites</a>
+ </h6>
+<p>
+ In addition to the main header file needed to include the core components
+ implemented in <span class="emphasis"><em>Spirit.Qi</em></span> we add the header file needed
+ for the new <code class="computeroutput"><span class="identifier">confix</span></code> directive.
+ </p>
+<p>
+ </p>
+<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>
+<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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_confix</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ In order to make the examples below more readable we import a number of
+ elements into the current namespace:
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">eol</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lexeme</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">::</span><span class="identifier">alnum</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">::</span><span class="identifier">char_</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">::</span><span class="identifier">space</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">::</span><span class="identifier">phrase_parse</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">repository</span><span class="special">::</span><span class="identifier">confix</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<a name="spirit_repository.qi_components.directives.confix.parsing_different_comment_styles"></a><h6>
+<a name="id1021287"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parsing_different_comment_styles">Parsing
+ Different Comment Styles</a>
+ </h6>
+<p>
+ We will show how to parse different comment styles. First we will parse
+ a C++ comment:
+ </p>
+<p>
+ </p>
+<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>
+<span class="keyword">bool</span> <span class="identifier">parse_cpp_comment</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">string</span><span class="special">&</span> <span class="identifier">attr</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">parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span>
+ <span class="identifier">confix</span><span class="special">(</span><span class="string">"//"</span><span class="special">,</span> <span class="identifier">eol</span><span class="special">)[*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)],</span> <span class="comment">// grammar
+</span> <span class="identifier">attr</span><span class="special">);</span> <span class="comment">// attribute
+</span>
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">r</span> <span class="special">||</span> <span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">r</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ This function will obviously parse input such as "<code class="computeroutput"><span class="comment">//
+ This is a comment \n </span></code>". Similarily parsing a 'C'-style
+ comment proves to be straightforward:
+ </p>
+<p>
+ </p>
+<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>
+<span class="keyword">bool</span> <span class="identifier">parse_c_comment</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">string</span><span class="special">&</span> <span class="identifier">attr</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">parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span>
+ <span class="identifier">confix</span><span class="special">(</span><span class="string">"/*"</span><span class="special">,</span> <span class="string">"*/"</span><span class="special">)[*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="string">"*/"</span><span class="special">)],</span> <span class="comment">// grammar
+</span> <span class="identifier">attr</span><span class="special">);</span> <span class="comment">// attribute
+</span>
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">r</span> <span class="special">||</span> <span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">r</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ which again will be able to parse e.g. "<code class="computeroutput"><span class="comment">/*
+ This is a comment */</span> </code>".
+ </p>
+<a name="spirit_repository.qi_components.directives.confix.parsing_tagged_data"></a><h6>
+<a name="id1022962"></a>
+ <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parsing_tagged_data">Parsing
+ Tagged Data</a>
+ </h6>
+<p>
+ Generating a parser that extracts the body from the HTML snippet "<code class="computeroutput"><span class="special"><</span><span class="identifier">b</span><span class="special">></span><span class="identifier">The</span> <span class="identifier">Body</span><span class="special"></</span><span class="identifier">b</span><span class="special">></span></code>"
+ is not very hard, either:
+ </p>
+<p>
+ </p>
+<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>
+<span class="keyword">bool</span> <span class="identifier">parse_tagged</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">string</span><span class="special">&</span> <span class="identifier">attr</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">phrase_parse</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span>
+ <span class="identifier">confix</span><span class="special">(</span><span class="string">"<b>"</span><span class="special">,</span> <span class="string">"</b>"</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="comment">// grammar
+</span> <span class="identifier">space</span><span class="special">,</span> <span class="comment">// skip
+</span> <span class="identifier">attr</span><span class="special">);</span> <span class="comment">// attribute
+</span>
+ <span class="keyword">if</span> <span class="special">(!</span><span class="identifier">r</span> <span class="special">||</span> <span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">)</span> <span class="comment">// fail if we did not get a full match
+</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">r</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
+ de Guzman, Hartmut Kaiser<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../directives.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directives.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="distinct.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -0,0 +1,349 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Qi Distinct Parser Directive</title>
+<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
+<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
+<link rel="up" href="../directives.html" title="Qi Parser Directives">
+<link rel="prev" href="confix.html" title="Qi Confix Parser Directive">
+<link rel="next" href="../../karma_components.html" title="Karma Components">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="confix.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directives.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../karma_components.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Qi Distinct Parser Directive">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit_repository.qi_components.directives.distinct"></a><a class="link" href="distinct.html" title="Qi Distinct Parser Directive">
+ Qi Distinct Parser Directive</a>
+</h4></div></div></div>
+<a name="spirit_repository.qi_components.directives.distinct.description"></a><h6>
+<a name="id1023315"></a>
+ <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.description">Description</a>
+ </h6>
+<p>
+ The <span class="emphasis"><em>Spirit.Qi</em></span> <code class="computeroutput"><span class="identifier">distinct</span></code>
+ parser is a directive component allowing to avoid partial matches while
+ parsing using a skipper. A simple example is the common task of matching
+ a C keyword. Consider:
+ </p>
+<pre class="programlisting"><span class="string">"description"</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">":"</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
+</pre>
+<p>
+ intended to match a line in a configuration file. Let's assume further,
+ that this rule is used with a <code class="computeroutput"><span class="identifier">space</span></code>
+ skipper and that we have the following strings in the input:
+ </p>
+<pre class="programlisting"><span class="string">"description: ident\n"</span>
+<span class="string">"description ident\n"</span>
+<span class="string">"descriptionident\n"</span>
+</pre>
+<p>
+ It might seem unexpected, but the parser above matches all three inputs
+ just fine, even if the third input should not match at all! In order to
+ avoid the unwanted match we are forced to make our rule more complicated:
+ </p>
+<pre class="programlisting"><span class="identifier">lexeme</span><span class="special">[</span><span class="string">"description"</span> <span class="special">>></span> <span class="special">!</span><span class="identifier">char_</span><span class="special">(</span><span class="string">"a-zA-Z_0-9"</span><span class="special">)]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">":"</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
+</pre>
+<p>
+ (the rule reads as: match <code class="computeroutput"><span class="string">"description"</span></code>
+ as long as it's not <span class="emphasis"><em>directly</em></span> followed by a valid identifier).
+ </p>
+<p>
+ The <code class="computeroutput"><span class="identifier">distinct</span><span class="special">[]</span></code>
+ directive is meant to simplify the rule above:
+ </p>
+<pre class="programlisting"><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">char_</span><span class="special">(</span><span class="string">"a-zA-Z_0-9"</span><span class="special">))[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">":"</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
+</pre>
+<p>
+ Using the <code class="computeroutput"><span class="identifier">distinct</span><span class="special">[]</span></code>
+ component instead of the explicit sequence has the advantage of being able
+ to encapsulate the tail (i.e the <code class="computeroutput"><span class="identifier">char_</span><span class="special">(</span><span class="string">"a-zA-Z_0-9"</span><span class="special">)</span></code>) as a separate parser construct. The following
+ code snippet illustrates the idea (for the full code of this example please
+ see distinct.cpp):
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">spirit</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="keyword">namespace</span> <span class="identifier">ascii</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">ascii</span><span class="special">;</span>
+<span class="keyword">namespace</span> <span class="identifier">repo</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">repository</span><span class="special">;</span>
+
+<span class="comment">// Define metafunctions allowing to compute the type of the distinct()
+</span><span class="comment">// and ascii::char_() constructs
+</span><span class="keyword">namespace</span> <span class="identifier">traits</span>
+<span class="special">{</span>
+ <span class="comment">// Metafunction allowing to get the type of any repository::distinct(...)
+</span> <span class="comment">// construct
+</span> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Tail</span><span class="special">></span>
+ <span class="keyword">struct</span> <span class="identifier">distinct_spec</span>
+ <span class="special">:</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">terminal</span><span class="special"><</span><span class="identifier">repo</span><span class="special">::</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">Tail</span><span class="special">)></span>
+ <span class="special">{};</span>
+
+ <span class="comment">// Metafunction allowing to get the type of any ascii::char_(...) construct
+</span> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">String</span><span class="special">></span>
+ <span class="keyword">struct</span> <span class="identifier">char_spec</span>
+ <span class="special">:</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">terminal</span><span class="special"><</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">::</span><span class="identifier">char_</span><span class="special">(</span><span class="identifier">String</span><span class="special">)></span>
+ <span class="special">{};</span>
+<span class="special">};</span>
+
+<span class="comment">// Define a helper function allowing to create a distinct() construct from
+</span><span class="comment">// an arbitrary tail parser
+</span><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Tail</span><span class="special">></span>
+<span class="keyword">inline</span> <span class="keyword">typename</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">distinct_spec</span><span class="special"><</span><span class="identifier">Tail</span><span class="special">>::</span><span class="identifier">type</span>
+<span class="identifier">distinct_spec</span><span class="special">(</span><span class="identifier">Tail</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">tail</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">repo</span><span class="special">::</span><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">tail</span><span class="special">);</span>
+<span class="special">}</span>
+
+<span class="comment">// Define a helper function allowing to create a ascii::char_() construct
+</span><span class="comment">// from an arbitrary string representation
+</span><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">String</span><span class="special">></span>
+<span class="keyword">inline</span> <span class="keyword">typename</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">char_spec</span><span class="special"><</span><span class="identifier">String</span><span class="special">>::</span><span class="identifier">type</span>
+<span class="identifier">char_spec</span><span class="special">(</span><span class="identifier">String</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">str</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">ascii</span><span class="special">::</span><span class="identifier">char_</span><span class="special">(</span><span class="identifier">str</span><span class="special">);</span>
+<span class="special">}</span>
+
+<span class="comment">// the following constructs the type of a distinct_spec holding a
+</span><span class="comment">// charset("0-9a-zA-Z_") as its tail parser
+</span><span class="keyword">typedef</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">char_spec</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">type</span> <span class="identifier">charset_tag_type</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">distinct_spec</span><span class="special"><</span><span class="identifier">charset_tag_type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">keyword_tag_type</span><span class="special">;</span>
+
+<span class="comment">// Define a new Qi 'keyword' directive usable as a shortcut for a
+</span><span class="comment">// repository::distinct(char_(std::string("0-9a-zA-Z_")))
+</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span> <span class="identifier">keyword_spec</span><span class="special">(</span><span class="string">"0-9a-zA-Z_"</span><span class="special">);</span>
+<span class="identifier">keyword_tag_type</span> <span class="keyword">const</span> <span class="identifier">keyword</span> <span class="special">=</span> <span class="identifier">distinct_spec</span><span class="special">(</span><span class="identifier">char_spec</span><span class="special">(</span><span class="identifier">keyword_spec</span><span class="special">));</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ These definitions define a new Qi parser recognizing keywords! This allows
+ to rewrite our declaration parser expression as:
+ </p>
+<pre class="programlisting"><span class="identifier">keyword</span><span class="special">[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">":"</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
+</pre>
+<p>
+ which is much more readable and concise if compared to the original parser
+ expression. In addition the new <code class="computeroutput"><span class="identifier">keyword</span><span class="special">[]</span></code> directive has the advantage to be usable
+ for wrapping any parser expression, not only strings as in the example
+ above.
+ </p>
+<a name="spirit_repository.qi_components.directives.distinct.header"></a><h6>
+<a name="id1024552"></a>
+ <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.header">Header</a>
+ </h6>
+<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/qi/distinct.hpp>
+</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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_distinct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<a name="spirit_repository.qi_components.directives.distinct.synopsis"></a><h6>
+<a name="id1024630"></a>
+ <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.synopsis">Synopsis</a>
+ </h6>
+<pre class="programlisting"><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">tail</span><span class="special">)[</span><span class="identifier">subject</span><span class="special">]</span>
+</pre>
+<a name="spirit_repository.qi_components.directives.distinct.parameters"></a><h6>
+<a name="id1024675"></a>
+ <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.parameters">Parameters</a>
+ </h6>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Parameter
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">tail</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The parser construct specifying what whould not follow the subject
+ in order to match the overall expression.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">subject</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The parser construct to use to match the current input. The distinct
+ directive makes sure that no unexpected partial matches occur.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+ All two parameters can be arbitrary complex parsers themselves.
+ </p>
+<a name="spirit_repository.qi_components.directives.distinct.attribute"></a><h6>
+<a name="id1024778"></a>
+ <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.attribute">Attribute</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="identifier">distinct</span></code> component
+ exposes the attribute type of its subject as its own attribute type. If
+ the <code class="computeroutput"><span class="identifier">subject</span></code> does not expose
+ any attribute (the type is <code class="computeroutput"><span class="identifier">unused_type</span></code>),
+ then the <code class="computeroutput"><span class="identifier">distinct</span></code> does
+ not expose any attribute either.
+ </p>
+<pre class="programlisting"><span class="identifier">a</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">B</span> <span class="special">--></span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">b</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">A</span>
+</pre>
+<a name="spirit_repository.qi_components.directives.distinct.example"></a><h6>
+<a name="id1024896"></a>
+ <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.example">Example</a>
+ </h6>
+<p>
+ The following example shows simple use cases of the <code class="computeroutput"><span class="identifier">distinct</span></code>
+ parser. distinct.cpp)
+ </p>
+<a name="spirit_repository.qi_components.directives.distinct.prerequisites"></a><h6>
+<a name="id1025206"></a>
+ <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.prerequisites">Prerequisites</a>
+ </h6>
+<p>
+ In addition to the main header file needed to include the core components
+ implemented in <span class="emphasis"><em>Spirit.Qi</em></span> we add the header file needed
+ for the new <code class="computeroutput"><span class="identifier">distinct</span></code> generator.
+ </p>
+<p>
+ </p>
+<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>
+<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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_distinct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ To make all the code below more readable we introduce the following namespaces.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">repository</span><span class="special">::</span><span class="identifier">distinct</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ We show several examples of how the <code class="computeroutput"><span class="identifier">distinct</span><span class="special">[]</span></code> directive can be used to force correct
+ behavior while matching keywords. The first two code snippets show the
+ correct matching of the <code class="computeroutput"><span class="identifier">description</span></code>
+ keyword (in this hypothetical example we allow keywords to be directly
+ followed by an optional <code class="computeroutput"><span class="string">"--"</span></code>):
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span><span class="string">"description ident"</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="identifier">first</span><span class="special">(</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">qi</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">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
+ <span class="special">,</span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">"--"</span><span class="special">)</span> <span class="special">>></span> <span class="special">+(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">space</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span><span class="identifier">r</span> <span class="special">&&</span> <span class="identifier">first</span> <span class="special">==</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span><span class="string">"description--ident"</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="identifier">first</span><span class="special">(</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">qi</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">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
+ <span class="special">,</span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">"--"</span><span class="special">)</span> <span class="special">>></span> <span class="special">+(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">space</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(</span><span class="identifier">r</span> <span class="special">&&</span> <span class="identifier">first</span> <span class="special">==</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ The last example shows that the <code class="computeroutput"><span class="identifier">distinct</span><span class="special">[]</span></code> parser component correctly refuses to
+ match "description-ident":
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span><span class="string">"description-ident"</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="identifier">first</span><span class="special">(</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
+ <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">qi</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">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
+ <span class="special">,</span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">"--"</span><span class="special">)</span> <span class="special">>></span> <span class="special">+(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">space</span><span class="special">);</span>
+ <span class="identifier">BOOST_ASSERT</span><span class="special">(!</span><span class="identifier">r</span> <span class="special">&&</span> <span class="identifier">first</span> <span class="special">==</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
+ de Guzman, Hartmut Kaiser<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="confix.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directives.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../karma_components.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -0,0 +1,47 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Qi Parser Primitives</title>
+<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
+<link rel="home" href="../../index.html" title="Spirit Repository 0.1">
+<link rel="up" href="../qi_components.html" title="Qi Components">
+<link rel="prev" href="../qi_components.html" title="Qi Components">
+<link rel="next" href="primitive/flush_multi_pass.html" title="Qi flush_multi_pass parser">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../qi_components.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="primitive/flush_multi_pass.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Qi Parser Primitives">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="spirit_repository.qi_components.primitive"></a><a class="link" href="primitive.html" title="Qi Parser Primitives"> Qi Parser
+ Primitives</a>
+</h3></div></div></div>
+<div class="toc"><dl><dt><span class="section"><a href="primitive/flush_multi_pass.html">
+ Qi flush_multi_pass parser</a></span></dt></dl></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
+ de Guzman, Hartmut Kaiser<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../qi_components.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="primitive/flush_multi_pass.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
@@ -0,0 +1,220 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Qi flush_multi_pass parser</title>
+<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
+<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
+<link rel="up" href="../primitive.html" title="Qi Parser Primitives">
+<link rel="prev" href="../primitive.html" title="Qi Parser Primitives">
+<link rel="next" href="../directives.html" title="Qi Parser Directives">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../primitive.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../primitive.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../directives.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" title="Qi flush_multi_pass parser">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass"></a><a class="link" href="flush_multi_pass.html" title="Qi flush_multi_pass parser">
+ Qi flush_multi_pass parser</a>
+</h4></div></div></div>
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass.description"></a><h6>
+<a name="id1015567"></a>
+ <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.description">Description</a>
+ </h6>
+<p>
+ The <span class="emphasis"><em>Spirit.Qi</em></span> <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
+ parser is a primitive (pseudo) parser component allowing to clear the internal
+ buffer of a <code class="computeroutput"><span class="identifier">multi_pass</span></code>
+ iterator. Clearing the buffer of a <code class="computeroutput"><span class="identifier">multi_pass</span></code>
+ might be beneficial for grammars where it is clear that no backtracking
+ can occur. The general syntax for using the <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
+ is:
+ </p>
+<pre class="programlisting"><span class="identifier">flush_multi_pass</span>
+</pre>
+<p>
+ which will call the <code class="computeroutput"><span class="identifier">clear_queue</span><span class="special">()</span></code> member function if the current iterators
+ are of the type <code class="computeroutput"><span class="identifier">multi_pass</span></code>.
+ This will cause any buffered data to be erased. This also will invalidate
+ all other copies of multi_pass and they should not be used. If they are,
+ an <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">illegal_backtracking</span></code> exception will be
+ thrown. For all other iterator types this is a no-op. The <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code> generates a parser component
+ which always succeeds and which does not consume any input (very much like
+ <code class="computeroutput"><span class="identifier">eps</span></code>).
+ </p>
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass.header"></a><h6>
+<a name="id1015675"></a>
+ <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.header">Header</a>
+ </h6>
+<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/qi/flush_multi_pass.hpp>
+</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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_flush_multi_pass</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass.synopsis"></a><h6>
+<a name="id1015748"></a>
+ <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.synopsis">Synopsis</a>
+ </h6>
+<pre class="programlisting"><span class="identifier">flush_multi_pass</span>
+</pre>
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass.parameters"></a><h6>
+<a name="id1015770"></a>
+ <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.parameters">Parameters</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code> does
+ not require any parameters.
+ </p>
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass.attribute"></a><h6>
+<a name="id1015794"></a>
+ <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.attribute">Attribute</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code> component
+ exposes no attribute (the exposed attribute type is <code class="computeroutput"><span class="identifier">unused_type</span></code>):
+ </p>
+<pre class="programlisting"><span class="identifier">flush_multi_pass</span> <span class="special">--></span> <span class="identifier">unused</span>
+</pre>
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass.example"></a><h6>
+<a name="id1015843"></a>
+ <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.example">Example</a>
+ </h6>
+<p>
+ The following example shows a simple use case of the <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
+ parser.
+ </p>
+<p>
+ We will illustrate its usage by generating different comment styles and
+ a function prototype (for the full example code see here: flush_multi_pass.cpp)
+ </p>
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass.prerequisites"></a><h6>
+<a name="id1015876"></a>
+ <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.prerequisites">Prerequisites</a>
+ </h6>
+<p>
+ In addition to the main header file needed to include the core components
+ implemented in <span class="emphasis"><em>Spirit.Qi</em></span> we add the header file needed
+ for the new <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
+ parser.
+ </p>
+<p>
+ </p>
+<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>
+<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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_flush_multi_pass</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<p>
+ To make all the code below more readable we introduce the following namespaces.
+ </p>
+<p>
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">spirit</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="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">repository</span><span class="special">::</span><span class="identifier">flush_multi_pass</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<a name="spirit_repository.qi_components.primitive.flush_multi_pass.clearing_the_internal_buffer"></a><h6>
+<a name="id1016092"></a>
+ <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.clearing_the_internal_buffer">Clearing
+ the internal buffer</a>
+ </h6>
+<p>
+ The example grammar recognizes the (simplified) preprocessor commands
+ <code class="computeroutput"><span class="preprocessor">#define</span></code> and <code class="computeroutput"><span class="preprocessor">#undef</span></code> both of which are constraint
+ to a single line. This makes it possible to delete all internal iterator
+ buffers on each detected line break. This is safe as no backtracking will
+ occur after any line end. The following code snippet shows the usage of
+ <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code> for this
+ purpose.
+ </p>
+<p>
+ </p>
+<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> <span class="keyword">typename</span> <span class="identifier">Skipper</span><span class="special">></span>
+<span class="keyword">struct</span> <span class="identifier">preprocessor</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="identifier">grammar</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="special">{</span>
+ <span class="comment">// This is a simplified preprocessor grammar recognizing
+</span> <span class="comment">//
+</span> <span class="comment">// #define MACRONAME something
+</span> <span class="comment">// #undef MACRONAME
+</span> <span class="comment">//
+</span> <span class="comment">// Its sole purpose is to show an example how to use the
+</span> <span class="comment">// flush_multi_pass parser. At the end of each line no backtracking can
+</span> <span class="comment">// occur anymore so that it's safe to clear all internal buffers in the
+</span> <span class="comment">// multi_pass.
+</span> <span class="identifier">preprocessor</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">preprocessor</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">file</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">::</span><span class="identifier">char_</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">::</span><span class="identifier">eol</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">::</span><span class="identifier">lit</span><span class="special">;</span>
+
+ <span class="identifier">file</span> <span class="special">=</span>
+ <span class="special">*</span><span class="identifier">line</span>
+ <span class="special">;</span>
+
+ <span class="identifier">line</span> <span class="special">=</span> <span class="special">(</span> <span class="identifier">command</span> <span class="special">|</span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">>></span> <span class="identifier">eol</span>
+ <span class="special">>></span> <span class="identifier">flush_multi_pass</span>
+ <span class="special">;</span>
+
+ <span class="identifier">command</span> <span class="special">=</span>
+ <span class="string">"#define"</span> <span class="special">>></span> <span class="special">*</span><span class="identifier">lit</span><span class="special">(</span><span class="char">' '</span><span class="special">)</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="special">*</span><span class="identifier">lit</span><span class="special">(</span><span class="char">' '</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
+ <span class="special">|</span> <span class="string">"#undef"</span> <span class="special">>></span> <span class="special">*</span><span class="identifier">lit</span><span class="special">(</span><span class="char">' '</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
+ <span class="special">;</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="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">file</span><span class="special">,</span> <span class="identifier">line</span><span class="special">,</span> <span class="identifier">command</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ </p>
+<div class="note" title="Note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Using the <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
+ parser component with iterators other than <code class="computeroutput"><span class="identifier">multi_pass</span></code>
+ is safe to use as it has no effect on the parsing.
+ </p></td></tr>
+</table></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
+ de Guzman, Hartmut Kaiser<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../primitive.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../primitive.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../directives.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Deleted: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_directives.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_directives.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
+++ (empty file)
@@ -1,47 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Qi Parser Directives</title>
-<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
-<link rel="home" href="../../index.html" title="Spirit Repository 0.1">
-<link rel="up" href="../qi_components.html" title="Qi Components">
-<link rel="prev" href="qi_parser_primitives/qi_flush_multi_pass_parser.html" title="Qi flush_multi_pass parser">
-<link rel="next" href="qi_parser_directives/qi_distinct_parser.html" title="Qi Distinct Parser">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
-<td align="center">Home</td>
-<td align="center">Libraries</td>
-<td align="center">People</td>
-<td align="center">FAQ</td>
-<td align="center">More</td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="qi_parser_primitives/qi_flush_multi_pass_parser.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_parser_directives/qi_distinct_parser.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-<div class="section" title="Qi Parser Directives">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="spirit_repository.qi_components.qi_parser_directives"></a><a class="link" href="qi_parser_directives.html" title="Qi Parser Directives">Qi
- Parser Directives</a>
-</h3></div></div></div>
-<div class="toc"><dl><dt><span class="section"><a href="qi_parser_directives/qi_distinct_parser.html">Qi
- Distinct Parser</a></span></dt></dl></div>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
- de Guzman, Hartmut Kaiser<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="qi_parser_primitives/qi_flush_multi_pass_parser.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_parser_directives/qi_distinct_parser.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-</body>
-</html>
Deleted: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_directives/qi_distinct_parser.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_directives/qi_distinct_parser.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
+++ (empty file)
@@ -1,349 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Qi Distinct Parser</title>
-<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
-<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
-<link rel="up" href="../qi_parser_directives.html" title="Qi Parser Directives">
-<link rel="prev" href="../qi_parser_directives.html" title="Qi Parser Directives">
-<link rel="next" href="../../karma_components.html" title="Karma Components">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
-<td align="center">Home</td>
-<td align="center">Libraries</td>
-<td align="center">People</td>
-<td align="center">FAQ</td>
-<td align="center">More</td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="../qi_parser_directives.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_parser_directives.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../karma_components.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-<div class="section" title="Qi Distinct Parser">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser"></a><a class="link" href="qi_distinct_parser.html" title="Qi Distinct Parser">Qi
- Distinct Parser</a>
-</h4></div></div></div>
-<a name="spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.description"></a><h6>
-<a name="id1027896"></a>
- <a class="link" href="qi_distinct_parser.html#spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.description">Description</a>
- </h6>
-<p>
- The <span class="emphasis"><em>Spirit.Qi</em></span> <code class="computeroutput"><span class="identifier">distinct</span></code>
- parser is a directive component allowing to avoid partial matches while
- parsing using a skipper. A simple example is the common task of matching
- a C keyword, intended to match a line in a configuration file. Consider:
- </p>
-<pre class="programlisting"><span class="string">"description"</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">":"</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
-</pre>
-<p>
- intending to match a variable declaration rule in some imaginary language.
- Let's assume further, that this rule is used with a <code class="computeroutput"><span class="identifier">space</span></code>
- skipper and that we have the following strings in the input:
- </p>
-<pre class="programlisting"><span class="string">"description: ident\n"</span>
-<span class="string">"description ident\n"</span>
-<span class="string">"descriptionident\n"</span>
-</pre>
-<p>
- It might seem unexpected, but the parser above matches all three inputs
- just fine, even if the third input should not match at all! In order to
- avoid the unwanted match we are forced to make our rule more complicated:
- </p>
-<pre class="programlisting"><span class="identifier">lexeme</span><span class="special">[</span><span class="string">"description"</span> <span class="special">>></span> <span class="special">!</span><span class="identifier">char_</span><span class="special">(</span><span class="string">"a-zA-Z_0-9"</span><span class="special">)]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">":"</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
-</pre>
-<p>
- (the rule reads as: match <code class="computeroutput"><span class="string">"description"</span></code>
- as long as it's not <span class="emphasis"><em>directly</em></span> followed by a valid identifier).
- </p>
-<p>
- The <code class="computeroutput"><span class="identifier">distinct</span><span class="special">[]</span></code>
- directive is meant to simplify the rule above:
- </p>
-<pre class="programlisting"><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">char_</span><span class="special">(</span><span class="string">"a-zA-Z_0-9"</span><span class="special">))[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">":"</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
-</pre>
-<p>
- Using the <code class="computeroutput"><span class="identifier">distinct</span><span class="special">[]</span></code>
- component instead of the explicit sequence has the advantage of being able
- to encapsulate the tail (i.e the <code class="computeroutput"><span class="identifier">char_</span><span class="special">(</span><span class="string">"a-zA-Z_0-9"</span><span class="special">)</span></code>) as a separate parser construct. The following
- code snippet illustrates the idea (for the full code of this example please
- see distinct.cpp):
- </p>
-<p>
- </p>
-<p>
-
-</p>
-<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">spirit</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="keyword">namespace</span> <span class="identifier">ascii</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">ascii</span><span class="special">;</span>
-<span class="keyword">namespace</span> <span class="identifier">repo</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">repository</span><span class="special">;</span>
-
-<span class="comment">// Define metafunctions allowing to compute the type of the distinct()
-</span><span class="comment">// and ascii::char_() constructs
-</span><span class="keyword">namespace</span> <span class="identifier">traits</span>
-<span class="special">{</span>
- <span class="comment">// Metafunction allowing to get the type of any repository::distinct(...)
-</span> <span class="comment">// construct
-</span> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Tail</span><span class="special">></span>
- <span class="keyword">struct</span> <span class="identifier">distinct_spec</span>
- <span class="special">:</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">terminal</span><span class="special"><</span><span class="identifier">repo</span><span class="special">::</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">Tail</span><span class="special">)></span>
- <span class="special">{};</span>
-
- <span class="comment">// Metafunction allowing to get the type of any ascii::char_(...) construct
-</span> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">String</span><span class="special">></span>
- <span class="keyword">struct</span> <span class="identifier">char_spec</span>
- <span class="special">:</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">terminal</span><span class="special"><</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">::</span><span class="identifier">char_</span><span class="special">(</span><span class="identifier">String</span><span class="special">)></span>
- <span class="special">{};</span>
-<span class="special">};</span>
-
-<span class="comment">// Define a helper function allowing to create a distinct() construct from
-</span><span class="comment">// an arbitrary tail parser
-</span><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Tail</span><span class="special">></span>
-<span class="keyword">inline</span> <span class="keyword">typename</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">distinct_spec</span><span class="special"><</span><span class="identifier">Tail</span><span class="special">>::</span><span class="identifier">type</span>
-<span class="identifier">distinct_spec</span><span class="special">(</span><span class="identifier">Tail</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">tail</span><span class="special">)</span>
-<span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">repo</span><span class="special">::</span><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">tail</span><span class="special">);</span>
-<span class="special">}</span>
-
-<span class="comment">// Define a helper function allowing to create a ascii::char_() construct
-</span><span class="comment">// from an arbitrary string representation
-</span><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">String</span><span class="special">></span>
-<span class="keyword">inline</span> <span class="keyword">typename</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">char_spec</span><span class="special"><</span><span class="identifier">String</span><span class="special">>::</span><span class="identifier">type</span>
-<span class="identifier">char_spec</span><span class="special">(</span><span class="identifier">String</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">str</span><span class="special">)</span>
-<span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">ascii</span><span class="special">::</span><span class="identifier">char_</span><span class="special">(</span><span class="identifier">str</span><span class="special">);</span>
-<span class="special">}</span>
-
-<span class="comment">// the following constructs the type of a distinct_spec holding a
-</span><span class="comment">// charset("0-9a-zA-Z_") as its tail parser
-</span><span class="keyword">typedef</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">char_spec</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">type</span> <span class="identifier">charset_tag_type</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">distinct_spec</span><span class="special"><</span><span class="identifier">charset_tag_type</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">keyword_tag_type</span><span class="special">;</span>
-
-<span class="comment">// Define a new Qi 'keyword' directive usable as a shortcut for a
-</span><span class="comment">// repository::distinct(char_(std::string("0-9a-zA-Z_")))
-</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span> <span class="identifier">keyword_spec</span><span class="special">(</span><span class="string">"0-9a-zA-Z_"</span><span class="special">);</span>
-<span class="identifier">keyword_tag_type</span> <span class="keyword">const</span> <span class="identifier">keyword</span> <span class="special">=</span> <span class="identifier">distinct_spec</span><span class="special">(</span><span class="identifier">char_spec</span><span class="special">(</span><span class="identifier">keyword_spec</span><span class="special">));</span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-<p>
- These definitions define a new Qi parser recognizing keywords! This allows
- to rewrite our declaration parser expression as:
- </p>
-<pre class="programlisting"><span class="identifier">keyword</span><span class="special">[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">":"</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
-</pre>
-<p>
- which is much more readable and concise if compared to the original parser
- expression. In addition the new <code class="computeroutput"><span class="identifier">keyword</span><span class="special">[]</span></code> directive has the advantage to be usable
- for wrapping any parser expression, not only strings as in the example
- above.
- </p>
-<a name="spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.header"></a><h6>
-<a name="id1031885"></a>
- <a class="link" href="qi_distinct_parser.html#spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.header">Header</a>
- </h6>
-<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/qi/distinct.hpp>
-</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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_distinct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-</pre>
-<a name="spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.synopsis"></a><h6>
-<a name="id1031958"></a>
- <a class="link" href="qi_distinct_parser.html#spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.synopsis">Synopsis</a>
- </h6>
-<pre class="programlisting"><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">tail</span><span class="special">)[</span><span class="identifier">subject</span><span class="special">]</span>
-</pre>
-<a name="spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.parameters"></a><h6>
-<a name="id1031998"></a>
- <a class="link" href="qi_distinct_parser.html#spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.parameters">Parameters</a>
- </h6>
-<div class="informaltable"><table class="table">
-<colgroup>
-<col>
-<col>
-</colgroup>
-<thead><tr>
-<th>
- <p>
- Parameter
- </p>
- </th>
-<th>
- <p>
- Description
- </p>
- </th>
-</tr></thead>
-<tbody>
-<tr>
-<td>
- <p>
- <code class="computeroutput"><span class="identifier">tail</span></code>
- </p>
- </td>
-<td>
- <p>
- The parser construct specifying what whould not follow the subject
- in order to match the overall expression.
- </p>
- </td>
-</tr>
-<tr>
-<td>
- <p>
- <code class="computeroutput"><span class="identifier">subject</span></code>
- </p>
- </td>
-<td>
- <p>
- The parser construct to use to match the current input. The distinct
- directive makes sure that no unexpected partial matches occur.
- </p>
- </td>
-</tr>
-</tbody>
-</table></div>
-<p>
- All two parameters can be arbitrary complex parsers themselves.
- </p>
-<a name="spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.attribute"></a><h6>
-<a name="id1032096"></a>
- <a class="link" href="qi_distinct_parser.html#spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.attribute">Attribute</a>
- </h6>
-<p>
- The <code class="computeroutput"><span class="identifier">distinct</span></code> component
- exposes the attribute type of its subject as its own attribute type. If
- the <code class="computeroutput"><span class="identifier">subject</span></code> does not expose
- any attribute (the type is <code class="computeroutput"><span class="identifier">unused_type</span></code>),
- then the <code class="computeroutput"><span class="identifier">distinct</span></code> does
- not expose any attribute either.
- </p>
-<pre class="programlisting"><span class="identifier">a</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">B</span> <span class="special">--></span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">b</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">A</span>
-</pre>
-<a name="spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.example"></a><h6>
-<a name="id1032209"></a>
- <a class="link" href="qi_distinct_parser.html#spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.example">Example</a>
- </h6>
-<p>
- The following example shows simple use cases of the <code class="computeroutput"><span class="identifier">distinct</span></code>
- parser. distinct.cpp)
- </p>
-<a name="spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.prerequisites"></a><h6>
-<a name="id1032239"></a>
- <a class="link" href="qi_distinct_parser.html#spirit_repository.qi_components.qi_parser_directives.qi_distinct_parser.prerequisites">Prerequisites</a>
- </h6>
-<p>
- In addition to the main header file needed to include the core components
- implemented in <span class="emphasis"><em>Spirit.Qi</em></span> we add the header file needed
- for the new <code class="computeroutput"><span class="identifier">distinct</span></code> generator.
- </p>
-<p>
- </p>
-<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>
-<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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_distinct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-<p>
- To make all the code below more readable we introduce the following namespaces.
- </p>
-<p>
- </p>
-<p>
-
-</p>
-<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">;</span>
-<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">;</span>
-<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">repository</span><span class="special">::</span><span class="identifier">distinct</span><span class="special">;</span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-<p>
- We show several examples of how the <code class="computeroutput"><span class="identifier">distinct</span><span class="special">[]</span></code> directive can be used to force correct
- behavior while matching keywords. The first two code snippets show the
- correct matching of the <code class="computeroutput"><span class="identifier">description</span></code>
- keyword (in this hypothetical example we allow keywords to be directly
- followed by an optional <code class="computeroutput"><span class="string">"--"</span></code>):
- </p>
-<p>
- </p>
-<p>
-
-</p>
-<pre class="programlisting"><span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span><span class="string">"description ident"</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="identifier">first</span><span class="special">(</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
- <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">qi</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">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
- <span class="special">,</span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">"--"</span><span class="special">)</span> <span class="special">>></span> <span class="special">+(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)</span>
- <span class="special">,</span> <span class="identifier">space</span><span class="special">);</span>
- <span class="identifier">BOOST_ASSERT</span><span class="special">(</span><span class="identifier">r</span> <span class="special">&&</span> <span class="identifier">first</span> <span class="special">==</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-<p>
-
-</p>
-<pre class="programlisting"><span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span><span class="string">"description--ident"</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="identifier">first</span><span class="special">(</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
- <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">qi</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">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
- <span class="special">,</span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">"--"</span><span class="special">)</span> <span class="special">>></span> <span class="special">+(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)</span>
- <span class="special">,</span> <span class="identifier">space</span><span class="special">);</span>
- <span class="identifier">BOOST_ASSERT</span><span class="special">(</span><span class="identifier">r</span> <span class="special">&&</span> <span class="identifier">first</span> <span class="special">==</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-<p>
- The last example shows that the <code class="computeroutput"><span class="identifier">distinct</span><span class="special">[]</span></code> parser component correctly refuses to
- match "description-ident":
- </p>
-<p>
- </p>
-<p>
-
-</p>
-<pre class="programlisting"><span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">str</span><span class="special">(</span><span class="string">"description-ident"</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="identifier">first</span><span class="special">(</span><span class="identifier">str</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
- <span class="keyword">bool</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">qi</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">str</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
- <span class="special">,</span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)[</span><span class="string">"description"</span><span class="special">]</span> <span class="special">>></span> <span class="special">-</span><span class="identifier">lit</span><span class="special">(</span><span class="string">"--"</span><span class="special">)</span> <span class="special">>></span> <span class="special">+(</span><span class="identifier">alnum</span> <span class="special">|</span> <span class="char">'_'</span><span class="special">)</span>
- <span class="special">,</span> <span class="identifier">space</span><span class="special">);</span>
- <span class="identifier">BOOST_ASSERT</span><span class="special">(!</span><span class="identifier">r</span> <span class="special">&&</span> <span class="identifier">first</span> <span class="special">==</span> <span class="identifier">str</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
- de Guzman, Hartmut Kaiser<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="../qi_parser_directives.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_parser_directives.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../karma_components.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-</body>
-</html>
Deleted: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_primitives.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_primitives.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
+++ (empty file)
@@ -1,47 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Qi Parser Primitives</title>
-<link rel="stylesheet" href="../../../../../../../doc/html/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
-<link rel="home" href="../../index.html" title="Spirit Repository 0.1">
-<link rel="up" href="../qi_components.html" title="Qi Components">
-<link rel="prev" href="../qi_components.html" title="Qi Components">
-<link rel="next" href="qi_parser_primitives/qi_flush_multi_pass_parser.html" title="Qi flush_multi_pass parser">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
-<td align="center">Home</td>
-<td align="center">Libraries</td>
-<td align="center">People</td>
-<td align="center">FAQ</td>
-<td align="center">More</td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="../qi_components.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_parser_primitives/qi_flush_multi_pass_parser.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-<div class="section" title="Qi Parser Primitives">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="spirit_repository.qi_components.qi_parser_primitives"></a><a class="link" href="qi_parser_primitives.html" title="Qi Parser Primitives">Qi
- Parser Primitives</a>
-</h3></div></div></div>
-<div class="toc"><dl><dt><span class="section"><a href="qi_parser_primitives/qi_flush_multi_pass_parser.html">Qi
- flush_multi_pass parser</a></span></dt></dl></div>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
- de Guzman, Hartmut Kaiser<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="../qi_components.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="qi_parser_primitives/qi_flush_multi_pass_parser.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-</body>
-</html>
Deleted: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_primitives/qi_flush_multi_pass_parser.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/qi_parser_primitives/qi_flush_multi_pass_parser.html 2009-07-30 18:59:42 EDT (Thu, 30 Jul 2009)
+++ (empty file)
@@ -1,220 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Qi flush_multi_pass parser</title>
-<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
-<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
-<link rel="up" href="../qi_parser_primitives.html" title="Qi Parser Primitives">
-<link rel="prev" href="../qi_parser_primitives.html" title="Qi Parser Primitives">
-<link rel="next" href="../qi_parser_directives.html" title="Qi Parser Directives">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
-<td align="center">Home</td>
-<td align="center">Libraries</td>
-<td align="center">People</td>
-<td align="center">FAQ</td>
-<td align="center">More</td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="../qi_parser_primitives.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_parser_primitives.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../qi_parser_directives.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-<div class="section" title="Qi flush_multi_pass parser">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser"></a><a class="link" href="qi_flush_multi_pass_parser.html" title="Qi flush_multi_pass parser">Qi
- flush_multi_pass parser</a>
-</h4></div></div></div>
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.description"></a><h6>
-<a name="id1026666"></a>
- <a class="link" href="qi_flush_multi_pass_parser.html#spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.description">Description</a>
- </h6>
-<p>
- The <span class="emphasis"><em>Spirit.Qi</em></span> <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
- parser is a primitive (pseudo) parser component allowing to clear the internal
- buffer of a <code class="computeroutput"><span class="identifier">multi_pass</span></code>
- iterator. Clearing the buffer of a <code class="computeroutput"><span class="identifier">multi_pass</span></code>
- might be beneficial for grammars where it is clear that no backtracking
- can occur. The general syntax for using the <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
- is:
- </p>
-<pre class="programlisting"><span class="identifier">flush_multi_pass</span>
-</pre>
-<p>
- which will call the <code class="computeroutput"><span class="identifier">clear_queue</span><span class="special">()</span></code> member function if the current iterators
- are of the type <code class="computeroutput"><span class="identifier">multi_pass</span></code>.
- This will cause any buffered data to be erased. This also will invalidate
- all other copies of multi_pass and they should not be used. If they are,
- an <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">illegal_backtracking</span></code> exception will be
- thrown. For all other iterator types this is a no-op. The <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code> generates a parser component
- which always succeeds and which does not consume any input (very much like
- <code class="computeroutput"><span class="identifier">eps</span></code>).
- </p>
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.header"></a><h6>
-<a name="id1026774"></a>
- <a class="link" href="qi_flush_multi_pass_parser.html#spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.header">Header</a>
- </h6>
-<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/qi/flush_multi_pass.hpp>
-</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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_flush_multi_pass</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-</pre>
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.synopsis"></a><h6>
-<a name="id1026847"></a>
- <a class="link" href="qi_flush_multi_pass_parser.html#spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.synopsis">Synopsis</a>
- </h6>
-<pre class="programlisting"><span class="identifier">flush_multi_pass</span>
-</pre>
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.parameters"></a><h6>
-<a name="id1026869"></a>
- <a class="link" href="qi_flush_multi_pass_parser.html#spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.parameters">Parameters</a>
- </h6>
-<p>
- The <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code> does
- not require any parameters.
- </p>
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.attribute"></a><h6>
-<a name="id1026893"></a>
- <a class="link" href="qi_flush_multi_pass_parser.html#spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.attribute">Attribute</a>
- </h6>
-<p>
- The <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code> component
- exposes no attribute (the exposed attribute type is <code class="computeroutput"><span class="identifier">unused_type</span></code>):
- </p>
-<pre class="programlisting"><span class="identifier">flush_multi_pass</span> <span class="special">--></span> <span class="identifier">unused</span>
-</pre>
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.example"></a><h6>
-<a name="id1026942"></a>
- <a class="link" href="qi_flush_multi_pass_parser.html#spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.example">Example</a>
- </h6>
-<p>
- The following example shows a simple use case of the <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
- parser.
- </p>
-<p>
- We will illustrate its usage by generating different comment styles and
- a function prototype (for the full example code see here: flush_multi_pass.cpp)
- </p>
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.prerequisites"></a><h6>
-<a name="id1026974"></a>
- <a class="link" href="qi_flush_multi_pass_parser.html#spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.prerequisites">Prerequisites</a>
- </h6>
-<p>
- In addition to the main header file needed to include the core components
- implemented in <span class="emphasis"><em>Spirit.Qi</em></span> we add the header file needed
- for the new <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
- parser.
- </p>
-<p>
- </p>
-<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>
-<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">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_flush_multi_pass</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-<p>
- To make all the code below more readable we introduce the following namespaces.
- </p>
-<p>
- </p>
-<p>
-
-</p>
-<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">spirit</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="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">repository</span><span class="special">::</span><span class="identifier">flush_multi_pass</span><span class="special">;</span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-<a name="spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.clearing_the_internal_buffer"></a><h6>
-<a name="id1027190"></a>
- <a class="link" href="qi_flush_multi_pass_parser.html#spirit_repository.qi_components.qi_parser_primitives.qi_flush_multi_pass_parser.clearing_the_internal_buffer">Clearing
- the internal buffer</a>
- </h6>
-<p>
- The example grammar recognizes the (simplified) preprocessor commands
- <code class="computeroutput"><span class="preprocessor">#define</span></code> and <code class="computeroutput"><span class="preprocessor">#undef</span></code> both of which are constraint
- to a single line. This makes it possible to delete all internal iterator
- buffers on each detected line break. This is safe as no backtracking will
- occur after any line end. The following code snippet shows the usage of
- <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code> for this
- purpose.
- </p>
-<p>
- </p>
-<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> <span class="keyword">typename</span> <span class="identifier">Skipper</span><span class="special">></span>
-<span class="keyword">struct</span> <span class="identifier">preprocessor</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="identifier">grammar</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="special">{</span>
- <span class="comment">// This is a simplified preprocessor grammar recognizing
-</span> <span class="comment">//
-</span> <span class="comment">// #define MACRONAME something
-</span> <span class="comment">// #undef MACRONAME
-</span> <span class="comment">//
-</span> <span class="comment">// Its sole purpose is to show an example how to use the
-</span> <span class="comment">// flush_multi_pass parser. At the end of each line no backtracking can
-</span> <span class="comment">// occur anymore so that it's safe to clear all internal buffers in the
-</span> <span class="comment">// multi_pass.
-</span> <span class="identifier">preprocessor</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">preprocessor</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">file</span><span class="special">)</span>
- <span class="special">{</span>
- <span class="keyword">using</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">ascii</span><span class="special">::</span><span class="identifier">char_</span><span class="special">;</span>
- <span class="keyword">using</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">::</span><span class="identifier">eol</span><span class="special">;</span>
- <span class="keyword">using</span> <span class="identifier">spirit</span><span class="special">::</span><span class="identifier">qi</span><span class="special">::</span><span class="identifier">lit</span><span class="special">;</span>
-
- <span class="identifier">file</span> <span class="special">=</span>
- <span class="special">*</span><span class="identifier">line</span>
- <span class="special">;</span>
-
- <span class="identifier">line</span> <span class="special">=</span> <span class="special">(</span> <span class="identifier">command</span> <span class="special">|</span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">>></span> <span class="identifier">eol</span>
- <span class="special">>></span> <span class="identifier">flush_multi_pass</span>
- <span class="special">;</span>
-
- <span class="identifier">command</span> <span class="special">=</span>
- <span class="string">"#define"</span> <span class="special">>></span> <span class="special">*</span><span class="identifier">lit</span><span class="special">(</span><span class="char">' '</span><span class="special">)</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="special">*</span><span class="identifier">lit</span><span class="special">(</span><span class="char">' '</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
- <span class="special">|</span> <span class="string">"#undef"</span> <span class="special">>></span> <span class="special">*</span><span class="identifier">lit</span><span class="special">(</span><span class="char">' '</span><span class="special">)</span> <span class="special">>></span> <span class="special">*(</span><span class="identifier">char_</span> <span class="special">-</span> <span class="identifier">eol</span><span class="special">)</span>
- <span class="special">;</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="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">file</span><span class="special">,</span> <span class="identifier">line</span><span class="special">,</span> <span class="identifier">command</span><span class="special">;</span>
-<span class="special">};</span>
-</pre>
-<p>
- </p>
-<p>
- </p>
-<div class="note" title="Note"><table border="0" summary="Note">
-<tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../images/note.png"></td>
-<th align="left">Note</th>
-</tr>
-<tr><td align="left" valign="top"><p>
- Using the <code class="computeroutput"><span class="identifier">flush_multi_pass</span></code>
- parser component with iterators other than <code class="computeroutput"><span class="identifier">multi_pass</span></code>
- is safe to use as it has no effect on the parsing.
- </p></td></tr>
-</table></div>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright © 2001-2009 Joel
- de Guzman, Hartmut Kaiser<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="../qi_parser_primitives.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_parser_primitives.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../qi_parser_directives.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
-</div>
-</body>
-</html>
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