[antlr-interest] case sensitivity for ANTLR v3 lexers
Jim Idle
jimi at temporal-wave.com
Fri Aug 3 09:29:25 PDT 2007
Andy, that is one way. I have also posted code that overrides LA, which
is probably best. This means that it matches only UPPER case in the
lexer but preserves the case for the tokens, which is usually what you
want.
The code, and variants, can be found:
http://www.antlr.org/pipermail/antlr-interest/2007-January/019008.h
tml
and:
http://www.antlr.org/wiki/pages/viewpage.action?pageId=1782
Jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Andy Tripp
> Sent: Friday, August 03, 2007 8:55 AM
> To: ANTLR Interest
> Cc: antlr at jazillian.com
> Subject: Re: [antlr-interest] case sensitivity for ANTLR v3 lexers
>
> So there was this thread back in May about supporting case sensitivity
> in antlrV3.
> Is there any support yet?
> If not, has anyone managed to write a CaseInsensitiveLexer?
> And barring that, is it actually just as simple as changing this one
> line in BaseRecognizer from this:
> if ( input.LA(1)==ttype ) {
> ...to this...
> if (Character.toUpperCase(input.LA(1)) ==
> Character.toUpperCase(ttype)) {
>
> Andy
>
More information about the antlr-interest
mailing list