[antlr-interest] How to define a FLOAT number

maulattu maulattu at yahoo.it
Thu Feb 28 09:08:37 PST 2008


Hello, here is a little surprise..
With the following grammar, the input "1" is not recognized as float (note that the rule DIGIT isn't used):
------------------------------
grammar float_recon;
offset
    :
        FLOAT
    ;
DIGIT
    :    '0'..'9'
    ;
FLOAT
    :
        ('0'..'9')+ ('.' (('0'..'9')+))?
    ;
------------------------------


Conversely, with this one the input "1" is recognized as float:
------------------------------
 grammar float_recon;
 offset
     :
         FLOAT
     ;
 FLOAT
      :
          ('0'..'9')+ ('.' (('0'..'9')+))?
      ;
 DIGIT
     :    '0'..'9'
     ;
 ------------------------------

How can it be possible? Is it related to this bug?
http://www.antlr.org:8888/browse/ANTLR-41

I'm using ANTLRWorks 1.1.7 and 1.1.5 some days ago...

Bye!

       
---------------------------------

---------------------------------
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080228/47e3f8ca/attachment.html 


More information about the antlr-interest mailing list