| Index: pkg/front_end/lib/src/scanner/token.dart
|
| diff --git a/pkg/front_end/lib/src/scanner/token.dart b/pkg/front_end/lib/src/scanner/token.dart
|
| index ec38b9ce0b59ba14ed871226fd850254c2450e29..c4ce6f1e55239614c0f56350ba96ea2f8e7fc2b3 100644
|
| --- a/pkg/front_end/lib/src/scanner/token.dart
|
| +++ b/pkg/front_end/lib/src/scanner/token.dart
|
| @@ -45,7 +45,8 @@ class BeginToken extends SimpleToken {
|
| * [offset].
|
| */
|
| BeginToken(TokenType type, int offset) : super(type, offset) {
|
| - assert(type == TokenType.OPEN_CURLY_BRACKET ||
|
| + assert(type == TokenType.LT ||
|
| + type == TokenType.OPEN_CURLY_BRACKET ||
|
| type == TokenType.OPEN_PAREN ||
|
| type == TokenType.OPEN_SQUARE_BRACKET ||
|
| type == TokenType.STRING_INTERPOLATION_EXPRESSION);
|
| @@ -53,6 +54,18 @@ class BeginToken extends SimpleToken {
|
|
|
| @override
|
| Token copy() => new BeginToken(type, offset);
|
| +
|
| + /**
|
| + * The token that corresponds to this token.
|
| + */
|
| + Token get endGroup => endToken;
|
| +
|
| + /**
|
| + * Set the token that corresponds to this token.
|
| + */
|
| + set endGroup(Token token) {
|
| + endToken = token;
|
| + }
|
| }
|
|
|
| /**
|
| @@ -712,6 +725,22 @@ class SyntheticStringToken extends StringToken {
|
|
|
| @override
|
| bool get isSynthetic => true;
|
| +
|
| + @override
|
| + Token copy() => new SyntheticStringToken(type, _value, offset);
|
| +}
|
| +
|
| +/**
|
| + * A synthetic token.
|
| + */
|
| +class SyntheticToken extends SimpleToken {
|
| + SyntheticToken(TokenType type, int offset) : super(type, offset);
|
| +
|
| + @override
|
| + int get length => 0;
|
| +
|
| + @override
|
| + Token copy() => new SyntheticToken(type, offset);
|
| }
|
|
|
| /**
|
| @@ -727,6 +756,19 @@ abstract class Token implements SyntacticEntity {
|
| factory Token(TokenType type, int offset) = SimpleToken;
|
|
|
| /**
|
| + * Initialize a newly created end-of-file token to have the given [offset].
|
| + */
|
| + factory Token.eof(int offset, [CommentToken precedingComments]) {
|
| + Token eof = precedingComments == null
|
| + ? new SimpleToken(TokenType.EOF, offset)
|
| + : new TokenWithComment(TokenType.EOF, offset, precedingComments);
|
| + // EOF points to itself so there's always infinite look-ahead.
|
| + eof.previous = eof;
|
| + eof.next = eof;
|
| + return eof;
|
| + }
|
| +
|
| + /**
|
| * The number of characters parsed by this token.
|
| */
|
| int get charCount;
|
|
|