Quellcode durchsuchen

fix(parser): case-insensitive exponent

Signed-off-by: Alexey Shekhirin <a.shekhirin@gmail.com>
Alexey Shekhirin vor 3 Jahren
Ursprung
Commit
1292f1b3bb
2 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  1. 1 1
      solang-parser/src/lexer.rs
  2. 2 2
      tests/codegen_testcases/strength_reduce.sol

+ 1 - 1
solang-parser/src/lexer.rs

@@ -655,7 +655,7 @@ impl<'input> Lexer<'input> {
         let old_end = end;
         let mut exp_start = end + 1;
 
-        if let Some((i, 'e')) = self.chars.peek() {
+        if let Some((i, 'e' | 'E')) = self.chars.peek() {
             exp_start = *i + 1;
             self.chars.next();
             while let Some((i, ch)) = self.chars.peek() {

+ 2 - 2
tests/codegen_testcases/strength_reduce.sol

@@ -64,7 +64,7 @@ contract test {
 
 // BEGIN-CHECK: test::function::f6
     function f6() pure public {
-        for (uint i = 1e9; i < 1e9+10; i++) {
+        for (uint i = 1E9; i < 1E9+10; i++) {
             print("i:{}".format(i / 32768));
         }
 // CHECK: (%i >> uint256 15)
@@ -116,4 +116,4 @@ contract test {
         }
 // CHECK: (%i % int256 4294967297)
     }
-}
+}