Search in sources :

Example 1 with SiddhiQLBaseVisitorImpl

use of org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project ballerina by ballerina-lang.

the class SiddhiCompiler method parse.

public static SiddhiApp parse(String source) {
    ANTLRInputStream input = new ANTLRInputStream(source);
    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);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) SiddhiApp(org.ballerinalang.siddhi.query.api.SiddhiApp) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 2 with SiddhiQLBaseVisitorImpl

use of org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project ballerina by ballerina-lang.

the class SiddhiCompiler method parseStoreQuery.

public static StoreQuery parseStoreQuery(String storeQuery) throws SiddhiParserException {
    ANTLRInputStream input = new ANTLRInputStream(storeQuery);
    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.store_query_final();
    SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
    return (StoreQuery) eval.visit(tree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) StoreQuery(org.ballerinalang.siddhi.query.api.execution.query.StoreQuery) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 3 with SiddhiQLBaseVisitorImpl

use of org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project ballerina by ballerina-lang.

the class SiddhiCompiler method parseQuery.

public static Query parseQuery(String source) throws SiddhiParserException {
    ANTLRInputStream input = new ANTLRInputStream(source);
    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);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) Query(org.ballerinalang.siddhi.query.api.execution.query.Query) StoreQuery(org.ballerinalang.siddhi.query.api.execution.query.StoreQuery) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 4 with SiddhiQLBaseVisitorImpl

use of org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project ballerina by ballerina-lang.

the class SiddhiCompiler method parseTableDefinition.

public static TableDefinition parseTableDefinition(String source) throws SiddhiParserException {
    ANTLRInputStream input = new ANTLRInputStream(source);
    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_table_final();
    SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
    return (TableDefinition) eval.visit(tree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) TableDefinition(org.ballerinalang.siddhi.query.api.definition.TableDefinition) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 5 with SiddhiQLBaseVisitorImpl

use of org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project ballerina by ballerina-lang.

the class SiddhiCompiler method parseTimeConstantDefinition.

public static TimeConstant parseTimeConstantDefinition(String source) throws SiddhiParserException {
    ANTLRInputStream input = new ANTLRInputStream(source);
    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.time_value();
    SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
    return (TimeConstant) eval.visit(tree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree) TimeConstant(org.ballerinalang.siddhi.query.api.expression.constant.TimeConstant)

Aggregations

ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)9 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)9 ParseTree (org.antlr.v4.runtime.tree.ParseTree)9 SiddhiQLBaseVisitorImpl (org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl)9 StoreQuery (org.ballerinalang.siddhi.query.api.execution.query.StoreQuery)2 SiddhiApp (org.ballerinalang.siddhi.query.api.SiddhiApp)1 AggregationDefinition (org.ballerinalang.siddhi.query.api.definition.AggregationDefinition)1 FunctionDefinition (org.ballerinalang.siddhi.query.api.definition.FunctionDefinition)1 StreamDefinition (org.ballerinalang.siddhi.query.api.definition.StreamDefinition)1 TableDefinition (org.ballerinalang.siddhi.query.api.definition.TableDefinition)1 Partition (org.ballerinalang.siddhi.query.api.execution.partition.Partition)1 Query (org.ballerinalang.siddhi.query.api.execution.query.Query)1 TimeConstant (org.ballerinalang.siddhi.query.api.expression.constant.TimeConstant)1