use of io.druid.math.expr.antlr.ExprLexer in project druid by druid-io.
the class Parser method parse.
public static Expr parse(String in, boolean withFlatten) {
ExprLexer lexer = new ExprLexer(new ANTLRInputStream(in));
CommonTokenStream tokens = new CommonTokenStream(lexer);
ExprParser parser = new ExprParser(tokens);
parser.setBuildParseTree(true);
ParseTree parseTree = parser.expr();
ParseTreeWalker walker = new ParseTreeWalker();
ExprListenerImpl listener = new ExprListenerImpl(parseTree);
walker.walk(listener, parseTree);
return withFlatten ? flatten(listener.getAST()) : listener.getAST();
}
Aggregations