use of org.finos.legend.engine.language.pure.grammar.from.antlr4.runtime.RuntimeParserGrammar in project legend-engine by finos.
the class RuntimeParser method getParserInfo.
private SourceCodeParserInfo getParserInfo(String code, SourceInformation sectionSourceInformation, ParseTreeWalkerSourceInformation walkerSourceInformation, boolean includeRootContext) {
CharStream input = CharStreams.fromString(code);
ParserErrorListener errorListener = new ParserErrorListener(walkerSourceInformation);
RuntimeLexerGrammar lexer = new RuntimeLexerGrammar(input);
lexer.removeErrorListeners();
lexer.addErrorListener(errorListener);
RuntimeParserGrammar parser = new RuntimeParserGrammar(new CommonTokenStream(lexer));
parser.removeErrorListeners();
parser.addErrorListener(errorListener);
return new SourceCodeParserInfo(code, input, sectionSourceInformation, walkerSourceInformation, lexer, parser, includeRootContext ? parser.definition() : null);
}
Aggregations