[antlr-interest] Lexer problem

manfredlotz Manfred.Lotz at web.de
Thu Dec 27 21:40:45 PST 2001

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.


class TLexer extends Lexer;
options {

MYENDTOKEN   : '$' ;

A       :   ( ".a" | ".a.a" | ".b" | 'a' | 'c' )  ;

IGNORE  : ( "\r\n" | '\r' | '\n'  ) { _ttype = Token.SKIP; };


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

More information about the antlr-interest mailing list