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

Update Dart for digit-separators feature #4081

Merged
merged 3 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Core Grammars:
- enh(erlang) OTP 27 doc attribute [nixxquality][]
- enh(erlang) OTP 27 Sigil type [nixxquality][]
- enh(erlang) OTP25/27 maybe statement [nixxquality][]
- enh(dart) Support digit-separators in number literals [Sam Rawlins][]
srawlins marked this conversation as resolved.
Show resolved Hide resolved

New Grammars:

Expand All @@ -33,6 +34,7 @@ CONTRIBUTORS
[BaliBalo]: https://github.com/BaliBalo
[William Wilkinson]: https://github.com/wilkinson4
[nixxquality]: https://github.com/nixxquality
[srawlins]: https://github.com/srawlins


## Version 11.10.0
Expand Down
13 changes: 11 additions & 2 deletions src/languages/dart.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ export default function(hljs) {
keywords: 'true false null this is new super'
};

const NUMBER = {
className: 'number',
relevance: 0,
variants: [
{ match: /\b[0-9][0-9_]*(\.[0-9][0-9_]*)?([eE][+-]?[0-9][0-9_]*)?\b/ },
{ match: /\b0[xX][0-9A-Fa-f][0-9A-Fa-f_]*\b/ }
]
};

const STRING = {
className: 'string',
variants: [
Expand Down Expand Up @@ -87,7 +96,7 @@ export default function(hljs) {
]
};
BRACED_SUBST.contains = [
hljs.C_NUMBER_MODE,
NUMBER,
STRING
];

Expand Down Expand Up @@ -248,7 +257,7 @@ export default function(hljs) {
hljs.UNDERSCORE_TITLE_MODE
]
},
hljs.C_NUMBER_MODE,
NUMBER,
{
className: 'meta',
begin: '@[A-Za-z]+'
Expand Down