...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The raw[]
disregards the attribute of its subject parser, instead exposing the
half-open range [first, last)
pointing to the matched characters from
the input stream. The raw[]
directive brings back the classic Spirit
transduction (un-attributed) behavior for a subject parser.
// forwards to <boost/spirit/home/qi/directive/raw.hpp> #include <boost/spirit/include/qi_raw.hpp>
Also, see Include Structure.
Name |
---|
|
Notation
a
A Parser
.
Iter
A ForwardIterator
type.
Semantics of an expression is defined only where it differs from, or
is not defined in UnaryParser
.
Expression |
Semantics |
---|---|
|
Disregard the attribute of the subject parser, |
See Compound Attribute Notation.
Expression |
Attribute |
---|---|
|
a: A --> raw[a]: boost::iterator_range<Iter> a: Unused --> raw[a]: Unused
|
Note | |
---|---|
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::raw; using boost::spirit::ascii::alpha; using boost::spirit::ascii::alnum;
This parser matches and extracts C++ identifiers:
std::string id; test_parser_attr("James007", raw[(alpha | '_') >> *(alnum | '_')], id); std::cout << id << std::endl; // should print James007