use of org.finos.legend.engine.language.pure.grammar.from.antlr4.PersistenceParserGrammar in project legend-engine by finos.
the class PersistenceParserExtension method getPersistenceParserInfo.
private static SourceCodeParserInfo getPersistenceParserInfo(SectionSourceCode sectionSourceCode) {
CharStream input = CharStreams.fromString(sectionSourceCode.code);
ParserErrorListener errorListener = new PersistenceParserErrorListener(sectionSourceCode.walkerSourceInformation);
PersistenceLexerGrammar lexer = new PersistenceLexerGrammar(input);
lexer.removeErrorListeners();
lexer.addErrorListener(errorListener);
PersistenceParserGrammar parser = new PersistenceParserGrammar(new CommonTokenStream(lexer));
parser.removeErrorListeners();
parser.addErrorListener(errorListener);
return new SourceCodeParserInfo(sectionSourceCode.code, input, sectionSourceCode.sourceInformation, sectionSourceCode.walkerSourceInformation, lexer, parser, parser.definition());
}
Aggregations