| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.dart.scanner.scanner; | 5 library analyzer.src.dart.scanner.scanner; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/token.dart'; | 7 import 'package:analyzer/dart/ast/token.dart'; |
| 8 import 'package:analyzer/error/error.dart'; | 8 import 'package:analyzer/error/error.dart'; |
| 9 import 'package:analyzer/error/listener.dart'; | 9 import 'package:analyzer/error/listener.dart'; |
| 10 import 'package:analyzer/src/dart/ast/token.dart'; | 10 import 'package:analyzer/src/dart/ast/token.dart'; |
| 11 import 'package:analyzer/src/dart/error/syntactic_errors.dart'; |
| 11 import 'package:analyzer/src/dart/scanner/reader.dart'; | 12 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| 12 import 'package:analyzer/src/generated/java_engine.dart'; | 13 import 'package:analyzer/src/generated/java_engine.dart'; |
| 13 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
| 14 import 'package:charcode/ascii.dart'; | 15 import 'package:charcode/ascii.dart'; |
| 15 | 16 |
| 17 export 'package:analyzer/src/dart/error/syntactic_errors.dart'; |
| 18 |
| 16 /** | 19 /** |
| 17 * A state in a state machine used to scan keywords. | 20 * A state in a state machine used to scan keywords. |
| 18 */ | 21 */ |
| 19 class KeywordState { | 22 class KeywordState { |
| 20 /** | 23 /** |
| 21 * An empty transition table used by leaf states. | 24 * An empty transition table used by leaf states. |
| 22 */ | 25 */ |
| 23 static List<KeywordState> _EMPTY_TABLE = new List<KeywordState>(26); | 26 static List<KeywordState> _EMPTY_TABLE = new List<KeywordState>(26); |
| 24 | 27 |
| 25 /** | 28 /** |
| (...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 } | 1346 } |
| 1344 | 1347 |
| 1345 /** | 1348 /** |
| 1346 * Checks if [value] is a single-line or multi-line comment. | 1349 * Checks if [value] is a single-line or multi-line comment. |
| 1347 */ | 1350 */ |
| 1348 static bool _isDocumentationComment(String value) { | 1351 static bool _isDocumentationComment(String value) { |
| 1349 return StringUtilities.startsWith3(value, 0, $slash, $slash, $slash) || | 1352 return StringUtilities.startsWith3(value, 0, $slash, $slash, $slash) || |
| 1350 StringUtilities.startsWith3(value, 0, $slash, $asterisk, $asterisk); | 1353 StringUtilities.startsWith3(value, 0, $slash, $asterisk, $asterisk); |
| 1351 } | 1354 } |
| 1352 } | 1355 } |
| 1353 | |
| 1354 /** | |
| 1355 * The error codes used for errors detected by the scanner. | |
| 1356 */ | |
| 1357 class ScannerErrorCode extends ErrorCode { | |
| 1358 static const ScannerErrorCode ILLEGAL_CHARACTER = | |
| 1359 const ScannerErrorCode('ILLEGAL_CHARACTER', "Illegal character {0}"); | |
| 1360 | |
| 1361 static const ScannerErrorCode MISSING_DIGIT = | |
| 1362 const ScannerErrorCode('MISSING_DIGIT', "Decimal digit expected"); | |
| 1363 | |
| 1364 static const ScannerErrorCode MISSING_HEX_DIGIT = | |
| 1365 const ScannerErrorCode('MISSING_HEX_DIGIT', "Hexidecimal digit expected"); | |
| 1366 | |
| 1367 static const ScannerErrorCode MISSING_QUOTE = | |
| 1368 const ScannerErrorCode('MISSING_QUOTE', "Expected quote (' or \")"); | |
| 1369 | |
| 1370 static const ScannerErrorCode UNABLE_GET_CONTENT = const ScannerErrorCode( | |
| 1371 'UNABLE_GET_CONTENT', "Unable to get content: {0}"); | |
| 1372 | |
| 1373 static const ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = | |
| 1374 const ScannerErrorCode( | |
| 1375 'UNTERMINATED_MULTI_LINE_COMMENT', "Unterminated multi-line comment"); | |
| 1376 | |
| 1377 static const ScannerErrorCode UNTERMINATED_STRING_LITERAL = | |
| 1378 const ScannerErrorCode( | |
| 1379 'UNTERMINATED_STRING_LITERAL', "Unterminated string literal"); | |
| 1380 | |
| 1381 /** | |
| 1382 * Initialize a newly created error code to have the given [name]. The message | |
| 1383 * associated with the error will be created from the given [message] | |
| 1384 * template. The correction associated with the error will be created from the | |
| 1385 * given [correction] template. | |
| 1386 */ | |
| 1387 const ScannerErrorCode(String name, String message, [String correction]) | |
| 1388 : super(name, message, correction); | |
| 1389 | |
| 1390 @override | |
| 1391 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | |
| 1392 | |
| 1393 @override | |
| 1394 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | |
| 1395 } | |
| OLD | NEW |