mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
Spirit: merging Phoenix V3 support from trunk
[SVN r71244]
This commit is contained in:
@@ -84,13 +84,21 @@ overall usability.
|
||||
[*Thomas Bernard] (a.k.a. teajay) for working on the keyword parser and for
|
||||
adding explicit names to the `qi::`__qi_symbols__ component.
|
||||
|
||||
[*Robert Stewart] for his active participation on the mailing list, his
|
||||
helpful comments, examples and suggestions.
|
||||
|
||||
[*Thomas Taylor], [*Richard Crossley], [*Semen], and [*Adalberto Castelo] for
|
||||
their help in isolating problems while testing the new attribute handling code
|
||||
released with V2.5.
|
||||
|
||||
Special thanks to spirit-devel and spirit-general mailing lists for
|
||||
participating in the discussions, being early adopters of pre-release
|
||||
versions of Spirit2 from the very start and helping out in various tasks
|
||||
such as helping with support, bug tracking, benchmarking and testing,
|
||||
etc. The list include: [*Larry Evans], [*Richard Webb], [*Martin Wille],
|
||||
[*Dan Marsden], [*Cedric Venet], [*Allan Odgaard], [*Matthias
|
||||
Vallentin], [*Justinas V.D.], [*Darid Tromer].
|
||||
Vallentin], [*Justinas V.D.], [*Darid Tromer], [*Brian O'Kennedy],
|
||||
[*Aaron Graham], [*Joerg Becker].
|
||||
|
||||
[*Joao Abecasis] for his early support and involvement in Spirit2
|
||||
development and for disturbing my peace every once in a while for a
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Spirit 2.4.2</title>
|
||||
<title>Spirit 2.5</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="index.html" title="Spirit 2.4.2">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
|
||||
<link rel="home" href="index.html" title="Spirit 2.5">
|
||||
<link rel="next" href="spirit/preface.html" title="Preface">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="titlepage">
|
||||
<div>
|
||||
<div><h2 class="title">
|
||||
<a name="spirit"></a>Spirit 2.4.2</h2></div>
|
||||
<a name="spirit"></a>Spirit 2.5</h2></div>
|
||||
<div><div class="authorgroup">
|
||||
<div class="author"><h3 class="author">
|
||||
<span class="firstname">Joel</span> <span class="surname">de Guzman</span>
|
||||
@@ -33,7 +33,7 @@
|
||||
</div></div>
|
||||
<div><p class="copyright">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id720513"></a><p>
|
||||
<a name="id847426"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@@ -289,12 +289,12 @@
|
||||
</div>
|
||||
<p>
|
||||
This is the documentation of the newest version of <a href="http://boost-spirit.com" target="_top">Spirit</a>
|
||||
(currently, V2.4.2). If you're looking for the documentation of Spirit's previous
|
||||
(currently, V2.5). If you're looking for the documentation of Spirit's previous
|
||||
version (formerly Spirit V1.8), see <a href="../../../../libs/spirit/classic/index.html" target="_top"><span class="emphasis"><em>Spirit.Classic</em></span></a>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: January 29, 2011 at 00:27:27 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: April 14, 2011 at 01:30:18 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
||||
@@ -120,7 +120,7 @@ skip "" ".*qi.reference.directive\..*" qi_index
|
||||
repeat "" ".*qi.reference.directive\..*" qi_index
|
||||
inf "" ".*qi.reference.directive\..*" qi_index
|
||||
omit "" ".*qi.reference.directive\..*" qi_index
|
||||
"as<T>" "as" ".*qi.reference.directive.as" qi_index
|
||||
"as<T>" "as" ".*qi.reference.directive.as" qi_index
|
||||
as_string "" ".*qi.reference.directive.as" qi_index
|
||||
as_wstring "" ".*qi.reference.directive.as" qi_index
|
||||
hold "" ".*qi.reference.directive.hold" qi_index
|
||||
@@ -139,7 +139,7 @@ columns "" ".*karma.reference.directive\..*" karma_index
|
||||
repeat "" ".*karma.reference.directive\..*" karma_index
|
||||
inf "" ".*karma.reference.directive\..*" karma_index
|
||||
omit "" ".*karma.reference.directive\..*" karma_index
|
||||
"as<T>" "as" ".*karma.reference.directive.as" karma_index
|
||||
"as<T>" "as" ".*karma.reference.directive.as" karma_index
|
||||
as_string "" ".*karma.reference.directive.as" karma_index
|
||||
as_wstring "" ".*karma.reference.directive.as" karma_index
|
||||
|
||||
@@ -209,13 +209,13 @@ uint_generator "" ".*karma.reference.numeric\..*" karma_index
|
||||
real_generator "" ".*karma.reference.numeric\..*" karma_index
|
||||
|
||||
# parser/generator operators
|
||||
"sequence (a >> b)" "sequence" ".*qi.reference.operator.sequence.*" qi_index
|
||||
"sequence (a >> b)" "sequence" ".*qi.reference.operator.sequence.*" qi_index
|
||||
"alternative (a | b)" "alternative" ".*qi.reference.operator.alternative.*" qi_index
|
||||
"kleene (*a)" "[K|k]leene" ".*qi.reference.operator.kleene.*" qi_index
|
||||
"plus (+a)" "[P|p]lus" ".*qi.reference.operator.plus.*" qi_index
|
||||
"list (a % b)" "list" ".*qi.reference.operator.list.*" qi_index
|
||||
"optional (-a)" "optional" ".*qi.reference.operator.optional.*" qi_index
|
||||
"and-predicate (&a)" "and-predicate" ".*qi.reference.operator.and_predicate.*" qi_index
|
||||
"and-predicate (&a)" "and-predicate" ".*qi.reference.operator.and_predicate.*" qi_index
|
||||
"not-predicate (!a)" "not-predicate" ".*qi.reference.operator.not_predicate.*" qi_index
|
||||
|
||||
"expectation (a > b)" "expectation" ".*qi.reference.operator.expect.*" qi_index
|
||||
@@ -223,13 +223,13 @@ real_generator "" ".*karma.reference.numeric\..*" karma_index
|
||||
"permutation (a ^ b)" "permutation" ".*qi.reference.operator.permutation.*" qi_index
|
||||
"sequential-or (a || b)" "sequential-or" ".*qi.reference.operator.sequential_or.*" qi_index
|
||||
|
||||
"sequence (a << b)" "sequence" ".*karma.reference.operator.sequence.*" karma_index
|
||||
"sequence (a << b)" "sequence" ".*karma.reference.operator.sequence.*" karma_index
|
||||
"alternative (a | b)" "alternative" ".*karma.reference.operator.alternative.*" karma_index
|
||||
"kleene (*a)" "[K|k]leene" ".*karma.reference.operator.kleene.*" karma_index
|
||||
"plus (+a)" "[P|p]lus" ".*karma.reference.operator.plus.*" karma_index
|
||||
"list (a % b)" "list" ".*karma.reference.operator.list.*" karma_index
|
||||
"optional (-a)" "optional" ".*karma.reference.operator.optional.*" karma_index
|
||||
"and-predicate (&a)" "and-predicate" ".*karma.reference.operator.and_predicate.*" karma_index
|
||||
"and-predicate (&a)" "and-predicate" ".*karma.reference.operator.and_predicate.*" karma_index
|
||||
"not-predicate (!a)" "not-predicate" ".*karma.reference.operator.not_predicate.*" karma_index
|
||||
|
||||
# stream parsers/generators
|
||||
|
||||
@@ -22,7 +22,7 @@ extensive template metaprogramming) with exceptional performance that
|
||||
rivals the low level C functions such as `atof`, `strtod`, `atol`,
|
||||
`strtol`. Benchmarks reveal up to 4X speed over the C counterparts. This
|
||||
goes to show that you can write extremely tight generic C++ code that
|
||||
rivals, if not surpasses C.
|
||||
rivals, if not surpasses C.
|
||||
|
||||
[heading Module Header]
|
||||
|
||||
@@ -42,7 +42,7 @@ arbitrary length and size. The `uint_parser` parser can be used to parse
|
||||
ordinary primitive C/C++ integers or even user defined scalars such as
|
||||
bigints (unlimited precision integers) as long as the type follows
|
||||
certain expression requirements (documented below). The `uint_parser` is
|
||||
a template class. Template parameters fine tune its behavior.
|
||||
a template class. Template parameters fine tune its behavior.
|
||||
|
||||
[heading Header]
|
||||
|
||||
@@ -70,10 +70,10 @@ constant `BOOST_HAS_LONG_LONG` is defined (i.e. on platforms having
|
||||
native support for `unsigned long long` (64 bit) unsigned integer
|
||||
types).]
|
||||
|
||||
[note `lit` is reused by the [qi_lit_char Character Parsers], and the Numeric
|
||||
[note `lit` is reused by the [qi_lit_char Character Parsers], and the Numeric
|
||||
Parsers. In general, a char parser is created when you pass in a
|
||||
character, and a numeric parser is created when you use a numeric
|
||||
literal.]
|
||||
character, and a numeric parser is created when you use a numeric
|
||||
literal.]
|
||||
|
||||
[heading Synopsis]
|
||||
|
||||
@@ -88,16 +88,14 @@ types).]
|
||||
|
||||
[table
|
||||
[[Parameter] [Description] [Default]]
|
||||
[[`T`] [The numeric base type of the
|
||||
[[`T`] [The numeric base type of the
|
||||
numeric parser.] [none]]
|
||||
[[`Radix`] [The radix base. This can be
|
||||
either 2 for binary, 8 for octal,
|
||||
10 for decimal and 16 for
|
||||
hexadecimal.] [10]]
|
||||
[[`MinDigits`] [The minimum number of digits
|
||||
[[`Radix`] [The radix base. This can be
|
||||
any base from 2..10 and 16] [10]]
|
||||
[[`MinDigits`] [The minimum number of digits
|
||||
allowable.] [1]]
|
||||
[[`MaxDigits`] [The maximum number of digits
|
||||
allowable. If this is -1, then the
|
||||
[[`MaxDigits`] [The maximum number of digits
|
||||
allowable. If this is -1, then the
|
||||
maximum limit becomes unbounded.] [-1]]
|
||||
]
|
||||
|
||||
@@ -147,7 +145,7 @@ not defined in __primitive_parser_concept__.
|
||||
``]
|
||||
[Parse an unsigned integer using radix 2 for `bin`, radix 8 for `oct`, and
|
||||
radix 16 for `hex`.]
|
||||
][
|
||||
][
|
||||
[``
|
||||
bin(num)
|
||||
oct(num)
|
||||
@@ -156,7 +154,7 @@ not defined in __primitive_parser_concept__.
|
||||
[Match the literal `num` using radix 2 for `bin`, radix 8 for `oct`, and
|
||||
radix 16 for `hex`. The parser will fail
|
||||
if the parsed value is not equal to the specified value.]
|
||||
][
|
||||
][
|
||||
[``
|
||||
uint_parser<
|
||||
T, Radix, MinDigits, MaxDigits
|
||||
@@ -173,13 +171,13 @@ not defined in __primitive_parser_concept__.
|
||||
[Match the literal `num` of type `T` using radix `Radix`, with
|
||||
a minimum of `MinDigits` and a maximum of `MaxDigits`. The parser will fail
|
||||
if the parsed value is not equal to the specified value.]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
[important All numeric parsers check for overflow conditions based on the type
|
||||
`T` the corresponding `uint_parser<>` has been instantiated with. If the
|
||||
`T` the corresponding `uint_parser<>` has been instantiated with. If the
|
||||
parsed number overflows this type the parsing fails. Please be aware
|
||||
that the overflow check is not based on the type of the supplied
|
||||
that the overflow check is not based on the type of the supplied
|
||||
attribute but solely depends on the template parameter `T`.]
|
||||
|
||||
[heading Attributes]
|
||||
@@ -233,7 +231,7 @@ not defined in __primitive_parser_concept__.
|
||||
>()(num)
|
||||
``]
|
||||
[`T`]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
[heading Complexity]
|
||||
@@ -252,13 +250,13 @@ valid:
|
||||
[[`n + n`] [Addition.]]
|
||||
[[`n * n`] [Multiplication.]]
|
||||
[[`std::numeric_limits<T>::is_bounded`] [`true` or `false` if `T` bounded.]]
|
||||
[[`std::numeric_limits<T>::digits`] [Maximum Digits for `T`, radix digits.
|
||||
[[`std::numeric_limits<T>::digits`] [Maximum Digits for `T`, radix digits.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::digits10`] [Maximum Digits for `T`, base 10.
|
||||
[[`std::numeric_limits<T>::digits10`] [Maximum Digits for `T`, base 10.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::max()`] [Maximum value for `T`.
|
||||
[[`std::numeric_limits<T>::max()`] [Maximum value for `T`.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::min()`] [Minimum value for `T`.
|
||||
[[`std::numeric_limits<T>::min()`] [Minimum value for `T`.
|
||||
Required only if `T` is bounded.]]
|
||||
]
|
||||
|
||||
@@ -292,7 +290,7 @@ The class interface is the same as that of the `uint_parser`.
|
||||
The `int_parser` parser can be used to parse ordinary primitive C/C++
|
||||
integers or even user defined scalars such as bigints (unlimited
|
||||
precision integers) as long as the type follows certain expression
|
||||
requirements (documented below).
|
||||
requirements (documented below).
|
||||
|
||||
[heading Header]
|
||||
|
||||
@@ -316,10 +314,10 @@ Also, see __include_structure__.
|
||||
constant `BOOST_HAS_LONG_LONG` is defined (i.e. on platforms having
|
||||
native support for `signed long long` (64 bit) unsigned integer types).]
|
||||
|
||||
[note `lit` is reused by the [qi_lit_char Character Parsers], and the Numeric
|
||||
[note `lit` is reused by the [qi_lit_char Character Parsers], and the Numeric
|
||||
Parsers. In general, a char parser is created when you pass in a
|
||||
character, and a numeric parser is created when you use a numeric
|
||||
literal.]
|
||||
character, and a numeric parser is created when you use a numeric
|
||||
literal.]
|
||||
|
||||
[heading Synopsis]
|
||||
|
||||
@@ -334,16 +332,14 @@ native support for `signed long long` (64 bit) unsigned integer types).]
|
||||
|
||||
[table
|
||||
[[Parameter] [Description] [Default]]
|
||||
[[`T`] [The numeric base type of the
|
||||
[[`T`] [The numeric base type of the
|
||||
numeric parser.] [none]]
|
||||
[[`Radix`] [The radix base. This can be
|
||||
either 2 for binary, 8 for octal,
|
||||
10 for decimal and 16 for
|
||||
hexadecimal.] [10]]
|
||||
[[`MinDigits`] [The minimum number of digits
|
||||
[[`Radix`] [The radix base. This can be
|
||||
any base from 2..10 and 16] [10]]
|
||||
[[`MinDigits`] [The minimum number of digits
|
||||
allowable.] [1]]
|
||||
[[`MaxDigits`] [The maximum number of digits
|
||||
allowable. If this is -1, then the
|
||||
[[`MaxDigits`] [The maximum number of digits
|
||||
allowable. If this is -1, then the
|
||||
maximum limit becomes unbounded.] [-1]]
|
||||
]
|
||||
|
||||
@@ -385,7 +381,7 @@ not defined in __primitive_parser_concept__.
|
||||
``]
|
||||
[Match the literal `num` using the default radix (10). The parser will fail
|
||||
if the parsed value is not equal to the specified value.]
|
||||
][
|
||||
][
|
||||
[``
|
||||
int_parser<
|
||||
T, Radix, MinDigits, MaxDigits
|
||||
@@ -402,13 +398,13 @@ not defined in __primitive_parser_concept__.
|
||||
[Match the literal `num` of type `T` using radix `Radix`, with
|
||||
a minimum of `MinDigits` and a maximum of `MaxDigits`. The parser will fail
|
||||
if the parsed value is not equal to the specified value.]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
[important All numeric parsers check for overflow conditions based on the type `T`
|
||||
the corresponding `int_parser<>` has been instantiated with. If the
|
||||
the corresponding `int_parser<>` has been instantiated with. If the
|
||||
parsed number overflows this type the parsing fails. Please be aware
|
||||
that the overflow check is not based on the type of the supplied
|
||||
that the overflow check is not based on the type of the supplied
|
||||
attribute but solely depends on the template parameter `T`.]
|
||||
|
||||
[heading Attributes]
|
||||
@@ -456,7 +452,7 @@ not defined in __primitive_parser_concept__.
|
||||
>()(num)
|
||||
``]
|
||||
[`T`]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
[heading Complexity]
|
||||
@@ -476,13 +472,13 @@ valid:
|
||||
[[`n - n`] [Subtraction.]]
|
||||
[[`n * n`] [Multiplication.]]
|
||||
[[`std::numeric_limits<T>::is_bounded`] [`true` or `false` if `T` bounded.]]
|
||||
[[`std::numeric_limits<T>::digits`] [Maximum Digits for `T`, radix digits.
|
||||
[[`std::numeric_limits<T>::digits`] [Maximum Digits for `T`, radix digits.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::digits10`] [Maximum Digits for `T`, base 10.
|
||||
[[`std::numeric_limits<T>::digits10`] [Maximum Digits for `T`, base 10.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::max()`] [Maximum value for `T`.
|
||||
[[`std::numeric_limits<T>::max()`] [Maximum value for `T`.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::min()`] [Minimum value for `T`.
|
||||
[[`std::numeric_limits<T>::min()`] [Minimum value for `T`.
|
||||
Required only if `T` is bounded.]]
|
||||
]
|
||||
|
||||
@@ -529,10 +525,10 @@ Also, see __include_structure__.
|
||||
[[`boost::spirit::long_double // alias: boost::spirit::qi::long_double`]]
|
||||
]
|
||||
|
||||
[note `lit` is reused by the [qi_lit_char Character Parsers], and the Numeric
|
||||
[note `lit` is reused by the [qi_lit_char Character Parsers], and the Numeric
|
||||
Parsers. In general, a char parser is created when you pass in a
|
||||
character, and a numeric parser is created when you use a numeric
|
||||
literal.]
|
||||
character, and a numeric parser is created when you use a numeric
|
||||
literal.]
|
||||
|
||||
[heading Synopsis]
|
||||
|
||||
@@ -543,9 +539,9 @@ Also, see __include_structure__.
|
||||
|
||||
[table
|
||||
[[Parameter] [Description] [Default]]
|
||||
[[`T`] [The numeric base type of the
|
||||
[[`T`] [The numeric base type of the
|
||||
numeric parser.] [none]]
|
||||
[[`RealPolicies`] [Policies control the
|
||||
[[`RealPolicies`] [Policies control the
|
||||
parser's behavior.] [`real_policies<T>`]]
|
||||
]
|
||||
|
||||
@@ -586,10 +582,10 @@ not defined in __primitive_parser_concept__.
|
||||
double_(num)
|
||||
long_double(num)
|
||||
``]
|
||||
[Match the literal `num` using the default policies (`real_policies<T>`).
|
||||
The parser will fail if the parsed value is not equal to the specified
|
||||
[Match the literal `num` using the default policies (`real_policies<T>`).
|
||||
The parser will fail if the parsed value is not equal to the specified
|
||||
value.]
|
||||
][
|
||||
][
|
||||
[``
|
||||
real_parser<
|
||||
T, RealPolicies
|
||||
@@ -603,8 +599,8 @@ not defined in __primitive_parser_concept__.
|
||||
>()(num)
|
||||
``]
|
||||
[Match the literal `num` of type `T` using `RealPolicies`. The parser will fail
|
||||
if the parsed value is not equal to the specified value.]
|
||||
]
|
||||
if the parsed value is not equal to the specified value.]
|
||||
]
|
||||
]
|
||||
|
||||
[heading Attributes]
|
||||
@@ -646,7 +642,7 @@ not defined in __primitive_parser_concept__.
|
||||
>()(num)
|
||||
``]
|
||||
[`T`]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
[heading Complexity]
|
||||
@@ -658,7 +654,7 @@ exponent, sign, etc.) being parsed.]
|
||||
|
||||
The numeric base type, `T`, the minimum expression requirements listed
|
||||
below must be valid. Take note that additional requirements may be
|
||||
imposed by custom policies.
|
||||
imposed by custom policies.
|
||||
|
||||
[table
|
||||
[[Expression] [Semantics]]
|
||||
@@ -668,28 +664,28 @@ imposed by custom policies.
|
||||
[[`n - n`] [Subtraction.]]
|
||||
[[`n * n`] [Multiplication.]]
|
||||
[[`std::numeric_limits<T>::is_bounded`] [`true` or `false` if `T` bounded.]]
|
||||
[[`std::numeric_limits<T>::digits`] [Maximum Digits for `T`, radix digits.
|
||||
[[`std::numeric_limits<T>::digits`] [Maximum Digits for `T`, radix digits.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::digits10`] [Maximum Digits for `T`, base 10.
|
||||
[[`std::numeric_limits<T>::digits10`] [Maximum Digits for `T`, base 10.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::max()`] [Maximum value for `T`.
|
||||
[[`std::numeric_limits<T>::max()`] [Maximum value for `T`.
|
||||
Required only if `T` is bounded.]]
|
||||
[[`std::numeric_limits<T>::min()`] [Minimum value for `T`.
|
||||
[[`std::numeric_limits<T>::min()`] [Minimum value for `T`.
|
||||
Required only if `T` is bounded.]]
|
||||
|
||||
|
||||
[[`boost::spirit::traits::scale(exp, n)`]
|
||||
|
||||
|
||||
[[`boost::spirit::traits::scale(exp, n)`]
|
||||
[Multiply `n` by `10^exp`. Default implementation
|
||||
is provided for `float`, `double` and `long double`.]]
|
||||
|
||||
[[`boost::spirit::traits::negate(b, n)`]
|
||||
[[`boost::spirit::traits::negate(b, n)`]
|
||||
[Negate `n` if `b` is `true`. Default implementation
|
||||
is provided for `float`, `double` and `long double`.]]
|
||||
|
||||
[[`boost::spirit::traits::is_equal_to_one(n)`]
|
||||
[[`boost::spirit::traits::is_equal_to_one(n)`]
|
||||
[Return `true` if `n` is equal to `1.0`. Default implementation
|
||||
is provided for `float`, `double` and `long double`.]]
|
||||
|
||||
|
||||
]
|
||||
|
||||
[note The additional spirit real number traits above are provided to
|
||||
@@ -701,7 +697,7 @@ exponent is a very cheap operation.]
|
||||
|
||||
The `RealPolicies` template parameter is a class that groups all the
|
||||
policies that control the parser's behavior. Policies control the real
|
||||
number parsers' behavior.
|
||||
number parsers' behavior.
|
||||
|
||||
The default is `real_policies<T>`. The default is provided to take care
|
||||
of the most common case (there are many ways to represent, and hence
|
||||
@@ -713,17 +709,17 @@ C/C++ style floating point numbers of the form `nnn.fff.Eeee` where
|
||||
`'+'` with the additional detection of NaN and Inf as mandated by the
|
||||
C99 Standard and proposed for inclusion into the C++0x Standard: nan,
|
||||
nan(...), inf and infinity (the matching is case-insensitive). This
|
||||
corresponds to the following grammar:
|
||||
corresponds to the following grammar:
|
||||
|
||||
sign
|
||||
= lit('+') | '-'
|
||||
;
|
||||
|
||||
nan
|
||||
= -lit("1.0#") >> no_case["nan"]
|
||||
nan
|
||||
= -lit("1.0#") >> no_case["nan"]
|
||||
>> -('(' >> *(char_ - ')') >> ')')
|
||||
;
|
||||
|
||||
|
||||
inf
|
||||
= no_case[lit("inf") >> -lit("inity")]
|
||||
;
|
||||
@@ -751,10 +747,10 @@ There are four `RealPolicies` predefined for immediate use:
|
||||
[table Predefined Policies
|
||||
|
||||
[[Policies] [Description]]
|
||||
[[`ureal_policies<double> >`] [Without sign.]]
|
||||
[[`real_policies<double> >`] [With sign.]]
|
||||
[[`strict_ureal_policies<double> >`] [Without sign, dot required.]]
|
||||
[[`strict_real_policies<double> >`] [With sign, dot required.]]
|
||||
[[`ureal_policies<double>`] [Without sign.]]
|
||||
[[`real_policies<double>`] [With sign.]]
|
||||
[[`strict_ureal_policies<double>`] [Without sign, dot required.]]
|
||||
[[`strict_real_policies<double>`] [With sign, dot required.]]
|
||||
]
|
||||
|
||||
[note Integers are considered a subset of real numbers, so for instance,
|
||||
@@ -772,25 +768,25 @@ For models of `RealPolicies` the following expressions must be valid:
|
||||
[[`RP::allow_leading_dot`] [Allow leading dot.]]
|
||||
[[`RP::allow_trailing_dot`] [Allow trailing dot.]]
|
||||
[[`RP::expect_dot`] [Require a dot.]]
|
||||
[[`RP::parse_sign(f, l)`] [Parse the prefix sign (e.g. '-').
|
||||
[[`RP::parse_sign(f, l)`] [Parse the prefix sign (e.g. '-').
|
||||
Return `true` if successful, otherwise `false`.]]
|
||||
[[`RP::parse_n(f, l, n)`] [Parse the integer at the left of the decimal point.
|
||||
[[`RP::parse_n(f, l, n)`] [Parse the integer at the left of the decimal point.
|
||||
Return `true` if successful, otherwise `false`.
|
||||
If successful, place the result into `n`.]]
|
||||
[[`RP::parse_dot(f, l)`] [Parse the decimal point.
|
||||
[[`RP::parse_dot(f, l)`] [Parse the decimal point.
|
||||
Return `true` if successful, otherwise `false`.]]
|
||||
[[`RP::parse_frac_n(f, l, n)`] [Parse the fraction after the decimal point.
|
||||
[[`RP::parse_frac_n(f, l, n)`] [Parse the fraction after the decimal point.
|
||||
Return `true` if successful, otherwise `false`.
|
||||
If successful, place the result into `n`.]]
|
||||
[[`RP::parse_exp(f, l)`] [Parse the exponent prefix (e.g. 'e').
|
||||
[[`RP::parse_exp(f, l)`] [Parse the exponent prefix (e.g. 'e').
|
||||
Return `true` if successful, otherwise `false`.]]
|
||||
[[`RP::parse_exp_n(f, l, n)`] [Parse the actual exponent.
|
||||
[[`RP::parse_exp_n(f, l, n)`] [Parse the actual exponent.
|
||||
Return `true` if successful, otherwise `false`.
|
||||
If successful, place the result into `n`.]]
|
||||
[[`RP::parse_nan(f, l, n)`] [Parse a NaN.
|
||||
[[`RP::parse_nan(f, l, n)`] [Parse a NaN.
|
||||
Return `true` if successful, otherwise `false`.
|
||||
If successful, place the result into `n`.]]
|
||||
[[`RP::parse_inf(f, l, n)`] [Parse an Inf.
|
||||
[[`RP::parse_inf(f, l, n)`] [Parse an Inf.
|
||||
Return `true` if successful, otherwise `false`.
|
||||
If successful, place the result into `n`.]]
|
||||
]
|
||||
@@ -855,7 +851,7 @@ And its use:
|
||||
|
||||
[heading Description]
|
||||
|
||||
The `bool_parser` can parse booleans of arbitrary type, `B`. The boolean base
|
||||
The `bool_parser` can parse booleans of arbitrary type, `B`. The boolean base
|
||||
type `T` can be a user defined boolean type as long as the type follows certain
|
||||
expression requirements (documented below).
|
||||
|
||||
@@ -884,9 +880,9 @@ Also, see __include_structure__.
|
||||
|
||||
[table
|
||||
[[Parameter] [Description] [Default]]
|
||||
[[`B`] [The boolean type of the
|
||||
[[`B`] [The boolean type of the
|
||||
boolean parser.] [`bool`]]
|
||||
[[`BooleanPolicies`] [Policies control the
|
||||
[[`BooleanPolicies`] [Policies control the
|
||||
parser's behavior.] [`bool_policies<B>`]]
|
||||
]
|
||||
|
||||
@@ -925,16 +921,16 @@ not defined in __primitive_parser_concept__.
|
||||
lit(boolean)
|
||||
bool_(boolean)
|
||||
``]
|
||||
[Match the literal `boolean` using the default policies (`bool_policies<T>`).
|
||||
The parser will fail if the parsed value is not equal to the specified
|
||||
[Match the literal `boolean` using the default policies (`bool_policies<T>`).
|
||||
The parser will fail if the parsed value is not equal to the specified
|
||||
value.]
|
||||
][
|
||||
][
|
||||
[``
|
||||
true_
|
||||
false_
|
||||
false_
|
||||
``]
|
||||
[Match `"true"` and `"false"`, respectively.]
|
||||
][
|
||||
][
|
||||
[``
|
||||
bool_parser<
|
||||
T, BoolPolicies
|
||||
@@ -948,8 +944,8 @@ not defined in __primitive_parser_concept__.
|
||||
>()(boolean)
|
||||
``]
|
||||
[Match the literal `boolean` of type `T` using `BoolPolicies`. The parser will fail
|
||||
if the parsed value is not equal to the specified value.]
|
||||
]
|
||||
if the parsed value is not equal to the specified value.]
|
||||
]
|
||||
]
|
||||
|
||||
[note All boolean parsers properly respect the __qi_no_case__`[]` directive.]
|
||||
@@ -983,7 +979,7 @@ not defined in __primitive_parser_concept__.
|
||||
>()(num)
|
||||
``]
|
||||
[`T`]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
[heading Complexity]
|
||||
@@ -994,7 +990,7 @@ not defined in __primitive_parser_concept__.
|
||||
|
||||
The boolean type, `B`, the minimum expression requirements listed
|
||||
below must be valid. Take note that additional requirements may be
|
||||
imposed by custom policies.
|
||||
imposed by custom policies.
|
||||
|
||||
[table
|
||||
[[Expression] [Semantics]]
|
||||
@@ -1005,7 +1001,7 @@ imposed by custom policies.
|
||||
|
||||
The boolean `Policies` template parameter is a class that groups all the
|
||||
policies that control the parser's behavior. Policies control the boolean
|
||||
parsers' behavior.
|
||||
parsers' behavior.
|
||||
|
||||
The default is `bool_policies<bool>`. The default is provided to take care
|
||||
of the most common case (there are many ways to represent, and hence
|
||||
@@ -1023,8 +1019,8 @@ For models of boolean `Policies` the following expressions must be valid:
|
||||
[[`BP::parse_false(f, l, attr, ctx)`] [Parse a `false` value.]]
|
||||
]
|
||||
|
||||
The functions should return true if the required representations of `true` or
|
||||
`false` have been found. In this case the attribute `n` should be set to the
|
||||
The functions should return true if the required representations of `true` or
|
||||
`false` have been found. In this case the attribute `n` should be set to the
|
||||
matched value (`true` or `false`).
|
||||
|
||||
[heading Boolean `Policies` Specializations]
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
[article Spirit
|
||||
[quickbook 1.5]
|
||||
[version 2.4.2]
|
||||
[version 2.5]
|
||||
[authors [de Guzman, Joel], [Kaiser, Hartmut]]
|
||||
[copyright 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 Joel de Guzman, Hartmut Kaiser]
|
||||
[/ purpose Parser and Generator Library]
|
||||
@@ -23,10 +23,12 @@
|
||||
|
||||
[/ Some links ]
|
||||
|
||||
[def __version__ V2.5]
|
||||
|
||||
[def __spirit__ [@http://boost-spirit.com Spirit]]
|
||||
[def __spirit_list__ [@http://www.nabble.com/The-Spirit-Parser-Library-f3430.html Spirit General List]]
|
||||
[def __phoenix__ [@../../phoenix/doc/html/index.html Phoenix]]
|
||||
[def __boost_phoenix__ [@../../phoenix/doc/html/index.html Boost.Phoenix]]
|
||||
[def __boost_phoenix__ [@boost:/libs/phoenix/doc/html/index.html Boost.Phoenix]]
|
||||
[def __fusion__ [@boost:/libs/fusion/doc/html/index.html Boost.Fusion]]
|
||||
[def __mpl__ [@http://www.boost.org/libs/mpl/index.html Boost.Mpl]]
|
||||
[def __stl__ [@http://www.sgi.com/tech/stl/ STL]]
|
||||
@@ -434,12 +436,12 @@ For now, I'll put my stuff here ad-hoc (JDG). $$$]
|
||||
[template qi_auto[str] [link spirit.qi.reference.auto [str]]]
|
||||
[def __create_parser__ [link spirit.qi.reference.parse_api.create_parser `create_parser`]]
|
||||
|
||||
[__parse_api__ [link spirit.qi.reference.parse_api The Parse API]]
|
||||
[def __parse_api__ [link spirit.qi.reference.parse_api The Parse API]]
|
||||
|
||||
[/ Here we go ]
|
||||
|
||||
This is the documentation of the newest version of __spirit__ (currently,
|
||||
V2.4.2). If you're looking for the documentation of Spirit's previous version
|
||||
__version__). If you're looking for the documentation of Spirit's previous version
|
||||
(formerly Spirit V1.8), see __classic__.
|
||||
|
||||
[include preface.qbk]
|
||||
|
||||
22
doc/support/line_pos_iterator.qbk
Normal file
22
doc/support/line_pos_iterator.qbk
Normal file
@@ -0,0 +1,22 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2011 Hartmut Kaiser
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2011 Bryce Lelbach
|
||||
|
||||
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)
|
||||
==============================================================================/]
|
||||
|
||||
[import ../../../../boost/spirit/home/support/iterators/line_pos_iterator.hpp]
|
||||
[/ [import ../../example/support/line_pos_iterator.cpp] ]
|
||||
|
||||
[section:line_pos_iterator The line position iterator]
|
||||
|
||||
[line_pos_iterator_class]
|
||||
|
||||
[line_pos_iterator_utilities]
|
||||
|
||||
[/ [line_pos_iterator_example] ]
|
||||
|
||||
[endsect] [/ line_pos_iterator]
|
||||
|
||||
@@ -13,6 +13,18 @@
|
||||
|
||||
[heading What's changed in __qi__ and __karma__ from V2.4.2 (Boost V1.46.0) to V2.5 (Boost V1.47.0)]
|
||||
|
||||
This version of __spirit__ now supports the new version of __boost_phoenix__ (V3),
|
||||
which has been released as part of Boost V1.47. Please note that this support
|
||||
is purely preliminary and should not be considered production quality. The
|
||||
reason why we are releasing this now is to enable people who want to use the
|
||||
new version of __boost_phoenix__ in their code to do so without any conflicts with
|
||||
existing code using __spirit__. Generally, no __spirit__ code needs to be
|
||||
changed. To activate the use of __boost_phoenix__ V3 for __spirit__ you need to
|
||||
define the following preprocessor constant for your builds (before including
|
||||
any of Spirit's include files):
|
||||
|
||||
#define BOOST_SPIRIT_USE_PHOENIX_V3 1
|
||||
|
||||
[heading New Features in Qi or Karma]
|
||||
|
||||
* Added __utree__, a generic, hierarchical, and dynamic data structure that can
|
||||
@@ -24,16 +36,17 @@
|
||||
(the terminal name and its type). Before, there was only one parameter
|
||||
(the terminal name) and the type assumed the terminal name with `_type`
|
||||
appended. This produced invalid C++ identifiers with terminals such as
|
||||
`int_`, which resulted in generated a type `int__type` with a bogus double
|
||||
`int_`, which resulted in generated a type `int__type` with a bogus double
|
||||
underscore that is reserved for system use in C++.
|
||||
* The placeholder `_val` now can be used in top level semantic actions outside
|
||||
* The numeric parsers now allow arbitrary radix from 2..10 and 16
|
||||
* The placeholder `_val` now can be used in top level semantic actions outside
|
||||
of any right hand side of a rule. Here is an example:
|
||||
``
|
||||
int i = 0
|
||||
BOOST_TEST(test_attr("456", int_[_val = _1], i) && i == 456);
|
||||
``
|
||||
In this case _val refers to the attribute value, which is passed in to the
|
||||
`parse()` or `phrase_parse()` functions.
|
||||
In this case _val refers to the attribute value, which is passed in to the
|
||||
`parse()` or `phrase_parse()` functions.
|
||||
Similar constructs are now possible in __karma__ as well:
|
||||
``
|
||||
int i = 123;
|
||||
@@ -53,14 +66,16 @@
|
||||
use of const floating point types with the generator. Thanks to Jeroen
|
||||
Habraken (a.k.a. VeXocide) for reporting it and for submitting a patch and
|
||||
a test.
|
||||
* Fixed the __qi__ __qi_attr__ parser, the __qi__ __qi_symbols__ parser, and
|
||||
the __karma__ [karma_symbols `symbols<>`] generator to properly handle
|
||||
container attributes. Those have been broken in Boost V1.46.1 (thanks to
|
||||
Aaron Graham and Joerg Becker for reporting those).
|
||||
* Fixed the __qi_stream__ parser to properly adjust the iterator of the
|
||||
underlying input stream in the case when the stream parser component was
|
||||
successful. Thanks to Brian O'Kennedy who reported the problem on
|
||||
* Fixed the __qi__ __qi_attr__ parser, the __qi__ __qi_symbols__ parser, and
|
||||
the __karma__ [karma_symbols `symbols<>`] generator to properly handle
|
||||
container attributes. These were broken in Boost V1.46.1 (thanks to
|
||||
Aaron Graham and Joerg Becker for reporting the problems).
|
||||
* Fixed the __qi_stream__ parser to properly adjust the iterator of the
|
||||
underlying input stream in the case when the stream parser component was
|
||||
successful. Thanks to Brian O'Kennedy who reported the problem on
|
||||
Stackoverflow.
|
||||
* Fixed failing Karma numerics generators when used with adapted ADTs (thanks
|
||||
to Colin Rundel for reporting that problem).
|
||||
|
||||
[heading Breaking Changes]
|
||||
|
||||
@@ -77,9 +92,9 @@
|
||||
|
||||
[heading New Features in Lex]
|
||||
|
||||
* Added the possibility to specify a token id while creating a token definition
|
||||
using `lex::char_` and `lex::string`. Both primitives now accept a second
|
||||
parameter which will be interpreted as the requested token id for any token
|
||||
* Added the possibility to specify a token id while creating a token definition
|
||||
using `lex::char_` and `lex::string`. Both primitives now accept a second
|
||||
parameter which will be interpreted as the requested token id for any token
|
||||
generated from this definition.
|
||||
|
||||
[heading Making Stuff Work]
|
||||
@@ -98,10 +113,10 @@
|
||||
is still in place.
|
||||
* Alternatives now support attribute compatibility.
|
||||
* The attribute handling for container attributes of sequences and container
|
||||
components (list, Kleene, Plus, and repeat) has been completely rewritten.
|
||||
It now supports many more use cases and behaves much more predictable than
|
||||
the older version. Thanks to Thomas Taylor, Richard Crossley, Semen,
|
||||
Adalberto Castelo, and many others for reporting bugs and helping in making
|
||||
components (list, Kleene, Plus, and repeat) has been completely rewritten.
|
||||
It now supports many more use cases and behaves much more predictable than
|
||||
the older version. Thanks to Thomas Taylor, Richard Crossley, Semen,
|
||||
Adalberto Castelo, and many others for reporting bugs and helping in making
|
||||
the new code behave as expected.
|
||||
|
||||
[endsect]
|
||||
@@ -180,8 +195,8 @@
|
||||
|
||||
[heading Bug Fixes in Lex]
|
||||
|
||||
* Fixed an issue in the Lexer giving problems while assigning tokens to all
|
||||
lexer states at once. This is now possible by simply using "*" as the state
|
||||
* Fixed an issue in the Lexer giving problems while assigning tokens to all
|
||||
lexer states at once. This is now possible by simply using "*" as the state
|
||||
name. For instance this will add the token int_ to all lexer states:
|
||||
``
|
||||
template <typename Lexer>
|
||||
@@ -208,7 +223,7 @@
|
||||
|
||||
[heading Known Problems]
|
||||
|
||||
* __qi__ integer literals (like `int_(10)`) consume input on failure, which can
|
||||
* __qi__ integer literals (like `int_(10)`) consume input on failure, which can
|
||||
lead to problems with the alternative operator.
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace client
|
||||
|
||||
struct expr
|
||||
{
|
||||
template <typename T1, typename T2>
|
||||
template <typename T1, typename T2 = void>
|
||||
struct result { typedef void type; };
|
||||
|
||||
expr(char op) : op(op) {}
|
||||
@@ -58,7 +58,7 @@ namespace client
|
||||
|
||||
struct negate_expr
|
||||
{
|
||||
template <typename T1, typename T2>
|
||||
template <typename T1, typename T2 = void>
|
||||
struct result { typedef void type; };
|
||||
|
||||
void operator()(spirit::utree& expr, spirit::utree const& rhs) const
|
||||
|
||||
@@ -42,14 +42,13 @@ namespace client
|
||||
using qi::_1;
|
||||
using ascii::space;
|
||||
using phoenix::push_back;
|
||||
using phoenix::ref;
|
||||
|
||||
bool r = phrase_parse(first, last,
|
||||
|
||||
// Begin grammar
|
||||
(
|
||||
double_[push_back(ref(v), _1)]
|
||||
>> *(',' >> double_[push_back(ref(v), _1)])
|
||||
double_[push_back(phoenix::ref(v), _1)]
|
||||
>> *(',' >> double_[push_back(phoenix::ref(v), _1)])
|
||||
)
|
||||
,
|
||||
// End grammar
|
||||
|
||||
@@ -42,13 +42,12 @@ namespace client
|
||||
using qi::_1;
|
||||
using ascii::space;
|
||||
using phoenix::push_back;
|
||||
using phoenix::ref;
|
||||
|
||||
bool r = phrase_parse(first, last,
|
||||
|
||||
// Begin grammar
|
||||
(
|
||||
double_[push_back(ref(v), _1)] % ','
|
||||
double_[push_back(phoenix::ref(v), _1)] % ','
|
||||
)
|
||||
,
|
||||
// End grammar
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
|
||||
// this code is not supposed to be executed, so the asserts are for
|
||||
// this code is not supposed to be executed, so the asserts are for
|
||||
// demonstration purposes only
|
||||
// boostinspect:naassert_macro
|
||||
|
||||
@@ -43,7 +43,7 @@ void test_phrase_parser(
|
||||
{
|
||||
using boost::spirit::qi::phrase_parse;
|
||||
using boost::spirit::qi::ascii::space;
|
||||
|
||||
|
||||
char const* f(input);
|
||||
char const* l(f + strlen(f));
|
||||
if (phrase_parse(f, l, p, space) && (!full_match || (f == l)))
|
||||
@@ -182,7 +182,7 @@ struct ts_real_policies : boost::spirit::qi::ureal_policies<T>
|
||||
|
||||
//[reference_test_bool_policy
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// These policies can be used to parse "eurt" (i.e. "true" spelled backwards)
|
||||
// These policies can be used to parse "eurt" (i.e. "true" spelled backwards)
|
||||
// as `false`
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
struct backwards_bool_policies : boost::spirit::qi::bool_policies<>
|
||||
@@ -219,7 +219,7 @@ struct complex
|
||||
|
||||
//[reference_qi_stream_complex
|
||||
// define streaming operator for the type complex
|
||||
std::istream&
|
||||
std::istream&
|
||||
operator>> (std::istream& is, complex& z)
|
||||
{
|
||||
char lbrace = '\0', comma = '\0', rbrace = '\0';
|
||||
@@ -232,7 +232,7 @@ operator>> (std::istream& is, complex& z)
|
||||
|
||||
//[reference_qi_auto_complex
|
||||
/*`The following construct is required to allow the `complex` data structure
|
||||
to be utilized as a __fusion__ sequence. This is required as we will
|
||||
to be utilized as a __fusion__ sequence. This is required as we will
|
||||
emit output for this data structure with a __qi__ sequence:
|
||||
`'{' >> qi::double_ >> ',' >> qi::double_ >> '}'`.
|
||||
*/
|
||||
@@ -243,15 +243,15 @@ BOOST_FUSION_ADAPT_STRUCT(
|
||||
)
|
||||
|
||||
/*`We add a specialization for the create_parser customization point
|
||||
defining a custom output format for the complex type. Generally, any
|
||||
specialization for create_parser is expected to return the proto
|
||||
expression to be used to match input for the type the customization
|
||||
defining a custom output format for the complex type. Generally, any
|
||||
specialization for create_parser is expected to return the proto
|
||||
expression to be used to match input for the type the customization
|
||||
point has been specialized for.
|
||||
*/
|
||||
/*`We need to utilize `proto::deep_copy` as the expression contains literals
|
||||
(the `'{'`, `','`, and `'}'`) which normally get embedded in the proto
|
||||
expression by reference only. The deep copy converts the proto tree to
|
||||
hold this by value. The deep copy operation can be left out for simpler
|
||||
/*`We need to utilize `proto::deep_copy` as the expression contains literals
|
||||
(the `'{'`, `','`, and `'}'`) which normally get embedded in the proto
|
||||
expression by reference only. The deep copy converts the proto tree to
|
||||
hold this by value. The deep copy operation can be left out for simpler
|
||||
proto expressions (not containing references to temporaries). Alternatively
|
||||
you could use the `proto::make_expr` facility to build the required
|
||||
proto expression.
|
||||
@@ -285,7 +285,7 @@ struct int_data
|
||||
// we provide a custom attribute transformation to allow its use as an int
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
// in this case we just expose the embedded 'int' as the attribute instance
|
||||
// in this case we just expose the embedded 'int' as the attribute instance
|
||||
// to use, allowing to leave the function 'post()' empty
|
||||
template <>
|
||||
struct transform_attribute<int_data, int, qi::domain>
|
||||
@@ -298,7 +298,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
}}}
|
||||
//]
|
||||
|
||||
namespace client
|
||||
namespace client
|
||||
{
|
||||
using boost::spirit::qi::grammar;
|
||||
using boost::spirit::qi::rule;
|
||||
@@ -329,7 +329,7 @@ main()
|
||||
using boost::spirit::qi::lit;
|
||||
using boost::spirit::ascii::char_;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_char_literals
|
||||
test_parser("x", 'x'); // plain literal
|
||||
test_parser("x", lit('x')); // explicit literal
|
||||
@@ -341,37 +341,37 @@ main()
|
||||
test_parser_attr("5", char_('0','9'), ch); // ascii::char_ range
|
||||
std::cout << ch << std::endl; // prints '5'
|
||||
//]
|
||||
|
||||
|
||||
//[reference_char_set
|
||||
test_parser_attr("5", char_("0-9"), ch); // ascii::char_ set
|
||||
std::cout << ch << std::endl; // prints '5'
|
||||
//]
|
||||
|
||||
|
||||
//[reference_char_phoenix
|
||||
namespace phx = boost::phoenix;
|
||||
namespace phx = boost::phoenix;
|
||||
test_parser("x", phx::val('x')); // direct
|
||||
test_parser("5",
|
||||
test_parser("5",
|
||||
char_(phx::val('0'),phx::val('9'))); // ascii::char_ range
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//[reference_using_declarations_lit_string
|
||||
using boost::spirit::qi::lit;
|
||||
using boost::spirit::ascii::string;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_string_literals
|
||||
test_parser("boost", "boost"); // plain literal
|
||||
test_parser("boost", lit("boost")); // explicit literal
|
||||
test_parser("boost", string("boost")); // ascii::string
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
using boost::spirit::qi::lit;
|
||||
using boost::spirit::ascii::string;
|
||||
|
||||
|
||||
//[reference_string_std_string
|
||||
std::string s("boost");
|
||||
test_parser("boost", s); // direct
|
||||
@@ -379,19 +379,19 @@ main()
|
||||
test_parser("boost", string(s)); // ascii::string
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
using boost::spirit::qi::lit;
|
||||
using boost::spirit::ascii::string;
|
||||
|
||||
|
||||
//[reference_string_phoenix
|
||||
namespace phx = boost::phoenix;
|
||||
namespace phx = boost::phoenix;
|
||||
test_parser("boost", phx::val("boost")); // direct
|
||||
test_parser("boost", lit(phx::val("boost"))); // explicit
|
||||
test_parser("boost", string(phx::val("boost"))); // ascii::string
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//[reference_using_declarations_symbols
|
||||
using boost::spirit::qi::symbols;
|
||||
@@ -411,41 +411,41 @@ main()
|
||||
std::cout << i << std::endl;
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//[reference_using_declarations_lexeme
|
||||
using boost::spirit::qi::lexeme;
|
||||
using boost::spirit::qi::lit;
|
||||
using boost::spirit::ascii::digit;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_lexeme
|
||||
/*`The use of lexeme here will prevent skipping in between the
|
||||
digits and the sign making inputs such as `"1 2 345"` erroneous.*/
|
||||
test_phrase_parser("12345", lexeme[ -(lit('+') | '-') >> +digit ]);
|
||||
//]
|
||||
}
|
||||
|
||||
// as
|
||||
|
||||
// as
|
||||
{
|
||||
//[reference_using_declarations_as
|
||||
using boost::spirit::utree;
|
||||
using boost::spirit::utree_type;
|
||||
using boost::spirit::utf8_symbol_type;
|
||||
using boost::spirit::utf8_symbol_type;
|
||||
using boost::spirit::qi::as;
|
||||
using boost::spirit::qi::as_string;
|
||||
using boost::spirit::qi::char_;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_as
|
||||
/*`To properly handle string concatenation with __utree__, we
|
||||
/*`To properly handle string concatenation with __utree__, we
|
||||
make use of `as_string[]`. We also use `as<T>` to explicitly create
|
||||
a __utree__ symbol node.*/
|
||||
utree ut;
|
||||
|
||||
typedef as<utf8_symbol_type> as_symbol_type;
|
||||
as_symbol_type const as_symbol = as_symbol_type();
|
||||
|
||||
|
||||
test_parser_attr("foo", as_string[*char_], ut);
|
||||
std::cout << ut << std::endl; // will output >"foo"<
|
||||
BOOST_ASSERT(ut.which() == utree_type::string_type);
|
||||
@@ -455,7 +455,7 @@ main()
|
||||
std::cout << ut << std::endl; // will output >"foo"<
|
||||
BOOST_ASSERT(ut.which() == utree_type::string_type);
|
||||
ut.clear();
|
||||
|
||||
|
||||
test_parser_attr("foo", as_symbol[*char_], ut);
|
||||
std::cout << ut << std::endl; // will output >foo<
|
||||
BOOST_ASSERT(ut.which() == utree_type::symbol_type);
|
||||
@@ -472,37 +472,37 @@ main()
|
||||
using boost::spirit::qi::no_skip;
|
||||
using boost::spirit::qi::char_;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_no_skip
|
||||
/*`The use of no_skip here will prevent skipping of whitespace in front
|
||||
/*`The use of no_skip here will prevent skipping of whitespace in front
|
||||
and in between the characters of the string `' abc '`.*/
|
||||
|
||||
|
||||
std::string str;
|
||||
test_phrase_parser_attr("' abc '",
|
||||
'\'' >> no_skip[+~char_('\'')] >> '\'', str);
|
||||
test_phrase_parser_attr("' abc '",
|
||||
'\'' >> no_skip[+~char_('\'')] >> '\'', str);
|
||||
std::cout << str << std::endl; // will output: > abc <
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//[reference_using_declarations_hold
|
||||
using boost::spirit::qi::hold;
|
||||
using boost::spirit::qi::int_;
|
||||
using boost::spirit::qi::attr;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_hold
|
||||
/*`The use of `hold[]` here will make sure the changes to the attribute
|
||||
/*`The use of `hold[]` here will make sure the changes to the attribute
|
||||
caused by the (failing) first alternative will not be visible after
|
||||
the whole parsing succeeded. */
|
||||
|
||||
|
||||
std::vector<int> v;
|
||||
test_phrase_parser_attr("123",
|
||||
hold[int_ >> ':' >> int_] | int_ >> attr(0), v);
|
||||
test_phrase_parser_attr("123",
|
||||
hold[int_ >> ':' >> int_] | int_ >> attr(0), v);
|
||||
std::cout << v[0] << "," << v[1] << std::endl; // will output: >123,0<
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//[reference_using_declarations_no_case
|
||||
using boost::spirit::ascii::no_case;
|
||||
@@ -510,12 +510,12 @@ main()
|
||||
using boost::spirit::ascii::alnum;
|
||||
using boost::spirit::qi::symbols;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_no_case
|
||||
test_parser("X", no_case[char_('x')]);
|
||||
test_parser("6", no_case[alnum]);
|
||||
//]
|
||||
|
||||
|
||||
//[reference_symbols_with_no_case
|
||||
symbols<char, int> sym;
|
||||
|
||||
@@ -540,7 +540,7 @@ main()
|
||||
using boost::spirit::qi::int_;
|
||||
using boost::spirit::ascii::char_;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_omit
|
||||
/*`This parser ignores the first two characters
|
||||
and extracts the succeeding `int`:*/
|
||||
@@ -557,7 +557,7 @@ main()
|
||||
//]
|
||||
|
||||
//[reference_matches
|
||||
/*`This parser tries to match an `int` and returns `true` a its
|
||||
/*`This parser tries to match an `int` and returns `true` a its
|
||||
attribute as it succeeded matching: */
|
||||
bool result = false;
|
||||
test_parser_attr("345", matches[int_], result);
|
||||
@@ -577,7 +577,7 @@ main()
|
||||
using boost::spirit::ascii::alpha;
|
||||
using boost::spirit::ascii::alnum;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_raw
|
||||
//`This parser matches and extracts C++ identifiers:
|
||||
std::string id;
|
||||
@@ -585,7 +585,7 @@ main()
|
||||
std::cout << id << std::endl; // should print James007
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//[reference_using_declarations_repeat
|
||||
using boost::spirit::qi::repeat;
|
||||
@@ -595,57 +595,57 @@ main()
|
||||
using boost::spirit::ascii::char_;
|
||||
namespace phx = boost::phoenix;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_repeat
|
||||
//`A parser for a file name with a maximum of 255 characters:
|
||||
test_parser("batman.jpeg", repeat(1, 255)[char_("a-zA-Z_./")]);
|
||||
|
||||
|
||||
/*`A parser for a specific bitmap file format which has exactly 4096 RGB color information.
|
||||
(for the purpose of this example, we will be testing only 3 RGB color information.)
|
||||
*/
|
||||
uint_parser<unsigned, 16, 6, 6> rgb;
|
||||
std::vector<unsigned> colors;
|
||||
test_parser_attr("ffffff0000003f3f3f", repeat(3)[rgb], colors);
|
||||
std::cout
|
||||
std::cout
|
||||
<< std::hex
|
||||
<< colors[0] << ','
|
||||
<< colors[1] << ','
|
||||
<< colors[0] << ','
|
||||
<< colors[1] << ','
|
||||
<< colors[2] << std::endl;
|
||||
|
||||
/*`A 256 bit binary string (1..256 1s or 0s). (For the purpose of this example,
|
||||
|
||||
/*`A 256 bit binary string (1..256 1s or 0s). (For the purpose of this example,
|
||||
we will be testing only 16 bits.)
|
||||
*/
|
||||
test_parser("1011101011110010", repeat(16)[lit('1') | '0']);
|
||||
//]
|
||||
|
||||
|
||||
std::cout << std::dec; // reset to decimal
|
||||
|
||||
|
||||
//[reference_repeat_pascal
|
||||
/*`This trivial example cannot be practically defined in traditional EBNF.
|
||||
Although some EBNF variants allow more powerful repetition constructs other
|
||||
than the Kleene Star, we are still limited to parsing fixed strings.
|
||||
The nature of EBNF forces the repetition factor to be a constant.
|
||||
On the other hand, Spirit allows the repetition factor to be variable at
|
||||
run time. We could write a grammar that accepts the input string above.
|
||||
Example using phoenix:
|
||||
/*`This trivial example cannot be practically defined in traditional EBNF.
|
||||
Although some EBNF variants allow more powerful repetition constructs other
|
||||
than the Kleene Star, we are still limited to parsing fixed strings.
|
||||
The nature of EBNF forces the repetition factor to be a constant.
|
||||
On the other hand, Spirit allows the repetition factor to be variable at
|
||||
run time. We could write a grammar that accepts the input string above.
|
||||
Example using phoenix:
|
||||
*/
|
||||
std::string str;
|
||||
int n;
|
||||
test_parser_attr("\x0bHello World",
|
||||
test_parser_attr("\x0bHello World",
|
||||
char_[phx::ref(n) = _1] >> repeat(phx::ref(n))[char_], str);
|
||||
std::cout << n << ',' << str << std::endl; // will print "11,Hello World"
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
//[reference_using_declarations_skip
|
||||
using boost::spirit::qi::skip;
|
||||
using boost::spirit::qi::int_;
|
||||
using boost::spirit::ascii::space;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_skip
|
||||
/*`Explicitly specify a skip parser. This parser parses comma
|
||||
/*`Explicitly specify a skip parser. This parser parses comma
|
||||
delimited numbers, ignoring spaces.*/
|
||||
test_parser("1, 2, 3, 4, 5", skip(space)[int_ >> *(',' >> int_)]);
|
||||
//]
|
||||
@@ -699,7 +699,7 @@ main()
|
||||
test_parser("\n", eol);
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// eoi
|
||||
{
|
||||
//[reference_using_declarations_eoi
|
||||
@@ -710,7 +710,7 @@ main()
|
||||
test_parser("", eoi);
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// eps
|
||||
{
|
||||
//[reference_using_declarations_eps
|
||||
@@ -724,25 +724,25 @@ main()
|
||||
//`Basic `eps`:
|
||||
test_parser("", eps); // always matches
|
||||
//]
|
||||
|
||||
|
||||
//[reference_eps_if
|
||||
/*`This example simulates the "classic" `if_p` parser. Here, `int_` will be
|
||||
/*`This example simulates the "classic" `if_p` parser. Here, `int_` will be
|
||||
tried only if the condition, `c`, is true.
|
||||
*/
|
||||
bool c = true; // a flag
|
||||
test_parser("1234", eps(phx::ref(c) == true) >> int_);
|
||||
//]
|
||||
|
||||
|
||||
//[reference_eps_while
|
||||
/*`This example simulates the "classic" `while_p` parser. Here, the kleene loop
|
||||
will exit once the condition, `c`, becomes true. Notice that the condition, `c`,
|
||||
is turned to `false` when we get to parse `4`.
|
||||
*/
|
||||
test_phrase_parser("1 2 3 4",
|
||||
test_phrase_parser("1 2 3 4",
|
||||
*(eps(phx::ref(c) == true) >> int_[phx::ref(c) = (_1 == 4)]));
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// lazy
|
||||
{
|
||||
//[reference_using_declarations_lazy
|
||||
@@ -759,12 +759,12 @@ main()
|
||||
takes place at parse time.
|
||||
*/
|
||||
test_parser("Hello", lazy(val(string("Hello"))));
|
||||
|
||||
|
||||
//` The above is equivalent to:
|
||||
test_parser("Hello", val(string("Hello")));
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// char class
|
||||
{
|
||||
//[reference_using_declarations_char_class
|
||||
@@ -774,14 +774,14 @@ main()
|
||||
using boost::spirit::ascii::lower;
|
||||
//]
|
||||
|
||||
//[reference_char_class
|
||||
//[reference_char_class
|
||||
test_parser("1", alnum);
|
||||
test_parser(" ", blank);
|
||||
test_parser("1", digit);
|
||||
test_parser("a", lower);
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// uint
|
||||
{
|
||||
//[reference_using_declarations_uint
|
||||
@@ -794,22 +794,22 @@ main()
|
||||
//[reference_uint
|
||||
// unsigned int
|
||||
test_parser("12345", uint_);
|
||||
test_parser("12345", uint_(12345));
|
||||
test_parser("12345", uint_(12345));
|
||||
test_parser("12345", uint_(val(12345)));
|
||||
|
||||
// literals
|
||||
test_parser("12345", lit(12345));
|
||||
test_parser("12345", lit(val(12345)));
|
||||
test_parser("12345", lit(12345));
|
||||
test_parser("12345", lit(val(12345)));
|
||||
//]
|
||||
|
||||
//[reference_thousand_separated
|
||||
//`Thousand separated number parser:
|
||||
uint_parser<unsigned, 10, 1, 3> uint3_p; // 1..3 digits
|
||||
uint_parser<unsigned, 10, 3, 3> uint3_3_p; // exactly 3 digits
|
||||
uint_parser<unsigned, 10, 3, 3> uint3_3_p; // exactly 3 digits
|
||||
test_parser("12,345,678", uint3_p >> *(',' >> uint3_3_p));
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// int
|
||||
{
|
||||
//[reference_using_declarations_int
|
||||
@@ -820,18 +820,18 @@ main()
|
||||
|
||||
//[reference_int
|
||||
// signed int
|
||||
test_parser("+12345", int_);
|
||||
test_parser("+12345", int_);
|
||||
test_parser("-12345", int_);
|
||||
test_parser("+12345", int_(12345));
|
||||
test_parser("+12345", int_(12345));
|
||||
test_parser("-12345", int_(-12345));
|
||||
test_parser("+12345", int_(val(12345)));
|
||||
test_parser("-12345", int_(val(-12345)));
|
||||
|
||||
test_parser("+12345", int_(val(12345)));
|
||||
test_parser("-12345", int_(val(-12345)));
|
||||
|
||||
// literals
|
||||
test_parser("+12345", lit(12345));
|
||||
test_parser("+12345", lit(12345));
|
||||
test_parser("-12345", lit(-12345));
|
||||
test_parser("+12345", lit(val(12345)));
|
||||
test_parser("-12345", lit(val(-12345)));
|
||||
test_parser("+12345", lit(val(12345)));
|
||||
test_parser("-12345", lit(val(-12345)));
|
||||
//]
|
||||
}
|
||||
|
||||
@@ -841,6 +841,7 @@ main()
|
||||
using boost::phoenix::val;
|
||||
using boost::spirit::qi::double_;
|
||||
using boost::spirit::qi::real_parser;
|
||||
using boost::spirit::qi::lit;
|
||||
//]
|
||||
|
||||
//[reference_real
|
||||
@@ -872,6 +873,7 @@ main()
|
||||
using boost::phoenix::val;
|
||||
using boost::spirit::qi::bool_;
|
||||
using boost::spirit::qi::bool_parser;
|
||||
using boost::spirit::qi::lit;
|
||||
//]
|
||||
|
||||
//[reference_bool
|
||||
@@ -907,32 +909,32 @@ main()
|
||||
using boost::spirit::qi::_2;
|
||||
namespace bf = boost::fusion;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_sequence
|
||||
//`Simple usage:
|
||||
test_parser("xy", char_ >> char_);
|
||||
|
||||
|
||||
//`Extracting the attribute tuple (using __fusion__):
|
||||
bf::vector<char, char> attr;
|
||||
test_parser_attr("xy", char_ >> char_, attr);
|
||||
std::cout << bf::at_c<0>(attr) << ',' << bf::at_c<1>(attr) << std::endl;
|
||||
|
||||
|
||||
//`Extracting the attribute vector (using __stl__):
|
||||
std::vector<char> vec;
|
||||
test_parser_attr("xy", char_ >> char_, vec);
|
||||
std::cout << vec[0] << ',' << vec[1] << std::endl;
|
||||
|
||||
|
||||
//`Extracting the attributes using __qi_semantic_actions__ (using __phoenix__):
|
||||
test_parser("xy", (char_ >> char_)[std::cout << _1 << ',' << _2 << std::endl]);
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// sequential_or
|
||||
{
|
||||
//[reference_using_declarations_sequential_or
|
||||
using boost::spirit::qi::int_;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_sequential_or
|
||||
//`Correctly parsing a number with optional fractional digits:
|
||||
test_parser("123.456", int_ || ('.' >> int_)); // full
|
||||
@@ -940,14 +942,14 @@ main()
|
||||
test_parser(".456", int_ || ('.' >> int_)); // just the fraction
|
||||
|
||||
/*`A naive but incorrect solution would try to do this using optionals (e.g.):
|
||||
|
||||
|
||||
int_ >> -('.' >> int_) // will not match ".456"
|
||||
-int_ >> ('.' >> int_) // will not match "123"
|
||||
-int_ >> -('.' >> int_) // will match empty strings! Ooops.
|
||||
*/
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// alternative
|
||||
{
|
||||
//[reference_using_declarations_alternative
|
||||
@@ -956,7 +958,7 @@ main()
|
||||
using boost::spirit::qi::_1;
|
||||
using boost::variant;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_alternative
|
||||
//`Simple usage:
|
||||
test_parser("Hello", string("Hello") | int_);
|
||||
@@ -965,7 +967,7 @@ main()
|
||||
//`Extracting the attribute variant (using __boost_variant__):
|
||||
variant<std::string, int> attr;
|
||||
test_parser_attr("Hello", string("Hello") | int_, attr);
|
||||
|
||||
|
||||
/*`This should print `"Hello"`. Note: There are better ways to extract the value
|
||||
from the variant. See __boost_variant__ visitation. This code is solely
|
||||
for demonstration.
|
||||
@@ -982,19 +984,19 @@ main()
|
||||
//]
|
||||
|
||||
}
|
||||
|
||||
|
||||
// permutation
|
||||
{
|
||||
//[reference_using_declarations_permutation
|
||||
using boost::spirit::ascii::char_;
|
||||
//]
|
||||
|
||||
|
||||
//[reference_permutation
|
||||
//`Parse a string containing DNA codes (ACTG)
|
||||
test_parser("ACTGGCTAGACT", *(char_('A') ^ 'C' ^ 'T' ^ 'G'));
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// expect
|
||||
{
|
||||
//[reference_using_declarations_expect
|
||||
@@ -1019,7 +1021,7 @@ main()
|
||||
std::cout << "got: \"" << std::string(x.first, x.last) << '"' << std::endl;
|
||||
}
|
||||
/*`The code above will print:[teletype]
|
||||
|
||||
|
||||
expected: tag: literal-char, value: o
|
||||
got: "i"``[c++]``
|
||||
*/
|
||||
@@ -1031,14 +1033,14 @@ main()
|
||||
//[reference_and_predicate
|
||||
//`Some using declarations:
|
||||
using boost::spirit::lit;
|
||||
|
||||
|
||||
/*`Basic look-ahead example: make sure that the last character is a
|
||||
semicolon, but don't consume it, just peek at the next character:
|
||||
*/
|
||||
test_phrase_parser("Hello ;", lit("Hello") >> &lit(';'), false);
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// not-predicate
|
||||
{
|
||||
//[reference_not_predicate
|
||||
@@ -1047,20 +1049,20 @@ main()
|
||||
using boost::spirit::ascii::alpha;
|
||||
using boost::spirit::qi::lit;
|
||||
using boost::spirit::qi::symbols;
|
||||
|
||||
|
||||
/*`Here's an alternative to the `*(r - x) >> x` idiom using the
|
||||
not-predicate instead. This parses a list of characters terminated
|
||||
by a ';':
|
||||
*/
|
||||
test_parser("abcdef;", *(!lit(';') >> char_) >> ';');
|
||||
|
||||
/*`The following parser ensures that we match distinct keywords
|
||||
(stored in a symbol table). To do this, we make sure that the
|
||||
|
||||
/*`The following parser ensures that we match distinct keywords
|
||||
(stored in a symbol table). To do this, we make sure that the
|
||||
keyword does not follow an alpha or an underscore:
|
||||
*/
|
||||
symbols<char, int> keywords;
|
||||
keywords = "begin", "end", "for";
|
||||
|
||||
|
||||
// This should fail:
|
||||
test_parser("beginner", keywords >> !(alpha | '_'));
|
||||
|
||||
@@ -1071,37 +1073,37 @@ main()
|
||||
test_parser("for()", keywords >> !(alpha | '_'), false);
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// difference
|
||||
{
|
||||
//[reference_difference
|
||||
//`Some using declarations:
|
||||
using boost::spirit::ascii::char_;
|
||||
|
||||
|
||||
/*`Parse a C/C++ style comment:
|
||||
*/
|
||||
test_parser("/*A Comment*/", "/*" >> *(char_ - "*/") >> "*/");
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// kleene
|
||||
{
|
||||
//[reference_kleene
|
||||
//`Some using declarations:
|
||||
using boost::spirit::qi::int_;
|
||||
|
||||
|
||||
/*`Parse a comma separated list of numbers and put them in a vector:
|
||||
*/
|
||||
std::vector<int> attr;
|
||||
test_phrase_parser_attr(
|
||||
"111, 222, 333, 444, 555", int_ >> *(',' >> int_), attr);
|
||||
std::cout
|
||||
<< attr[0] << ',' << attr[1] << ',' << attr[2] << ','
|
||||
<< attr[3] << ',' << attr[4]
|
||||
std::cout
|
||||
<< attr[0] << ',' << attr[1] << ',' << attr[2] << ','
|
||||
<< attr[3] << ',' << attr[4]
|
||||
<< std::endl;
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// plus
|
||||
{
|
||||
//[reference_plus
|
||||
@@ -1109,7 +1111,7 @@ main()
|
||||
using boost::spirit::ascii::alpha;
|
||||
using boost::spirit::qi::lexeme;
|
||||
|
||||
/*`Parse one or more strings containing one or more alphabetic
|
||||
/*`Parse one or more strings containing one or more alphabetic
|
||||
characters and put them in a vector:
|
||||
*/
|
||||
std::vector<std::string> attr;
|
||||
@@ -1117,7 +1119,7 @@ main()
|
||||
std::cout << attr[0] << ',' << attr[1] << ',' << attr[2] << std::endl;
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// optional
|
||||
{
|
||||
//[reference_optional
|
||||
@@ -1129,29 +1131,29 @@ main()
|
||||
using boost::fusion::at_c;
|
||||
using boost::optional;
|
||||
|
||||
/*`Parse a person info with name (in quotes) optional age [footnote
|
||||
James Bond is shy about his age :-)] and optional sex, all
|
||||
/*`Parse a person info with name (in quotes) optional age [footnote
|
||||
James Bond is shy about his age :-)] and optional sex, all
|
||||
separated by comma.
|
||||
*/
|
||||
vector<std::string, optional<int>, optional<char> > attr;
|
||||
|
||||
|
||||
test_phrase_parser_attr(
|
||||
"\"James Bond\", M"
|
||||
, lexeme['"' >> +(char_ - '"') >> '"'] // name
|
||||
>> -(',' >> int_) // optional age
|
||||
>> -(',' >> char_) // optional sex
|
||||
, attr);
|
||||
|
||||
|
||||
// Should print: James Bond,M
|
||||
std::cout << at_c<0>(attr); // print name
|
||||
if (at_c<1>(attr)) // print optional age
|
||||
std::cout << ',' << *at_c<1>(attr);
|
||||
if (at_c<2>(attr)) // print optional sex
|
||||
std::cout << ',' << *at_c<2>(attr);
|
||||
std::cout << std::endl;
|
||||
std::cout << std::endl;
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// list
|
||||
{
|
||||
//[reference_list
|
||||
@@ -1163,9 +1165,9 @@ main()
|
||||
std::vector<int> attr;
|
||||
test_phrase_parser_attr(
|
||||
"111, 222, 333, 444, 555", int_ % ',', attr);
|
||||
std::cout
|
||||
<< attr[0] << ',' << attr[1] << ',' << attr[2] << ','
|
||||
<< attr[3] << ',' << attr[4]
|
||||
std::cout
|
||||
<< attr[0] << ',' << attr[1] << ',' << attr[2] << ','
|
||||
<< attr[3] << ',' << attr[4]
|
||||
<< std::endl;
|
||||
//]
|
||||
}
|
||||
@@ -1173,7 +1175,7 @@ main()
|
||||
// stream
|
||||
{
|
||||
//[reference_qi_stream
|
||||
//`Using declarations and variables:
|
||||
//`Using declarations and variables:
|
||||
using boost::spirit::qi::stream;
|
||||
using boost::spirit::qi::stream_parser;
|
||||
|
||||
@@ -1217,7 +1219,7 @@ main()
|
||||
// native binary
|
||||
{
|
||||
//[reference_qi_native_binary
|
||||
//`Using declarations and variables:
|
||||
//`Using declarations and variables:
|
||||
using boost::spirit::qi::byte_;
|
||||
using boost::spirit::qi::word;
|
||||
using boost::spirit::qi::dword;
|
||||
@@ -1235,7 +1237,7 @@ main()
|
||||
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
//->
|
||||
//`Basic usage of the native binary parsers for little endian platforms:
|
||||
//`Basic usage of the native binary parsers for little endian platforms:
|
||||
test_parser_attr("\x01", byte_, uc); assert(uc == 0x01);
|
||||
test_parser_attr("\x01\x02", word, us); assert(us == 0x0201);
|
||||
test_parser_attr("\x01\x02\x03\x04", dword, ui); assert(ui == 0x04030201);
|
||||
@@ -1253,20 +1255,20 @@ main()
|
||||
test_parser("\x01\x02\x03\x04", dword(0x04030201));
|
||||
//<-
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
//->
|
||||
//->
|
||||
test_parser("\x01\x02\x03\x04\x05\x06\x07\x08",
|
||||
qword(0x0807060504030201LL));
|
||||
//<-
|
||||
#endif
|
||||
#else
|
||||
//->
|
||||
//`Basic usage of the native binary parsers for big endian platforms:
|
||||
//`Basic usage of the native binary parsers for big endian platforms:
|
||||
test_parser_attr("\x01", byte_, uc); assert(uc == 0x01);
|
||||
test_parser_attr("\x01\x02", word, us); assert(us == 0x0102);
|
||||
test_parser_attr("\x01\x02\x03\x04", dword, ui); assert(ui == 0x01020304);
|
||||
//<-
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
//->
|
||||
//->
|
||||
test_parser_attr("\x01\x02\x03\x04\x05\x06\x07\x08", qword, ul);
|
||||
assert(0x0102030405060708LL);
|
||||
|
||||
@@ -1278,24 +1280,24 @@ main()
|
||||
test_parser("\x01\x02\x03\x04", dword(0x01020304));
|
||||
//<-
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
//->
|
||||
//->
|
||||
test_parser("\x01\x02\x03\x04\x05\x06\x07\x08",
|
||||
qword(0x0102030405060708LL));
|
||||
//<-
|
||||
#endif
|
||||
#endif
|
||||
//->
|
||||
//->
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// little binary
|
||||
{
|
||||
//[reference_qi_little_binary
|
||||
//`Using declarations and variables:
|
||||
//`Using declarations and variables:
|
||||
using boost::spirit::qi::little_word;
|
||||
using boost::spirit::qi::little_dword;
|
||||
using boost::spirit::qi::little_qword;
|
||||
|
||||
|
||||
boost::uint16_t us;
|
||||
boost::uint32_t ui;
|
||||
//<-
|
||||
@@ -1306,7 +1308,7 @@ main()
|
||||
#endif
|
||||
|
||||
//->
|
||||
//`Basic usage of the little endian binary parsers:
|
||||
//`Basic usage of the little endian binary parsers:
|
||||
test_parser_attr("\x01\x02", little_word, us); assert(us == 0x0201);
|
||||
test_parser_attr("\x01\x02\x03\x04", little_dword, ui); assert(ui == 0x04030201);
|
||||
//<-
|
||||
@@ -1322,23 +1324,23 @@ main()
|
||||
test_parser("\x01\x02\x03\x04", little_dword(0x04030201));
|
||||
//<-
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
//->
|
||||
//->
|
||||
test_parser("\x01\x02\x03\x04\x05\x06\x07\x08",
|
||||
little_qword(0x0807060504030201LL));
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
//->
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// big binary
|
||||
{
|
||||
//[reference_qi_big_binary
|
||||
//`Using declarations and variables:
|
||||
//`Using declarations and variables:
|
||||
using boost::spirit::qi::big_word;
|
||||
using boost::spirit::qi::big_dword;
|
||||
using boost::spirit::qi::big_qword;
|
||||
|
||||
|
||||
boost::uint16_t us;
|
||||
boost::uint32_t ui;
|
||||
//<-
|
||||
@@ -1349,12 +1351,12 @@ main()
|
||||
#endif
|
||||
|
||||
//->
|
||||
//`Basic usage of the big endian binary parsers:
|
||||
//`Basic usage of the big endian binary parsers:
|
||||
test_parser_attr("\x01\x02", big_word, us); assert(us == 0x0102);
|
||||
test_parser_attr("\x01\x02\x03\x04", big_dword, ui); assert(ui == 0x01020304);
|
||||
//<-
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
//->
|
||||
//->
|
||||
test_parser_attr("\x01\x02\x03\x04\x05\x06\x07\x08", big_qword, ul);
|
||||
assert(0x0102030405060708LL);
|
||||
|
||||
@@ -1365,15 +1367,15 @@ main()
|
||||
test_parser("\x01\x02\x03\x04", big_dword(0x01020304));
|
||||
//<-
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
//->
|
||||
//->
|
||||
test_parser("\x01\x02\x03\x04\x05\x06\x07\x08",
|
||||
big_qword(0x0102030405060708LL));
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
//->
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// rule
|
||||
{
|
||||
//[reference_rule
|
||||
@@ -1392,7 +1394,7 @@ main()
|
||||
rule<char const*> r;
|
||||
r = int_;
|
||||
test_parser("123", r);
|
||||
|
||||
|
||||
/*`Rule with synthesized attribute:
|
||||
*/
|
||||
rule<char const*, int()> ra;
|
||||
@@ -1400,7 +1402,7 @@ main()
|
||||
int i;
|
||||
test_parser_attr("123", ra, i);
|
||||
assert(i == 123);
|
||||
|
||||
|
||||
/*`Rule with skipper and synthesized attribute:
|
||||
*/
|
||||
rule<char const*, std::vector<int>(), space_type> rs;
|
||||
@@ -1410,7 +1412,7 @@ main()
|
||||
assert(v[0] == 123);
|
||||
assert(v[1] == 456);
|
||||
assert(v[2] == 789);
|
||||
|
||||
|
||||
/*`Rule with one local variable:
|
||||
*/
|
||||
rule<char const*, locals<char> > rl;
|
||||
@@ -1419,7 +1421,7 @@ main()
|
||||
test_parser("ax", rl); // fail
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
// grammar
|
||||
{
|
||||
using client::num_list;
|
||||
@@ -1438,6 +1440,6 @@ main()
|
||||
test_phrase_parser("123, 456, 789", nlist);
|
||||
//]
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace client
|
||||
("\\r", '\r')("\\t", '\t')("\\v", '\v')("\\\\", '\\')
|
||||
("\\\'", '\'')("\\\"", '\"')
|
||||
;
|
||||
|
||||
|
||||
unesc_str = qi::lit(qi::_r1)
|
||||
>> *(unesc_char | qi::alnum | "\\x" >> qi::hex)
|
||||
>> qi::lit(qi::_r1)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Spirit Repository 0.1</title>
|
||||
<title>Spirit Repository 0.2</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="home" href="index.html" title="Spirit Repository 0.2">
|
||||
<link rel="next" href="spirit_repository/preface.html" title="Preface">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="titlepage">
|
||||
<div>
|
||||
<div><h2 class="title">
|
||||
<a name="spirit_repository"></a>Spirit Repository 0.1</h2></div>
|
||||
<a name="spirit_repository"></a>Spirit Repository 0.2</h2></div>
|
||||
<div><div class="authorgroup">
|
||||
<div class="author"><h3 class="author">
|
||||
<span class="firstname">Joel</span> <span class="surname">de Guzman</span>
|
||||
@@ -31,9 +31,9 @@
|
||||
<span class="firstname">Hartmut</span> <span class="surname">Kaiser</span>
|
||||
</h3></div>
|
||||
</div></div>
|
||||
<div><p class="copyright">Copyright © 2001-2010 Joel de Guzman, Hartmut Kaiser</p></div>
|
||||
<div><p class="copyright">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id834034"></a><p>
|
||||
<a name="id863156"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@@ -62,11 +62,17 @@
|
||||
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/kwd.html">Qi
|
||||
Keyword Parser Directive </a></span></dt>
|
||||
</dl></dd>
|
||||
<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>
|
||||
<dt><span class="section"><a href="spirit_repository/qi_components/operators.html">Qi Parser
|
||||
Operators</a></span></dt>
|
||||
<dd><dl><dt><span class="section"><a href="spirit_repository/qi_components/operators/keyword_list.html">Keyword
|
||||
List Operator</a></span></dt></dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="spirit_repository/karma_components.html">Karma Components</a></span></dt>
|
||||
<dd><dl>
|
||||
@@ -79,11 +85,12 @@
|
||||
<dd><dl><dt><span class="section"><a href="spirit_repository/karma_components/nonterminal/subrule.html">Karma
|
||||
subrules</a></span></dt></dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="spirit_repository/acknowledgments.html">Acknowledgments</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"><p><small>Last revised: January 27, 2011 at 01:05:40 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: March 26, 2011 at 19:23:38 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
|
||||
<link rel="home" href="../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="up" href="../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="prev" href="qi_components/nonterminal/subrule.html" title="Qi subrules">
|
||||
<link rel="prev" href="qi_components/operators/keyword_list.html" title="Keyword List Operator">
|
||||
<link rel="next" href="karma_components/directives.html" title="Karma Generator Directives">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="qi_components/nonterminal/subrule.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="karma_components/directives.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="qi_components/operators/keyword_list.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="karma_components/directives.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
@@ -47,7 +47,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="qi_components/nonterminal/subrule.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="karma_components/directives.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="qi_components/operators/keyword_list.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="karma_components/directives.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<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.0">
|
||||
<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="home" href="../../../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="up" href="../directives.html" title="Karma Generator Directives">
|
||||
<link rel="prev" href="../directives.html" title="Karma Generator Directives">
|
||||
<link rel="next" href="../nonterminal.html" title="Karma Generator Non-terminals">
|
||||
@@ -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="id858383"></a>
|
||||
<a name="id898353"></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="id860372"></a>
|
||||
<a name="id899318"></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="id860445"></a>
|
||||
<a name="id899392"></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="id860493"></a>
|
||||
<a name="id899440"></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="id860657"></a>
|
||||
<a name="id899603"></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="id860832"></a>
|
||||
<a name="id899778"></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: <a href="../../../../../example/karma/confix.cpp" target="_top">confix.cpp</a>)
|
||||
</p>
|
||||
<a name="spirit_repository.karma_components.directives.karma_confix_generator.prerequisites"></a><h6>
|
||||
<a name="id860862"></a>
|
||||
<a name="id899808"></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="id861098"></a>
|
||||
<a name="id900044"></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="id861392"></a>
|
||||
<a name="id900338"></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>
|
||||
@@ -317,7 +317,7 @@
|
||||
</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>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
<title>Karma subrules</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="home" href="../../../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="up" href="../nonterminal.html" title="Karma Generator Non-terminals">
|
||||
<link rel="prev" href="../nonterminal.html" title="Karma Generator Non-terminals">
|
||||
<link rel="next" href="../../acknowledgments.html" title="Acknowledgments">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@@ -19,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../nonterminal.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../nonterminal.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="p" href="../nonterminal.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../nonterminal.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="../../acknowledgments.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
@@ -27,7 +28,7 @@
|
||||
subrules</a>
|
||||
</h4></div></div></div>
|
||||
<a name="spirit_repository.karma_components.nonterminal.subrule.description"></a><h6>
|
||||
<a name="id861721"></a>
|
||||
<a name="id900667"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.description">Description</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -85,21 +86,21 @@
|
||||
parts), whereas the rest can use rules and grammars.
|
||||
</p>
|
||||
<a name="spirit_repository.karma_components.nonterminal.subrule.header"></a><h6>
|
||||
<a name="id861987"></a>
|
||||
<a name="id900934"></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="id862064"></a>
|
||||
<a name="id901009"></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="id862128"></a>
|
||||
<a name="id901074"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.parameters__declaration_">Parameters
|
||||
(declaration)</a>
|
||||
</h6>
|
||||
@@ -169,7 +170,7 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="spirit_repository.karma_components.nonterminal.subrule.synopsis__usage_"></a><h6>
|
||||
<a name="id862263"></a>
|
||||
<a name="id902369"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.synopsis__usage_">Synopsis
|
||||
(usage)</a>
|
||||
</h6>
|
||||
@@ -198,7 +199,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="id862498"></a>
|
||||
<a name="id902605"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.parameters__usage_">Parameters
|
||||
(usage)</a>
|
||||
</h6>
|
||||
@@ -322,7 +323,7 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
<a name="spirit_repository.karma_components.nonterminal.subrule.groups"></a><h6>
|
||||
<a name="id862824"></a>
|
||||
<a name="id902931"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.groups">Groups</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -367,7 +368,7 @@
|
||||
</span><span class="special">;</span>
|
||||
</pre>
|
||||
<a name="spirit_repository.karma_components.nonterminal.subrule.attributes"></a><h6>
|
||||
<a name="id863218"></a>
|
||||
<a name="id903325"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.attributes">Attributes</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -396,7 +397,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="spirit_repository.karma_components.nonterminal.subrule.locals"></a><h6>
|
||||
<a name="id863306"></a>
|
||||
<a name="id903412"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.locals">Locals</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -406,7 +407,7 @@
|
||||
refer to the subrule's locals, if present.
|
||||
</p>
|
||||
<a name="spirit_repository.karma_components.nonterminal.subrule.example"></a><h6>
|
||||
<a name="id863342"></a>
|
||||
<a name="id903448"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -472,7 +473,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="id864368"></a>
|
||||
<a name="id904333"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.performance">Performance</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -483,7 +484,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="id864405"></a>
|
||||
<a name="id904370"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -499,7 +500,7 @@
|
||||
</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>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@@ -507,7 +508,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../nonterminal.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../nonterminal.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="p" href="../nonterminal.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../nonterminal.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="../../acknowledgments.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<title>Preface</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="../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="prev" href="../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="home" href="../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="up" href="../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="prev" href="../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="next" href="qi_components.html" title="Qi Components">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@@ -27,20 +27,20 @@
|
||||
<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="id834064"></a>
|
||||
<a name="id863183"></a>
|
||||
<a class="link" href="preface.html#spirit_repository.preface.the_spirit_repository">The Spirit
|
||||
Repository</a>
|
||||
</h4>
|
||||
<p>
|
||||
The <a href="http://spirit.sourceforge.net" target="_top">Spirit</a> repository is
|
||||
a community effort collecting different reusable components (primitives, directives,
|
||||
grammars, etc.) for <span class="emphasis"><em>Spirit.Qi</em></span> parsers and <span class="emphasis"><em>Spirit.Karma</em></span>
|
||||
The <a href="http://boost-spirit.com" target="_top">Spirit</a> repository is a community
|
||||
effort collecting different reusable components (primitives, directives, grammars,
|
||||
etc.) for <span class="emphasis"><em>Spirit.Qi</em></span> parsers and <span class="emphasis"><em>Spirit.Karma</em></span>
|
||||
generators. All components in the repository have been peer reviewed and/or
|
||||
discussed on the <a href="http://www.nabble.com/The-Spirit-Parser-Library-f3430.html" target="_top">Spirit
|
||||
General List</a>. The aim is to broaden the scope of the <a href="http://spirit.sourceforge.net" target="_top">Spirit</a>
|
||||
General List</a>. The aim is to broaden the scope of the <a href="http://boost-spirit.com" target="_top">Spirit</a>
|
||||
library while being able to maintain its high standards in terms of code quality,
|
||||
flexibility, and maintainability. At the same time it encourages people to
|
||||
contribute even small components as it lessens the hurdle of becoming a <a href="http://www.boost.org/" target="_top">Boost</a> and <a href="http://spirit.sourceforge.net" target="_top">Spirit</a>
|
||||
contribute even small components as it lessens the hurdle of becoming a <a href="http://www.boost.org/" target="_top">Boost</a> and <a href="http://boost-spirit.com" target="_top">Spirit</a>
|
||||
author.
|
||||
</p>
|
||||
<p>
|
||||
@@ -77,7 +77,7 @@
|
||||
core library.
|
||||
</p>
|
||||
<a name="spirit_repository.preface.how_to_use_this_manual"></a><h4>
|
||||
<a name="id834153"></a>
|
||||
<a name="id863271"></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="id834166"></a><p class="title"><b>Table 1. Icons</b></p>
|
||||
<a name="id863285"></a><p class="title"><b>Table 1. Icons</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Icons">
|
||||
<colgroup>
|
||||
<col>
|
||||
@@ -208,14 +208,14 @@
|
||||
Tools</a>.
|
||||
</p>
|
||||
<a name="spirit_repository.preface.support"></a><h4>
|
||||
<a name="id834422"></a>
|
||||
<a name="id863540"></a>
|
||||
<a class="link" href="preface.html#spirit_repository.preface.support">Support</a>
|
||||
</h4>
|
||||
<p>
|
||||
Please direct all questions to Spirit's mailing list. You can subscribe to
|
||||
the <a href="http://www.nabble.com/The-Spirit-Parser-Library-f3430.html" target="_top">Spirit
|
||||
General List</a>. The mailing list has a searchable archive. A search link
|
||||
to this archive is provided in <a href="http://spirit.sourceforge.net" target="_top">Spirit</a>'s
|
||||
to this archive is provided in <a href="http://boost-spirit.com" target="_top">Spirit</a>'s
|
||||
home page. You may also read and post messages to the mailing list through
|
||||
<a href="news://news.gmane.org/gmane.comp.spirit.general" target="_top">Spirit General
|
||||
NNTP news portal</a> (thanks to <a href="http://www.gmane.org" target="_top">Gmane</a>).
|
||||
@@ -224,7 +224,7 @@
|
||||
</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>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
||||
@@ -42,11 +42,17 @@
|
||||
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/kwd.html">Qi
|
||||
Keyword Parser Directive </a></span></dt>
|
||||
</dl></dd>
|
||||
<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>
|
||||
<dt><span class="section"><a href="qi_components/operators.html">Qi Parser
|
||||
Operators</a></span></dt>
|
||||
<dd><dl><dt><span class="section"><a href="qi_components/operators/keyword_list.html">Keyword
|
||||
List Operator</a></span></dt></dl></dd>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
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/kwd.html">Qi
|
||||
Keyword Parser Directive </a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<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.0">
|
||||
<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="home" href="../../../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="up" href="../directives.html" title="Qi Parser Directives">
|
||||
<link rel="prev" href="../directives.html" title="Qi Parser Directives">
|
||||
<link rel="next" href="distinct.html" title="Qi Distinct Parser Directive">
|
||||
@@ -28,7 +28,7 @@
|
||||
Confix Parser Directive</a>
|
||||
</h4></div></div></div>
|
||||
<a name="spirit_repository.qi_components.directives.confix.description"></a><h6>
|
||||
<a name="id847270"></a>
|
||||
<a name="id876299"></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="id848044"></a>
|
||||
<a name="id878160"></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="id848122"></a>
|
||||
<a name="id878238"></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="id848175"></a>
|
||||
<a name="id878291"></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="id848321"></a>
|
||||
<a name="id878437"></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="id848559"></a>
|
||||
<a name="id878675"></a>
|
||||
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -208,7 +208,7 @@
|
||||
see <a href="../../../../../example/qi/confix.cpp" target="_top">confix.cpp</a>)
|
||||
</p>
|
||||
<a name="spirit_repository.qi_components.directives.confix.prerequisites"></a><h6>
|
||||
<a name="id848594"></a>
|
||||
<a name="id878710"></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="id849004"></a>
|
||||
<a name="id879120"></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="id849575"></a>
|
||||
<a name="id879691"></a>
|
||||
<a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parsing_tagged_data">Parsing
|
||||
Tagged Data</a>
|
||||
</h6>
|
||||
@@ -324,7 +324,7 @@
|
||||
</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>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
<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.0">
|
||||
<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="home" href="../../../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="up" href="../directives.html" title="Qi Parser Directives">
|
||||
<link rel="prev" href="confix.html" title="Qi Confix Parser Directive">
|
||||
<link rel="next" href="../nonterminal.html" title="Qi Parser Non-terminals">
|
||||
<link rel="next" href="kwd.html" title="Qi Keyword Parser Directive">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="confix.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directives.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="../nonterminal.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="confix.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directives.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="kwd.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
@@ -28,7 +28,7 @@
|
||||
Distinct Parser Directive</a>
|
||||
</h4></div></div></div>
|
||||
<a name="spirit_repository.qi_components.directives.distinct.description"></a><h6>
|
||||
<a name="id849924"></a>
|
||||
<a name="id880040"></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="id851159"></a>
|
||||
<a name="id881275"></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="id851237"></a>
|
||||
<a name="id881353"></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="id851281"></a>
|
||||
<a name="id881397"></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="id851388"></a>
|
||||
<a name="id881504"></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="id851505"></a>
|
||||
<a name="id881621"></a>
|
||||
<a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -228,7 +228,7 @@
|
||||
parser. <a href="../../../../../example/qi/distinct.cpp" target="_top">distinct.cpp</a>)
|
||||
</p>
|
||||
<a name="spirit_repository.qi_components.directives.distinct.prerequisites"></a><h6>
|
||||
<a name="id851538"></a>
|
||||
<a name="id881654"></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="id851774"></a>
|
||||
<a name="id881890"></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>
|
||||
@@ -317,7 +317,7 @@
|
||||
</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>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@@ -325,7 +325,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="confix.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directives.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="../nonterminal.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="confix.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directives.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="kwd.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
|
||||
<link rel="home" href="../../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="up" href="../qi_components.html" title="Qi Components">
|
||||
<link rel="prev" href="directives/distinct.html" title="Qi Distinct Parser Directive">
|
||||
<link rel="prev" href="directives/kwd.html" title="Qi Keyword Parser Directive">
|
||||
<link rel="next" href="nonterminal/subrule.html" title="Qi subrules">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="directives/distinct.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="nonterminal/subrule.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="directives/kwd.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="nonterminal/subrule.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@@ -40,7 +40,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="directives/distinct.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="nonterminal/subrule.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="directives/kwd.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="nonterminal/subrule.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
<title>Qi subrules</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="home" href="../../../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="up" href="../nonterminal.html" title="Qi Parser Non-terminals">
|
||||
<link rel="prev" href="../nonterminal.html" title="Qi Parser Non-terminals">
|
||||
<link rel="next" href="../../karma_components.html" title="Karma Components">
|
||||
<link rel="next" href="../operators.html" title="Qi Parser Operators">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../nonterminal.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../nonterminal.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="../../karma_components.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="../nonterminal.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../nonterminal.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="../operators.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
@@ -28,7 +28,7 @@
|
||||
subrules</a>
|
||||
</h4></div></div></div>
|
||||
<a name="spirit_repository.qi_components.nonterminal.subrule.description"></a><h6>
|
||||
<a name="id854341"></a>
|
||||
<a name="id890393"></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="id854732"></a>
|
||||
<a name="id891331"></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="id854808"></a>
|
||||
<a name="id891406"></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="id854872"></a>
|
||||
<a name="id891471"></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="id855007"></a>
|
||||
<a name="id891606"></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="id855242"></a>
|
||||
<a name="id891841"></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="id855567"></a>
|
||||
<a name="id892166"></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="id855968"></a>
|
||||
<a name="id892567"></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="id856605"></a>
|
||||
<a name="id892657"></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="id856641"></a>
|
||||
<a name="id892693"></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="id857901"></a>
|
||||
<a name="id895182"></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="id857916"></a><p class="title"><b>Table 2. Subrules performance</b></p>
|
||||
<a name="id895198"></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="id858309"></a>
|
||||
<a name="id895590"></a>
|
||||
<a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -777,7 +777,7 @@
|
||||
</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>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@@ -785,7 +785,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../nonterminal.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../nonterminal.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="../../karma_components.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="../nonterminal.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../nonterminal.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="../operators.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<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="home" href="../../../index.html" title="Spirit Repository 0.2">
|
||||
<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">
|
||||
@@ -28,7 +28,7 @@
|
||||
advance Parser</a>
|
||||
</h4></div></div></div>
|
||||
<a name="spirit_repository.qi_components.primitive.advance.description"></a><h6>
|
||||
<a name="id834496"></a>
|
||||
<a name="id863615"></a>
|
||||
<a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.description">Description</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -45,7 +45,7 @@
|
||||
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 class="programlisting">00 00 00 01 77 fc b4 51 0a b3 b7 ... 1e 60 70 b6 00 00 01 00
|
||||
</pre>
|
||||
<p>
|
||||
If the first 4 bytes are a little-endian 32-bit integer describing the
|
||||
@@ -66,20 +66,20 @@
|
||||
<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 name="id871597"></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 name="id871675"></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 name="id871712"></a>
|
||||
<a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="informaltable"><table class="table">
|
||||
@@ -113,7 +113,7 @@
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<a name="spirit_repository.qi_components.primitive.advance.attribute"></a><h6>
|
||||
<a name="id842759"></a>
|
||||
<a name="id871783"></a>
|
||||
<a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.attribute">Attribute</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -123,7 +123,7 @@
|
||||
<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 name="id871837"></a>
|
||||
<a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -132,7 +132,7 @@
|
||||
binary data (for the full example code see <a href="../../../../../example/qi/advance.cpp" target="_top">advance.cpp</a>)
|
||||
</p>
|
||||
<a name="spirit_repository.qi_components.primitive.advance.prerequisites"></a><h6>
|
||||
<a name="id842848"></a>
|
||||
<a name="id871872"></a>
|
||||
<a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.prerequisites">Prerequisites</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -162,7 +162,7 @@
|
||||
<p>
|
||||
</p>
|
||||
<a name="spirit_repository.qi_components.primitive.advance.setting_up_the_grammar"></a><h6>
|
||||
<a name="id843119"></a>
|
||||
<a name="id872143"></a>
|
||||
<a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.setting_up_the_grammar">Setting
|
||||
up the Grammar</a>
|
||||
</h6>
|
||||
@@ -206,7 +206,7 @@
|
||||
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 name="id872598"></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>
|
||||
@@ -245,7 +245,7 @@
|
||||
<p>
|
||||
</p>
|
||||
<a name="spirit_repository.qi_components.primitive.advance.parsing_the_alternative_representation"></a><h6>
|
||||
<a name="id844258"></a>
|
||||
<a name="id873282"></a>
|
||||
<a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.parsing_the_alternative_representation">Parsing
|
||||
the Alternative Representation</a>
|
||||
</h6>
|
||||
@@ -284,7 +284,7 @@
|
||||
<p>
|
||||
</p>
|
||||
<a name="spirit_repository.qi_components.primitive.advance.notes"></a><h6>
|
||||
<a name="id846009"></a>
|
||||
<a name="id875038"></a>
|
||||
<a class="link" href="advance.html#spirit_repository.qi_components.primitive.advance.notes">Notes</a>
|
||||
</h6>
|
||||
<p>
|
||||
@@ -295,7 +295,7 @@
|
||||
</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>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<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.0">
|
||||
<link rel="home" href="../../../index.html" title="Spirit Repository 0.1">
|
||||
<link rel="home" href="../../../index.html" title="Spirit Repository 0.2">
|
||||
<link rel="up" 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">
|
||||
@@ -28,7 +28,7 @@
|
||||
flush_multi_pass parser</a>
|
||||
</h4></div></div></div>
|
||||
<a name="spirit_repository.qi_components.primitive.flush_multi_pass.description"></a><h6>
|
||||
<a name="id846049"></a>
|
||||
<a name="id875078"></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="id846157"></a>
|
||||
<a name="id875186"></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="id846230"></a>
|
||||
<a name="id875259"></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="id846252"></a>
|
||||
<a name="id875280"></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="id846276"></a>
|
||||
<a name="id875304"></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="id846325"></a>
|
||||
<a name="id875354"></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: <a href="../../../../../example/qi/flush_multi_pass.cpp" target="_top">flush_multi_pass.cpp</a>)
|
||||
</p>
|
||||
<a name="spirit_repository.qi_components.primitive.flush_multi_pass.prerequisites"></a><h6>
|
||||
<a name="id846357"></a>
|
||||
<a name="id875386"></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="id846566"></a>
|
||||
<a name="id875595"></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>
|
||||
@@ -193,7 +193,7 @@
|
||||
</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>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 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 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
[def __qi_advance__ [link spirit_repository.qi_components.primitive.advance `advance`]]
|
||||
[def __qi_subrule__ [link spirit_repository.qi_components.nonterminal.subrule `subrule`]]
|
||||
[def __qi_confix__ [link spirit_repository.qi_components.directives.confix `confix`]]
|
||||
[def __qi_keywords__ [link spirit_repository.qi_components.operators.keyword_list keyword_list]]
|
||||
[def __qi_keywords_list__ [link spirit_repository.qi_components.directives.kwd `kwd()[]`]]
|
||||
|
||||
[def __karma_subrule__ [link spirit_repository.karma_components.nonterminal.subrule `subrule`]]
|
||||
|
||||
|
||||
72
test/Jamfile
72
test/Jamfile
@@ -7,6 +7,24 @@
|
||||
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#==============================================================================
|
||||
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
import modules ;
|
||||
import feature ;
|
||||
|
||||
###############################################################################
|
||||
# new feature definition allowing to switch between Phoenix V2 and V3 tests
|
||||
feature.feature phoenix_v3
|
||||
: off on
|
||||
: composite propagated
|
||||
;
|
||||
|
||||
feature.compose <phoenix_v3>on
|
||||
: <define>BOOST_SPIRIT_USE_PHOENIX_V3=1
|
||||
;
|
||||
|
||||
###############################################################################
|
||||
project spirit_v2x/test
|
||||
: requirements
|
||||
<include>.
|
||||
@@ -15,12 +33,34 @@ project spirit_v2x/test
|
||||
:
|
||||
:
|
||||
;
|
||||
|
||||
v2_tests = ;
|
||||
v3_tests = ;
|
||||
|
||||
rule run ( sources + : args * : input-files * : requirements * : target-name ? : default-build * )
|
||||
{
|
||||
target-name ?= $(sources[1]:D=:S=) ;
|
||||
v2_tests += [ testing.run $(sources) : $(args) : $(input-files) : $(requirements) : $(target-name)-p2 : $(default-build) ] ;
|
||||
v3_tests += [ testing.run $(sources) : $(args) : $(input-files) : $(requirements) <phoenix_v3>on : $(target-name)-p3 : $(default-build) ] ;
|
||||
}
|
||||
|
||||
rule compile ( sources + : requirements * : target-name ? )
|
||||
{
|
||||
target-name ?= $(sources[1]:D=:S=) ;
|
||||
v2_tests += [ testing.compile $(sources) : $(requirements) : $(target-name)-p2 ] ;
|
||||
v3_tests += [ testing.compile $(sources) : $(requirements) <phoenix_v3>on : $(target-name)-p3 ] ;
|
||||
}
|
||||
|
||||
rule compile-fail ( sources + : requirements * : target-name ? )
|
||||
{
|
||||
target-name ?= $(sources[1]:D=:S=) ;
|
||||
v2_tests += [ testing.compile-fail $(sources) : $(requirements) : $(target-name)-p2 ] ;
|
||||
v3_tests += [ testing.compile-fail $(sources) : $(requirements) <phoenix_v3>on : $(target-name)-p3 ] ;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
path-constant LEX_DIR : $(BOOST_ROOT)/libs/spirit/test/lex ;
|
||||
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
{
|
||||
###########################################################################
|
||||
test-suite spirit_v2/qi :
|
||||
@@ -201,6 +241,7 @@ import testing ;
|
||||
[ run karma/regression_semantic_action_attribute.cpp : : : : karma_regression_semantic_action_attribute ]
|
||||
[ run karma/regression_real_scientific.cpp : : : : karma_regression_real_scientific ]
|
||||
[ compile karma/regression_const_real_policies.cpp : : regression_const_real_policies ]
|
||||
[ run karma/regression_numerics_adapt_adt.cpp : : : : karma_regression_numerics_adapt_adt ]
|
||||
|
||||
;
|
||||
|
||||
@@ -230,9 +271,15 @@ import testing ;
|
||||
[ run lex/regression_basic_lexer.cpp : : : : lex_regression_basic_lexer ]
|
||||
[ run lex/regression_matlib_dynamic.cpp : : : : lex_regression_matlib_dynamic ]
|
||||
[ run lex/regression_matlib_generate.cpp : $(LEX_DIR)/matlib_static.h : : : lex_regression_matlib_generate ]
|
||||
[ run lex/regression_matlib_static.cpp : : : <dependency>.//lex_regression_matlib_generate : lex_regression_matlib_static ]
|
||||
[ run lex/regression_matlib_static.cpp : : :
|
||||
<phoenix_v3>on:<dependency>.//lex_regression_matlib_generate-p3
|
||||
<phoenix_v3>off:<dependency>.//lex_regression_matlib_generate-p2
|
||||
: lex_regression_matlib_static ]
|
||||
[ run lex/regression_matlib_generate_switch.cpp : $(LEX_DIR)/matlib_static_switch.h : : : lex_regression_matlib_generate_switch ]
|
||||
[ run lex/regression_matlib_switch.cpp : : : <dependency>.//lex_regression_matlib_generate_switch : lex_regression_matlib_switch ]
|
||||
[ run lex/regression_matlib_switch.cpp : : :
|
||||
<phoenix_v3>on:<dependency>.//lex_regression_matlib_generate_switch-p3
|
||||
<phoenix_v3>off:<dependency>.//lex_regression_matlib_generate_switch-p2
|
||||
: lex_regression_matlib_switch ]
|
||||
[ run lex/regression_word_count.cpp : : : : lex_regression_word_count ]
|
||||
[ run lex/regression_syntax_error.cpp : : : : lex_regression_syntax_error ]
|
||||
[ run lex/regression_wide.cpp : : : : lex_regression_wide ]
|
||||
@@ -262,3 +309,18 @@ import testing ;
|
||||
;
|
||||
}
|
||||
|
||||
# use this alias to build Spirit against Phoenix V2
|
||||
alias test_using_phoenix_v2 : $(v2_tests) ;
|
||||
|
||||
# use this alias to build Spirit against Phoenix V3
|
||||
alias test_using_phoenix_v3 : $(v3_tests) ;
|
||||
|
||||
# We keep both aliases non-explicit to invoke tests for Phoenix V2 and V3
|
||||
# while running the regerssion tests.
|
||||
#
|
||||
# If you want to avoid running tests for both Phoenix V2 and V3 by default
|
||||
# then simply uncomment the following 'explicit' command. If no target is
|
||||
# specified, only the V2 tests will be run.
|
||||
#
|
||||
# explicit test_using_phoenix_v2 test_using_phoenix_v3 ;
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/spirit/include/phoenix_limits.hpp>
|
||||
|
||||
#include <boost/fusion/include/struct.hpp>
|
||||
#include <boost/fusion/include/nview.hpp>
|
||||
|
||||
|
||||
61
test/karma/regression_numerics_adapt_adt.cpp
Normal file
61
test/karma/regression_numerics_adapt_adt.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
// Copyright (c) 2011 Colin Rundel
|
||||
//
|
||||
// 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)
|
||||
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/fusion/include/adapt_adt.hpp>
|
||||
|
||||
#include <boost/spirit/include/karma.hpp>
|
||||
#include <boost/spirit/include/support_adapt_adt_attributes.hpp>
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class box
|
||||
{
|
||||
private:
|
||||
int width_;
|
||||
int height_;
|
||||
|
||||
public:
|
||||
|
||||
box()
|
||||
: width_(400),
|
||||
height_(400) {}
|
||||
|
||||
box(int width, int height)
|
||||
: width_(width),
|
||||
height_(height) {}
|
||||
|
||||
int width() const { return width_;}
|
||||
int height() const { return height_;}
|
||||
|
||||
void set_width(int width) { width_=width;}
|
||||
void set_height(int height) { height_=height;}
|
||||
};
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
box,
|
||||
(int, int, obj.width(), obj.set_width(val) )
|
||||
(int, int, obj.height(), obj.set_height(val) )
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int main ()
|
||||
{
|
||||
using spirit_test::test;
|
||||
|
||||
{
|
||||
using boost::spirit::karma::int_;
|
||||
|
||||
box b(800, 600);
|
||||
BOOST_TEST(test("width: 800\nheight: 600\n",
|
||||
"width: " << int_ << "\n" << "height: " << int_ << "\n", b));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -34,10 +34,15 @@ using namespace spirit_test;
|
||||
struct seqsize_impl
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct result
|
||||
struct result
|
||||
: boost::fusion::result_of::size<Sequence>
|
||||
{};
|
||||
|
||||
template <typename This, typename Sequence>
|
||||
struct result<This(Sequence)>
|
||||
: result<typename boost::proto::detail::uncvref<Sequence>::type>
|
||||
{};
|
||||
|
||||
template <typename Sequence>
|
||||
typename result<Sequence>::type
|
||||
operator()(Sequence const& seq) const
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <boost/mpl/print.hpp>
|
||||
|
||||
#include <boost/spirit/include/support_utree.hpp>
|
||||
#include <boost/spirit/include/karma.hpp>
|
||||
#include <boost/spirit/include/support_utree.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <boost/mpl/print.hpp>
|
||||
|
||||
#include <boost/spirit/include/support_utree.hpp>
|
||||
#include <boost/spirit/include/karma.hpp>
|
||||
#include <boost/spirit/include/support_utree.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <boost/mpl/print.hpp>
|
||||
|
||||
#include <boost/spirit/include/support_utree.hpp>
|
||||
#include <boost/spirit/include/karma.hpp>
|
||||
#include <boost/spirit/include/support_utree.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -15,16 +15,12 @@
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/spirit/include/phoenix.hpp>
|
||||
|
||||
#include <boost/spirit/include/support_multi_pass.hpp>
|
||||
#include <boost/spirit/include/classic_position_iterator.hpp>
|
||||
#include <boost/spirit/include/lex_lexertl.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/core.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement.hpp>
|
||||
#include <boost/spirit/home/phoenix/object.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl.hpp>
|
||||
|
||||
namespace spirit = boost::spirit;
|
||||
namespace lex = spirit::lex;
|
||||
namespace phoenix = boost::phoenix;
|
||||
|
||||
@@ -48,7 +48,7 @@ struct multi_tokens : lex::lexer<Lexer>
|
||||
_end = _start
|
||||
]
|
||||
.else_ [
|
||||
_state = "INITIAL"
|
||||
_state = "INITIAL"
|
||||
]
|
||||
]
|
||||
;
|
||||
|
||||
@@ -11,10 +11,7 @@
|
||||
#include <boost/spirit/include/classic_position_iterator.hpp>
|
||||
#include <boost/spirit/include/lex_lexertl.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/core.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement.hpp>
|
||||
#include <boost/spirit/home/phoenix/object.hpp>
|
||||
#include <boost/spirit/include/phoenix.hpp>
|
||||
|
||||
namespace spirit = boost::spirit;
|
||||
namespace lex = spirit::lex;
|
||||
|
||||
@@ -26,7 +26,7 @@ struct switch_state_tokens : boost::spirit::lex::lexer<Lexer>
|
||||
this->self = identifier [ phoenix::ref(state_) = _state ];
|
||||
|
||||
integer = "[0-9]+";
|
||||
this->self("INT") = integer [ _state = phoenix::val("INITIAL") ];
|
||||
this->self("INT") = integer [ _state = "INITIAL" ];
|
||||
}
|
||||
|
||||
std::string state_;
|
||||
|
||||
@@ -13,11 +13,7 @@
|
||||
#include <boost/spirit/include/classic_position_iterator.hpp>
|
||||
#include <boost/spirit/include/lex_lexertl.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/core.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement.hpp>
|
||||
#include <boost/spirit/home/phoenix/object.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl.hpp>
|
||||
#include <boost/spirit/include/phoenix.hpp>
|
||||
|
||||
namespace spirit = boost::spirit;
|
||||
namespace lex = spirit::lex;
|
||||
@@ -41,14 +37,14 @@ make_file_iterator(std::istream& input, const std::string& filename)
|
||||
|
||||
struct identifier
|
||||
{
|
||||
identifier(file_iterator begin, file_iterator end)
|
||||
identifier(file_iterator, file_iterator)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct string_literal
|
||||
{
|
||||
string_literal(file_iterator begin, file_iterator end)
|
||||
string_literal(file_iterator, file_iterator)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,11 +13,7 @@
|
||||
#include <boost/spirit/include/classic_position_iterator.hpp>
|
||||
#include <boost/spirit/include/lex_lexertl.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/core.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement.hpp>
|
||||
#include <boost/spirit/home/phoenix/object.hpp>
|
||||
#include <boost/spirit/home/phoenix/stl.hpp>
|
||||
#include <boost/spirit/include/phoenix.hpp>
|
||||
|
||||
namespace spirit = boost::spirit;
|
||||
namespace lex = spirit::lex;
|
||||
@@ -39,14 +35,14 @@ make_file_iterator(std::istream& input, const std::string& filename)
|
||||
|
||||
struct identifier
|
||||
{
|
||||
identifier(file_iterator begin, file_iterator end)
|
||||
identifier(file_iterator, file_iterator)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct string_literal
|
||||
{
|
||||
string_literal(file_iterator begin, file_iterator end)
|
||||
string_literal(file_iterator, file_iterator)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
#include <boost/spirit/include/classic_position_iterator.hpp>
|
||||
#include <boost/spirit/include/lex_lexertl.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/core.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement.hpp>
|
||||
#include <boost/spirit/home/phoenix/object.hpp>
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
#include <boost/spirit/include/phoenix_statement.hpp>
|
||||
#include <boost/spirit/include/phoenix_object.hpp>
|
||||
#include <boost/spirit/include/phoenix_stl.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@@ -43,7 +44,7 @@ make_file_iterator(std::istream& input, const std::string& filename)
|
||||
|
||||
struct string_literal
|
||||
{
|
||||
string_literal(file_iterator begin, file_iterator end)
|
||||
string_literal(file_iterator, file_iterator)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -59,7 +60,7 @@ struct lexer
|
||||
{
|
||||
lex::token_def<> string_lookahead('\'');
|
||||
self("LA") = string_lookahead;
|
||||
|
||||
|
||||
// make sure lookahead is implicitly evaluated using the lexer state
|
||||
// the token_def has been associated with
|
||||
self = st [
|
||||
@@ -77,14 +78,14 @@ int main()
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "'foo''bar'";
|
||||
|
||||
|
||||
file_iterator begin = make_file_iterator(ss, "SS");
|
||||
file_iterator end;
|
||||
|
||||
|
||||
lexer l;
|
||||
token_iterator begin2 = l.begin(begin, end);
|
||||
token_iterator end2 = l.end();
|
||||
|
||||
|
||||
char const* test_data[] = { "1,'foo'", "1,'foo''bar'" };
|
||||
std::size_t const test_data_size = sizeof(test_data)/sizeof(test_data[0]);
|
||||
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
#include <boost/spirit/include/classic_position_iterator.hpp>
|
||||
#include <boost/spirit/include/lex_lexertl.hpp>
|
||||
|
||||
#include <boost/spirit/home/phoenix/core.hpp>
|
||||
#include <boost/spirit/home/phoenix/operator.hpp>
|
||||
#include <boost/spirit/home/phoenix/statement.hpp>
|
||||
#include <boost/spirit/home/phoenix/object.hpp>
|
||||
#include <boost/spirit/include/phoenix.hpp>
|
||||
|
||||
namespace spirit = boost::spirit;
|
||||
namespace lex = spirit::lex;
|
||||
|
||||
@@ -59,6 +59,7 @@ test_data data[] =
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
struct test_impl
|
||||
{
|
||||
typedef void result_type;
|
||||
template <typename TokenId, typename Value>
|
||||
struct result { typedef void type; };
|
||||
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/lex_lexertl.hpp>
|
||||
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
#include <boost/spirit/include/phoenix_statement.hpp>
|
||||
#include <boost/spirit/include/phoenix_container.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
#include <boost/spirit/include/qi_action.hpp>
|
||||
#include <boost/spirit/include/qi_nonterminal.hpp>
|
||||
#include <boost/spirit/include/qi_auxiliary.hpp>
|
||||
#include <boost/spirit/include/qi_rule.hpp>
|
||||
#include <boost/spirit/include/support_argument.hpp>
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/spirit/include/phoenix_operator.hpp>
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
@@ -55,6 +57,26 @@ struct test_action_2
|
||||
}
|
||||
};
|
||||
|
||||
struct DIgnore
|
||||
{
|
||||
std::string text;
|
||||
};
|
||||
|
||||
struct DInclude
|
||||
{
|
||||
std::string FileName;
|
||||
};
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
DIgnore,
|
||||
(std::string, text)
|
||||
)
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
DInclude,
|
||||
(std::string, FileName)
|
||||
)
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
@@ -228,6 +250,15 @@ main()
|
||||
rule<std::string::const_iterator, value_type()> r1 = r1 | eps;
|
||||
}
|
||||
|
||||
{
|
||||
using boost::spirit::qi::rule;
|
||||
typedef boost::variant<DIgnore, DInclude> DLine;
|
||||
|
||||
rule<char*, DIgnore()> ignore;
|
||||
rule<char*, DInclude()> include;
|
||||
rule<char*, DLine()> line = include | ignore;
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/spirit/include/phoenix_limits.hpp>
|
||||
|
||||
#include <boost/fusion/include/struct.hpp>
|
||||
#include <boost/fusion/include/nview.hpp>
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <boost/config/warning_disable.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/spirit/include/phoenix_limits.hpp>
|
||||
|
||||
#include <boost/fusion/include/struct.hpp>
|
||||
#include <boost/fusion/include/nview.hpp>
|
||||
|
||||
|
||||
187
test/qi/radix_test.cpp
Normal file
187
test/qi/radix_test.cpp
Normal file
@@ -0,0 +1,187 @@
|
||||
#include "uint.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using spirit_test::test;
|
||||
using spirit_test::test_attr;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// arbitrary radix test (base 3)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
using boost::spirit::qi::uint_;
|
||||
using boost::spirit::qi::uint_parser;
|
||||
unsigned int u;
|
||||
|
||||
uint_parser<unsigned int, 3, 1, -1> base3_parser;
|
||||
|
||||
BOOST_TEST(test("210112221200", base3_parser));
|
||||
BOOST_TEST(test_attr("210112221200", base3_parser, u));
|
||||
BOOST_TEST(424242 == u);
|
||||
|
||||
BOOST_TEST(!test("1231", base3_parser));
|
||||
BOOST_TEST(!test_attr("1231", base3_parser, u));
|
||||
|
||||
char const* max_unsigned_base3 = "102002022201221111210";
|
||||
char const* unsigned_overflow_base3 = "102002022201221111211";
|
||||
char const* digit_overflow_base3 = "1020020222012211112100";
|
||||
|
||||
BOOST_TEST(test(max_unsigned_base3, base3_parser));
|
||||
BOOST_TEST(test_attr(max_unsigned_base3, base3_parser, u));
|
||||
|
||||
BOOST_TEST(!test(unsigned_overflow_base3, base3_parser));
|
||||
BOOST_TEST(!test_attr(unsigned_overflow_base3, base3_parser, u));
|
||||
BOOST_TEST(!test(digit_overflow_base3, base3_parser));
|
||||
BOOST_TEST(!test_attr(digit_overflow_base3, base3_parser, u));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// arbitrary radix test (base 4)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
using boost::spirit::qi::uint_;
|
||||
using boost::spirit::qi::uint_parser;
|
||||
unsigned int u;
|
||||
|
||||
uint_parser<unsigned int, 4, 1, -1> base4_parser;
|
||||
|
||||
BOOST_TEST(test("1213210302", base4_parser));
|
||||
BOOST_TEST(test_attr("1213210302", base4_parser, u));
|
||||
BOOST_TEST(424242 == u);
|
||||
|
||||
BOOST_TEST(!test("1234", base4_parser));
|
||||
BOOST_TEST(!test_attr("1234", base4_parser, u));
|
||||
|
||||
char const* max_unsigned_base4 = "3333333333333333";
|
||||
char const* unsigned_overflow_base4 = "33333333333333330";
|
||||
BOOST_TEST(test(max_unsigned_base4, base4_parser));
|
||||
BOOST_TEST(test_attr(max_unsigned_base4, base4_parser, u));
|
||||
BOOST_TEST(!test(unsigned_overflow_base4, base4_parser));
|
||||
BOOST_TEST(!test_attr(unsigned_overflow_base4, base4_parser, u));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// arbitrary radix test (base 5)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
using boost::spirit::qi::uint_;
|
||||
using boost::spirit::qi::uint_parser;
|
||||
unsigned int u;
|
||||
|
||||
uint_parser<unsigned int, 5, 1, -1> base5_parser;
|
||||
|
||||
BOOST_TEST(test("102033432", base5_parser));
|
||||
BOOST_TEST(test_attr("102033432", base5_parser, u));
|
||||
BOOST_TEST(424242 == u);
|
||||
|
||||
BOOST_TEST(!test("2345", base5_parser));
|
||||
BOOST_TEST(!test_attr("2345", base5_parser, u));
|
||||
|
||||
char const* max_unsigned_base5 = "32244002423140";
|
||||
char const* unsigned_overflow_base5 = "32244002423141";
|
||||
char const* digit_overflow_base5 = "322440024231400";
|
||||
|
||||
BOOST_TEST(test(max_unsigned_base5, base5_parser));
|
||||
BOOST_TEST(test_attr(max_unsigned_base5, base5_parser, u));
|
||||
|
||||
BOOST_TEST(!test(unsigned_overflow_base5, base5_parser));
|
||||
BOOST_TEST(!test_attr(unsigned_overflow_base5, base5_parser, u));
|
||||
BOOST_TEST(!test(digit_overflow_base5, base5_parser));
|
||||
BOOST_TEST(!test_attr(digit_overflow_base5, base5_parser, u));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// arbitrary radix test (base 6)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
using boost::spirit::qi::uint_;
|
||||
using boost::spirit::qi::uint_parser;
|
||||
unsigned int u;
|
||||
|
||||
uint_parser<unsigned int, 6, 1, -1> base6_parser;
|
||||
|
||||
BOOST_TEST(test("13032030", base6_parser));
|
||||
BOOST_TEST(test_attr("13032030", base6_parser, u));
|
||||
BOOST_TEST(424242 == u);
|
||||
|
||||
BOOST_TEST(!test("3456", base6_parser));
|
||||
BOOST_TEST(!test_attr("3456", base6_parser, u));
|
||||
|
||||
char const* max_unsigned_base6 = "1550104015503";
|
||||
char const* unsigned_overflow_base6 = "1550104015504";
|
||||
char const* digit_overflow_base6 = "15501040155030";
|
||||
|
||||
BOOST_TEST(test(max_unsigned_base6, base6_parser));
|
||||
BOOST_TEST(test_attr(max_unsigned_base6, base6_parser, u));
|
||||
|
||||
BOOST_TEST(!test(unsigned_overflow_base6, base6_parser));
|
||||
BOOST_TEST(!test_attr(unsigned_overflow_base6, base6_parser, u));
|
||||
BOOST_TEST(!test(digit_overflow_base6, base6_parser));
|
||||
BOOST_TEST(!test_attr(digit_overflow_base6, base6_parser, u));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// arbitrary radix test (base 7)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
using boost::spirit::qi::uint_;
|
||||
using boost::spirit::qi::uint_parser;
|
||||
unsigned int u;
|
||||
|
||||
uint_parser<unsigned int, 7, 1, -1> base7_parser;
|
||||
|
||||
BOOST_TEST(test("3414600", base7_parser));
|
||||
BOOST_TEST(test_attr("3414600", base7_parser, u));
|
||||
BOOST_TEST(424242 == u);
|
||||
|
||||
BOOST_TEST(!test("4567", base7_parser));
|
||||
BOOST_TEST(!test_attr("4567", base7_parser, u));
|
||||
|
||||
char const* max_unsigned_base7 = "211301422353";
|
||||
char const* unsigned_overflow_base7 = "211301422354";
|
||||
char const* digit_overflow_base7 = "2113014223530";
|
||||
|
||||
BOOST_TEST(test(max_unsigned_base7, base7_parser));
|
||||
BOOST_TEST(test_attr(max_unsigned_base7, base7_parser, u));
|
||||
|
||||
BOOST_TEST(!test(unsigned_overflow_base7, base7_parser));
|
||||
BOOST_TEST(!test_attr(unsigned_overflow_base7, base7_parser, u));
|
||||
BOOST_TEST(!test(digit_overflow_base7, base7_parser));
|
||||
BOOST_TEST(!test_attr(digit_overflow_base7, base7_parser, u));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// arbitrary radix test (base 7)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
using boost::spirit::qi::uint_;
|
||||
using boost::spirit::qi::uint_parser;
|
||||
unsigned int u;
|
||||
|
||||
uint_parser<unsigned int, 9, 1, -1> base9_parser;
|
||||
|
||||
BOOST_TEST(test("715850", base9_parser));
|
||||
BOOST_TEST(test_attr("715850", base9_parser, u));
|
||||
BOOST_TEST(424242 == u);
|
||||
|
||||
BOOST_TEST(!test("6789", base9_parser));
|
||||
BOOST_TEST(!test_attr("6789", base9_parser, u));
|
||||
|
||||
char const* max_unsigned_base9 = "12068657453";
|
||||
char const* unsigned_overflow_base9 = "12068657454";
|
||||
char const* digit_overflow_base9 = "120686574530";
|
||||
|
||||
BOOST_TEST(test(max_unsigned_base9, base9_parser));
|
||||
BOOST_TEST(test_attr(max_unsigned_base9, base9_parser, u));
|
||||
|
||||
BOOST_TEST(!test(unsigned_overflow_base9, base9_parser));
|
||||
BOOST_TEST(!test_attr(unsigned_overflow_base9, base9_parser, u));
|
||||
BOOST_TEST(!test(digit_overflow_base9, base9_parser));
|
||||
BOOST_TEST(!test_attr(digit_overflow_base9, base9_parser, u));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -3,11 +3,14 @@
|
||||
// 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)
|
||||
|
||||
#include "test.hpp"
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/spirit/include/phoenix.hpp>
|
||||
|
||||
int main() {
|
||||
#include "test.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
using spirit_test::test;
|
||||
using boost::spirit::qi::rule;
|
||||
using boost::spirit::qi::parse;
|
||||
|
||||
@@ -238,6 +238,7 @@ main()
|
||||
BOOST_TEST(!test("aaaaaa", repeat(3, val(5))[char_]));
|
||||
BOOST_TEST(!test("aa", repeat(val(3), 5)[char_]));
|
||||
|
||||
//#warning "testcase commented out"
|
||||
BOOST_TEST(test("aaa", repeat(val(3), inf)[char_]));
|
||||
BOOST_TEST(test("aaaaa", repeat(3, val(inf))[char_]));
|
||||
BOOST_TEST(test("aaaaaa", repeat(val(3), inf)[char_]));
|
||||
|
||||
@@ -316,10 +316,6 @@ main()
|
||||
using spirit_test::test_attr;
|
||||
using spirit_test::test;
|
||||
|
||||
using boost::phoenix::val;
|
||||
using boost::phoenix::actor;
|
||||
using boost::phoenix::value;
|
||||
|
||||
using testns::ops;
|
||||
using testns::check_type_1;
|
||||
using testns::check_type_2;
|
||||
@@ -345,6 +341,12 @@ main()
|
||||
BOOST_TEST(test_attr("++---****/", IP4 >> '/', c) && c == 9);
|
||||
}
|
||||
|
||||
#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
|
||||
using boost::phoenix::val;
|
||||
using boost::phoenix::actor;
|
||||
using boost::phoenix::value;
|
||||
|
||||
{ // all lazy args
|
||||
int c = 0;
|
||||
#define LP1 ops(val(1))
|
||||
@@ -393,6 +395,61 @@ main()
|
||||
BOOST_TEST(test_attr("++--**/", MP5 >> '/', c) && c == 6);
|
||||
}
|
||||
|
||||
#else // BOOST_SPIRIT_USE_PHOENIX_V3
|
||||
|
||||
using boost::phoenix::val;
|
||||
using boost::phoenix::actor;
|
||||
using boost::phoenix::expression::value;
|
||||
|
||||
{ // all lazy args
|
||||
int c = 0;
|
||||
#define LP1 ops(val(1))
|
||||
check_type_1<value<int>::type>(LP1);
|
||||
BOOST_TEST(test_attr("+/", LP1 >> '/', c) && c == 1);
|
||||
|
||||
c = 0;
|
||||
#define LP2 ops(val(1), val(4))
|
||||
check_type_2<value<int>::type, value<int>::type>(LP2);
|
||||
BOOST_TEST(test_attr("+----/", LP2 >> '/', c) && c == 5);
|
||||
|
||||
c = 0;
|
||||
#define LP3 ops(val((char)2), val(3.), val(4))
|
||||
check_type_3<value<char>::type, value<double>::type, value<int>::type>(LP3);
|
||||
BOOST_TEST(!test("++---***/", LP3 >> '/'));
|
||||
#define LP4 ops(val(1), val(2), val(3))
|
||||
check_type_3<value<int>::type, value<int>::type, value<int>::type>(LP4);
|
||||
BOOST_TEST(test_attr("+--***/", LP4 >> '/', c) && c == 6);
|
||||
}
|
||||
|
||||
{ // mixed immediate and lazy args
|
||||
namespace fusion = boost::fusion;
|
||||
namespace phx = boost::phoenix;
|
||||
|
||||
int c = 0;
|
||||
#define MP1 ops(val(3), 2)
|
||||
check_type_2<value<int>::type, int>(MP1);
|
||||
BOOST_TEST(test_attr("+++--/", MP1 >> '/', c) && c == 5);
|
||||
|
||||
c = 0;
|
||||
#define MP2 ops(4, val(1))
|
||||
check_type_2<int, value<int>::type>(MP2);
|
||||
BOOST_TEST(test_attr("++++-/", MP2 >> '/', c) && c == 5);
|
||||
|
||||
c = 0;
|
||||
#define MP3 ops(2, val(2), val(2))
|
||||
check_type_3<int, value<int>::type, value<int>::type>(MP3);
|
||||
BOOST_TEST(!test("++-**/", MP3 >> '/'));
|
||||
#define MP4 ops(2, val(2), 2)
|
||||
check_type_3<int, value<int>::type, int>(MP4);
|
||||
BOOST_TEST(test_attr("++--**/", MP4 >> '/', c) && c == 6);
|
||||
|
||||
c = 0;
|
||||
#define MP5 ops(val(5) - val(3), 2, val(2))
|
||||
check_type_3<phx::expression::minus<value<int>::type, value<int>::type>::type, int, value<int>::type>(MP5);
|
||||
BOOST_TEST(test_attr("++--**/", MP5 >> '/', c) && c == 6);
|
||||
}
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -148,9 +148,25 @@ main()
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
boost::spirit::qi::uint_parser<boost::uint8_t> uint8_;
|
||||
boost::uint8_t u;
|
||||
boost::uint8_t u8;
|
||||
|
||||
BOOST_TEST(!test_attr("999", uint8_, u));
|
||||
BOOST_TEST(!test_attr("999", uint8_, u8));
|
||||
BOOST_TEST(!test_attr("256", uint8_, u8));
|
||||
BOOST_TEST(test_attr("255", uint8_, u8));
|
||||
|
||||
boost::spirit::qi::uint_parser<boost::uint16_t> uint16_;
|
||||
boost::uint16_t u16;
|
||||
|
||||
BOOST_TEST(!test_attr("99999", uint16_, u16));
|
||||
BOOST_TEST(!test_attr("65536", uint16_, u16));
|
||||
BOOST_TEST(test_attr("65535", uint16_, u16));
|
||||
|
||||
boost::spirit::qi::uint_parser<boost::uint32_t> uint32_;
|
||||
boost::uint32_t u32;
|
||||
|
||||
BOOST_TEST(!test_attr("9999999999", uint32_, u32));
|
||||
BOOST_TEST(!test_attr("4294967296", uint32_, u32));
|
||||
BOOST_TEST(test_attr("4294967295", uint32_, u32));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/spirit/include/phoenix.hpp>
|
||||
#include <boost/spirit/include/support_utree.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Reference in New Issue
Block a user