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 import org.antlr.runtime.*; |
| 6 |
| 7 /// Class for `main` which will parse files given as command line arguments. |
| 8 public class SpecParser { |
| 9 static boolean verbose = false; |
| 10 |
| 11 public static void main(String[] args) throws Exception { |
| 12 if (args.length == 0) { |
| 13 System.err.println("Expected a file path as argument."); |
| 14 System.exit(1); |
| 15 } |
| 16 for (int i = 0; i < args.length; i++) { |
| 17 String filePath = args[i]; |
| 18 if (filePath.equals("--verbose")) { |
| 19 verbose = true; |
| 20 continue; |
| 21 } |
| 22 CharStream charStream = new ANTLRFileStream(filePath); |
| 23 DartLexer lexer = new DartLexer(charStream); |
| 24 CommonTokenStream tokens = new CommonTokenStream(lexer); |
| 25 DartParser parser = new DartParser(tokens); |
| 26 DartParser.filePath = filePath; |
| 27 DartParser.filePathHasBeenPrinted = false; |
| 28 if (verbose) System.err.println(">>> Parsing file: " + filePath); |
| 29 parser.libraryDefinition(); |
| 30 } |
| 31 } |
| 32 } |
OLD | NEW |