mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-17 20:58:08 +02:00
fix: add Dart required
keyword
This commit is contained in:
parent
647b7a6352
commit
7bfe2f41c6
@ -97,7 +97,7 @@
|
||||
<rule pattern="\b(assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b">
|
||||
<token type="Keyword"/>
|
||||
</rule>
|
||||
<rule pattern="\b(abstract|async|await|const|extends|factory|final|get|implements|native|operator|set|static|sync|typedef|var|with|yield)\b">
|
||||
<rule pattern="\b(abstract|async|await|const|extends|factory|final|get|implements|native|operator|required|set|static|sync|typedef|var|with|yield)\b">
|
||||
<token type="KeywordDeclaration"/>
|
||||
</rule>
|
||||
<rule pattern="\b(bool|double|dynamic|int|num|Object|String|void)\b">
|
||||
|
8
lexers/testdata/dart.actual
vendored
8
lexers/testdata/dart.actual
vendored
@ -3,8 +3,8 @@ import 'dart:html';
|
||||
import 'dart:math' show Random;
|
||||
|
||||
// We changed 5 lines of code to make this sample nicer on
|
||||
// the web (so that the execution waits for animation frame,
|
||||
// the number gets updated in the DOM, and the program ends
|
||||
// the web (so that the execution waits for animation frame,
|
||||
// the number gets updated in the DOM, and the program ends
|
||||
// after 500 iterations).
|
||||
|
||||
main() async {
|
||||
@ -39,12 +39,12 @@ Stream<double> computePi({int batch: 100000}) async* {
|
||||
Iterable<Point> generateRandom([int seed]) sync* {
|
||||
final random = new Random(seed);
|
||||
while (true) {
|
||||
yield new Point(random.nextDouble(), random.nextDouble());
|
||||
yield new Point(x: random.nextDouble(), y: random.nextDouble());
|
||||
}
|
||||
}
|
||||
|
||||
class Point {
|
||||
final double x, y;
|
||||
const Point(this.x, this.y);
|
||||
const Point({required this.x, required this.y});
|
||||
bool get isInsideUnitCircle => x * x + y * y <= 1;
|
||||
}
|
14
lexers/testdata/dart.expected
vendored
14
lexers/testdata/dart.expected
vendored
@ -18,7 +18,7 @@
|
||||
{"type":"Name","value":"Random"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"// We changed 5 lines of code to make this sample nicer on\n// the web (so that the execution waits for animation frame, \n// the number gets updated in the DOM, and the program ends \n// after 500 iterations).\n"},
|
||||
{"type":"CommentSingle","value":"// We changed 5 lines of code to make this sample nicer on\n// the web (so that the execution waits for animation frame,\n// the number gets updated in the DOM, and the program ends\n// after 500 iterations).\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Name","value":"main"},
|
||||
{"type":"Punctuation","value":"()"},
|
||||
@ -270,11 +270,15 @@
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"Point"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"NameLabel","value":"x:"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"random"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"nextDouble"},
|
||||
{"type":"Punctuation","value":"(),"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameLabel","value":"y:"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"random"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"nextDouble"},
|
||||
@ -303,16 +307,20 @@
|
||||
{"type":"KeywordDeclaration","value":"const"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"Point"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Punctuation","value":"({"},
|
||||
{"type":"KeywordDeclaration","value":"required"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"this"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"x"},
|
||||
{"type":"Punctuation","value":","},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"required"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"this"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Name","value":"y"},
|
||||
{"type":"Punctuation","value":");"},
|
||||
{"type":"Punctuation","value":"});"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"KeywordType","value":"bool"},
|
||||
{"type":"Text","value":" "},
|
||||
|
Loading…
x
Reference in New Issue
Block a user