use of org.finos.legend.engine.language.pure.grammar.from.antlr4.connection.ExternalFormatConnectionParserGrammar in project legend-engine by finos.
the class ExternalFormatConnectionGrammarParserExtension method getExternalFormatConnectionParserInfo.
private static SourceCodeParserInfo getExternalFormatConnectionParserInfo(ConnectionValueSourceCode connectionValueSourceCode) {
CharStream input = CharStreams.fromString(connectionValueSourceCode.code);
ParserErrorListener errorListener = new ParserErrorListener(connectionValueSourceCode.walkerSourceInformation);
ExternalFormatConnectionLexerGrammar lexer = new ExternalFormatConnectionLexerGrammar(input);
lexer.removeErrorListeners();
lexer.addErrorListener(errorListener);
ExternalFormatConnectionParserGrammar parser = new ExternalFormatConnectionParserGrammar(new CommonTokenStream(lexer));
parser.removeErrorListeners();
parser.addErrorListener(errorListener);
return new SourceCodeParserInfo(connectionValueSourceCode.code, input, connectionValueSourceCode.sourceInformation, connectionValueSourceCode.walkerSourceInformation, lexer, parser, parser.definition());
}
Aggregations