From 51da260fc3231a529cb6525dbf7f0c812e2f24f9 Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Wed, 31 Jul 2024 14:46:16 +0100 Subject: [PATCH 1/2] Add some number tests without the grammar change --- test/goldens/numbers.dart.golden | 36 ++++++++++++++++++++++++++++++++ test/test_files/numbers.dart | 15 +++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 test/goldens/numbers.dart.golden create mode 100644 test/test_files/numbers.dart diff --git a/test/goldens/numbers.dart.golden b/test/goldens/numbers.dart.golden new file mode 100644 index 0000000..cfe57a7 --- /dev/null +++ b/test/goldens/numbers.dart.golden @@ -0,0 +1,36 @@ +>// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.dart +>// for details. All rights reserved. Use of this source code is governed by a +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.dart +>// BSD-style license that can be found in the LICENSE file. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.dart +> +>var a = [ +#^^^ storage.type.primitive.dart +# ^ keyword.operator.assignment.dart +> 1, +# ^ constant.numeric.dart +# ^ punctuation.comma.dart +> .0, +# ^ punctuation.dot.dart +# ^ constant.numeric.dart +# ^ punctuation.comma.dart +> 1.2, +# ^^^ constant.numeric.dart +# ^ punctuation.comma.dart +> 0x123, +# ^^^^^ constant.numeric.dart +# ^ punctuation.comma.dart +> 100__000_000__000_000__000_000, +# ^ punctuation.comma.dart +> 0x4000_0000_0000_0000, +# ^ punctuation.comma.dart +> 0.000_000_000_01, +# ^^ constant.numeric.dart +# ^ punctuation.comma.dart +> 0x00_14_22_01_23_45, +# ^ punctuation.comma.dart +> 555_123_4567, +# ^ punctuation.comma.dart +>]; +# ^ punctuation.terminator.dart diff --git a/test/test_files/numbers.dart b/test/test_files/numbers.dart new file mode 100644 index 0000000..27dde38 --- /dev/null +++ b/test/test_files/numbers.dart @@ -0,0 +1,15 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +var a = [ + 1, + .0, + 1.2, + 0x123, + 100__000_000__000_000__000_000, + 0x4000_0000_0000_0000, + 0.000_000_000_01, + 0x00_14_22_01_23_45, + 555_123_4567, +]; From 9f5fd5d5b99315c899e5e66a612b4a0e1ba6249f Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Wed, 31 Jul 2024 14:49:42 +0100 Subject: [PATCH 2/2] Update grammar + goldens --- CHANGELOG.md | 4 ++++ grammars/dart.json | 4 ++-- test/goldens/numbers.dart.golden | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 048e11a..658e7b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.3.0 (2024-07-31) + +- Added support for digit separators (`_`). + ## 1.2.9 (2024-04-24) - Added support for `macro`, `augment library`, `import augment`, `augment`, `augmented`. diff --git a/grammars/dart.json b/grammars/dart.json index 7dfa571..6a4877b 100644 --- a/grammars/dart.json +++ b/grammars/dart.json @@ -1,6 +1,6 @@ { "name": "Dart", - "version": "1.2.9", + "version": "1.3.0", "fileTypes": [ "dart" ], @@ -215,7 +215,7 @@ }, { "name": "constant.numeric.dart", - "match": "(? 100__000_000__000_000__000_000, +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.dart # ^ punctuation.comma.dart > 0x4000_0000_0000_0000, +# ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.dart # ^ punctuation.comma.dart > 0.000_000_000_01, -# ^^ constant.numeric.dart +# ^^^^^^^^^^^^^^^^ constant.numeric.dart # ^ punctuation.comma.dart > 0x00_14_22_01_23_45, +# ^^^^^^^^^^^^^^^^^^^ constant.numeric.dart # ^ punctuation.comma.dart > 555_123_4567, +# ^^^^^^^^^^^^ constant.numeric.dart # ^ punctuation.comma.dart >]; # ^ punctuation.terminator.dart