[antlr-interest] Lexing problem I cannot resolve

Gavin Lambert antlr at mirality.co.nz
Wed Aug 6 13:09:11 PDT 2008


At 07:07 7/08/2008, Carter Cheng wrote:
 >I tried this variant too but it does not seem to parse
 >correctly(see attached). It still thinks that the 1. is a FLOAT
 >token. Perhaps I have run afoul of some bug in 3.0.1?

I did say that it would do that, since that's what you seemed to 
be wanting.

"1" should be an INT, "1." should be a FLOAT, ".2" should be a 
FLOAT, "1.2" should be a FLOAT, and "1..2" should be an INT RANGE 
INT.

If you want to disallow "1." as a FLOAT, then you need to change 
the DIGIT* to a DIGIT+ as I originally suggested; though you might 
also need to add additional lookahead.



More information about the antlr-interest mailing list