use of org.finos.legend.engine.language.pure.grammar.from.antlr4.domain.DomainParserGrammar in project legend-engine by finos.
the class DomainParser method getParserInfo.
private SourceCodeParserInfo getParserInfo(String code, SourceInformation sectionSourceInformation, ParseTreeWalkerSourceInformation walkerSourceInformation, boolean includeRootContext) {
CharStream input = CharStreams.fromString(code);
ParserErrorListener errorListener = new ParserErrorListener(walkerSourceInformation);
DomainLexerGrammar lexer = new DomainLexerGrammar(input);
lexer.removeErrorListeners();
lexer.addErrorListener(errorListener);
DomainParserGrammar parser = new DomainParserGrammar(new CommonTokenStream(lexer));
parser.removeErrorListeners();
parser.addErrorListener(errorListener);
return new SourceCodeParserInfo(code, input, sectionSourceInformation, walkerSourceInformation, lexer, parser, includeRootContext ? parser.definition() : null);
}
Aggregations