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

Unified Diff: pkg/analyzer/lib/src/generated/parser_fasta.dart

Issue 2948473002: integrating fasta parser (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/parser_fasta.dart
diff --git a/pkg/analyzer/lib/src/generated/parser_fasta.dart b/pkg/analyzer/lib/src/generated/parser_fasta.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7e8d8e5e9519679df3fb35f2e890291ea6fdb3df
--- /dev/null
+++ b/pkg/analyzer/lib/src/generated/parser_fasta.dart
@@ -0,0 +1,94 @@
+// 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.
+
+part of analyzer.parser;
+
+class _Builder implements Builder {
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
+class _ElementStore implements ElementStore {
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
+class _KernelLibraryBuilder implements KernelLibraryBuilder {
+ @override
+ final uri;
+
+ _KernelLibraryBuilder(this.uri);
+
+ @override
+ Uri get fileUri => uri;
+
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
+/**
+ * Replacement parser based on Fasta.
+ */
+class _Parser2 implements Parser {
+ @override
+ Token currentToken;
+
+ /**
+ * The builder which creates the analyzer AST data structures
+ * based on the Fasta parser.
+ */
+ final AstBuilder _astBuilder;
+
+ /**
+ * The error listener that will be informed of any errors that are found
+ * during the parse.
+ */
+ final AnalysisErrorListener _errorListener;
+
+ /**
+ * The fasta parser being wrapped.
+ */
+ final fasta.Parser _fastaParser;
+
+ /**
+ * The source being parsed.
+ */
+ final Source _source;
+
+ factory _Parser2(Source source, AnalysisErrorListener errorListener) {
+ var errorReporter = new ErrorReporter(errorListener, source);
+ var library = new _KernelLibraryBuilder(source.uri);
+ var member = new _Builder();
+ var elementStore = new _ElementStore();
+ var scope = new Scope.top(isModifiable: true);
+
+ AstBuilder astBuilder = new AstBuilder(
+ errorReporter, library, member, elementStore, scope, true);
+ fasta.Parser fastaParser = new fasta.Parser(astBuilder);
+ astBuilder.parser = fastaParser;
+ return new _Parser2._(source, errorListener, fastaParser, astBuilder);
+ }
+
+ _Parser2._(
+ this._source, this._errorListener, this._fastaParser, this._astBuilder);
+
+ @override
+ bool get parseGenericMethodComments => _astBuilder.parseGenericMethodComments;
+
+ @override
+ set parseGenericMethodComments(bool value) {
+ _astBuilder.parseGenericMethodComments = value;
+ }
+
+ @override
+ CompilationUnit parseCompilationUnit(Token token) {
+ currentToken = token;
+ return parseCompilationUnit2();
+ }
+
+ @override
+ CompilationUnit parseCompilationUnit2() {
+ currentToken = _fastaParser.parseUnit(currentToken);
+ return _astBuilder.pop();
+ }
+
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698