Search in sources :

Example 1 with ExternalFormatConnectionParserGrammar

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());
}
Also used : ExternalFormatConnectionParserGrammar(org.finos.legend.engine.language.pure.grammar.from.antlr4.connection.ExternalFormatConnectionParserGrammar) CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) ExternalFormatConnectionLexerGrammar(org.finos.legend.engine.language.pure.grammar.from.antlr4.connection.ExternalFormatConnectionLexerGrammar) CharStream(org.antlr.v4.runtime.CharStream)

Aggregations

CharStream (org.antlr.v4.runtime.CharStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 ExternalFormatConnectionLexerGrammar (org.finos.legend.engine.language.pure.grammar.from.antlr4.connection.ExternalFormatConnectionLexerGrammar)1 ExternalFormatConnectionParserGrammar (org.finos.legend.engine.language.pure.grammar.from.antlr4.connection.ExternalFormatConnectionParserGrammar)1