Skip to content

Commit

Permalink
Merge pull request #898 from dtolnay/lit
Browse files Browse the repository at this point in the history
Parse integer suffix beginning with `E`
  • Loading branch information
dtolnay committed Sep 25, 2020
2 parents 132bca5 + 9270f70 commit 1e010ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,10 @@ mod value {
// NOTE: Looking at a floating point literal, we don't want to
// consider these integers.
b'.' if base == 10 => return None,
b'e' | b'E' if base == 10 => return None,
b'e' | b'E' if base == 10 => match byte(s, 1) {
b'-' | b'+' | b'0'..=b'9' => return None,
_ => break,
},
_ => break,
};

Expand Down
2 changes: 2 additions & 0 deletions tests/test_lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ fn ints() {

test_int("5", 5, "");
test_int("5u32", 5, "u32");
test_int("0E", 0, "E");
test_int("0ECMA", 0, "ECMA");
test_int("0o0A", 0, "A");
test_int("5_0", 50, "");
test_int("5_____0_____", 50, "");
Expand Down

0 comments on commit 1e010ea

Please sign in to comment.