Skip to content

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
@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