[antlr-interest] overlapping lexer rules

cimbroken cimbroken at gmail.com
Fri Nov 2 15:52:05 PDT 2007


Hi everybody,
quoting two examples from the book (pg.280-281):

1)
INT : DIGIT+ ;
DIGIT : '0'..'9' ;

2)
INT : '0'..'9' +;
FLOAT : '0'..'9' + ('.' '0'..'9'*)? ;

I don't understand very well why the second is *not* a mistake. It seems to
me that this two examples are similar: 2 "free" rules (not fragment) that
try to match different tokens that start with the same character. Why antlr
treats them in different ways?

thanks!
teo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071102/e1812d42/attachment.html 


More information about the antlr-interest mailing list