| Index: tools/spec_parser/SpecParser.java
|
| diff --git a/tools/spec_parser/SpecParser.java b/tools/spec_parser/SpecParser.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ad08cb2349d7d19810e2b9cfecc32c30cec08987
|
| --- /dev/null
|
| +++ b/tools/spec_parser/SpecParser.java
|
| @@ -0,0 +1,32 @@
|
| +// 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.
|
| +
|
| +import org.antlr.runtime.*;
|
| +
|
| +/// Class for `main` which will parse files given as command line arguments.
|
| +public class SpecParser {
|
| + static boolean verbose = false;
|
| +
|
| + public static void main(String[] args) throws Exception {
|
| + if (args.length == 0) {
|
| + System.err.println("Expected a file path as argument.");
|
| + System.exit(1);
|
| + }
|
| + for (int i = 0; i < args.length; i++) {
|
| + String filePath = args[i];
|
| + if (filePath.equals("--verbose")) {
|
| + verbose = true;
|
| + continue;
|
| + }
|
| + CharStream charStream = new ANTLRFileStream(filePath);
|
| + DartLexer lexer = new DartLexer(charStream);
|
| + CommonTokenStream tokens = new CommonTokenStream(lexer);
|
| + DartParser parser = new DartParser(tokens);
|
| + DartParser.filePath = filePath;
|
| + DartParser.filePathHasBeenPrinted = false;
|
| + if (verbose) System.err.println(">>> Parsing file: " + filePath);
|
| + parser.libraryDefinition();
|
| + }
|
| + }
|
| +}
|
|
|