Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for digit separators #73

Merged
merged 2 commits into from
Jul 31, 2024
Merged

Conversation

DanTup
Copy link
Collaborator

@DanTup DanTup commented Jul 31, 2024

This updates the grammar to allow underscores within numbers (but not as the first digit), using some examples from https://github.com/dart-lang/language/blob/main/working/digit-separators/feature-specification.md#examples as tests.

I committed this in two parts:

  • First commit adds a new test with the separators but does not update the grammar
  • Updates the grammar and the test goldens

This is to make it easier to see the impact of the change to the grammar (by looking at the second changeset) without the whole block being new code.

Note: This change does allow trailing underscores (which are not valid), because that way the colouring will still work out while you're typing a literal with an underscore (you'll ofc still see an analysis error while it's invalid) and it keeps the regex simpler.

@srawlins

Copy link
Member

@srawlins srawlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect! Very tidy, thanks!

@DanTup DanTup merged commit e8b053f into dart-lang:master Jul 31, 2024
2 checks passed
@DanTup DanTup deleted the digit_separators branch July 31, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants