[antlr-interest] Case insensitive reserved words.

Peter C. Chapin pcc482719 at gmail.com
Fri Mar 20 06:48:21 PDT 2009


Hi again...

My new project entails building a parser for a language with case
insensitive reserved words. I see the page here:

http://www.antlr.org/wiki/pages/viewpage.action?pageId=1782

describing how to write a custom look-ahead to deal with this. However,
David Haubenstricker commented on that page with an alternative approach:

SELECT : S E L E C T

fragment A: ('A'|'a')
fragment B: ('B'|'b')
fragment C: ('C'|'c')
... etc.

To be honest, David's approach looks pretty good to me. I'm wondering if
there are any disadvantages to it that I should know about.

Thanks!

Peter


More information about the antlr-interest mailing list