Search in sources :

Example 6 with SiddhiQLBaseVisitorImpl

use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.

the class SiddhiCompiler method parseTableDefinition.

public static TableDefinition parseTableDefinition(String tableDefinition) throws SiddhiParserException {
    CharStream input = CharStreams.fromString(tableDefinition);
    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(io.siddhi.query.api.definition.TableDefinition) SiddhiQLBaseVisitorImpl(io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) CharStream(org.antlr.v4.runtime.CharStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 7 with SiddhiQLBaseVisitorImpl

use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.

the class SiddhiCompiler method parseAggregationDefinition.

public static AggregationDefinition parseAggregationDefinition(String aggregationDefinition) throws SiddhiParserException {
    CharStream input = CharStreams.fromString(aggregationDefinition);
    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(io.siddhi.query.api.definition.AggregationDefinition) SiddhiQLBaseVisitorImpl(io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) CharStream(org.antlr.v4.runtime.CharStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 8 with SiddhiQLBaseVisitorImpl

use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.

the class SiddhiCompiler method parseTimeConstantDefinition.

public static TimeConstant parseTimeConstantDefinition(String timeConstantDefinition) throws SiddhiParserException {
    CharStream input = CharStreams.fromString(timeConstantDefinition);
    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(io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) CharStream(org.antlr.v4.runtime.CharStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree) TimeConstant(io.siddhi.query.api.expression.constant.TimeConstant)

Example 9 with SiddhiQLBaseVisitorImpl

use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.

the class SiddhiCompiler method parseStreamDefinition.

public static StreamDefinition parseStreamDefinition(String streamDefinition) {
    CharStream input = CharStreams.fromString(streamDefinition);
    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(io.siddhi.query.api.definition.StreamDefinition) SiddhiQLBaseVisitorImpl(io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) CharStream(org.antlr.v4.runtime.CharStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 10 with SiddhiQLBaseVisitorImpl

use of io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl in project siddhi by wso2.

the class SiddhiCompiler method parseOnDemandQuery.

public static OnDemandQuery parseOnDemandQuery(String onDemandQueryString) throws SiddhiParserException {
    CharStream input = CharStreams.fromString(onDemandQueryString);
    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();
    OnDemandQuery onDemandQuery = (OnDemandQuery) eval.visit(tree);
    return onDemandQuery;
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) SiddhiQLBaseVisitorImpl(io.siddhi.query.compiler.internal.SiddhiQLBaseVisitorImpl) CharStream(org.antlr.v4.runtime.CharStream) ParseTree(org.antlr.v4.runtime.tree.ParseTree) OnDemandQuery(io.siddhi.query.api.execution.query.OnDemandQuery)

Aggregations

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