|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68461 - in trunk: boost/spirit/repository/home/qi boost/spirit/repository/home/qi/primitive boost/spirit/repository/include libs/spirit/repository/doc/html libs/spirit/repository/doc/html/spirit_repository libs/spirit/repository/doc/html/spirit_repository/karma_components libs/spirit/repository/doc/html/spirit_repository/karma_components/directives libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal libs/spirit/repository/doc/html/spirit_repository/qi_components libs/spirit/repository/doc/html/spirit_repository/qi_components/directives libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive libs/spirit/repository/doc/qi libs/spirit/repository/example/qi
From: hartmut.kaiser_at_[hidden]
Date: 2011-01-26 20:10:13
Author: hkaiser
Date: 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
New Revision: 68461
URL: http://svn.boost.org/trac/boost/changeset/68461
Log:
Spirit: adding advance parser component to Spirit repository
Added:
trunk/boost/spirit/repository/home/qi/primitive/advance.hpp (contents, props changed)
trunk/boost/spirit/repository/include/qi_advance.hpp (contents, props changed)
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/advance.html (contents, props changed)
trunk/libs/spirit/repository/doc/qi/advance.qbk (contents, props changed)
trunk/libs/spirit/repository/example/qi/advance.cpp (contents, props changed)
Text files modified:
trunk/boost/spirit/repository/home/qi/primitive.hpp | 1 +
trunk/libs/spirit/repository/doc/html/index.html | 40 ++++++++++++++++++++++------------------
trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components.html | 10 +++++-----
trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives.html | 4 ++--
trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html | 20 ++++++++++----------
trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal.html | 8 ++++----
trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html | 30 +++++++++++++++---------------
trunk/libs/spirit/repository/doc/html/spirit_repository/preface.html | 10 +++++-----
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components.html | 28 ++++++++++++++++------------
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html | 12 ++++++------
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html | 24 ++++++++++++------------
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html | 22 +++++++++++-----------
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal.html | 8 ++++----
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html | 32 ++++++++++++++++----------------
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html | 18 +++++++++++-------
trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html | 28 ++++++++++++++--------------
trunk/libs/spirit/repository/doc/qi/primitive_parsers.qbk | 1 +
trunk/libs/spirit/repository/example/qi/Jamfile | 1 +
18 files changed, 156 insertions(+), 141 deletions(-)
Modified: trunk/boost/spirit/repository/home/qi/primitive.hpp
==============================================================================
--- trunk/boost/spirit/repository/home/qi/primitive.hpp (original)
+++ trunk/boost/spirit/repository/home/qi/primitive.hpp 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -11,6 +11,7 @@
#pragma once
#endif
+#include <boost/spirit/repository/home/qi/primitive/advance.hpp>
#include <boost/spirit/repository/home/qi/primitive/flush_multi_pass.hpp>
#include <boost/spirit/repository/home/qi/primitive/iter_pos.hpp>
Added: trunk/boost/spirit/repository/home/qi/primitive/advance.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/repository/home/qi/primitive/advance.hpp 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -0,0 +1,130 @@
+// Copyright (c) 2011 Aaron Graham
+//
+// 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)
+
+#if !defined(BOOST_SPIRIT_REPOSITORY_QI_ADVANCE_JAN_23_2011_1203PM)
+#define BOOST_SPIRIT_REPOSITORY_QI_ADVANCE_JAN_23_2011_1203PM
+
+#include <boost/spirit/include/qi_parse.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// definition the place holder
+namespace boost { namespace spirit { namespace repository { namespace qi
+{
+ BOOST_SPIRIT_TERMINAL_EX(advance);
+}}}}
+
+///////////////////////////////////////////////////////////////////////////////
+// implementation the enabler
+namespace boost { namespace spirit
+{
+ template <typename A0>
+ struct use_terminal<qi::domain
+ , terminal_ex<repository::qi::tag::advance, fusion::vector1<A0> > >
+ : mpl::or_<is_integral<A0>, is_enum<A0> >
+ {};
+
+ template <>
+ struct use_lazy_terminal<qi::domain, repository::qi::tag::advance, 1>
+ : mpl::true_
+ {};
+}}
+
+///////////////////////////////////////////////////////////////////////////////
+// implementation of the parser
+namespace boost { namespace spirit { namespace repository { namespace qi
+{
+ template <typename Int>
+ struct advance_parser
+ : boost::spirit::qi::primitive_parser< advance_parser<Int> >
+ {
+ // Define the attribute type exposed by this parser component
+ template <typename Context, typename Iterator>
+ struct attribute
+ {
+ typedef boost::spirit::unused_type type;
+ };
+
+ advance_parser(Int dist)
+ : dist(dist)
+ {}
+
+ // This function is called during the actual parsing process
+ template <typename Iterator, typename Context
+ , typename Skipper, typename Attribute>
+ bool parse(Iterator& first, Iterator const& last
+ , Context&, Skipper&, Attribute&) const
+ {
+ // This series of checks is designed to fail parsing on negative
+ // values, without generating a "expression always evaluates true"
+ // warning on unsigned types.
+ if (dist == Int(0)) return true;
+ if (dist < Int(1)) return false;
+
+ typedef typename std::iterator_traits<Iterator>::iterator_category
+ iterator_category;
+ return advance(first, last, iterator_category());
+ }
+
+ // This function is called during error handling to create
+ // a human readable string for the error context.
+ template <typename Context>
+ boost::spirit::info what(Context&) const
+ {
+ return boost::spirit::info("advance");
+ }
+
+ private:
+ // this is the general implementation used by most iterator categories
+ template <typename Iterator, typename IteratorCategory>
+ bool advance(Iterator& first, Iterator const& last
+ , IteratorCategory) const
+ {
+ Int n = dist;
+ Iterator i = first;
+ while (n)
+ {
+ if (i == last) return false;
+ ++i;
+ --n;
+ }
+ first = i;
+ return true;
+ }
+
+ // this is a specialization for random access iterators
+ template <typename Iterator>
+ bool advance(Iterator& first, Iterator const& last
+ , std::random_access_iterator_tag) const
+ {
+ Iterator const it = first + dist;
+ if (it > last) return false;
+ first = it;
+ return true;
+ }
+
+ Int const dist;
+ };
+}}}}
+
+///////////////////////////////////////////////////////////////////////////////
+// instantiation of the parser
+namespace boost { namespace spirit { namespace qi
+{
+ template <typename Modifiers, typename A0>
+ struct make_primitive<
+ terminal_ex<repository::qi::tag::advance, fusion::vector1<A0> >
+ , Modifiers>
+ {
+ typedef repository::qi::advance_parser<A0> result_type;
+
+ template <typename Terminal>
+ result_type operator()(Terminal const& term, unused_type) const
+ {
+ return result_type(fusion::at_c<0>(term.args));
+ }
+ };
+}}}
+
+#endif
Added: trunk/boost/spirit/repository/include/qi_advance.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/repository/include/qi_advance.hpp 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -0,0 +1,17 @@
+/*=============================================================================
+ Copyright (c) 2011 Aaron Graham
+ http://spirit.sourceforge.net/
+
+ 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)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_INCLUDE_QI_REPOSITORY_ADVANCE
+#define BOOST_SPIRIT_INCLUDE_QI_REPOSITORY_ADVANCE
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/repository/home/qi/primitive/advance.hpp>
+
+#endif
Modified: trunk/libs/spirit/repository/doc/html/index.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/index.html (original)
+++ trunk/libs/spirit/repository/doc/html/index.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Spirit Repository 0.1</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
<link rel="home" href="index.html" title="Spirit Repository 0.1">
<link rel="next" href="spirit_repository/preface.html" title="Preface">
</head>
@@ -33,7 +33,7 @@
</div></div>
<div><p class="copyright">Copyright © 2001-2010 Joel de Guzman, Hartmut Kaiser</p></div>
<div><div class="legalnotice">
-<a name="id759740"></a><p>
+<a name="id834034"></a><p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</p>
@@ -47,39 +47,43 @@
<dt><span class="section">Preface</span></dt>
<dt><span class="section">Qi Components</span></dt>
<dd><dl>
-<dt><span class="section"><a href="spirit_repository/qi_components/primitive.html"> Qi Parser
+<dt><span class="section"><a href="spirit_repository/qi_components/primitive.html">Qi Parser
Primitives</a></span></dt>
-<dd><dl><dt><span class="section"><a href="spirit_repository/qi_components/primitive/flush_multi_pass.html">
- Qi flush_multi_pass parser</a></span></dt></dl></dd>
-<dt><span class="section"><a href="spirit_repository/qi_components/directives.html"> Qi Parser
+<dd><dl>
+<dt><span class="section"><a href="spirit_repository/qi_components/primitive/advance.html">Qi
+ advance Parser</a></span></dt>
+<dt><span class="section"><a href="spirit_repository/qi_components/primitive/flush_multi_pass.html">Qi
+ flush_multi_pass parser</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="spirit_repository/qi_components/directives.html">Qi Parser
Directives</a></span></dt>
<dd><dl>
-<dt><span class="section"><a href="spirit_repository/qi_components/directives/confix.html">
- Qi Confix Parser Directive</a></span></dt>
-<dt><span class="section"><a href="spirit_repository/qi_components/directives/distinct.html">
- Qi Distinct Parser Directive</a></span></dt>
+<dt><span class="section"><a href="spirit_repository/qi_components/directives/confix.html">Qi
+ Confix Parser Directive</a></span></dt>
+<dt><span class="section"><a href="spirit_repository/qi_components/directives/distinct.html">Qi
+ Distinct Parser Directive</a></span></dt>
</dl></dd>
-<dt><span class="section"><a href="spirit_repository/qi_components/nonterminal.html"> Qi Parser
+<dt><span class="section"><a href="spirit_repository/qi_components/nonterminal.html">Qi Parser
Non-terminals</a></span></dt>
-<dd><dl><dt><span class="section"><a href="spirit_repository/qi_components/nonterminal/subrule.html">
- Qi subrules</a></span></dt></dl></dd>
+<dd><dl><dt><span class="section"><a href="spirit_repository/qi_components/nonterminal/subrule.html">Qi
+ subrules</a></span></dt></dl></dd>
</dl></dd>
<dt><span class="section">Karma Components</span></dt>
<dd><dl>
-<dt><span class="section"><a href="spirit_repository/karma_components/directives.html"> Karma
+<dt><span class="section"><a href="spirit_repository/karma_components/directives.html">Karma
Generator Directives</a></span></dt>
<dd><dl><dt><span class="section"><a href="spirit_repository/karma_components/directives/karma_confix_generator.html">Karma
Confix Generator</a></span></dt></dl></dd>
-<dt><span class="section"><a href="spirit_repository/karma_components/nonterminal.html"> Karma
+<dt><span class="section"><a href="spirit_repository/karma_components/nonterminal.html">Karma
Generator Non-terminals</a></span></dt>
-<dd><dl><dt><span class="section"><a href="spirit_repository/karma_components/nonterminal/subrule.html">
- Karma subrules</a></span></dt></dl></dd>
+<dd><dl><dt><span class="section"><a href="spirit_repository/karma_components/nonterminal/subrule.html">Karma
+ subrules</a></span></dt></dl></dd>
</dl></dd>
</dl>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: July 19, 2010 at 19:04:13 GMT</small></p></td>
+<td align="left"><p><small>Last revised: January 27, 2011 at 01:05:40 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
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 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Karma Components</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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/nonterminal/subrule.html" title="Qi subrules">
@@ -27,14 +27,14 @@
<a name="spirit_repository.karma_components"></a><a class="link" href="karma_components.html" title="Karma Components">Karma Components</a>
</h2></div></div></div>
<div class="toc"><dl>
-<dt><span class="section"><a href="karma_components/directives.html"> Karma
+<dt><span class="section"><a href="karma_components/directives.html">Karma
Generator Directives</a></span></dt>
<dd><dl><dt><span class="section"><a href="karma_components/directives/karma_confix_generator.html">Karma
Confix Generator</a></span></dt></dl></dd>
-<dt><span class="section"><a href="karma_components/nonterminal.html"> Karma
+<dt><span class="section"><a href="karma_components/nonterminal.html">Karma
Generator Non-terminals</a></span></dt>
-<dd><dl><dt><span class="section"><a href="karma_components/nonterminal/subrule.html">
- Karma subrules</a></span></dt></dl></dd>
+<dd><dl><dt><span class="section"><a href="karma_components/nonterminal/subrule.html">Karma
+ subrules</a></span></dt></dl></dd>
</dl></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Karma Generator Directives</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="../karma_components.html" title="Karma Components">
<link rel="prev" href="../karma_components.html" title="Karma Components">
@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="spirit_repository.karma_components.directives"></a><a class="link" href="directives.html" title="Karma Generator Directives"> Karma
+<a name="spirit_repository.karma_components.directives"></a><a class="link" href="directives.html" title="Karma Generator Directives">Karma
Generator Directives</a>
</h3></div></div></div>
<div class="toc"><dl><dt><span class="section"><a href="directives/karma_confix_generator.html">Karma
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Karma Confix Generator</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="Karma Generator Directives">
<link rel="prev" href="../directives.html" title="Karma Generator Directives">
@@ -28,7 +28,7 @@
Confix Generator</a>
</h4></div></div></div>
<a name="spirit_repository.karma_components.directives.karma_confix_generator.description"></a><h6>
-<a name="id771856"></a>
+<a name="id858383"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.description">Description</a>
</h6>
<p>
@@ -93,20 +93,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.directives.karma_confix_generator.header"></a><h6>
-<a name="id772961"></a>
+<a name="id860372"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.header">Header</a>
</h6>
<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/karma/directive/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.directives.karma_confix_generator.synopsis"></a><h6>
-<a name="id773061"></a>
+<a name="id860445"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.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.directives.karma_confix_generator.parameters"></a><h6>
-<a name="id773128"></a>
+<a name="id860493"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.parameters">Parameters</a>
</h6>
<div class="informaltable"><table class="table">
@@ -175,7 +175,7 @@
All three parameters can be arbitrary complex generators themselves.
</p>
<a name="spirit_repository.karma_components.directives.karma_confix_generator.attribute"></a><h6>
-<a name="id773327"></a>
+<a name="id860657"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.attribute">Attribute</a>
</h6>
<p>
@@ -202,7 +202,7 @@
</p></td></tr>
</table></div>
<a name="spirit_repository.karma_components.directives.karma_confix_generator.example"></a><h6>
-<a name="id773559"></a>
+<a name="id860832"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.example">Example</a>
</h6>
<p>
@@ -211,7 +211,7 @@
styles and a function prototype (for the full example code see here: confix.cpp)
</p>
<a name="spirit_repository.karma_components.directives.karma_confix_generator.prerequisites"></a><h6>
-<a name="id773606"></a>
+<a name="id860862"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.prerequisites">Prerequisites</a>
</h6>
<p>
@@ -241,7 +241,7 @@
<p>
</p>
<a name="spirit_repository.karma_components.directives.karma_confix_generator.generating_different_comment_styles"></a><h6>
-<a name="id773903"></a>
+<a name="id861098"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.generating_different_comment_styles">Generating
Different Comment Styles</a>
</h6>
@@ -285,7 +285,7 @@
*/</span> </code>.
</p>
<a name="spirit_repository.karma_components.directives.karma_confix_generator.generating_a_function_prototype"></a><h6>
-<a name="id774271"></a>
+<a name="id861392"></a>
<a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.generating_a_function_prototype">Generating
a Function Prototype</a>
</h6>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Karma Generator Non-terminals</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="../karma_components.html" title="Karma Components">
<link rel="prev" href="directives/karma_confix_generator.html" title="Karma Confix Generator">
@@ -24,11 +24,11 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="spirit_repository.karma_components.nonterminal"></a><a class="link" href="nonterminal.html" title="Karma Generator Non-terminals"> Karma
+<a name="spirit_repository.karma_components.nonterminal"></a><a class="link" href="nonterminal.html" title="Karma Generator Non-terminals">Karma
Generator Non-terminals</a>
</h3></div></div></div>
-<div class="toc"><dl><dt><span class="section"><a href="nonterminal/subrule.html">
- Karma subrules</a></span></dt></dl></div>
+<div class="toc"><dl><dt><span class="section"><a href="nonterminal/subrule.html">Karma
+ subrules</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>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Karma subrules</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="../nonterminal.html" title="Karma Generator Non-terminals">
<link rel="prev" href="../nonterminal.html" title="Karma Generator Non-terminals">
@@ -23,11 +23,11 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
-<a name="spirit_repository.karma_components.nonterminal.subrule"></a><a class="link" href="subrule.html" title="Karma subrules">
- Karma subrules</a>
+<a name="spirit_repository.karma_components.nonterminal.subrule"></a><a class="link" href="subrule.html" title="Karma subrules">Karma
+ subrules</a>
</h4></div></div></div>
<a name="spirit_repository.karma_components.nonterminal.subrule.description"></a><h6>
-<a name="id774685"></a>
+<a name="id861721"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.description">Description</a>
</h6>
<p>
@@ -85,21 +85,21 @@
parts), whereas the rest can use rules and grammars.
</p>
<a name="spirit_repository.karma_components.nonterminal.subrule.header"></a><h6>
-<a name="id775027"></a>
+<a name="id861987"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.header">Header</a>
</h6>
<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/karma/nonterminal/subrule.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_subrule</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
</pre>
<a name="spirit_repository.karma_components.nonterminal.subrule.synopsis__declaration_"></a><h6>
-<a name="id775127"></a>
+<a name="id862064"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.synopsis__declaration_">Synopsis
(declaration)</a>
</h6>
<pre class="programlisting"><span class="identifier">subrule</span><span class="special"><</span><span class="identifier">ID</span><span class="special">,</span> <span class="identifier">A1</span><span class="special">,</span> <span class="identifier">A2</span><span class="special">></span> <span class="identifier">sr</span><span class="special">(</span><span class="identifier">name</span><span class="special">);</span>
</pre>
<a name="spirit_repository.karma_components.nonterminal.subrule.parameters__declaration_"></a><h6>
-<a name="id775212"></a>
+<a name="id862128"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.parameters__declaration_">Parameters
(declaration)</a>
</h6>
@@ -169,7 +169,7 @@
</tbody>
</table></div>
<a name="spirit_repository.karma_components.nonterminal.subrule.synopsis__usage_"></a><h6>
-<a name="id775374"></a>
+<a name="id862263"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.synopsis__usage_">Synopsis
(usage)</a>
</h6>
@@ -198,7 +198,7 @@
<span class="special">)(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span> <span class="special">...)</span> <span class="comment">// Arguments to group, i.e. to start subrule srA
</span></pre>
<a name="spirit_repository.karma_components.nonterminal.subrule.parameters__usage_"></a><h6>
-<a name="id775661"></a>
+<a name="id862498"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.parameters__usage_">Parameters
(usage)</a>
</h6>
@@ -322,7 +322,7 @@
</tbody>
</table></div>
<a name="spirit_repository.karma_components.nonterminal.subrule.groups"></a><h6>
-<a name="id776039"></a>
+<a name="id862824"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.groups">Groups</a>
</h6>
<p>
@@ -367,7 +367,7 @@
</span><span class="special">;</span>
</pre>
<a name="spirit_repository.karma_components.nonterminal.subrule.attributes"></a><h6>
-<a name="id776523"></a>
+<a name="id863218"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.attributes">Attributes</a>
</h6>
<p>
@@ -396,7 +396,7 @@
</li>
</ul></div>
<a name="spirit_repository.karma_components.nonterminal.subrule.locals"></a><h6>
-<a name="id776641"></a>
+<a name="id863306"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.locals">Locals</a>
</h6>
<p>
@@ -406,7 +406,7 @@
refer to the subrule's locals, if present.
</p>
<a name="spirit_repository.karma_components.nonterminal.subrule.example"></a><h6>
-<a name="id776689"></a>
+<a name="id863342"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.example">Example</a>
</h6>
<p>
@@ -472,7 +472,7 @@
<a href="../../../../../example/karma/mini_xml_karma_sr.cpp" target="_top">../../example/karma/mini_xml_karma_sr.cpp</a>
</p>
<a name="spirit_repository.karma_components.nonterminal.subrule.performance"></a><h6>
-<a name="id777754"></a>
+<a name="id864368"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.performance">Performance</a>
</h6>
<p>
@@ -483,7 +483,7 @@
subrules is very similar, so performance is very similar too).
</p>
<a name="spirit_repository.karma_components.nonterminal.subrule.notes"></a><h6>
-<a name="id777801"></a>
+<a name="id864405"></a>
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.notes">Notes</a>
</h6>
<p>
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 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Preface</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="../index.html" title="Spirit Repository 0.1">
@@ -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="id759774"></a>
+<a name="id834064"></a>
<a class="link" href="preface.html#spirit_repository.preface.the_spirit_repository">The Spirit
Repository</a>
</h4>
@@ -77,7 +77,7 @@
core library.
</p>
<a name="spirit_repository.preface.how_to_use_this_manual"></a><h4>
-<a name="id759903"></a>
+<a name="id834153"></a>
<a class="link" href="preface.html#spirit_repository.preface.how_to_use_this_manual">How to use
this manual</a>
</h4>
@@ -86,7 +86,7 @@
icons precede some text to indicate:
</p>
<div class="table">
-<a name="id759921"></a><p class="title"><b>Table 1. Icons</b></p>
+<a name="id834166"></a><p class="title"><b>Table 1. Icons</b></p>
<div class="table-contents"><table class="table" summary="Icons">
<colgroup>
<col>
@@ -208,7 +208,7 @@
Tools</a>.
</p>
<a name="spirit_repository.preface.support"></a><h4>
-<a name="id760179"></a>
+<a name="id834422"></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 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Qi Components</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="preface.html" title="Preface">
@@ -27,22 +27,26 @@
<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/primitive.html"> Qi Parser
+<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
+<dd><dl>
+<dt><span class="section"><a href="qi_components/primitive/advance.html">Qi
+ advance Parser</a></span></dt>
+<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>
+<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>
-<dt><span class="section"><a href="qi_components/nonterminal.html"> Qi Parser
+<dt><span class="section"><a href="qi_components/nonterminal.html">Qi Parser
Non-terminals</a></span></dt>
-<dd><dl><dt><span class="section"><a href="qi_components/nonterminal/subrule.html">
- Qi subrules</a></span></dt></dl></dd>
+<dd><dl><dt><span class="section"><a href="qi_components/nonterminal/subrule.html">Qi
+ subrules</a></span></dt></dl></dd>
</dl></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Qi Parser Directives</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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">
@@ -24,14 +24,14 @@
</div>
<div class="section">
<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
+<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>
+<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>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Qi Confix Parser Directive</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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">
@@ -24,11 +24,11 @@
</div>
<div class="section">
<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>
+<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="id761680"></a>
+<a name="id847270"></a>
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.description">Description</a>
</h6>
<p>
@@ -95,20 +95,20 @@
</p></td></tr>
</table></div>
<a name="spirit_repository.qi_components.directives.confix.header"></a><h6>
-<a name="id762520"></a>
+<a name="id848044"></a>
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.header">Header</a>
</h6>
<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/qi/directive/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">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="id762608"></a>
+<a name="id848122"></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="id762664"></a>
+<a name="id848175"></a>
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parameters">Parameters</a>
</h6>
<div class="informaltable"><table class="table">
@@ -172,7 +172,7 @@
All three parameters can be arbitrarily complex parsers themselves.
</p>
<a name="spirit_repository.qi_components.directives.confix.attribute"></a><h6>
-<a name="id762814"></a>
+<a name="id848321"></a>
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.attribute">Attribute</a>
</h6>
<p>
@@ -198,7 +198,7 @@
</p></td></tr>
</table></div>
<a name="spirit_repository.qi_components.directives.confix.example"></a><h6>
-<a name="id763077"></a>
+<a name="id848559"></a>
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.example">Example</a>
</h6>
<p>
@@ -208,7 +208,7 @@
see confix.cpp)
</p>
<a name="spirit_repository.qi_components.directives.confix.prerequisites"></a><h6>
-<a name="id763116"></a>
+<a name="id848594"></a>
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.prerequisites">Prerequisites</a>
</h6>
<p>
@@ -243,7 +243,7 @@
<p>
</p>
<a name="spirit_repository.qi_components.directives.confix.parsing_different_comment_styles"></a><h6>
-<a name="id763572"></a>
+<a name="id849004"></a>
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parsing_different_comment_styles">Parsing
Different Comment Styles</a>
</h6>
@@ -295,7 +295,7 @@
This is a comment */</span> </code>".
</p>
<a name="spirit_repository.qi_components.directives.confix.parsing_tagged_data"></a><h6>
-<a name="id764198"></a>
+<a name="id849575"></a>
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parsing_tagged_data">Parsing
Tagged Data</a>
</h6>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Qi Distinct Parser Directive</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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">
@@ -24,11 +24,11 @@
</div>
<div class="section">
<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>
+<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="id764582"></a>
+<a name="id849924"></a>
<a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.description">Description</a>
</h6>
<p>
@@ -140,20 +140,20 @@
above.
</p>
<a name="spirit_repository.qi_components.directives.distinct.header"></a><h6>
-<a name="id765952"></a>
+<a name="id851159"></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/directive/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="id766039"></a>
+<a name="id851237"></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="id766087"></a>
+<a name="id851281"></a>
<a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.parameters">Parameters</a>
</h6>
<div class="informaltable"><table class="table">
@@ -206,7 +206,7 @@
All two parameters can be arbitrary complex parsers themselves.
</p>
<a name="spirit_repository.qi_components.directives.distinct.attribute"></a><h6>
-<a name="id766199"></a>
+<a name="id851388"></a>
<a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.attribute">Attribute</a>
</h6>
<p>
@@ -220,7 +220,7 @@
<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="id766328"></a>
+<a name="id851505"></a>
<a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.example">Example</a>
</h6>
<p>
@@ -228,7 +228,7 @@
parser. distinct.cpp)
</p>
<a name="spirit_repository.qi_components.directives.distinct.prerequisites"></a><h6>
-<a name="id766365"></a>
+<a name="id851538"></a>
<a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.prerequisites">Prerequisites</a>
</h6>
<p>
@@ -257,7 +257,7 @@
<p>
</p>
<a name="spirit_repository.qi_components.directives.distinct.using_the_distinct_directive_to_match_keywords"></a><h6>
-<a name="id766632"></a>
+<a name="id851774"></a>
<a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.using_the_distinct_directive_to_match_keywords">Using
The Distinct Directive to Match keywords</a>
</h6>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Qi Parser Non-terminals</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="directives/distinct.html" title="Qi Distinct Parser Directive">
@@ -24,11 +24,11 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="spirit_repository.qi_components.nonterminal"></a><a class="link" href="nonterminal.html" title="Qi Parser Non-terminals"> Qi Parser
+<a name="spirit_repository.qi_components.nonterminal"></a><a class="link" href="nonterminal.html" title="Qi Parser Non-terminals">Qi Parser
Non-terminals</a>
</h3></div></div></div>
-<div class="toc"><dl><dt><span class="section"><a href="nonterminal/subrule.html">
- Qi subrules</a></span></dt></dl></div>
+<div class="toc"><dl><dt><span class="section"><a href="nonterminal/subrule.html">Qi
+ subrules</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>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Qi subrules</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="../nonterminal.html" title="Qi Parser Non-terminals">
<link rel="prev" href="../nonterminal.html" title="Qi Parser Non-terminals">
@@ -24,11 +24,11 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
-<a name="spirit_repository.qi_components.nonterminal.subrule"></a><a class="link" href="subrule.html" title="Qi subrules">
- Qi subrules</a>
+<a name="spirit_repository.qi_components.nonterminal.subrule"></a><a class="link" href="subrule.html" title="Qi subrules">Qi
+ subrules</a>
</h4></div></div></div>
<a name="spirit_repository.qi_components.nonterminal.subrule.description"></a><h6>
-<a name="id767651"></a>
+<a name="id854341"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.description">Description</a>
</h6>
<p>
@@ -97,21 +97,21 @@
most performance-critical parts), whereas the rest can use rules and grammars.
</p>
<a name="spirit_repository.qi_components.nonterminal.subrule.header"></a><h6>
-<a name="id768089"></a>
+<a name="id854732"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.header">Header</a>
</h6>
<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/qi/nonterminal/subrule.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_subrule</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
</pre>
<a name="spirit_repository.qi_components.nonterminal.subrule.synopsis__declaration_"></a><h6>
-<a name="id768178"></a>
+<a name="id854808"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.synopsis__declaration_">Synopsis
(declaration)</a>
</h6>
<pre class="programlisting"><span class="identifier">subrule</span><span class="special"><</span><span class="identifier">ID</span><span class="special">,</span> <span class="identifier">A1</span><span class="special">,</span> <span class="identifier">A2</span><span class="special">></span> <span class="identifier">sr</span><span class="special">(</span><span class="identifier">name</span><span class="special">);</span>
</pre>
<a name="spirit_repository.qi_components.nonterminal.subrule.parameters__declaration_"></a><h6>
-<a name="id768255"></a>
+<a name="id854872"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.parameters__declaration_">Parameters
(declaration)</a>
</h6>
@@ -181,7 +181,7 @@
</tbody>
</table></div>
<a name="spirit_repository.qi_components.nonterminal.subrule.synopsis__usage_"></a><h6>
-<a name="id768407"></a>
+<a name="id855007"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.synopsis__usage_">Synopsis
(usage)</a>
</h6>
@@ -210,7 +210,7 @@
<span class="special">)(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span> <span class="special">...)</span> <span class="comment">// Arguments to group, i.e. to start subrule srA
</span></pre>
<a name="spirit_repository.qi_components.nonterminal.subrule.parameters__usage_"></a><h6>
-<a name="id768670"></a>
+<a name="id855242"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.parameters__usage_">Parameters
(usage)</a>
</h6>
@@ -334,7 +334,7 @@
</tbody>
</table></div>
<a name="spirit_repository.qi_components.nonterminal.subrule.groups"></a><h6>
-<a name="id769280"></a>
+<a name="id855567"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.groups">Groups</a>
</h6>
<p>
@@ -379,7 +379,7 @@
</span><span class="special">;</span>
</pre>
<a name="spirit_repository.qi_components.nonterminal.subrule.attributes"></a><h6>
-<a name="id769725"></a>
+<a name="id855968"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.attributes">Attributes</a>
</h6>
<p>
@@ -408,7 +408,7 @@
</li>
</ul></div>
<a name="spirit_repository.qi_components.nonterminal.subrule.locals"></a><h6>
-<a name="id769830"></a>
+<a name="id856605"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.locals">Locals</a>
</h6>
<p>
@@ -418,7 +418,7 @@
refer to the subrule's locals, if present.
</p>
<a name="spirit_repository.qi_components.nonterminal.subrule.example"></a><h6>
-<a name="id769872"></a>
+<a name="id856641"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.example">Example</a>
</h6>
<p>
@@ -506,7 +506,7 @@
<a href="../../../../../example/qi/mini_xml2_sr.cpp" target="_top">../../example/qi/mini_xml2_sr.cpp</a>
</p>
<a name="spirit_repository.qi_components.nonterminal.subrule.performance"></a><h6>
-<a name="id771325"></a>
+<a name="id857901"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.performance">Performance</a>
</h6>
<p>
@@ -514,7 +514,7 @@
examples to subrules, with various compilers.
</p>
<div class="table">
-<a name="id771345"></a><p class="title"><b>Table 2. Subrules performance</b></p>
+<a name="id857916"></a><p class="title"><b>Table 2. Subrules performance</b></p>
<div class="table-contents"><table class="table" summary="Subrules performance">
<colgroup>
<col>
@@ -761,7 +761,7 @@
</li>
</ul></div>
<a name="spirit_repository.qi_components.nonterminal.subrule.notes"></a><h6>
-<a name="id771740"></a>
+<a name="id858309"></a>
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.notes">Notes</a>
</h6>
<p>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,11 +3,11 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Qi Parser Primitives</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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">
+<link rel="next" href="primitive/advance.html" title="Qi advance Parser">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,15 +20,19 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="../qi_components.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="primitive/flush_multi_pass.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="../qi_components.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="primitive/advance.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<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
+<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 class="toc"><dl>
+<dt><span class="section"><a href="primitive/advance.html">Qi
+ advance Parser</a></span></dt>
+<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>
@@ -40,7 +44,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="../qi_components.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="primitive/flush_multi_pass.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="../qi_components.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../qi_components.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="primitive/advance.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Added: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/advance.html
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/advance.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -0,0 +1,309 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Qi advance Parser</title>
+<link rel="stylesheet" href="../../../../../../../../doc/src/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="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="../primitive.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../primitive.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="flush_multi_pass.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="spirit_repository.qi_components.primitive.advance"></a><a class="link" href="advance.html" title="Qi advance Parser">Qi
+ advance Parser</a>
+</h4></div></div></div>
+<a name="spirit_repository.qi_components.primitive.advance.description"></a><h6>
+<a name="id834496"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.description">Description</a>
+ </h6>
+<p>
+ The <span class="emphasis"><em>Spirit.Qi</em></span> <code class="computeroutput"><span class="identifier">advance</span></code>
+ is a primitive parser component allowing the parser to skip (advance) through
+ a specified number of iterations without performing unnecessary work:
+ </p>
+<pre class="programlisting"><span class="identifier">advance</span><span class="special">(</span><span class="identifier">distance</span><span class="special">)</span>
+</pre>
+<p>
+ The most obvious existing alternative to this, the <code class="computeroutput"><span class="identifier">repeat</span></code>
+ directive, will cause the parser to advance one iterator at a time while
+ usually performing operations at each step. In some cases that work is
+ unnecessary, as in the case where large binary objects are being parsed.
+ Take, for example, the following binary data:
+ </p>
+<pre class="programlisting"><span class="number">00</span> <span class="number">00</span> <span class="number">00</span> <span class="number">01</span> <span class="number">77</span> <span class="identifier">fc</span> <span class="identifier">b4</span> <span class="number">51</span> <span class="number">0</span><span class="identifier">a</span> <span class="identifier">b3</span> <span class="identifier">b7</span> <span class="special">...</span> <span class="error">1</span><span class="identifier">e</span> <span class="number">60</span> <span class="number">70</span> <span class="identifier">b6</span> <span class="number">00</span> <span class="number">00</span> <span class="number">01</span> <span class="number">00</span>
+</pre>
+<p>
+ If the first 4 bytes are a little-endian 32-bit integer describing the
+ length of the subsequent data, but the data itself is not relevant to parsing,
+ then the repeat directive would cause all of the subsequent 16 MB of data
+ to be consumed one byte at a time while generating page faults or other
+ superfluous I/O. If the value is large, as it is in this case, the parser
+ becomes very slow.
+ </p>
+<pre class="programlisting"><span class="identifier">little_dword</span><span class="special">[</span><span class="identifier">_a</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span> <span class="special">>></span> <span class="identifier">repeat</span><span class="special">(</span><span class="identifier">_a</span><span class="special">)[</span><span class="identifier">byte_</span><span class="special">]</span> <span class="special">>></span> <span class="identifier">little_dword</span><span class="special">...</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">advance</span></code> parser component
+ solves this problem by performing as little work as possible to advance
+ the parser's iterator, and will optimize for the case of random-access
+ iterators by advancing directly to the desired relative iterator position.
+ </p>
+<pre class="programlisting"><span class="identifier">little_dword</span><span class="special">[</span><span class="identifier">_a</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span> <span class="special">>></span> <span class="identifier">advance</span><span class="special">(</span><span class="identifier">_a</span><span class="special">)</span> <span class="special">>></span> <span class="identifier">little_dword</span><span class="special">...</span>
+</pre>
+<a name="spirit_repository.qi_components.primitive.advance.header"></a><h6>
+<a name="id842573"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.header">Header</a>
+ </h6>
+<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/repository/home/qi/primitive/advance.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_advance</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<a name="spirit_repository.qi_components.primitive.advance.synopsis"></a><h6>
+<a name="id842651"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.synopsis">Synopsis</a>
+ </h6>
+<pre class="programlisting"><span class="identifier">advance</span><span class="special">(</span><span class="identifier">distance</span><span class="special">)</span>
+</pre>
+<a name="spirit_repository.qi_components.primitive.advance.parameters"></a><h6>
+<a name="id842688"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.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>
+ 'distance'
+ </p>
+ </td>
+<td>
+ <p>
+ The distance that the iterator shall be advanced
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+<a name="spirit_repository.qi_components.primitive.advance.attribute"></a><h6>
+<a name="id842759"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.attribute">Attribute</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="identifier">advance</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">advance</span> <span class="special">--></span> <span class="identifier">unused</span>
+</pre>
+<a name="spirit_repository.qi_components.primitive.advance.example"></a><h6>
+<a name="id842813"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.example">Example</a>
+ </h6>
+<p>
+ The following example shows simple use cases of the <code class="computeroutput"><span class="identifier">advance</span></code>
+ component. We will illustrate its usage by generating parsers for some
+ binary data (for the full example code see advance.cpp)
+ </p>
+<a name="spirit_repository.qi_components.primitive.advance.prerequisites"></a><h6>
+<a name="id842848"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.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">advance</span></code> component.
+ </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">include</span><span class="special">/</span><span class="identifier">phoenix_operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_advance</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>
+ </p>
+<p>
+ In order to make the examples below more readable we introduce or use the
+ following namespaces.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">qi</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">qi</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">qi</span><span class="special">::</span><span class="identifier">advance</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<a name="spirit_repository.qi_components.primitive.advance.setting_up_the_grammar"></a><h6>
+<a name="id843119"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.setting_up_the_grammar">Setting
+ up the Grammar</a>
+ </h6>
+<p>
+ This is a very simple grammar that recognizes several fields of a binary
+ stream of data. There are two fields explicitly delimited by a field indicating
+ the number of bytes that are spanned. They are separated by a literal string.
+ </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">struct</span> <span class="identifier">advance_grammar</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">qi</span><span class="special">::</span><span class="identifier">locals</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="special">></span>
+<span class="special">{</span>
+ <span class="identifier">advance_grammar</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">advance_grammar</span><span class="special">::</span><span class="identifier">base_type</span><span class="special">(</span><span class="identifier">start</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">qi</span><span class="special">::</span><span class="identifier">byte_</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">qi</span><span class="special">::</span><span class="identifier">eoi</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">qi</span><span class="special">::</span><span class="identifier">labels</span><span class="special">;</span>
+
+ <span class="identifier">start</span>
+ <span class="special">=</span> <span class="identifier">byte_</span> <span class="special">[</span><span class="identifier">_a</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
+ <span class="special">>></span> <span class="identifier">advance</span><span class="special">(</span><span class="identifier">_a</span><span class="special">)</span>
+ <span class="special">>></span> <span class="string">"boost"</span>
+ <span class="special">>></span> <span class="identifier">byte_</span> <span class="special">[</span><span class="identifier">_a</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">]</span>
+ <span class="special">>></span> <span class="special">(</span><span class="identifier">advance</span><span class="special">(</span><span class="identifier">_a</span><span class="special">)</span> <span class="special">|</span> <span class="string">"qi"</span><span class="special">)</span> <span class="comment">// note alternative when advance fails
+</span> <span class="special">>></span> <span class="identifier">eoi</span>
+ <span class="special">;</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">qi</span><span class="special">::</span><span class="identifier">locals</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="special">></span> <span class="identifier">start</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+ Note that the second binary field may either contain the number of specified
+ bytes, or the word "qi". If the <code class="computeroutput"><span class="identifier">advance</span></code>
+ parser component fails to advance the specified number of bytes before
+ reaching the end of input, it will fail and the parser will attempt to
+ descend into alternatives.
+ </p>
+<a name="spirit_repository.qi_components.primitive.advance.parsing_a_correctly_delimited_string_of_data"></a><h6>
+<a name="id843574"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.parsing_a_correctly_delimited_string_of_data">Parsing
+ a Correctly-delimited String of Data</a>
+ </h6>
+<p>
+ The data below is correctly delimited and will thus result in a valid parse.
+ Note that both random-access and bidirectional iterators are used here.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">unsigned</span> <span class="keyword">char</span> <span class="keyword">const</span> <span class="identifier">alt1</span><span class="special">[]</span> <span class="special">=</span>
+<span class="special">{</span>
+ <span class="number">5</span><span class="special">,</span> <span class="comment">// number of bytes to advance
+</span> <span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">4</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span> <span class="comment">// data to advance through
+</span> <span class="char">'b'</span><span class="special">,</span> <span class="char">'o'</span><span class="special">,</span> <span class="char">'o'</span><span class="special">,</span> <span class="char">'s'</span><span class="special">,</span> <span class="char">'t'</span><span class="special">,</span> <span class="comment">// word to parse
+</span> <span class="number">2</span><span class="special">,</span> <span class="comment">// number of bytes to advance
+</span> <span class="number">11</span><span class="special">,</span> <span class="number">12</span> <span class="comment">// more data to advance through
+</span> <span class="comment">// eoi
+</span><span class="special">};</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span> <span class="identifier">alt1_string</span><span class="special">(</span><span class="identifier">alt1</span><span class="special">,</span> <span class="identifier">alt1</span> <span class="special">+</span> <span class="keyword">sizeof</span> <span class="identifier">alt1</span><span class="special">);</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">></span> <span class="keyword">const</span> <span class="identifier">alt1_list</span><span class="special">(</span><span class="identifier">alt1</span><span class="special">,</span> <span class="identifier">alt1</span> <span class="special">+</span> <span class="keyword">sizeof</span> <span class="identifier">alt1</span><span class="special">);</span>
+
+<span class="identifier">result</span> <span class="special">=</span>
+ <span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">alt1_string</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">alt1_string</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
+ <span class="special">,</span> <span class="identifier">client</span><span class="special">::</span><span class="identifier">advance_grammar</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">const_iterator</span><span class="special">>())</span>
+ <span class="special">?</span> <span class="string">"succeeded"</span> <span class="special">:</span> <span class="string">"failed"</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Parsing alt1 using random access iterator "</span> <span class="special"><<</span> <span class="identifier">result</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+<span class="identifier">result</span> <span class="special">=</span>
+ <span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">alt1_list</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">alt1_list</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
+ <span class="special">,</span> <span class="identifier">client</span><span class="special">::</span><span class="identifier">advance_grammar</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">>())</span>
+ <span class="special">?</span> <span class="string">"succeeded"</span> <span class="special">:</span> <span class="string">"failed"</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Parsing alt1 using bidirectional iterator "</span> <span class="special"><<</span> <span class="identifier">result</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<a name="spirit_repository.qi_components.primitive.advance.parsing_the_alternative_representation"></a><h6>
+<a name="id844258"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.parsing_the_alternative_representation">Parsing
+ the Alternative Representation</a>
+ </h6>
+<p>
+ The data below is not correctly delimited, but will correctly parse because
+ the alternative word "qi" is available.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">unsigned</span> <span class="keyword">char</span> <span class="keyword">const</span> <span class="identifier">alt2</span><span class="special">[]</span> <span class="special">=</span>
+<span class="special">{</span>
+ <span class="number">2</span><span class="special">,</span> <span class="comment">// number of bytes to advance
+</span> <span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="comment">// data to advance through
+</span> <span class="char">'b'</span><span class="special">,</span> <span class="char">'o'</span><span class="special">,</span> <span class="char">'o'</span><span class="special">,</span> <span class="char">'s'</span><span class="special">,</span> <span class="char">'t'</span><span class="special">,</span> <span class="comment">// word to parse
+</span> <span class="number">4</span><span class="special">,</span> <span class="comment">// number of bytes to advance
+</span> <span class="char">'q'</span><span class="special">,</span> <span class="char">'i'</span> <span class="comment">// alternative (advance won't work)
+</span> <span class="comment">// eoi
+</span><span class="special">};</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span> <span class="identifier">alt2_string</span><span class="special">(</span><span class="identifier">alt2</span><span class="special">,</span> <span class="identifier">alt2</span> <span class="special">+</span> <span class="keyword">sizeof</span> <span class="identifier">alt2</span><span class="special">);</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">></span> <span class="keyword">const</span> <span class="identifier">alt2_list</span><span class="special">(</span><span class="identifier">alt2</span><span class="special">,</span> <span class="identifier">alt2</span> <span class="special">+</span> <span class="keyword">sizeof</span> <span class="identifier">alt2</span><span class="special">);</span>
+
+<span class="identifier">result</span> <span class="special">=</span>
+ <span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">alt2_string</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">alt2_string</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
+ <span class="special">,</span> <span class="identifier">client</span><span class="special">::</span><span class="identifier">advance_grammar</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">const_iterator</span><span class="special">>())</span>
+ <span class="special">?</span> <span class="string">"succeeded"</span> <span class="special">:</span> <span class="string">"failed"</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Parsing alt2 using random access iterator "</span> <span class="special"><<</span> <span class="identifier">result</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+<span class="identifier">result</span> <span class="special">=</span>
+ <span class="identifier">qi</span><span class="special">::</span><span class="identifier">parse</span><span class="special">(</span><span class="identifier">alt2_list</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">alt2_list</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span>
+ <span class="special">,</span> <span class="identifier">client</span><span class="special">::</span><span class="identifier">advance_grammar</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">>())</span>
+ <span class="special">?</span> <span class="string">"succeeded"</span> <span class="special">:</span> <span class="string">"failed"</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Parsing alt2 using bidirectional iterator "</span> <span class="special"><<</span> <span class="identifier">result</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<a name="spirit_repository.qi_components.primitive.advance.notes"></a><h6>
+<a name="id846009"></a>
+ <a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.notes">Notes</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="identifier">advance</span></code> parser component
+ will fail unconditionally on negative values. It will never attempt to
+ advance the iterator in the reverse direction.
+ </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-2010 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/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../primitive.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="flush_multi_pass.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Modified: trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html
==============================================================================
--- trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html (original)
+++ trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -3,10 +3,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Qi flush_multi_pass parser</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
+<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="prev" href="advance.html" title="Qi advance Parser">
<link rel="next" href="../directives.html" title="Qi Parser Directives">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,15 +20,15 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="../primitive.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../primitive.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../directives.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="advance.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../primitive.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../directives.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<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>
+<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="id760277"></a>
+<a name="id846049"></a>
<a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.description">Description</a>
</h6>
<p>
@@ -53,20 +53,20 @@
<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="id760413"></a>
+<a name="id846157"></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/primitive/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="id760502"></a>
+<a name="id846230"></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="id760531"></a>
+<a name="id846252"></a>
<a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.parameters">Parameters</a>
</h6>
<p>
@@ -74,7 +74,7 @@
not require any parameters.
</p>
<a name="spirit_repository.qi_components.primitive.flush_multi_pass.attribute"></a><h6>
-<a name="id760563"></a>
+<a name="id846276"></a>
<a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.attribute">Attribute</a>
</h6>
<p>
@@ -84,7 +84,7 @@
<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="id760623"></a>
+<a name="id846325"></a>
<a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.example">Example</a>
</h6>
<p>
@@ -96,7 +96,7 @@
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="id760666"></a>
+<a name="id846357"></a>
<a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.prerequisites">Prerequisites</a>
</h6>
<p>
@@ -125,7 +125,7 @@
<p>
</p>
<a name="spirit_repository.qi_components.primitive.flush_multi_pass.clearing_the_internal_buffer"></a><h6>
-<a name="id760902"></a>
+<a name="id846566"></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>
@@ -201,7 +201,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="../primitive.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../primitive.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../directives.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="advance.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../primitive.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../directives.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Added: trunk/libs/spirit/repository/doc/qi/advance.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/repository/doc/qi/advance.qbk 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -0,0 +1,120 @@
+[/==============================================================================
+ Copyright (C) 2001-2011 Hartmut Kaiser
+ Copyright (C) 2001-2011 Joel de Guzman
+ Copyright (C) 2011 Aaron Graham
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+===============================================================================/]
+
+[section:advance Qi advance Parser]
+
+[heading Description]
+
+The __qi__ `advance` is a primitive parser component allowing the parser to
+skip (advance) through a specified number of iterations without performing
+unnecessary work:
+
+ advance(distance)
+
+The most obvious existing alternative to this, the `repeat` directive, will
+cause the parser to advance one iterator at a time while usually performing
+operations at each step. In some cases that work is unnecessary, as in the case
+where large binary objects are being parsed. Take, for example, the following
+binary data:
+
+ 00 00 00 01 77 fc b4 51 0a b3 b7 ... 1e 60 70 b6 00 00 01 00
+
+If the first 4 bytes are a little-endian 32-bit integer describing the length
+of the subsequent data, but the data itself is not relevant to parsing, then the
+repeat directive would cause all of the subsequent 16 MB of data to be consumed
+one byte at a time while generating page faults or other superfluous I/O. If the
+value is large, as it is in this case, the parser becomes very slow.
+
+ little_dword[_a = _1] >> repeat(_a)[byte_] >> little_dword...
+
+The `advance` parser component solves this problem by performing as little work
+as possible to advance the parser's iterator, and will optimize for the case of
+random-access iterators by advancing directly to the desired relative iterator
+position.
+
+ little_dword[_a = _1] >> advance(_a) >> little_dword...
+
+[heading Header]
+
+ // forwards to <boost/spirit/repository/home/qi/primitive/advance.hpp>
+ #include <boost/spirit/repository/include/qi_advance.hpp>
+
+[heading Synopsis]
+
+ advance(distance)
+
+[heading Parameters]
+
+[table
+ [[Parameter] [Description]]
+ [['distance'] [The distance that the iterator shall be advanced]]
+]
+
+[heading Attribute]
+
+The `advance` component exposes no attribute (the exposed attribute type is
+`unused_type`):
+
+ advance --> unused
+
+[heading Example]
+
+The following example shows simple use cases of the `advance` component. We will
+illustrate its usage by generating parsers for some binary data (for the full
+example code see
+[@../../example/qi/advance.cpp advance.cpp])
+
+[import ../example/qi/advance.cpp]
+
+[heading Prerequisites]
+
+In addition to the main header file needed to include the core components
+implemented in __qi__ we add the header file needed for the new `advance`
+component.
+
+[qi_advance_includes]
+
+In order to make the examples below more readable we introduce or use the
+following namespaces.
+
+[qi_advance_namespaces]
+
+[heading Setting up the Grammar]
+
+This is a very simple grammar that recognizes several fields of a binary stream
+of data. There are two fields explicitly delimited by a field indicating the
+number of bytes that are spanned. They are separated by a literal string.
+
+[qi_advance_grammar]
+
+Note that the second binary field may either contain the number of specified
+bytes, or the word "qi". If the `advance` parser component fails to advance the
+specified number of bytes before reaching the end of input, it will fail and
+the parser will attempt to descend into alternatives.
+
+[heading Parsing a Correctly-delimited String of Data]
+
+The data below is correctly delimited and will thus result in a valid parse.
+Note that both random-access and bidirectional iterators are used here.
+
+[qi_advance_example1]
+
+[heading Parsing the Alternative Representation]
+
+The data below is not correctly delimited, but will correctly parse because the
+alternative word "qi" is available.
+
+[qi_advance_example2]
+
+[heading Notes]
+
+The `advance` parser component will fail unconditionally on negative values.
+It will never attempt to advance the iterator in the reverse direction.
+
+[endsect]
Modified: trunk/libs/spirit/repository/doc/qi/primitive_parsers.qbk
==============================================================================
--- trunk/libs/spirit/repository/doc/qi/primitive_parsers.qbk (original)
+++ trunk/libs/spirit/repository/doc/qi/primitive_parsers.qbk 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -7,5 +7,6 @@
===============================================================================/]
[section:primitive Qi Parser Primitives]
+[include advance.qbk]
[include flush_multi_pass.qbk]
[endsect]
Modified: trunk/libs/spirit/repository/example/qi/Jamfile
==============================================================================
--- trunk/libs/spirit/repository/example/qi/Jamfile (original)
+++ trunk/libs/spirit/repository/example/qi/Jamfile 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -17,4 +17,5 @@
exe flush_multi_pass : flush_multi_pass.cpp ;
exe calc1_sr : calc1_sr.cpp ;
exe mini_xml2_sr : mini_xml2_sr.cpp ;
+exe advance : advance.cpp ;
Added: trunk/libs/spirit/repository/example/qi/advance.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/repository/example/qi/advance.cpp 2011-01-26 20:09:54 EST (Wed, 26 Jan 2011)
@@ -0,0 +1,110 @@
+// Copyright (c) 2011 Aaron Graham
+//
+// 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)
+
+// The purpose of this example is to demonstrate the use of the advance parser.
+
+//[qi_advance_includes
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/repository/include/qi_advance.hpp>
+//]
+
+#include <list>
+#include <string>
+
+//[qi_advance_namespaces
+namespace qi = boost::spirit::qi;
+using boost::spirit::repository::qi::advance;
+//]
+
+namespace client
+{
+ //[qi_advance_grammar
+ template <typename Iterator>
+ struct advance_grammar : qi::grammar<Iterator, qi::locals<int> >
+ {
+ advance_grammar() : advance_grammar::base_type(start)
+ {
+ using qi::byte_;
+ using qi::eoi;
+ using namespace qi::labels;
+
+ start
+ = byte_ [_a = _1]
+ >> advance(_a)
+ >> "boost"
+ >> byte_ [_a = _1]
+ >> (advance(_a) | "qi") // note alternative when advance fails
+ >> eoi
+ ;
+ }
+
+ qi::rule<Iterator, qi::locals<int> > start;
+ };
+ //]
+}
+
+int main()
+{
+ // This parser is tested with both random access iterators (std::string)
+ // and bidirectional iterators (std::list).
+ char const* result;
+
+ //[qi_advance_example1
+ unsigned char const alt1[] =
+ {
+ 5, // number of bytes to advance
+ 1, 2, 3, 4, 5, // data to advance through
+ 'b', 'o', 'o', 's', 't', // word to parse
+ 2, // number of bytes to advance
+ 11, 12 // more data to advance through
+ // eoi
+ };
+
+ std::string const alt1_string(alt1, alt1 + sizeof alt1);
+ std::list<unsigned char> const alt1_list(alt1, alt1 + sizeof alt1);
+
+ result =
+ qi::parse(alt1_string.begin(), alt1_string.end()
+ , client::advance_grammar<std::string::const_iterator>())
+ ? "succeeded" : "failed";
+ std::cout << "Parsing alt1 using random access iterator " << result << std::endl;
+
+ result =
+ qi::parse(alt1_list.begin(), alt1_list.end()
+ , client::advance_grammar<std::list<unsigned char>::const_iterator>())
+ ? "succeeded" : "failed";
+ std::cout << "Parsing alt1 using bidirectional iterator " << result << std::endl;
+ //]
+
+ //[qi_advance_example2
+ unsigned char const alt2[] =
+ {
+ 2, // number of bytes to advance
+ 1, 2, // data to advance through
+ 'b', 'o', 'o', 's', 't', // word to parse
+ 4, // number of bytes to advance
+ 'q', 'i' // alternative (advance won't work)
+ // eoi
+ };
+
+ std::string const alt2_string(alt2, alt2 + sizeof alt2);
+ std::list<unsigned char> const alt2_list(alt2, alt2 + sizeof alt2);
+
+ result =
+ qi::parse(alt2_string.begin(), alt2_string.end()
+ , client::advance_grammar<std::string::const_iterator>())
+ ? "succeeded" : "failed";
+ std::cout << "Parsing alt2 using random access iterator " << result << std::endl;
+
+ result =
+ qi::parse(alt2_list.begin(), alt2_list.end()
+ , client::advance_grammar<std::list<unsigned char>::const_iterator>())
+ ? "succeeded" : "failed";
+ std::cout << "Parsing alt2 using bidirectional iterator " << result << std::endl;
+ //]
+
+ return 0;
+}
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