diff options
author | Shevek <[email protected]> | 2019-08-19 12:23:10 -0700 |
---|---|---|
committer | Shevek <[email protected]> | 2019-08-19 12:23:10 -0700 |
commit | f658426ba59bd956c6ec61663e87c3e594361640 (patch) | |
tree | 198b20d74fcecb5001c58f60de46d7a4cee95bdd /src | |
parent | 1099a07af5bc2d99d844bc7843625c237acf0161 (diff) |
LexerSource: Fix handling of numeric values with explicit positive exponents.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/anarres/cpp/LexerSource.java | 2 | ||||
-rw-r--r-- | src/test/java/org/anarres/cpp/NumericValueTest.java | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/org/anarres/cpp/LexerSource.java b/src/main/java/org/anarres/cpp/LexerSource.java index 33268f8..c613f96 100644 --- a/src/main/java/org/anarres/cpp/LexerSource.java +++ b/src/main/java/org/anarres/cpp/LexerSource.java @@ -569,7 +569,7 @@ public class LexerSource extends Source { LexerException { StringBuilder part = new StringBuilder(); int d = read(); - if (sign && d == '-') { + if (sign && (d == '+' || d == '-')) { text.append((char) d); part.append((char) d); d = read(); diff --git a/src/test/java/org/anarres/cpp/NumericValueTest.java b/src/test/java/org/anarres/cpp/NumericValueTest.java index d4ea432..5551942 100644 --- a/src/test/java/org/anarres/cpp/NumericValueTest.java +++ b/src/test/java/org/anarres/cpp/NumericValueTest.java @@ -75,6 +75,7 @@ public class NumericValueTest { testNumericValue("1e1", 1e1); // testNumericValue("-1e1", -1e1); testNumericValue("1e-1", 1e-1); + testNumericValue("1e+1", 1e+1); // Hex numbers with decimal exponents testNumericValue("0x12e3", 0x12e3); |