MCPcopy
hub / github.com/antlr/antlr4 / parseGrammar

Method parseGrammar

tool/src/org/antlr/v4/Tool.java:574–589  ·  view source on GitHub ↗
(String fileName)

Source from the content-addressed store, hash-verified

572 }
573
574 public GrammarRootAST parseGrammar(String fileName) {
575 try {
576 File file = new File(fileName);
577 if (!file.isAbsolute()) {
578 file = new File(inputDirectory, fileName);
579 }
580
581 ANTLRFileStream in = new ANTLRFileStream(file.getAbsolutePath(), grammarEncoding);
582 GrammarRootAST t = parse(fileName, in);
583 return t;
584 }
585 catch (IOException ioe) {
586 errMgr.toolError(ErrorType.CANNOT_OPEN_FILE, ioe, fileName);
587 }
588 return null;
589 }
590
591 /** Convenience method to load and process an ANTLR grammar. Useful
592 * when creating interpreters. If you need to access to the lexer

Callers 3

loadGrammarMethod · 0.95
analyseMethod · 0.80

Calls 2

parseMethod · 0.95
toolErrorMethod · 0.80

Tested by

no test coverage detected