...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Syntactic predicates assert a certain conditional syntax to be satisfied
before evaluating another production. Similar to semantic predicates,
eps
,
syntactic predicates do not consume any input. The and-predicate,
&a
,
is a positive syntactic predicate that returns a zero length match only
if its predicate matches.
// forwards to <boost/spirit/home/qi/operator/and_predicate.hpp> #include <boost/spirit/include/qi_and_predicate.hpp>
Also, see Include Structure.
Notation
a
A Parser
Semantics of an expression is defined only where it differs from, or
is not defined in UnaryParser
.
Expression |
Semantics |
---|---|
|
If the predicate |
See Compound Attribute Notation.
Expression |
Attribute |
---|---|
|
|
The complexity is defined by the complexity of the predicate,
a
Note | |
---|---|
The test harness for the example(s) below is presented in the Basics Examples section. |
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);