[antlr-interest] lexing: case insensitivity

Edwards, Waverly Waverly.Edwards at genesys.com
Mon Aug 20 02:11:34 PDT 2007


 
Ahhh, but it is an option?  I've pondered a syntax aware editor and error messages.
A syntax aware editor is going to require some type of style array which include
case that is separate from the actual text.  Speed is critical here.
For error messages, speed is not an issue, so I can reread the lines of text
from disk since I will have all error in one file before I reach another. My modified
text still matches the original text positions character for character.  I coalesce
all the errors then read the original text from the files so the user doesn't see the
difference.  I get all the speed I can out of the lexer and only have to deal with
case at error message time.

Now I just have to see how to implement it.


Thanks,


W.

-----Original Message-----
From: Kay Roepke [mailto:kroepke at classdump.org] 
Sent: Monday, August 20, 2007 4:31 AM
To: Edwards, Waverly
Cc: antlr
Subject: Re: [antlr-interest] lexing: case insensitivity


On Aug 20, 2007, at 10:09 AM, Edwards, Waverly wrote:

> In ANTLR Is it possible to manage the file stream *before* the lexer 
> handles it?

That's probably not your best option, since you actually lose the character's case (for pretty printing/error messages etc).

For the C target what Jim has done was to modify the input stream to always return uppercase characters so that ANTLR is tricked into thinking everything was uppercase, even though the actual input wasn't.

He provided <http://www.antlr.org/pipermail/antlr-interest/2007-
January/019008.html>
in the discussion. Take a look :)

cheers,
-k
--
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list