Search in sources :

Example 1 with DataParserGrammar

use of org.finos.legend.engine.language.pure.grammar.from.antlr4.data.DataParserGrammar in project legend-engine by finos.

the class CorePureGrammarParser method getDataParserInfo.

private static SourceCodeParserInfo getDataParserInfo(SectionSourceCode sectionSourceCode) {
    CharStream input = CharStreams.fromString(sectionSourceCode.code);
    ParserErrorListener errorListener = new ParserErrorListener(sectionSourceCode.walkerSourceInformation);
    DataLexerGrammar lexer = new DataLexerGrammar(input);
    lexer.removeErrorListeners();
    lexer.addErrorListener(errorListener);
    DataParserGrammar parser = new DataParserGrammar(new CommonTokenStream(lexer));
    parser.removeErrorListeners();
    parser.addErrorListener(errorListener);
    return new SourceCodeParserInfo(sectionSourceCode.code, input, sectionSourceCode.sourceInformation, sectionSourceCode.walkerSourceInformation, lexer, parser, parser.definition());
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) DataLexerGrammar(org.finos.legend.engine.language.pure.grammar.from.antlr4.data.DataLexerGrammar) DataParserGrammar(org.finos.legend.engine.language.pure.grammar.from.antlr4.data.DataParserGrammar) CharStream(org.antlr.v4.runtime.CharStream)

Aggregations

CharStream (org.antlr.v4.runtime.CharStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 DataLexerGrammar (org.finos.legend.engine.language.pure.grammar.from.antlr4.data.DataLexerGrammar)1 DataParserGrammar (org.finos.legend.engine.language.pure.grammar.from.antlr4.data.DataParserGrammar)1