blynn / nex

Lexer for Go
http://cs.stanford.edu/~blynn/nex/
GNU General Public License v3.0
416 stars 47 forks source link

Case insensitive regular expressions #46

Closed andresrgz closed 6 years ago

andresrgz commented 6 years ago

Is there a way to define case insensitive regular expressions? I am making a SQL parser and I need to be able to parse correctly SELECT, select or any of its variants.

I do know that Flex has %option caseless, is there something similar for Nex?

purpleidea commented 6 years ago

What about a [Ss][Ee][Ll][Ee][Cc][Tt] sort of thing? (you get the idea...) But I'd keep it simple and disallow a mixed case token. Eg: SeLeCt should be a compile error.

andresrgz commented 6 years ago

@purpleidea

What about a [Ss][Ee][Ll][Ee][Cc][Tt] sort of thing? (you get the idea...) But I'd keep it simple and disallow a mixed case token. Eg: SeLeCt should be a compile error.

I guess that would be the simplest solution. Thanks for replying and for the suggestion.