Tuesday, May 14, 2002 07:27 PM
The bug still stands, but I made a small error in describing it, and I have found another bug since.
Of course, the rule should check for a float suffix following octal digits, because the integer part of a float can have leading zeroes, looking like octal. Therefore, the semantic action should be associated with matching hex digits only, not with hex and octal digits.
Additional bug: according to the Language Spec, a floating point number can begin with a string of digits, followed by a decimal point. It can include leading zeroes. However, the rule supplied in the Java 1.2 and 1.3 recognisers decides that a number is octal as soon as it encounters a leading zero, without considering the possibility that it is the start of a decimal floating point number. From then on, it only accepts octal digits before the decimal point. This means that 0123.45 and 789.45 are correctly tokenised, but 0789.45 is not.
In my opinion this is a much more severe bug, not least because people like me, who are looking for a quick way to parse the hell that is C-style numeric literals, are likely to copy the entire thing into their own grammars.