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

Unified Diff: pkg/fasta/lib/src/source/unhandled_listener.dart

Issue 2634543002: Fasta parser listener infrastructure. (Closed)
Patch Set: Created 3 years, 11 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/fasta/lib/src/source/unhandled_listener.dart
diff --git a/pkg/fasta/lib/src/source/unhandled_listener.dart b/pkg/fasta/lib/src/source/unhandled_listener.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ec4430511d21872b7251f0967849f9211d4c5e74
--- /dev/null
+++ b/pkg/fasta/lib/src/source/unhandled_listener.dart
@@ -0,0 +1,73 @@
+// Copyright (c) 2016, 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.unhandled_listener;
+
+import 'package:dart_scanner/src/token.dart' show
+ Token;
+
+import 'stack_listener.dart' show
+ NullValue,
+ StackListener;
+
+export 'stack_listener.dart' show
+ NullValue;
+
+// TODO(ahe): Get rid of this.
+enum Unhandled {
+ ConditionalUri,
+ ConditionalUris,
+ DottedName,
+ Hide,
+ Initializers,
+ Interpolation,
+ Metadata,
+ Show,
+ TypeVariables,
+}
+
+// TODO(ahe): Get rid of this class when all listeners are complete.
+abstract class UnhandledListener extends StackListener {
+ void endMetadataStar(int count, bool forParameter) {
+ debugEvent("MetadataStar");
+ push(popList(count) ?? NullValue.Metadata);
+ }
+
+ void endConditionalUri(Token ifKeyword, Token equalitySign) {
+ debugEvent("ConditionalUri");
+ pop(); // URI.
+ popIfNotNull(equalitySign); // String.
+ pop(); // DottedName.
+ push(Unhandled.ConditionalUri);
+ }
+
+ void endConditionalUris(int count) {
+ debugEvent("ConditionalUris");
+ popList(count);
+ push(Unhandled.ConditionalUris);
+ }
+
+ void endHide(Token hideKeyword) {
+ debugEvent("Hide");
+ pop();
+ push(Unhandled.Hide);
+ }
+
+ void endShow(Token showKeyword) {
+ debugEvent("Show");
+ pop();
+ push(Unhandled.Show);
+ }
+
+ void endCombinators(int count) {
+ debugEvent("Combinators");
+ push(popList(count) ?? NullValue.Combinators);
+ }
+
+ void endDottedName(int count, Token firstIdentifier) {
+ debugEvent("DottedName");
+ popList(count);
+ push(Unhandled.DottedName);
+ }
+}
« pkg/fasta/lib/src/source/stack_listener.dart ('K') | « pkg/fasta/lib/src/source/stack_listener.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698