| OLD | NEW |
| 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 BeginToken, TokenType, TokenWithComment; | 7 import '../../scanner/token.dart' show BeginToken, SimpleToken, TokenType; |
| 8 | 8 |
| 9 import '../fasta_codes.dart' | 9 import '../fasta_codes.dart' |
| 10 show | 10 show |
| 11 Code, | 11 Code, |
| 12 codeAsciiControlCharacter, | 12 codeAsciiControlCharacter, |
| 13 codeEncoding, | 13 codeEncoding, |
| 14 codeExpectedHexDigit, | 14 codeExpectedHexDigit, |
| 15 codeMissingExponent, | 15 codeMissingExponent, |
| 16 codeNonAsciiIdentifier, | 16 codeNonAsciiIdentifier, |
| 17 codeNonAsciiWhitespace, | 17 codeNonAsciiWhitespace, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 default: | 59 default: |
| 60 return new NonAsciiIdentifierToken(character, charOffset); | 60 return new NonAsciiIdentifierToken(character, charOffset); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 /// Common superclass for all error tokens. | 64 /// Common superclass for all error tokens. |
| 65 /// | 65 /// |
| 66 /// It's considered an implementation error to access [lexeme] of an | 66 /// It's considered an implementation error to access [lexeme] of an |
| 67 /// [ErrorToken]. | 67 /// [ErrorToken]. |
| 68 abstract class ErrorToken extends TokenWithComment { | 68 abstract class ErrorToken extends SimpleToken { |
| 69 ErrorToken(int offset) : super(TokenType.BAD_INPUT, offset, null); | 69 ErrorToken(int offset) : super(TokenType.BAD_INPUT, offset, null); |
| 70 | 70 |
| 71 /// This is a token that wraps around an error message. Return 1 | 71 /// This is a token that wraps around an error message. Return 1 |
| 72 /// instead of the size of the length of the error message. | 72 /// instead of the size of the length of the error message. |
| 73 @override | 73 @override |
| 74 int get length => 1; | 74 int get length => 1; |
| 75 | 75 |
| 76 String get lexeme => throw assertionMessage; | 76 String get lexeme => throw assertionMessage; |
| 77 | 77 |
| 78 String get assertionMessage; | 78 String get assertionMessage; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 UnmatchedToken(BeginToken begin) | 215 UnmatchedToken(BeginToken begin) |
| 216 : this.begin = begin, | 216 : this.begin = begin, |
| 217 super(begin.charOffset); | 217 super(begin.charOffset); |
| 218 | 218 |
| 219 String toString() => "UnmatchedToken(${begin.lexeme})"; | 219 String toString() => "UnmatchedToken(${begin.lexeme})"; |
| 220 | 220 |
| 221 String get assertionMessage => "'$begin' isn't closed."; | 221 String get assertionMessage => "'$begin' isn't closed."; |
| 222 | 222 |
| 223 Code get errorCode => codeUnmatchedToken; | 223 Code get errorCode => codeUnmatchedToken; |
| 224 } | 224 } |
| OLD | NEW |