Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2429)

Unified Diff: pkg/front_end/lib/src/fasta/parser/parser_error.dart

Issue 2978063002: Move parser helper classes to own files and clean them up. (Closed)
Patch Set: Don't use problems.dart in parser. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/parser/parser_error.dart
diff --git a/pkg/front_end/lib/src/fasta/parser/parser_error.dart b/pkg/front_end/lib/src/fasta/parser/parser_error.dart
new file mode 100644
index 0000000000000000000000000000000000000000..366ce2426007b9cf6d0d9b519d78b5af021d6705
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/parser/parser_error.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library fasta.parser.parser_error;
+
+import '../fasta_codes.dart' show Message;
+
+import '../scanner.dart' show Token;
+
+class ParserError {
+ /// Character offset from the beginning of file where this error starts.
+ final int beginOffset;
+
+ /// Character offset from the beginning of file where this error ends.
+ final int endOffset;
+
+ final Message message;
+
+ ParserError(this.beginOffset, this.endOffset, this.message);
+
+ ParserError.fromTokens(Token begin, Token end, Message message)
+ : this(begin.charOffset, end.charOffset + end.charCount, message);
+
+ String toString() => "@${beginOffset}: ${message.message}\n${message.tip}";
+}
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/parser.dart ('k') | pkg/front_end/lib/src/fasta/parser/type_continuation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698