[antlr-interest] java.g NUM_INT

Ray Waldin ray at waldin.net
Tue Sep 23 15:44:58 PDT 2003


Hi everyone,

I'm new to this group, so apologies if this issue has been raised 
before.  I wasn't able to find any reference to it.  In java.g (Version 
1.20) it seems that the NUM_INT rule is broken for cases of floats and 
doubles which have leading zeros and contain the digits 8 or 9 in the 
decimal integer or mantissa part.

While the following cases work (by sheer luck, I believe):

> 07.0f
> 06d
> 07e0

these do not:

> 08.0f
> 09d
> 08e0

A quick fix can be found below.

-Ray


--- old/java.g  2003-09-23 15:20:05.000000000 -0700
+++ java.g      2003-09-23 15:21:28.000000000 -0700
@@ -1234,6 +1234,7 @@
                                        }
                                :       HEX_DIGIT
                                )+
+                       |       (('0'..'9')+ 
('.'|EXPONENT|FLOAT_SUFFIX|)) => ('0'..'9')+   // float or double with 
leading zero
                        |       
('0'..'7')+                                                                     
// octal
                        )?
                |       ('1'..'9') ('0'..'9')*  
{isDecimal=true;}               // non-zero decimal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030923/eb958f9f/attachment.html


More information about the antlr-interest mailing list