[antlr-interest] Problem parsing float numbers

Marcel Schaible marcel at schaible-consulting.de
Wed Nov 25 14:43:31 PST 2009


Hello everybody,

I have a problem with parsing floating point numbers:

My grammar contains the following part for recognizing floats:

fragment DIGIT : '0'..'9' ;
fragment INT   : DIGIT + ;
NUM     : INT ( '.' INT)? ;
EXP     : ( 'E' | 'e' ) ( '-' | '+')? NUM  ;
ENUM    : NUM ( EXP )? ;

When I feed into the parser 1.0 I got the following error message:

line 1:0 required (...)+ loop did not match anything at input '1.0'

I did not see the problem. Any ideas and comments are welcome!

Thanks in advance for your help.

Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091125/9b6c9632/attachment.html 


More information about the antlr-interest mailing list