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