use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.
the class SiddhiCompiler method parseQuery.
public static Query parseQuery(String query) throws SiddhiParserException {
CharStream input = CharStreams.fromString(query);
SiddhiQLLexer lexer = new SiddhiQLLexer(input);
lexer.removeErrorListeners();
lexer.addErrorListener(SiddhiErrorListener.INSTANCE);
CommonTokenStream tokens = new CommonTokenStream(lexer);
SiddhiQLParser parser = new SiddhiQLParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(SiddhiErrorListener.INSTANCE);
ParseTree tree = parser.query_final();
SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
return (Query) eval.visit(tree);
}
use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.
the class SiddhiCompiler method parseFunctionDefinition.
public static FunctionDefinition parseFunctionDefinition(String functionDefinition) throws SiddhiParserException {
CharStream input = CharStreams.fromString(functionDefinition);
SiddhiQLLexer lexer = new SiddhiQLLexer(input);
lexer.removeErrorListeners();
lexer.addErrorListener(SiddhiErrorListener.INSTANCE);
CommonTokenStream tokens = new CommonTokenStream(lexer);
SiddhiQLParser parser = new SiddhiQLParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(SiddhiErrorListener.INSTANCE);
ParseTree tree = parser.definition_function_final();
SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
return (FunctionDefinition) eval.visit(tree);
}
use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.
the class SiddhiCompiler method parsePartition.
public static Partition parsePartition(String partition) throws SiddhiParserException {
CharStream input = CharStreams.fromString(partition);
SiddhiQLLexer lexer = new SiddhiQLLexer(input);
lexer.removeErrorListeners();
lexer.addErrorListener(SiddhiErrorListener.INSTANCE);
CommonTokenStream tokens = new CommonTokenStream(lexer);
SiddhiQLParser parser = new SiddhiQLParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(SiddhiErrorListener.INSTANCE);
ParseTree tree = parser.partition_final();
SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
return (Partition) eval.visit(tree);
}
use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.
the class SiddhiCompiler method parseExpression.
public static Expression parseExpression(String expression) {
CharStream input = CharStreams.fromString(expression);
SiddhiQLLexer lexer = new SiddhiQLLexer(input);
lexer.removeErrorListeners();
lexer.addErrorListener(SiddhiErrorListener.INSTANCE);
CommonTokenStream tokens = new CommonTokenStream(lexer);
SiddhiQLParser parser = new SiddhiQLParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(SiddhiErrorListener.INSTANCE);
ParseTree tree = parser.expression();
SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
return (Expression) eval.visit(tree);
}
use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.
the class SiddhiCompiler method parse.
public static SiddhiApp parse(String siddhiApp) {
CharStream input = CharStreams.fromString(siddhiApp);
SiddhiQLLexer lexer = new SiddhiQLLexer(input);
lexer.removeErrorListeners();
lexer.addErrorListener(SiddhiErrorListener.INSTANCE);
CommonTokenStream tokens = new CommonTokenStream(lexer);
SiddhiQLParser parser = new SiddhiQLParser(tokens);
// parser.setErrorHandler(new BailErrorStrategy());
parser.removeErrorListeners();
parser.addErrorListener(SiddhiErrorListener.INSTANCE);
ParseTree tree = parser.parse();
SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
return (SiddhiApp) eval.visit(tree);
}
Aggregations