OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library fasta.parser.parser_error; |
| 6 |
| 7 import '../fasta_codes.dart' show Message; |
| 8 |
| 9 import '../scanner.dart' show Token; |
| 10 |
| 11 class ParserError { |
| 12 /// Character offset from the beginning of file where this error starts. |
| 13 final int beginOffset; |
| 14 |
| 15 /// Character offset from the beginning of file where this error ends. |
| 16 final int endOffset; |
| 17 |
| 18 final Message message; |
| 19 |
| 20 ParserError(this.beginOffset, this.endOffset, this.message); |
| 21 |
| 22 ParserError.fromTokens(Token begin, Token end, Message message) |
| 23 : this(begin.charOffset, end.charOffset + end.charCount, message); |
| 24 |
| 25 String toString() => "@${beginOffset}: ${message.message}\n${message.tip}"; |
| 26 } |
OLD | NEW |