Search in sources :

Example 6 with SiddhiQLBaseVisitorImpl

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

the class SiddhiCompiler method parsePartition.

public static Partition parsePartition(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.partition_final();
    SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
    return (Partition) eval.visit(tree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) Partition(org.ballerinalang.siddhi.query.api.execution.partition.Partition) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 7 with SiddhiQLBaseVisitorImpl

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

the class SiddhiCompiler method parseFunctionDefinition.

public static FunctionDefinition parseFunctionDefinition(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_function_final();
    SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
    return (FunctionDefinition) eval.visit(tree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) FunctionDefinition(org.ballerinalang.siddhi.query.api.definition.FunctionDefinition) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 8 with SiddhiQLBaseVisitorImpl

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

the class SiddhiCompiler method parseAggregationDefinition.

public static AggregationDefinition parseAggregationDefinition(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_aggregation_final();
    SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
    return (AggregationDefinition) eval.visit(tree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) AggregationDefinition(org.ballerinalang.siddhi.query.api.definition.AggregationDefinition) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 9 with SiddhiQLBaseVisitorImpl

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

the class SiddhiCompiler method parseStreamDefinition.

public static StreamDefinition parseStreamDefinition(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.removeErrorListeners();
    parser.addErrorListener(SiddhiErrorListener.INSTANCE);
    ParseTree tree = parser.definition_stream_final();
    SiddhiQLVisitor eval = new SiddhiQLBaseVisitorImpl();
    return (StreamDefinition) eval.visit(tree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) StreamDefinition(org.ballerinalang.siddhi.query.api.definition.StreamDefinition) SiddhiQLBaseVisitorImpl(org.ballerinalang.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

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