[antlr-interest] Syntactic predicate in lexer rule
Martin Traverso
mtraverso at gmail.com
Sun Jan 1 19:01:22 PST 2006
Hi all,
Happy new year!
I'm having some trouble with the following grammar. I would think the
syntactic predicate in FLOAT should be enough to distinguish between a FLOAT
and an INTEGER followed by two dots, but when parsing stuff like "1..2" the
lexer tries to match a FLOAT. Any ideas why?
grammar T;
range: number ('..' number)?;
number: INTEGER | FLOAT;
FLOAT: (DIGITS '.' DIGITS) => DIGITS '.' DIGITS;
INTEGER : DIGITS;
fragment
DIGITS: ('0'..'9')+;
Thanks!
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060101/99d7ffab/attachment.html
More information about the antlr-interest
mailing list