diff --git a/CHANGES.md b/CHANGES.md index d84c96801a..8b1b9d3dc4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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][] New Grammars: @@ -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 diff --git a/src/languages/dart.js b/src/languages/dart.js index 2b801255e4..32e4b43b2a 100644 --- a/src/languages/dart.js +++ b/src/languages/dart.js @@ -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: [ @@ -87,7 +96,7 @@ export default function(hljs) { ] }; BRACED_SUBST.contains = [ - hljs.C_NUMBER_MODE, + NUMBER, STRING ]; @@ -248,7 +257,7 @@ export default function(hljs) { hljs.UNDERSCORE_TITLE_MODE ] }, - hljs.C_NUMBER_MODE, + NUMBER, { className: 'meta', begin: '@[A-Za-z]+'