Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
Re-Establish Skipping (skip[])
Description

The skip directive is the inverse of lexeme. 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:

Header
// forwards to <boost/spirit/home/qi/directive/skip.hpp>
#include <boost/spirit/include/qi_skip.hpp>

Also, see Include Structure.

Namespace

Name

boost::spirit::skip // alias: boost::spirit::qi::skip

Model of

UnaryParser

Notation

a

A Parser.

Expression Semantics

Semantics of an expression is defined only where it differs from, or is not defined in UnaryParser.

Expression

Semantics

skip[a]

Re-establish the skipper that got inhibited by lexeme

skip(p)[a]

Use p as a skipper for parsing a

Attributes

See Compound Attribute Notation.

Expression

Attribute

skip[a]

a: A --> skip[a]: A
a: Unused --> lexeme[a]: Unused

skip(p)[a]

a: A --> skip(p)[a]: A
a: Unused --> lexeme[a]: Unused

Complexity

The complexity is defined by the complexity of the subject parser, a

Example
[Note] 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_)]);


PrevUpHomeNext