[antlr-interest] java.g NUM_INT
Ernest Pasour
sasecp at wnt.sas.com
Wed Sep 24 13:26:43 PDT 2003
When I tried sticking this fix in, it allowed a number like 083 to pass through as an Integer. I'm not sure exactly why no error is thrown though. Do you see that behavior?
-----Original Message-----
From: Ray Waldin [mailto:ray at waldin.net]
Sent: Tuesday, September 23, 2003 7:38 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] java.g NUM_INT
I sent this earlier and it never showed up on the list, so here it is
again...
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 the archives. 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
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list