[antlr-interest] Bug in c# case-insensitive lexer

tdjastrzebski tdjastrzebski at yahoo.com
Wed Jul 2 08:20:42 PDT 2003


Since I am new to Antlr I had to spend half a day to figure this out. 
But at least I learned a lot how it works under the hood. Not to 
mention the opporunity to help improving such a good tool.

Here is what I found:
with option caseSensitiveLiterals set to false lexer creates literals 
hashtable passing to its constructor CaseInsensitiveHashCodeProvider 
but it does NOT pass CaseInsensitiveComparer. That is why tokens in 
uppercase are not being recognized properly.

So appropriate line in lexer should read:

literals = new Hashtable( new 
System.Collections.CaseInsensitiveHashCodeProvider(), new 
System.Collections.CaseInsensitiveComparer());

instead of:

literals = new Hashtable( new 
System.Collections.CaseInsensitiveHashCodeProvider(), null);

Which should be corrected in line 1252 of CSharpCodeGenerator.java 
file.

Regards,
Tom Jastrzebski



 

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




More information about the antlr-interest mailing list