[antlr-interest] Lexer problem

mzukowski at bco.com mzukowski at bco.com
Fri Dec 28 06:37:54 PST 2001


Take a look at the generated code.  Can you see why it doesn't work?  You
may need to use a syntactic predicate in front of ".a.a".

Monty

> -----Original Message-----
> From: manfredlotz [mailto:Manfred.Lotz at web.de]
> Sent: Thursday, December 27, 2001 9:41 PM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Lexer problem
> 
> 
> Using the definiton shown below the lexer has a problem to recognize
> tokens if they arrive in a certain order. 
> 
> E.g.,  ".a.a.b$" or ".ac$" work fine, however ".a.b$" does not.
> 
> Any idea what I have to change to make it working. I know it has to do
> with the fact that ".a" is a substring of ".a.a" but I don't know how
> to improve the t.g file.
> 
> Manfred
> _____________________
> 
> class TLexer extends Lexer;
> options {
>         k=4;
>         filter=IGNORE;
> }
> 
> MYENDTOKEN   : '$' ;
> 
> A       :   ( ".a" | ".a.a" | ".b" | 'a' | 'c' )  ;
> 
> protected
> IGNORE  : ( "\r\n" | '\r' | '\n'  ) { _ttype = Token.SKIP; };
> 
> 
>  
> 
> 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