Is there a way to recognize specific patterns case-insensitively?
E.g. if I have
literal_bool = L"True|False";
this->self.add(literal_bool, TokenId_LiteralBool);
How can I match true, TRUE, tRuE while avoiding to write [Tt][Rr][Uu][Ee] for each keyword?
Regular expressions supported by
boost::spirit::lexinclude a case-sensitivity control:Thus you can write:
Original answer
Introduce a function that makes a pattern case insensitive:
Implementation for regular (non-wide) strings: