[antlr-interest] case in-sensitive literals (possible bug?)

Andrew Deren andrew at adersoftware.com
Thu Mar 13 18:08:08 PST 2003


I think I found an answer. It seems antlr is not even using
caseSensitiveLiterals flag.
I overrode testLiteralsTable method and put ToLower() in there and it all
seems fine:
 public override int testLiteralsTable(int ttype)
 {  try  {
   int literalsIndex = (int) literals[text.ToString().ToLower()];
   ttype = literalsIndex;
   return ttype;
  }  catch  {   return ttype;  }
 }

I was doing this in C# and I tought maybe it was C# bug, but it seems java
implementation does the same thing.
Is it possible that this feature is not supported yet, or is there something
else I need to do.
Andrew

----- Original Message -----
From: "Andrew Deren" <andrew at adersoftware.com>
To: <antlr-interest at yahoogroups.com>
Sent: Thursday, March 13, 2003 6:52 PM
Subject: [antlr-interest] case in-sensitive literals


> I need my literals in grammar to not be case sensitive.
> I set the option: caseSensitive=false in lexer, and
> caseSensitiveLiterals=false but it still doesn't work.
> What I'm trying to accomplish is to have in parser:
> andExpr : otherExpr "and" otherExpr
> but have it work for either "and" or "AND" or any other combination.
> I have more of those literals (or, is, not, etc)
> It looks like when I put "AND" in the program, lexer matches Token.ID
> Thanks,
> Andrew
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list