[antlr-interest] Tracking absolute Lexer Position

ngormley1974 <ngormley at hotmail.com> ngormley at hotmail.com
Thu Jan 30 04:36:51 PST 2003


Hi,

I have a problem where I need to parse a file in a case insensitive  
way, and need to copy the input to the output as is, except for a 
small number of rules, where I need to process the token.

Its a clever SED by any other name...

I'm using the filtering/SCARFing technique to parse the file and 
identity the small parts I'm after. When I use caseSensitive=false, 
and match '.' in the SCARF rule the character returned is in lower 
case?

I tried subclassing the CharScanner to try to keep track of the 
actual position in the source, with limited success, i.e i am missing 
small portions of the text. I've overridden consume and rewind to 
manage the loction from the start of the file, but I missing the odd 
character here, and there... Is there anywhere else that I need to 
manage increment/decrement the file position counter?

Am I barking up the wrong tree. Has anyone else solved this problem.

Thanks,
Niall


 

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



More information about the antlr-interest mailing list