Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(611)

Side by Side Diff: pkg/front_end/lib/src/fasta/scanner/error_token.dart

Issue 2872433005: more work aligning fasta.Token with analyzer.Token (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style licenset hat can be found in the LICENSE file. 3 // BSD-style licenset hat can be found in the LICENSE file.
4 4
5 library dart_scanner.error_token; 5 library dart_scanner.error_token;
6 6
7 import '../../scanner/token.dart' show TokenType; 7 import '../../scanner/token.dart' show TokenType;
8 8
9 import '../fasta_codes.dart' 9 import '../fasta_codes.dart'
10 show 10 show
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 /// Common superclass for all error tokens. 65 /// Common superclass for all error tokens.
66 /// 66 ///
67 /// It's considered an implementation error to access [lexeme] of an 67 /// It's considered an implementation error to access [lexeme] of an
68 /// [ErrorToken]. 68 /// [ErrorToken].
69 abstract class ErrorToken extends Token { 69 abstract class ErrorToken extends Token {
70 ErrorToken(int charOffset) : super(charOffset); 70 ErrorToken(int charOffset) : super(charOffset);
71 71
72 TokenType get type => TokenType.BAD_INPUT; 72 TokenType get type => TokenType.BAD_INPUT;
73 73
74 /// This is a token that wraps around an error message. Return 1
75 /// instead of the size of the length of the error message.
76 @override
77 int get charCount => 1;
78
74 String get lexeme => throw assertionMessage; 79 String get lexeme => throw assertionMessage;
75 80
76 bool get isIdentifier => false; 81 bool get isIdentifier => false;
77 82
78 String get assertionMessage; 83 String get assertionMessage;
79 84
80 FastaCode get errorCode; 85 FastaCode get errorCode;
81 86
82 int get character => null; 87 int get character => null;
83 88
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 UnmatchedToken(BeginGroupToken begin) 220 UnmatchedToken(BeginGroupToken begin)
216 : this.begin = begin, 221 : this.begin = begin,
217 super(begin.charOffset); 222 super(begin.charOffset);
218 223
219 String toString() => "UnmatchedToken(${begin.lexeme})"; 224 String toString() => "UnmatchedToken(${begin.lexeme})";
220 225
221 String get assertionMessage => "'$begin' isn't closed."; 226 String get assertionMessage => "'$begin' isn't closed.";
222 227
223 FastaCode get errorCode => codeUnmatchedToken; 228 FastaCode get errorCode => codeUnmatchedToken;
224 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698