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

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

Issue 2688903004: Creating an ANTLR grammar for Dart, potentially the syntax spec.
Patch Set: Added support for generic function invocations 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
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 if (verbose) System.err.println("Parsing file: " + filePath);
27 parser.libraryDefinition();
28 }
29 }
30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698