diff options
author | Shevek <[email protected]> | 2013-12-28 03:38:35 -0800 |
---|---|---|
committer | Shevek <[email protected]> | 2013-12-28 03:38:35 -0800 |
commit | aff8211f1af04eb56f123ad1358a2f8d6c23b778 (patch) | |
tree | 54734f56b3d2d28c0b3f65525c08e288d0c86e2d /src/main/java/org/anarres/cpp | |
parent | fd16df830589051764a1bccb33c90cd6ca4c1c57 (diff) |
Fix floating point lexing: Missing chars and bad token stream.
Diffstat (limited to 'src/main/java/org/anarres/cpp')
-rw-r--r-- | src/main/java/org/anarres/cpp/LexerSource.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/anarres/cpp/LexerSource.java b/src/main/java/org/anarres/cpp/LexerSource.java index ca18314..5f1dac3 100644 --- a/src/main/java/org/anarres/cpp/LexerSource.java +++ b/src/main/java/org/anarres/cpp/LexerSource.java @@ -587,11 +587,13 @@ public class LexerSource extends Source { NumericValue value = new NumericValue(10, integer); int d = read(); if (d == '.') { + text.append((char) d); String fraction = _number_part(text, 10); value.setFractionalPart(fraction); d = read(); } if (d == 'E' || d == 'e') { + text.append((char) d); String exponent = _number_part(text, 10); value.setExponent(exponent); d = read(); @@ -847,7 +849,11 @@ public class LexerSource extends Source { d = read(); if (d == 'x' || d == 'X') tok = number_hex((char) d); - else { + else if (d == '.') { + unread(d); + unread(c); + tok = number_decimal(); + } else { unread(d); tok = number_octal(); } |