[antlr-interest] Help parsing floating point and integer numbers
Cristian Peraferrer
corellian.c at gmail.com
Fri Oct 19 08:11:03 PDT 2007
Hi, I can't see where is the error, for parsing floating point and integer
numbers:
DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ;
fragment
IntegerTypeSuffix : ('l'|'L') ;
FloatingPointLiteral
: ('0'..'9')+ '.' ('0'..'9')* Exponent? FloatTypeSuffix?
| '.' ('0'..'9')+ Exponent? FloatTypeSuffix?
| ('0'..'9')+ Exponent FloatTypeSuffix?
| ('0'..'9')+ Exponent? FloatTypeSuffix
;
fragment
Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
fragment
FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
The multiple alternatives problem is in the FloatingPointLiteral rule.
Thanks,
Cristian.
--
GPG Key-ID: 0x564903FA - JID: corellian at swissjabber.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071019/815d3338/attachment-0001.html
More information about the antlr-interest
mailing list