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