chore: bump scintilla and lexilla version

This commit is contained in:
2025-10-12 13:51:32 +08:00
parent 9fb3681e3a
commit db20417ce7
1093 changed files with 138943 additions and 128144 deletions

View File

@ -0,0 +1,339 @@
// coding:utf-8
void main() {
print('Hello, World!');
}
var name = 'Voyager I';
var url = 'url'
var year = 1977;
var antennaDiameter = 3.7;
var flybyObjects = ['Jupiter', 'Saturn', 'Uranus', 'Neptune'];
var image = {
'tags': ['saturn'],
url: '//path/to/saturn.jpg'
};
if (year >= 2001) {
print('21st century');
} else if (year >= 1901) {
print('20th century');
}
for (final object in flybyObjects) {
print(object);
}
for (int month = 1; month <= 12; month++) {
print(month);
}
while (year < 2016) {
year += 1;
}
flybyObjects.where((name) => name.contains('turn')).forEach(print);
// This is a normal, one-line comment.
/// This is a documentation comment, used to document libraries,
/// classes, and their members. Tools like IDEs and dartdoc treat
/// doc comments specially.
/* Comments like these are also supported. */
/** Comment
block doc */
// Importing core libraries
import 'dart:math';
// Importing libraries from external packages
import 'package:test/test.dart';
// Importing files
import 'path/to/my_other_file.dart';
class Spacecraft {
String name;
DateTime? launchDate;
// Read-only non-final property
int? get launchYear => launchDate?.year;
// Constructor, with syntactic sugar for assignment to members.
Spacecraft(this.name, this.launchDate) {
// Initialization code goes here.
}
// Named constructor that forwards to the default one.
Spacecraft.unlaunched(String name) : this(name, null);
// Method.
void describe() {
print('Spacecraft: $name');
// Type promotion doesn't work on getters.
var launchDate = this.launchDate;
if (launchDate != null) {
int years = DateTime.now().difference(launchDate).inDays ~/ 365;
print('Launched: $launchYear ($years years ago)');
} else {
print('Unlaunched');
}
}
}
var voyager = Spacecraft('Voyager I', DateTime(1977, 9, 5));
voyager.describe();
var voyager3 = Spacecraft.unlaunched('Voyager III');
voyager3.describe();
enum PlanetType { terrestrial, gas, ice }
/// Enum that enumerates the different planets in our solar system
/// and some of their properties.
enum Planet {
mercury(planetType: PlanetType.terrestrial, moons: 0, hasRings: false),
venus(planetType: PlanetType.terrestrial, moons: 0, hasRings: false),
// ···
uranus(planetType: PlanetType.ice, moons: 27, hasRings: true),
neptune(planetType: PlanetType.ice, moons: 14, hasRings: true);
/// A constant generating constructor
const Planet(
{required this.planetType, required this.moons, required this.hasRings});
/// All instance variables are final
final PlanetType planetType;
final int moons;
final bool hasRings;
/// Enhanced enums support getters and other methods
bool get isGiant =>
planetType == PlanetType.gas || planetType == PlanetType.ice;
}
final yourPlanet = Planet.earth;
if (!yourPlanet.isGiant) {
print('Your planet is not a "giant planet".');
}
mixin Piloted {
int astronauts = 1;
void describeCrew() {
print('Number of astronauts: $astronauts');
}
}
const oneSecond = Duration(seconds: 1);
// ···
Future<void> printWithDelay(String message) async {
await Future.delayed(oneSecond);
print(message);
}
Future<void> printWithDelay(String message) {
return Future.delayed(oneSecond).then((_) {
print(message);
});
}
Future<void> createDescriptions(Iterable<String> objects) async {
for (final object in objects) {
try {
var file = File('$object.txt');
if (await file.exists()) {
var modified = await file.lastModified();
print(
'File for $object already exists. It was modified on $modified.');
continue;
}
await file.create();
await file.writeAsString('Start describing $object in this file.');
} on IOException catch (e) {
print('Cannot create description for $object: $e');
}
}
}
Stream<String> report(Spacecraft craft, Iterable<String> objects) async* {
for (final object in objects) {
await Future.delayed(oneSecond);
yield '${craft.name} flies by $object';
}
}
Future<void> describeFlybyObjects(List<String> flybyObjects) async {
try {
for (final object in flybyObjects) {
var description = await File('$object.txt').readAsString();
print(description);
}
} on IOException catch (e) {
print('Could not describe object: $e');
} finally {
flybyObjects.clear();
}
}
class Television {
/// Use [turnOn] to turn the power on instead.
@Deprecated('Use turnOn instead')
void activate() {
turnOn();
}
/// Turns the TV's power on.
void turnOn() {...}
// ···
}
String? name // Nullable type. Can be `null` or string.
String name // Non-nullable type. Cannot be `null` but can be string.
/// A domesticated South American camelid (Lama glama).
///
/// Andean cultures have used llamas as meat and pack
/// animals since pre-Hispanic times.
///
/// Just like any other animal, llamas need to eat,
/// so don't forget to [feed] them some [Food].
class Llama {
String? name;
/** Feeds your llama [food].
/
/ The typical llama eats one bale of hay per week. **/
void feed(Food food) {
// ...
}
/// Exercises your llama with an [activity] for
/// [timeLimit] minutes.
void exercise(Activity activity, int timeLimit) {
// ...
}
}
import 'package:lib1/lib1.dart';
import 'package:lib2/lib2.dart' as lib2;
// Import only foo.
import 'package:lib1/lib1.dart' show foo;
// Import all names EXCEPT foo.
import 'package:lib2/lib2.dart' hide foo;
print(#mysymbol);
Symbol symbol = #myMethod;
Symbol symbol2 = #<;
Symbol symbol2 = #void;
var x = 1;
var hex = 0xDEADBEEF;
var y = 1.1;
var exponents = 1.42e5;
var s1 = 'Single quotes work well for string literals.';
var s2 = "Double quotes work just as well.";
var s3 = 'It\'s easy to escape the string delimiter.';
var s4 = "It's even easier to use the other delimiter.";
var s = 'string interpolation';
assert('Dart has $s, which is very handy.' ==
'Dart has string interpolation, '
'which is very handy.');
assert('That deserves all caps. '
'${s.toUpperCase()} is very handy!' ==
'That deserves all caps. '
'STRING INTERPOLATION is very handy!');
var s1 = 'String '
'concatenation'
" works even over line breaks.";
assert(s1 ==
'String concatenation works even over '
'line breaks.');
var s2 = 'The + operator ' + 'works, as well.';
assert(s2 == 'The + operator works, as well.');
var s1 = '''
You can create
multi-line strings like this one.
''';
var s2 = """This is also a
multi-line string.""";
var s = r'In a raw string, not even \n gets special treatment.';
var 2 = r"In a raw string, not even \n gets special treatment.";
var s1 = r'''
You can create
multi-line strings like this one.
''';
var s2 = r"""This is also a
multi-line string.""";
var record = ('first', a: 2, b: true, 'last');
var record = ('first', a: 2, b: true, 'last');
print(record.$1); // Prints 'first'
print(record.a); // Prints 2
print(record.b); // Prints true
print(record.$2); // Prints 'last'
({String name, int age}) userInfo(Map<String, dynamic> json)
// ···
// Destructures using a record pattern with named fields:
final (:name, :age) = userInfo(json);
var list = [1, 2, 3];
var list = [
'Car',
'Boat',
'Plane',
];
var halogens = {'fluorine', 'chlorine', 'bromine', 'iodine', 'astatine'};
var nobleGases = {
2: 'helium',
10: 'neon',
18: 'argon',
};
var s = """This is also a
${foo(
"$bar"
)}
multi-line string.""";
var s1 = """multi
line
\n
strings
""";
var s2 = """multi-line
$x
strings
""";
var s3 = """multi-line
${x}
strings
""";
var s1 = 'Unterminated string;
var s2 = "Unterminated string;
var s3 = r'Unterminated raw string;
var s4 = r'Unterminated raw string;

View File

@ -0,0 +1,340 @@
0 400 400 // coding:utf-8
0 400 400
2 400 401 + void main() {
0 401 401 | print('Hello, World!');
0 401 400 | }
0 400 400
0 400 400 var name = 'Voyager I';
0 400 400 var url = 'url'
0 400 400 var year = 1977;
0 400 400 var antennaDiameter = 3.7;
0 400 400 var flybyObjects = ['Jupiter', 'Saturn', 'Uranus', 'Neptune'];
2 400 401 + var image = {
0 401 401 | 'tags': ['saturn'],
0 401 401 | url: '//path/to/saturn.jpg'
0 401 400 | };
0 400 400
0 400 400
2 400 401 + if (year >= 2001) {
0 401 401 | print('21st century');
0 401 401 | } else if (year >= 1901) {
0 401 401 | print('20th century');
0 401 400 | }
0 400 400
2 400 401 + for (final object in flybyObjects) {
0 401 401 | print(object);
0 401 400 | }
0 400 400
2 400 401 + for (int month = 1; month <= 12; month++) {
0 401 401 | print(month);
0 401 400 | }
0 400 400
2 400 401 + while (year < 2016) {
0 401 401 | year += 1;
0 401 400 | }
0 400 400
0 400 400 flybyObjects.where((name) => name.contains('turn')).forEach(print);
0 400 400
0 400 400 // This is a normal, one-line comment.
0 400 400
2 400 401 + /// This is a documentation comment, used to document libraries,
0 401 401 | /// classes, and their members. Tools like IDEs and dartdoc treat
0 401 400 | /// doc comments specially.
0 400 400
0 400 400 /* Comments like these are also supported. */
0 400 400
2 400 401 + /** Comment
0 401 400 | block doc */
0 400 400
0 400 400 // Importing core libraries
0 400 400 import 'dart:math';
0 400 400
0 400 400 // Importing libraries from external packages
0 400 400 import 'package:test/test.dart';
0 400 400
0 400 400 // Importing files
0 400 400 import 'path/to/my_other_file.dart';
0 400 400
2 400 401 + class Spacecraft {
0 401 401 | String name;
0 401 401 | DateTime? launchDate;
0 401 401 |
0 401 401 | // Read-only non-final property
0 401 401 | int? get launchYear => launchDate?.year;
0 401 401 |
0 401 401 | // Constructor, with syntactic sugar for assignment to members.
2 401 402 + Spacecraft(this.name, this.launchDate) {
0 402 402 | // Initialization code goes here.
0 402 401 | }
0 401 401 |
0 401 401 | // Named constructor that forwards to the default one.
0 401 401 | Spacecraft.unlaunched(String name) : this(name, null);
0 401 401 |
0 401 401 | // Method.
2 401 402 + void describe() {
0 402 402 | print('Spacecraft: $name');
0 402 402 | // Type promotion doesn't work on getters.
0 402 402 | var launchDate = this.launchDate;
2 402 403 + if (launchDate != null) {
0 403 403 | int years = DateTime.now().difference(launchDate).inDays ~/ 365;
0 403 403 | print('Launched: $launchYear ($years years ago)');
0 403 403 | } else {
0 403 403 | print('Unlaunched');
0 403 402 | }
0 402 401 | }
0 401 400 | }
0 400 400
0 400 400 var voyager = Spacecraft('Voyager I', DateTime(1977, 9, 5));
0 400 400 voyager.describe();
0 400 400
0 400 400 var voyager3 = Spacecraft.unlaunched('Voyager III');
0 400 400 voyager3.describe();
0 400 400
0 400 400 enum PlanetType { terrestrial, gas, ice }
0 400 400
2 400 401 + /// Enum that enumerates the different planets in our solar system
0 401 400 | /// and some of their properties.
2 400 401 + enum Planet {
0 401 401 | mercury(planetType: PlanetType.terrestrial, moons: 0, hasRings: false),
0 401 401 | venus(planetType: PlanetType.terrestrial, moons: 0, hasRings: false),
0 401 401 | // ···
0 401 401 | uranus(planetType: PlanetType.ice, moons: 27, hasRings: true),
0 401 401 | neptune(planetType: PlanetType.ice, moons: 14, hasRings: true);
0 401 401 |
0 401 401 | /// A constant generating constructor
2 401 402 + const Planet(
0 402 401 | {required this.planetType, required this.moons, required this.hasRings});
0 401 401 |
0 401 401 | /// All instance variables are final
0 401 401 | final PlanetType planetType;
0 401 401 | final int moons;
0 401 401 | final bool hasRings;
0 401 401 |
0 401 401 | /// Enhanced enums support getters and other methods
0 401 401 | bool get isGiant =>
0 401 401 | planetType == PlanetType.gas || planetType == PlanetType.ice;
0 401 400 | }
0 400 400
0 400 400 final yourPlanet = Planet.earth;
0 400 400
2 400 401 + if (!yourPlanet.isGiant) {
0 401 401 | print('Your planet is not a "giant planet".');
0 401 400 | }
0 400 400
2 400 401 + mixin Piloted {
0 401 401 | int astronauts = 1;
0 401 401 |
2 401 402 + void describeCrew() {
0 402 402 | print('Number of astronauts: $astronauts');
0 402 401 | }
0 401 400 | }
0 400 400
0 400 400 const oneSecond = Duration(seconds: 1);
0 400 400 // ···
2 400 401 + Future<void> printWithDelay(String message) async {
0 401 401 | await Future.delayed(oneSecond);
0 401 401 | print(message);
0 401 400 | }
0 400 400
0 400 400
2 400 401 + Future<void> printWithDelay(String message) {
2 401 403 + return Future.delayed(oneSecond).then((_) {
0 403 403 | print(message);
0 403 401 | });
0 401 400 | }
0 400 400
2 400 401 + Future<void> createDescriptions(Iterable<String> objects) async {
2 401 402 + for (final object in objects) {
2 402 403 + try {
0 403 403 | var file = File('$object.txt');
2 403 404 + if (await file.exists()) {
0 404 404 | var modified = await file.lastModified();
2 404 405 + print(
0 405 404 | 'File for $object already exists. It was modified on $modified.');
0 404 404 | continue;
0 404 403 | }
0 403 403 | await file.create();
0 403 403 | await file.writeAsString('Start describing $object in this file.');
0 403 403 | } on IOException catch (e) {
0 403 403 | print('Cannot create description for $object: $e');
0 403 402 | }
0 402 401 | }
0 401 400 | }
0 400 400
2 400 401 + Stream<String> report(Spacecraft craft, Iterable<String> objects) async* {
2 401 402 + for (final object in objects) {
0 402 402 | await Future.delayed(oneSecond);
0 402 402 | yield '${craft.name} flies by $object';
0 402 401 | }
0 401 400 | }
0 400 400
2 400 401 + Future<void> describeFlybyObjects(List<String> flybyObjects) async {
2 401 402 + try {
2 402 403 + for (final object in flybyObjects) {
0 403 403 | var description = await File('$object.txt').readAsString();
0 403 403 | print(description);
0 403 402 | }
0 402 402 | } on IOException catch (e) {
0 402 402 | print('Could not describe object: $e');
0 402 402 | } finally {
0 402 402 | flybyObjects.clear();
0 402 401 | }
0 401 400 | }
0 400 400
2 400 401 + class Television {
0 401 401 | /// Use [turnOn] to turn the power on instead.
0 401 401 | @Deprecated('Use turnOn instead')
2 401 402 + void activate() {
0 402 402 | turnOn();
0 402 401 | }
0 401 401 |
0 401 401 | /// Turns the TV's power on.
0 401 401 | void turnOn() {...}
0 401 401 | // ···
0 401 400 | }
0 400 400
0 400 400 String? name // Nullable type. Can be `null` or string.
0 400 400
0 400 400 String name // Non-nullable type. Cannot be `null` but can be string.
0 400 400
0 400 400
2 400 401 + /// A domesticated South American camelid (Lama glama).
0 401 401 | ///
0 401 401 | /// Andean cultures have used llamas as meat and pack
0 401 401 | /// animals since pre-Hispanic times.
0 401 401 | ///
0 401 401 | /// Just like any other animal, llamas need to eat,
0 401 400 | /// so don't forget to [feed] them some [Food].
2 400 401 + class Llama {
0 401 401 | String? name;
0 401 401 |
2 401 402 + /** Feeds your llama [food].
0 402 402 | /
0 402 401 | / The typical llama eats one bale of hay per week. **/
2 401 402 + void feed(Food food) {
0 402 402 | // ...
0 402 401 | }
0 401 401 |
2 401 402 + /// Exercises your llama with an [activity] for
0 402 401 | /// [timeLimit] minutes.
2 401 402 + void exercise(Activity activity, int timeLimit) {
0 402 402 | // ...
0 402 401 | }
0 401 400 | }
0 400 400
2 400 401 + import 'package:lib1/lib1.dart';
0 401 400 | import 'package:lib2/lib2.dart' as lib2;
0 400 400 // Import only foo.
0 400 400 import 'package:lib1/lib1.dart' show foo;
0 400 400 // Import all names EXCEPT foo.
0 400 400 import 'package:lib2/lib2.dart' hide foo;
0 400 400
0 400 400 print(#mysymbol);
0 400 400 Symbol symbol = #myMethod;
0 400 400 Symbol symbol2 = #<;
0 400 400 Symbol symbol2 = #void;
0 400 400
0 400 400 var x = 1;
0 400 400 var hex = 0xDEADBEEF;
0 400 400 var y = 1.1;
0 400 400 var exponents = 1.42e5;
0 400 400
0 400 400 var s1 = 'Single quotes work well for string literals.';
0 400 400 var s2 = "Double quotes work just as well.";
0 400 400 var s3 = 'It\'s easy to escape the string delimiter.';
0 400 400 var s4 = "It's even easier to use the other delimiter.";
0 400 400
0 400 400 var s = 'string interpolation';
0 400 400
2 400 401 + assert('Dart has $s, which is very handy.' ==
0 401 401 | 'Dart has string interpolation, '
0 401 400 | 'which is very handy.');
2 400 401 + assert('That deserves all caps. '
0 401 401 | '${s.toUpperCase()} is very handy!' ==
0 401 401 | 'That deserves all caps. '
0 401 400 | 'STRING INTERPOLATION is very handy!');
0 400 400
0 400 400 var s1 = 'String '
0 400 400 'concatenation'
0 400 400 " works even over line breaks.";
2 400 401 + assert(s1 ==
0 401 401 | 'String concatenation works even over '
0 401 400 | 'line breaks.');
0 400 400
0 400 400 var s2 = 'The + operator ' + 'works, as well.';
0 400 400 assert(s2 == 'The + operator works, as well.');
0 400 400
2 400 401 + var s1 = '''
0 401 401 | You can create
0 401 401 | multi-line strings like this one.
0 401 400 | ''';
0 400 400
2 400 401 + var s2 = """This is also a
0 401 400 | multi-line string.""";
0 400 400
0 400 400 var s = r'In a raw string, not even \n gets special treatment.';
0 400 400 var 2 = r"In a raw string, not even \n gets special treatment.";
0 400 400
2 400 401 + var s1 = r'''
0 401 401 | You can create
0 401 401 | multi-line strings like this one.
0 401 400 | ''';
0 400 400
2 400 401 + var s2 = r"""This is also a
0 401 400 | multi-line string.""";
0 400 400
0 400 400 var record = ('first', a: 2, b: true, 'last');
0 400 400
0 400 400 var record = ('first', a: 2, b: true, 'last');
0 400 400
0 400 400 print(record.$1); // Prints 'first'
0 400 400 print(record.a); // Prints 2
0 400 400 print(record.b); // Prints true
0 400 400 print(record.$2); // Prints 'last'
0 400 400
0 400 400 ({String name, int age}) userInfo(Map<String, dynamic> json)
2 400 401 + // ···
0 401 400 | // Destructures using a record pattern with named fields:
0 400 400 final (:name, :age) = userInfo(json);
0 400 400
0 400 400 var list = [1, 2, 3];
2 400 401 + var list = [
0 401 401 | 'Car',
0 401 401 | 'Boat',
0 401 401 | 'Plane',
0 401 400 | ];
0 400 400 var halogens = {'fluorine', 'chlorine', 'bromine', 'iodine', 'astatine'};
0 400 400
2 400 401 + var nobleGases = {
0 401 401 | 2: 'helium',
0 401 401 | 10: 'neon',
0 401 401 | 18: 'argon',
0 401 400 | };
0 400 400
2 400 401 + var s = """This is also a
2 401 403 + ${foo(
0 403 403 | "$bar"
0 403 401 | )}
0 401 400 | multi-line string.""";
0 400 400
2 400 401 + var s1 = """multi
0 401 401 | line
0 401 401 | \n
0 401 401 | strings
0 401 400 | """;
0 400 400
2 400 401 + var s2 = """multi-line
0 401 401 | $x
0 401 401 | strings
0 401 400 | """;
0 400 400
2 400 401 + var s3 = """multi-line
0 401 401 | ${x}
0 401 401 | strings
0 401 400 | """;
0 400 400
0 400 400 var s1 = 'Unterminated string;
0 400 400 var s2 = "Unterminated string;
0 400 400 var s3 = r'Unterminated raw string;
0 400 400 var s4 = r'Unterminated raw string;
0 400 0

View File

@ -0,0 +1,339 @@
{1}// coding:utf-8
{0}
{24}void{0} {14}main{16}(){0} {16}{{0}
{14}print{16}({5}'Hello, World!'{16});{0}
{16}}{0}
{23}var{0} {14}name{0} {16}={0} {5}'Voyager I'{16};{0}
{23}var{0} {14}url{0} {16}={0} {5}'url'{0}
{23}var{0} {14}year{0} {16}={0} {20}1977{16};{0}
{23}var{0} {14}antennaDiameter{0} {16}={0} {20}3.7{16};{0}
{23}var{0} {14}flybyObjects{0} {16}={0} {16}[{5}'Jupiter'{16},{0} {5}'Saturn'{16},{0} {5}'Uranus'{16},{0} {5}'Neptune'{16}];{0}
{23}var{0} {14}image{0} {16}={0} {16}{{0}
{5}'tags'{16}:{0} {16}[{5}'saturn'{16}],{0}
{21}url{16}:{0} {5}'//path/to/saturn.jpg'{0}
{16}};{0}
{23}if{0} {16}({14}year{0} {16}>={0} {20}2001{16}){0} {16}{{0}
{14}print{16}({5}'21st century'{16});{0}
{16}}{0} {23}else{0} {23}if{0} {16}({14}year{0} {16}>={0} {20}1901{16}){0} {16}{{0}
{14}print{16}({5}'20th century'{16});{0}
{16}}{0}
{23}for{0} {16}({23}final{0} {14}object{0} {23}in{0} {14}flybyObjects{16}){0} {16}{{0}
{14}print{16}({14}object{16});{0}
{16}}{0}
{23}for{0} {16}({24}int{0} {14}month{0} {16}={0} {20}1{16};{0} {14}month{0} {16}<={0} {20}12{16};{0} {14}month{16}++){0} {16}{{0}
{14}print{16}({14}month{16});{0}
{16}}{0}
{23}while{0} {16}({14}year{0} {16}<{0} {20}2016{16}){0} {16}{{0}
{14}year{0} {16}+={0} {20}1{16};{0}
{16}}{0}
{14}flybyObjects{16}.{14}where{16}(({14}name{16}){0} {16}=>{0} {14}name{16}.{14}contains{16}({5}'turn'{16})).{14}forEach{16}({14}print{16});{0}
{1}// This is a normal, one-line comment.
{0}
{2}/// This is a documentation comment, used to document libraries,
/// classes, and their members. Tools like IDEs and dartdoc treat
/// doc comments specially.
{0}
{3}/* Comments like these are also supported. */{0}
{4}/** Comment
block doc */{0}
{1}// Importing core libraries
{23}import{0} {5}'dart:math'{16};{0}
{1}// Importing libraries from external packages
{23}import{0} {5}'package:test/test.dart'{16};{0}
{1}// Importing files
{23}import{0} {5}'path/to/my_other_file.dart'{16};{0}
{23}class{0} {26}Spacecraft{0} {16}{{0}
{25}String{0} {14}name{16};{0}
{25}DateTime{16}?{0} {14}launchDate{16};{0}
{1}// Read-only non-final property
{0} {24}int{16}?{0} {23}get{0} {14}launchYear{0} {16}=>{0} {14}launchDate{16}?.{14}year{16};{0}
{1}// Constructor, with syntactic sugar for assignment to members.
{0} {26}Spacecraft{16}({23}this{16}.{14}name{16},{0} {23}this{16}.{14}launchDate{16}){0} {16}{{0}
{1}// Initialization code goes here.
{0} {16}}{0}
{1}// Named constructor that forwards to the default one.
{0} {26}Spacecraft{16}.{14}unlaunched{16}({25}String{0} {14}name{16}){0} {16}:{0} {23}this{16}({14}name{16},{0} {23}null{16});{0}
{1}// Method.
{0} {24}void{0} {14}describe{16}(){0} {16}{{0}
{14}print{16}({5}'Spacecraft: {17}${15}name{5}'{16});{0}
{1}// Type promotion doesn't work on getters.
{0} {23}var{0} {14}launchDate{0} {16}={0} {23}this{16}.{14}launchDate{16};{0}
{23}if{0} {16}({14}launchDate{0} {16}!={0} {23}null{16}){0} {16}{{0}
{24}int{0} {14}years{0} {16}={0} {25}DateTime{16}.{14}now{16}().{14}difference{16}({14}launchDate{16}).{14}inDays{0} {16}~/{0} {20}365{16};{0}
{14}print{16}({5}'Launched: {17}${15}launchYear{5} ({17}${15}years{5} years ago)'{16});{0}
{16}}{0} {23}else{0} {16}{{0}
{14}print{16}({5}'Unlaunched'{16});{0}
{16}}{0}
{16}}{0}
{16}}{0}
{23}var{0} {14}voyager{0} {16}={0} {26}Spacecraft{16}({5}'Voyager I'{16},{0} {25}DateTime{16}({20}1977{16},{0} {20}9{16},{0} {20}5{16}));{0}
{14}voyager{16}.{14}describe{16}();{0}
{23}var{0} {14}voyager3{0} {16}={0} {26}Spacecraft{16}.{14}unlaunched{16}({5}'Voyager III'{16});{0}
{14}voyager3{16}.{14}describe{16}();{0}
{23}enum{0} {14}PlanetType{0} {16}{{0} {14}terrestrial{16},{0} {14}gas{16},{0} {14}ice{0} {16}}{0}
{2}/// Enum that enumerates the different planets in our solar system
/// and some of their properties.
{23}enum{0} {14}Planet{0} {16}{{0}
{14}mercury{16}({21}planetType{16}:{0} {14}PlanetType{16}.{14}terrestrial{16},{0} {21}moons{16}:{0} {20}0{16},{0} {21}hasRings{16}:{0} {23}false{16}),{0}
{14}venus{16}({21}planetType{16}:{0} {14}PlanetType{16}.{14}terrestrial{16},{0} {21}moons{16}:{0} {20}0{16},{0} {21}hasRings{16}:{0} {23}false{16}),{0}
{1}// ···
{0} {14}uranus{16}({21}planetType{16}:{0} {14}PlanetType{16}.{14}ice{16},{0} {21}moons{16}:{0} {20}27{16},{0} {21}hasRings{16}:{0} {23}true{16}),{0}
{14}neptune{16}({21}planetType{16}:{0} {14}PlanetType{16}.{14}ice{16},{0} {21}moons{16}:{0} {20}14{16},{0} {21}hasRings{16}:{0} {23}true{16});{0}
{2}/// A constant generating constructor
{0} {23}const{0} {14}Planet{16}({0}
{16}{{23}required{0} {23}this{16}.{14}planetType{16},{0} {23}required{0} {23}this{16}.{14}moons{16},{0} {23}required{0} {23}this{16}.{14}hasRings{16}});{0}
{2}/// All instance variables are final
{0} {23}final{0} {14}PlanetType{0} {14}planetType{16};{0}
{23}final{0} {24}int{0} {14}moons{16};{0}
{23}final{0} {24}bool{0} {14}hasRings{16};{0}
{2}/// Enhanced enums support getters and other methods
{0} {24}bool{0} {23}get{0} {14}isGiant{0} {16}=>{0}
{14}planetType{0} {16}=={0} {14}PlanetType{16}.{14}gas{0} {16}||{0} {14}planetType{0} {16}=={0} {14}PlanetType{16}.{14}ice{16};{0}
{16}}{0}
{23}final{0} {14}yourPlanet{0} {16}={0} {14}Planet{16}.{14}earth{16};{0}
{23}if{0} {16}(!{14}yourPlanet{16}.{14}isGiant{16}){0} {16}{{0}
{14}print{16}({5}'Your planet is not a "giant planet".'{16});{0}
{16}}{0}
{23}mixin{0} {14}Piloted{0} {16}{{0}
{24}int{0} {14}astronauts{0} {16}={0} {20}1{16};{0}
{24}void{0} {14}describeCrew{16}(){0} {16}{{0}
{14}print{16}({5}'Number of astronauts: {17}${15}astronauts{5}'{16});{0}
{16}}{0}
{16}}{0}
{23}const{0} {14}oneSecond{0} {16}={0} {25}Duration{16}({21}seconds{16}:{0} {20}1{16});{0}
{1}// ···
{25}Future{16}<{24}void{16}>{0} {14}printWithDelay{16}({25}String{0} {14}message{16}){0} {23}async{0} {16}{{0}
{23}await{0} {25}Future{16}.{14}delayed{16}({14}oneSecond{16});{0}
{14}print{16}({14}message{16});{0}
{16}}{0}
{25}Future{16}<{24}void{16}>{0} {14}printWithDelay{16}({25}String{0} {14}message{16}){0} {16}{{0}
{23}return{0} {25}Future{16}.{14}delayed{16}({14}oneSecond{16}).{14}then{16}(({14}_{16}){0} {16}{{0}
{14}print{16}({14}message{16});{0}
{16}});{0}
{16}}{0}
{25}Future{16}<{24}void{16}>{0} {14}createDescriptions{16}({25}Iterable{16}<{25}String{16}>{0} {14}objects{16}){0} {23}async{0} {16}{{0}
{23}for{0} {16}({23}final{0} {14}object{0} {23}in{0} {14}objects{16}){0} {16}{{0}
{23}try{0} {16}{{0}
{23}var{0} {14}file{0} {16}={0} {25}File{16}({5}'{17}${15}object{5}.txt'{16});{0}
{23}if{0} {16}({23}await{0} {14}file{16}.{14}exists{16}()){0} {16}{{0}
{23}var{0} {14}modified{0} {16}={0} {23}await{0} {14}file{16}.{14}lastModified{16}();{0}
{14}print{16}({0}
{5}'File for {17}${15}object{5} already exists. It was modified on {17}${15}modified{5}.'{16});{0}
{23}continue{16};{0}
{16}}{0}
{23}await{0} {14}file{16}.{14}create{16}();{0}
{23}await{0} {14}file{16}.{14}writeAsString{16}({5}'Start describing {17}${15}object{5} in this file.'{16});{0}
{16}}{0} {23}on{0} {25}IOException{0} {23}catch{0} {16}({14}e{16}){0} {16}{{0}
{14}print{16}({5}'Cannot create description for {17}${15}object{5}: {17}${15}e{5}'{16});{0}
{16}}{0}
{16}}{0}
{16}}{0}
{25}Stream{16}<{25}String{16}>{0} {14}report{16}({26}Spacecraft{0} {14}craft{16},{0} {25}Iterable{16}<{25}String{16}>{0} {14}objects{16}){0} {23}async{16}*{0} {16}{{0}
{23}for{0} {16}({23}final{0} {14}object{0} {23}in{0} {14}objects{16}){0} {16}{{0}
{23}await{0} {25}Future{16}.{14}delayed{16}({14}oneSecond{16});{0}
{23}yield{0} {5}'{17}${{14}craft{16}.{14}name{17}}{5} flies by {17}${15}object{5}'{16};{0}
{16}}{0}
{16}}{0}
{25}Future{16}<{24}void{16}>{0} {14}describeFlybyObjects{16}({25}List{16}<{25}String{16}>{0} {14}flybyObjects{16}){0} {23}async{0} {16}{{0}
{23}try{0} {16}{{0}
{23}for{0} {16}({23}final{0} {14}object{0} {23}in{0} {14}flybyObjects{16}){0} {16}{{0}
{23}var{0} {14}description{0} {16}={0} {23}await{0} {25}File{16}({5}'{17}${15}object{5}.txt'{16}).{14}readAsString{16}();{0}
{14}print{16}({14}description{16});{0}
{16}}{0}
{16}}{0} {23}on{0} {25}IOException{0} {23}catch{0} {16}({14}e{16}){0} {16}{{0}
{14}print{16}({5}'Could not describe object: {17}${15}e{5}'{16});{0}
{16}}{0} {23}finally{0} {16}{{0}
{14}flybyObjects{16}.{14}clear{16}();{0}
{16}}{0}
{16}}{0}
{23}class{0} {14}Television{0} {16}{{0}
{2}/// Use [turnOn] to turn the power on instead.
{0} {22}@Deprecated{16}({5}'Use turnOn instead'{16}){0}
{24}void{0} {14}activate{16}(){0} {16}{{0}
{14}turnOn{16}();{0}
{16}}{0}
{2}/// Turns the TV's power on.
{0} {24}void{0} {14}turnOn{16}(){0} {16}{...}{0}
{1}// ···
{16}}{0}
{25}String{16}?{0} {14}name{0} {1}// Nullable type. Can be `null` or string.
{0}
{25}String{0} {14}name{0} {1}// Non-nullable type. Cannot be `null` but can be string.
{0}
{2}/// A domesticated South American camelid (Lama glama).
///
/// Andean cultures have used llamas as meat and pack
/// animals since pre-Hispanic times.
///
/// Just like any other animal, llamas need to eat,
/// so don't forget to [feed] them some [Food].
{23}class{0} {14}Llama{0} {16}{{0}
{25}String{16}?{0} {14}name{16};{0}
{4}/** Feeds your llama [food].
/
/ The typical llama eats one bale of hay per week. **/{0}
{24}void{0} {14}feed{16}({14}Food{0} {14}food{16}){0} {16}{{0}
{1}// ...
{0} {16}}{0}
{2}/// Exercises your llama with an [activity] for
{0} {2}/// [timeLimit] minutes.
{0} {24}void{0} {14}exercise{16}({14}Activity{0} {14}activity{16},{0} {24}int{0} {14}timeLimit{16}){0} {16}{{0}
{1}// ...
{0} {16}}{0}
{16}}{0}
{23}import{0} {5}'package:lib1/lib1.dart'{16};{0}
{23}import{0} {5}'package:lib2/lib2.dart'{0} {23}as{0} {14}lib2{16};{0}
{1}// Import only foo.
{23}import{0} {5}'package:lib1/lib1.dart'{0} {23}show{0} {14}foo{16};{0}
{1}// Import all names EXCEPT foo.
{23}import{0} {5}'package:lib2/lib2.dart'{0} {23}hide{0} {14}foo{16};{0}
{14}print{16}({18}#mysymbol{16});{0}
{25}Symbol{0} {14}symbol{0} {16}={0} {18}#myMethod{16};{0}
{25}Symbol{0} {14}symbol2{0} {16}={0} {19}#<{16};{0}
{25}Symbol{0} {14}symbol2{0} {16}={0} {18}#void{16};{0}
{23}var{0} {14}x{0} {16}={0} {20}1{16};{0}
{23}var{0} {14}hex{0} {16}={0} {20}0xDEADBEEF{16};{0}
{23}var{0} {14}y{0} {16}={0} {20}1.1{16};{0}
{23}var{0} {14}exponents{0} {16}={0} {20}1.42e5{16};{0}
{23}var{0} {14}s1{0} {16}={0} {5}'Single quotes work well for string literals.'{16};{0}
{23}var{0} {14}s2{0} {16}={0} {6}"Double quotes work just as well."{16};{0}
{23}var{0} {14}s3{0} {16}={0} {5}'It{13}\'{5}s easy to escape the string delimiter.'{16};{0}
{23}var{0} {14}s4{0} {16}={0} {6}"It's even easier to use the other delimiter."{16};{0}
{23}var{0} {14}s{0} {16}={0} {5}'string interpolation'{16};{0}
{23}assert{16}({5}'Dart has {17}${15}s{5}, which is very handy.'{0} {16}=={0}
{5}'Dart has string interpolation, '{0}
{5}'which is very handy.'{16});{0}
{23}assert{16}({5}'That deserves all caps. '{0}
{5}'{17}${{14}s{16}.{14}toUpperCase{16}(){17}}{5} is very handy!'{0} {16}=={0}
{5}'That deserves all caps. '{0}
{5}'STRING INTERPOLATION is very handy!'{16});{0}
{23}var{0} {14}s1{0} {16}={0} {5}'String '{0}
{5}'concatenation'{0}
{6}" works even over line breaks."{16};{0}
{23}assert{16}({14}s1{0} {16}=={0}
{5}'String concatenation works even over '{0}
{5}'line breaks.'{16});{0}
{23}var{0} {14}s2{0} {16}={0} {5}'The + operator '{0} {16}+{0} {5}'works, as well.'{16};{0}
{23}assert{16}({14}s2{0} {16}=={0} {5}'The + operator works, as well.'{16});{0}
{23}var{0} {14}s1{0} {16}={0} {7}'''
You can create
multi-line strings like this one.
'''{16};{0}
{23}var{0} {14}s2{0} {16}={0} {8}"""This is also a
multi-line string."""{16};{0}
{23}var{0} {14}s{0} {16}={0} {9}r'In a raw string, not even \n gets special treatment.'{16};{0}
{23}var{0} {20}2{0} {16}={0} {10}r"In a raw string, not even \n gets special treatment."{16};{0}
{23}var{0} {14}s1{0} {16}={0} {11}r'''
You can create
multi-line strings like this one.
'''{16};{0}
{23}var{0} {14}s2{0} {16}={0} {12}r"""This is also a
multi-line string."""{16};{0}
{23}var{0} {14}record{0} {16}={0} {16}({5}'first'{16},{0} {21}a{16}:{0} {20}2{16},{0} {21}b{16}:{0} {23}true{16},{0} {5}'last'{16});{0}
{23}var{0} {14}record{0} {16}={0} {16}({5}'first'{16},{0} {21}a{16}:{0} {20}2{16},{0} {21}b{16}:{0} {23}true{16},{0} {5}'last'{16});{0}
{14}print{16}({14}record{16}.{14}$1{16});{0} {1}// Prints 'first'
{14}print{16}({14}record{16}.{14}a{16});{0} {1}// Prints 2
{14}print{16}({14}record{16}.{14}b{16});{0} {1}// Prints true
{14}print{16}({14}record{16}.{14}$2{16});{0} {1}// Prints 'last'
{0}
{16}({{25}String{0} {14}name{16},{0} {24}int{0} {14}age{16}}){0} {14}userInfo{16}({25}Map{16}<{25}String{16},{0} {24}dynamic{16}>{0} {14}json{16}){0}
{1}// ···
// Destructures using a record pattern with named fields:
{23}final{0} {16}(:{14}name{16},{0} {16}:{14}age{16}){0} {16}={0} {14}userInfo{16}({14}json{16});{0}
{23}var{0} {14}list{0} {16}={0} {16}[{20}1{16},{0} {20}2{16},{0} {20}3{16}];{0}
{23}var{0} {14}list{0} {16}={0} {16}[{0}
{5}'Car'{16},{0}
{5}'Boat'{16},{0}
{5}'Plane'{16},{0}
{16}];{0}
{23}var{0} {14}halogens{0} {16}={0} {16}{{5}'fluorine'{16},{0} {5}'chlorine'{16},{0} {5}'bromine'{16},{0} {5}'iodine'{16},{0} {5}'astatine'{16}};{0}
{23}var{0} {14}nobleGases{0} {16}={0} {16}{{0}
{20}2{16}:{0} {5}'helium'{16},{0}
{20}10{16}:{0} {5}'neon'{16},{0}
{20}18{16}:{0} {5}'argon'{16},{0}
{16}};{0}
{23}var{0} {14}s{0} {16}={0} {8}"""This is also a
{17}${{14}foo{16}({0}
{6}"{17}${15}bar{6}"{0}
{16}){17}}{8}
multi-line string."""{16};{0}
{23}var{0} {14}s1{0} {16}={0} {8}"""multi
line
{13}\n{8}
strings
"""{16};{0}
{23}var{0} {14}s2{0} {16}={0} {8}"""multi-line
{17}${15}x{8}
strings
"""{16};{0}
{23}var{0} {14}s3{0} {16}={0} {8}"""multi-line
{17}${{14}x{17}}{8}
strings
"""{16};{0}
{23}var{0} {14}s1{0} {16}={0} {27}'Unterminated string;
{23}var{0} {14}s2{0} {16}={0} {27}"Unterminated string;
{23}var{0} {14}s3{0} {16}={0} {27}r'Unterminated raw string;
{23}var{0} {14}s4{0} {16}={0} {27}r'Unterminated raw string;

View File

@ -0,0 +1,20 @@
lexer.*.dart=dart
fold=1
keywords.*.dart=abstract as assert async await base break case catch class const \
continue covariant default deferred do else enum export extends extension external \
factory false final finally for get hide if implements import in interface is late \
library mixin native new null of on operator part required rethrow return sealed \
set show static super switch sync this throw true try type typedef var when while \
with yield
keywords2.*.dart=Function Never bool double dynamic int num void
keywords3.*.dart=fBigInt Comparable Comparator Completer DateTime Deprecated \
Directory DoubleLinkedQueue Duration Enum Error Exception Expando File FileLock \
FileMode FileStat FileSystemEntity FileSystemEvent Future FutureOr HashMap HashSet \
IOException Invocation Iterable IterableBase IterableMixin Iterator LinkedHashMap \
LinkedHashSet LinkedList LinkedListEntry List ListBase ListMixin ListQueue Map \
MapBase MapEntry MapMixin MapView Match Null OSError Object Pattern Platform \
Point Process Queue Random RawSocket RawSocketEvent Record Rectangle RegExp \
RegExpMatch RuneIterator Runes ServerSocket Set SetBase SetMixin Sink Socket \
SocketException SplayTreeMap SplayTreeSet StackTrace Stopwatch Stream String \
StringBuffer StringSink Symbol SystemHash Timer Type Uri UriData WeakReference
keywords4.*.dart=Spacecraft