use of org.finos.legend.engine.language.pure.grammar.from.antlr4.mapping.MappingParserGrammar in project legend-engine by finos.
the class MappingParser method getParserInfo.
@Override
public SourceCodeParserInfo getParserInfo(String code, SourceInformation sourceInformation, ParseTreeWalkerSourceInformation walkerSourceInformation) {
CharStream input = CharStreams.fromString(code);
ParserErrorListener errorListener = new ParserErrorListener(walkerSourceInformation);
MappingLexerGrammar lexer = new MappingLexerGrammar(input);
lexer.removeErrorListeners();
lexer.addErrorListener(errorListener);
MappingParserGrammar parser = new MappingParserGrammar(new CommonTokenStream(lexer));
parser.removeErrorListeners();
parser.addErrorListener(errorListener);
return new SourceCodeParserInfo(code, input, sourceInformation, walkerSourceInformation, lexer, parser, parser.definition());
}
Aggregations