...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The skip
directive is
the inverse of lexeme
or no_skip
. While the lexeme
directive turns off white
space skipping, the skip
directive turns it on again. This is simply done by wrapping the parts
inside the skip
directive:
skip[a]
It is also possible to supply a skip parser to the skip
directive:
skip(p)[a] // Use `p` as a skipper for parsing `a`
This makes it possible to:
// forwards to <boost/spirit/home/qi/directive/skip.hpp> #include <boost/spirit/include/qi_skip.hpp>
Also, see Include Structure.
Name |
---|
|
Notation
a
A Parser
.
Semantics of an expression is defined only where it differs from, or
is not defined in UnaryParser
.
Expression |
Semantics |
---|---|
|
Re-establish the skipper that got inhibited by lexeme or no_skip |
|
Use |
See Compound Attribute Notation.
Expression |
Attribute |
---|---|
|
a: A --> skip[a]: A a: Unused --> skip[a]: Unused
|
|
a: A --> skip(p)[a]: A a: Unused --> skip(p)[a]: Unused
|
The complexity is defined by the complexity of the subject parser,
a
Note | |
---|---|
The test harness for the example(s) below is presented in the Basics Examples section. |
Some using declarations:
using boost::spirit::qi::skip; using boost::spirit::qi::int_; using boost::spirit::ascii::space;
Simple usage of skip[]
:
Explicitly specify a skip parser. This parser parses comma delimited numbers, ignoring spaces.
test_parser("1, 2, 3, 4, 5", skip(space)[int_ >> *(',' >> int_)]);