[antlr-interest] Ignoring case within token definition?

Haralambi Haralambiev hharalambiev at gmail.com
Fri May 30 04:15:19 PDT 2008


Hello,

I was wondering is there a possibility to ignore the letter case when
matching a token rule.

There are several languages that ignore the case of keywords, so
I wonder how to match all cases in a beautiful and efficient manner?

The only way I could think of is the following (consider the keyword is
"keyword"):

Keyword: ('K'|'k') ('E'|'e') ('Y'|'y') ('W'|'w') ('O'|'o') ('R'|'r')
('D'|'d');

This, obviously, is not nice to type... I would love if there is some option
to tell the lexer rule to ignore the case. Is there any?

Best Regards,
Hari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080530/b1060736/attachment.html 


More information about the antlr-interest mailing list