...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The library has the full repertoire of single character parsers for character
classification. This includes the usual alnum
,
alpha
, digit
, xdigit
,
etc. parsers. These parsers have an associated Character
Encoding Namespace. This is needed when doing basic operations
such as inhibiting case sensitivity.
// forwards to <boost/spirit/home/qi/char/char_class.hpp> #include <boost/spirit/include/qi_char_class.hpp>
Also, see Include Structure.
Name |
---|
|
|
|
|
|
|
|
|
|
|
|
|
In the table above, ns
represents a Character
Encoding Namespace.
Notation
Semantics of an expression is defined only where it differs from, or
is not defined in PrimitiveParser
.
Expression |
Semantics |
---|---|
|
Matches alpha-numeric characters |
|
Matches alphabetic characters |
|
Matches spaces or tabs |
|
Matches control characters |
|
Matches numeric digits |
|
Matches non-space printing characters |
|
Matches lower case letters |
|
Matches printable characters |
|
Matches punctuation symbols |
|
Matches spaces, tabs, returns, and newlines |
|
Matches upper case letters |
|
Matches hexadecimal digits |
The character type of the Character Encoding Namespace,
ns
.
O(N)
Note | |
---|---|
The test harness for the example(s) below is presented in the Basics Examples section. |
Some using declarations:
using boost::spirit::ascii::alnum; using boost::spirit::ascii::blank; using boost::spirit::ascii::digit; using boost::spirit::ascii::lower;
Basic usage:
test_parser("1", alnum); test_parser(" ", blank); test_parser("1", digit); test_parser("a", lower);