-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in scientific notation parsing
Fixes #676 Scientific notation parsing was using the shared `readInt` code path, which I had made more flexible to handle hex digits, but that means that literals like `1e2` were being treated as a complete number (with the hex digit `e`) rather than as scientific notation. Normally this wouldn't be a problem since it's all a number token anyway, but it caused trouble when using dot-style property access like `1e2.toString()`. Expressions like `1.toString()` are expected to fail because `.` is interpreted as a decimal point, but when using scientific notation, the parser needs to be smart enough see that a decimal point wouldn't be valid, and therefore not include it as part of the token. The fix was to change `readInt` to only handle decimal digits, not hex digits, and to inline the hex case into `readRadixNumber`. This should make number parsing slightly faster because it's not checking for hex digits anymore.
- Loading branch information
1 parent
ea15a79
commit 4a04c49
Showing
2 changed files
with
65 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters