...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The no_case[]
directive does not consume any input. The actual matching is done by
its subject parser. It's purpose is to force matching of the subject
parser (and all its children) to be case insensitive.
// forwards to <boost/spirit/home/qi/directive/no_case.hpp> #include <boost/spirit/include/qi_no_case.hpp>
Also, see Include Structure.
Name |
---|
|
In the table above, ns
represents a Character
Encoding Namespace.
The model of no_case
is the model of its subject parser.
Notation
a
A Parser
.
ns
Semantics of an expression is defined only where it differs from, or is not defined in the subject's concept.
Expression |
Semantics |
---|---|
|
Force matching of the subject parser, |
See Compound Attribute Notation.
Expression |
Attribute |
---|---|
|
a: A --> ns::no_case[a]: A a: Unused --> ns::no_case[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::ascii::no_case; using boost::spirit::ascii::char_; using boost::spirit::ascii::alnum; using boost::spirit::qi::symbols;
Simple usage of no_case[]
:
test_parser("X", no_case[char_('x')]); test_parser("6", no_case[alnum]);
A more sophisticated use case of no_case[]
in conjunction with a symbol table
(see symbols<>
for more details):
symbols<char, int> sym; sym.add ("apple", 1) // symbol strings are added in lowercase... ("banana", 2) ("orange", 3) ; int i; // ...because sym is used for case-insensitive parsing test_parser_attr("Apple", no_case[ sym ], i); std::cout << i << std::endl; test_parser_attr("ORANGE", no_case[ sym ], i); std::cout << i << std::endl;