| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * An error code associated with an [AnalysisError]. | 6 * An error code associated with an [AnalysisError]. |
| 7 * | 7 * |
| 8 * Generally, we want to provide messages that consist of three sentences. From | 8 * Generally, we want to provide messages that consist of three sentences. From |
| 9 * the user's perspective these sentences should explain: | 9 * the user's perspective these sentences should explain: |
| 10 * | 10 * |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 @override | 274 @override |
| 275 int get hashCode => ordinal; | 275 int get hashCode => ordinal; |
| 276 | 276 |
| 277 @override | 277 @override |
| 278 int compareTo(ErrorType other) => ordinal - other.ordinal; | 278 int compareTo(ErrorType other) => ordinal - other.ordinal; |
| 279 | 279 |
| 280 @override | 280 @override |
| 281 String toString() => name; | 281 String toString() => name; |
| 282 } | 282 } |
| 283 | |
| 284 /** | |
| 285 * The error codes used for errors detected by the scanner. | |
| 286 */ | |
| 287 class ScannerErrorCode extends ErrorCode { | |
| 288 /** | |
| 289 * Parameters: | |
| 290 * 0: the illegal character | |
| 291 */ | |
| 292 static const ScannerErrorCode ILLEGAL_CHARACTER = | |
| 293 const ScannerErrorCode('ILLEGAL_CHARACTER', "Illegal character '{0}'."); | |
| 294 | |
| 295 static const ScannerErrorCode MISSING_DIGIT = | |
| 296 const ScannerErrorCode('MISSING_DIGIT', "Decimal digit expected."); | |
| 297 | |
| 298 static const ScannerErrorCode MISSING_HEX_DIGIT = const ScannerErrorCode( | |
| 299 'MISSING_HEX_DIGIT', "Hexidecimal digit expected."); | |
| 300 | |
| 301 static const ScannerErrorCode MISSING_QUOTE = | |
| 302 const ScannerErrorCode('MISSING_QUOTE', "Expected quote (' or \")."); | |
| 303 | |
| 304 /** | |
| 305 * Parameters: | |
| 306 * 0: the path of the file that cannot be read | |
| 307 */ | |
| 308 static const ScannerErrorCode UNABLE_GET_CONTENT = const ScannerErrorCode( | |
| 309 'UNABLE_GET_CONTENT', "Unable to get content of '{0}'."); | |
| 310 | |
| 311 static const ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = | |
| 312 const ScannerErrorCode( | |
| 313 'UNTERMINATED_MULTI_LINE_COMMENT', | |
| 314 "Unterminated multi-line comment.", | |
| 315 "Try terminating the comment with '*/', or " | |
| 316 "removing any unbalanced occurances of '/*' (because comments nest in
Dart)."); | |
| 317 | |
| 318 static const ScannerErrorCode UNTERMINATED_STRING_LITERAL = | |
| 319 const ScannerErrorCode( | |
| 320 'UNTERMINATED_STRING_LITERAL', "Unterminated string literal."); | |
| 321 | |
| 322 /** | |
| 323 * Initialize a newly created error code to have the given [name]. The message | |
| 324 * associated with the error will be created from the given [message] | |
| 325 * template. The correction associated with the error will be created from the | |
| 326 * given [correction] template. | |
| 327 */ | |
| 328 const ScannerErrorCode(String name, String message, [String correction]) | |
| 329 : super(name, message, correction); | |
| 330 | |
| 331 @override | |
| 332 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | |
| 333 | |
| 334 @override | |
| 335 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | |
| 336 } | |
| OLD | NEW |