| Home | Libraries | People | FAQ | More

##### Parser Directive Inhibiting Case Sensitivity (`no_case[]`)

###### Description

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.

###### Header

    // forwards to <boost/spirit/home/qi/directive/no_case.hpp>
    #include <boost/spirit/include/qi_no_case.hpp>

Also, see Include Structure.

###### Namespace

Name
`ns::no_case`

In the table above, `ns` represents a Character Encoding Namespace.

###### Model of

The model of `no_case` is the model of its subject parser.

Notation

`a`

  A `Parser`.

`ns`

  A Character Encoding Namespace.

###### Expression Semantics

Semantics of an expression is defined only where it differs from, or is not defined in the subject's concept.

Expression | Semantics
--- | ---
`ns::no_case[a]` | Force matching of the subject parser, `a` (and all its children) to be case insensitive

###### Attributes

See Compound Attribute Notation.

Expression | Attribute
--- | ---
`ns::no_case[a]` |
    a: A --> ns::no_case[a]: A
    a: Unused --> ns::no_case[a]: Unused

###### Complexity

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

###### Example

| 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;