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