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 /** | 5 /** |
6 * The errors produced during syntactic analysis (scanning and parsing). | 6 * The errors produced during syntactic analysis (scanning and parsing). |
7 */ | 7 */ |
8 library analyzer.src.dart.error.syntactic_errors; | 8 library analyzer.src.dart.error.syntactic_errors; |
9 | 9 |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
11 | 11 |
| 12 export 'package:front_end/src/scanner/errors.dart' show ScannerErrorCode; |
| 13 |
12 /** | 14 /** |
13 * The error codes used for errors detected by the parser. The convention for | 15 * The error codes used for errors detected by the parser. The convention for |
14 * this class is for the name of the error code to indicate the problem that | 16 * this class is for the name of the error code to indicate the problem that |
15 * caused the error to be generated and for the error message to explain what | 17 * caused the error to be generated and for the error message to explain what |
16 * is wrong and, when appropriate, how the problem can be corrected. | 18 * is wrong and, when appropriate, how the problem can be corrected. |
17 */ | 19 */ |
18 class ParserErrorCode extends ErrorCode { | 20 class ParserErrorCode extends ErrorCode { |
19 static const ParserErrorCode ABSTRACT_CLASS_MEMBER = const ParserErrorCode( | 21 static const ParserErrorCode ABSTRACT_CLASS_MEMBER = const ParserErrorCode( |
20 'ABSTRACT_CLASS_MEMBER', | 22 'ABSTRACT_CLASS_MEMBER', |
21 "Members of classes can't be declared to be 'abstract'.", | 23 "Members of classes can't be declared to be 'abstract'.", |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 */ | 934 */ |
933 const ParserErrorCode(String name, String message, [String correction]) | 935 const ParserErrorCode(String name, String message, [String correction]) |
934 : super(name, message, correction); | 936 : super(name, message, correction); |
935 | 937 |
936 @override | 938 @override |
937 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 939 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
938 | 940 |
939 @override | 941 @override |
940 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | 942 ErrorType get type => ErrorType.SYNTACTIC_ERROR; |
941 } | 943 } |
942 | |
943 /** | |
944 * The error codes used for errors detected by the scanner. | |
945 */ | |
946 class ScannerErrorCode extends ErrorCode { | |
947 /** | |
948 * Parameters: | |
949 * 0: the illegal character | |
950 */ | |
951 static const ScannerErrorCode ILLEGAL_CHARACTER = | |
952 const ScannerErrorCode('ILLEGAL_CHARACTER', "Illegal character '{0}'."); | |
953 | |
954 static const ScannerErrorCode MISSING_DIGIT = | |
955 const ScannerErrorCode('MISSING_DIGIT', "Decimal digit expected."); | |
956 | |
957 static const ScannerErrorCode MISSING_HEX_DIGIT = const ScannerErrorCode( | |
958 'MISSING_HEX_DIGIT', "Hexidecimal digit expected."); | |
959 | |
960 static const ScannerErrorCode MISSING_QUOTE = | |
961 const ScannerErrorCode('MISSING_QUOTE', "Expected quote (' or \")."); | |
962 | |
963 /** | |
964 * Parameters: | |
965 * 0: the path of the file that cannot be read | |
966 */ | |
967 static const ScannerErrorCode UNABLE_GET_CONTENT = const ScannerErrorCode( | |
968 'UNABLE_GET_CONTENT', "Unable to get content of '{0}'."); | |
969 | |
970 static const ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = | |
971 const ScannerErrorCode( | |
972 'UNTERMINATED_MULTI_LINE_COMMENT', | |
973 "Unterminated multi-line comment.", | |
974 "Try terminating the comment with '*/', or " | |
975 "removing any unbalanced occurances of '/*' (because comments nest in
Dart)."); | |
976 | |
977 static const ScannerErrorCode UNTERMINATED_STRING_LITERAL = | |
978 const ScannerErrorCode( | |
979 'UNTERMINATED_STRING_LITERAL', "Unterminated string literal."); | |
980 | |
981 /** | |
982 * Initialize a newly created error code to have the given [name]. The message | |
983 * associated with the error will be created from the given [message] | |
984 * template. The correction associated with the error will be created from the | |
985 * given [correction] template. | |
986 */ | |
987 const ScannerErrorCode(String name, String message, [String correction]) | |
988 : super(name, message, correction); | |
989 | |
990 @override | |
991 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | |
992 | |
993 @override | |
994 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | |
995 } | |
OLD | NEW |