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

Side by Side Diff: tools/spec_parser/SpecParser.java

Issue 2688903004: Creating an ANTLR grammar for Dart, potentially the syntax spec.
Patch Set: Enabled parsing many files from one JVM process Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « tools/spec_parser/Makefile ('k') | tools/spec_parser/SpecParserRunner.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « tools/spec_parser/Makefile ('k') | tools/spec_parser/SpecParserRunner.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698