| 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 import 'package:front_end/src/base/errors.dart'; | 5 import 'package:front_end/src/base/errors.dart'; |
| 6 import 'package:front_end/src/fasta/fasta_codes.dart'; | 6 import 'package:front_end/src/fasta/fasta_codes.dart'; |
| 7 import 'package:front_end/src/fasta/scanner/error_token.dart'; | 7 import 'package:front_end/src/fasta/scanner/error_token.dart'; |
| 8 import 'package:front_end/src/scanner/token.dart' show Token; | 8 import 'package:front_end/src/scanner/token.dart' show Token; |
| 9 import 'package:front_end/src/fasta/scanner/token_constants.dart'; | 9 import 'package:front_end/src/fasta/scanner/token_constants.dart'; |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 charOffset--; | 87 charOffset--; |
| 88 } | 88 } |
| 89 reportError(errorCode, charOffset, arguments); | 89 reportError(errorCode, charOffset, arguments); |
| 90 } | 90 } |
| 91 | 91 |
| 92 var errorCode = token.errorCode; | 92 var errorCode = token.errorCode; |
| 93 switch (errorCode.analyzerCode) { | 93 switch (errorCode.analyzerCode) { |
| 94 case "UNTERMINATED_STRING_LITERAL": | 94 case "UNTERMINATED_STRING_LITERAL": |
| 95 // TODO(paulberry,ahe): Fasta reports the error location as the entire | 95 // TODO(paulberry,ahe): Fasta reports the error location as the entire |
| 96 // string; analyzer expects the end of the string. | 96 // string; analyzer expects the end of the string. |
| 97 charOffset = endOffset; | 97 charOffset = endOffset - 1; |
| 98 return _makeError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, null); | 98 return _makeError(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, null); |
| 99 | 99 |
| 100 case "UNTERMINATED_MULTI_LINE_COMMENT": | 100 case "UNTERMINATED_MULTI_LINE_COMMENT": |
| 101 // TODO(paulberry,ahe): Fasta reports the error location as the entire | 101 // TODO(paulberry,ahe): Fasta reports the error location as the entire |
| 102 // comment; analyzer expects the end of the comment. | 102 // comment; analyzer expects the end of the comment. |
| 103 charOffset = endOffset; | 103 charOffset = endOffset; |
| 104 return _makeError(ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT, null); | 104 return _makeError(ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT, null); |
| 105 | 105 |
| 106 case "MISSING_DIGIT": | 106 case "MISSING_DIGIT": |
| 107 // TODO(paulberry,ahe): Fasta reports the error location as the entire | 107 // TODO(paulberry,ahe): Fasta reports the error location as the entire |
| (...skipping 29 matching lines...) Expand all Loading... |
| 137 token = token.next; | 137 token = token.next; |
| 138 // If we've found an EOF token, its charOffset indicates where the end of | 138 // If we've found an EOF token, its charOffset indicates where the end of |
| 139 // the input is. | 139 // the input is. |
| 140 if (token.isEof) return token.charOffset == charOffset; | 140 if (token.isEof) return token.charOffset == charOffset; |
| 141 // If we've found a non-error token, then we know there is additional input | 141 // If we've found a non-error token, then we know there is additional input |
| 142 // text after [charOffset]. | 142 // text after [charOffset]. |
| 143 if (token.type.kind != BAD_INPUT_TOKEN) return false; | 143 if (token.type.kind != BAD_INPUT_TOKEN) return false; |
| 144 // Otherwise keep looking. | 144 // Otherwise keep looking. |
| 145 } | 145 } |
| 146 } | 146 } |
| OLD | NEW |