Fix parsing oct and hex numbers#364
Merged
Merged
Conversation
d5
requested changes
Feb 7, 2022
Owner
d5
left a comment
There was a problem hiding this comment.
Thanks for the PR. When I tested the following code at the VM-level:
expectRun(t, `out = 1 + 010`, nil, 9) // works
expectRun(t, `out = 1 + 0x10`, nil, 17) // works
expectRun(t, `out = 1 + 0o10`, nil, 9) // Parse Error: expected ';', found o10
expectRun(t, `out = 1 + 0b10`, nil, 3) // Parse Error: expected ';', found b10I think we should fix this too if we want to fully support the binary/octal numbers?
Contributor
Author
|
@d5 I've rewritten numbers scanning from scratch. Instead of trying to scan only valid numbers, it scans for things resembling number and let If you don't like those changes, I can revert them and add support only for literals you mentioned. |
Collaborator
|
@d5 will need your approval as well |
d5
approved these changes
Jun 14, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #363