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