[antlr-interest] case sensitivity for ANTLR v3 lexers

Terence Parr parrt at cs.usfca.edu
Fri Aug 3 08:59:07 PDT 2007


On Aug 3, 2007, at 8:55 AM, Andy Tripp wrote:

> 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)) {

Actually, that should work. :)    All tests use LA(i).

Ter



More information about the antlr-interest mailing list