You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was following the number prefix changes (#5519) and found that we didn't have very many tests for basic number-syntax edge cases, so I thought of a few that I didn't see elsewhere.
I added these tests just as a single named test with implicit allowed values and explicit errors, which is fine because all syntax errors are reported at once. But I can change that if you'd prefer them split out into separate tests.
I also am not sure that we really want to allow the double-percent sign. I think that it may be more consistent to just lex all trailing alpha-numeric characters or percent signs following numbers just for simplicity. It would improve the second error, but disallow the first case. But I don't really think the first case is actually helpful for markup mode.
wrzian
changed the title
improve number lexing
add number-syntax edge cases tests
Dec 11, 2024
I also am not sure that we really want to allow the double-percent sign. I think that it may be more consistent to just lex all trailing alpha-numeric characters or percent signs following numbers just for simplicity. It would improve the second error, but disallow the first case. But I don't really think the first case is actually helpful for markup mode.
I don't have a strong opinion either way. I don't really see a strong reason to forbid it (nobody will ever write that), but I'm also not necessarily opposed.
I feel like it would be good for consistency of implementations, i.e. other parsers/highlighters, to say that number suffixes include any series of alphanumeric/percent characters (so turning #1.2%% to an error). Feels like it better follows the principle of "maxmimum munch".
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
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.
I was following the number prefix changes (#5519) and found that we didn't have very many tests for basic number-syntax edge cases, so I thought of a few that I didn't see elsewhere.
I added these tests just as a single named test with implicit allowed values and explicit errors, which is fine because all syntax errors are reported at once. But I can change that if you'd prefer them split out into separate tests.
I also am not sure that we really want to allow the double-percent sign. I think that it may be more consistent to just lex all trailing alpha-numeric characters or percent signs following numbers just for simplicity. It would improve the second error, but disallow the first case. But I don't really think the first case is actually helpful for markup mode.