Search in sources :

Example 1 with PatternClause

use of org.ballerinalang.model.tree.clauses.PatternClause in project ballerina by ballerina-lang.

the class SiddhiQueryBuilder method visit.

@Override
public void visit(BLangStreamingQueryStatement streamingQueryStatement) {
    siddhiQuery.append("from ");
    StreamingInput streamingInput = streamingQueryStatement.getStreamingInput();
    if (streamingInput != null) {
        ((BLangStreamingInput) streamingInput).accept(this);
        siddhiQuery.append(" ").append(streamingInputClause);
    }
    PatternClause patternClause = streamingQueryStatement.getPatternClause();
    if (patternClause != null) {
        patternStreamingClause = new StringBuilder();
        ((BLangPatternClause) patternClause).accept(this);
        siddhiQuery.append(" ").append(patternStreamingClause);
    }
    JoinStreamingInput joinStreamingInput = streamingQueryStatement.getJoiningInput();
    if (joinStreamingInput != null) {
        ((BLangJoinStreamingInput) joinStreamingInput).accept(this);
        siddhiQuery.append(" ").append(joinStreamingInputClause);
    }
    SelectClauseNode selectClauseNode = streamingQueryStatement.getSelectClause();
    if (selectClauseNode != null) {
        ((BLangSelectClause) selectClauseNode).accept(this);
        siddhiQuery.append(" ").append(selectExprClause);
    }
    OrderByNode orderByNode = streamingQueryStatement.getOrderbyClause();
    if (orderByNode != null) {
        ((BLangOrderBy) orderByNode).accept(this);
        siddhiQuery.append(" ").append(orderByClause);
    }
    OutputRateLimitNode outputRateLimitNode = streamingQueryStatement.getOutputRateLimitNode();
    if (outputRateLimitNode != null) {
        ((BLangOutputRateLimit) outputRateLimitNode).accept(this);
        siddhiQuery.append(" ").append(outputRateLimitClause);
    }
    BLangStreamAction streamActionNode = (BLangStreamAction) streamingQueryStatement.getStreamingAction();
    if (streamActionNode != null) {
        streamActionNode.accept(this);
        siddhiQuery.append(" ").append(streamActionClause);
        siddhiQuery.append(" ; ");
    }
}
Also used : OutputRateLimitNode(org.ballerinalang.model.tree.clauses.OutputRateLimitNode) OrderByNode(org.ballerinalang.model.tree.clauses.OrderByNode) BLangPatternClause(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternClause) SelectClauseNode(org.ballerinalang.model.tree.clauses.SelectClauseNode) PatternClause(org.ballerinalang.model.tree.clauses.PatternClause) BLangPatternClause(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternClause) BLangOutputRateLimit(org.wso2.ballerinalang.compiler.tree.clauses.BLangOutputRateLimit) BLangPatternStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingInput) JoinStreamingInput(org.ballerinalang.model.tree.clauses.JoinStreamingInput) BLangStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput) BLangJoinStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput) StreamingInput(org.ballerinalang.model.tree.clauses.StreamingInput) BLangSelectClause(org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause) BLangJoinStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput) JoinStreamingInput(org.ballerinalang.model.tree.clauses.JoinStreamingInput) BLangJoinStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput) BLangStreamAction(org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamAction) BLangOrderBy(org.wso2.ballerinalang.compiler.tree.clauses.BLangOrderBy) BLangStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput)

Example 2 with PatternClause

use of org.ballerinalang.model.tree.clauses.PatternClause in project ballerina by ballerina-lang.

the class BLangPackageBuilder method startPatternClause.

public void startPatternClause(DiagnosticPos pos, Set<Whitespace> ws) {
    PatternClause patternClause = TreeBuilder.createPatternClause();
    ((BLangPatternClause) patternClause).pos = pos;
    patternClause.addWS(ws);
    this.patternClauseStack.push(patternClause);
}
Also used : BLangMatchStmtPatternClause(org.wso2.ballerinalang.compiler.tree.statements.BLangMatch.BLangMatchStmtPatternClause) BLangPatternClause(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternClause) PatternClause(org.ballerinalang.model.tree.clauses.PatternClause)

Example 3 with PatternClause

use of org.ballerinalang.model.tree.clauses.PatternClause in project ballerina by ballerina-lang.

the class BLangPackageBuilder method endPatternClause.

public void endPatternClause(boolean isForEvents, boolean isWithinClauseAvailable, DiagnosticPos pos, Set<Whitespace> ws) {
    PatternClause patternClause = this.patternClauseStack.peek();
    ((BLangPatternClause) patternClause).pos = pos;
    patternClause.addWS(ws);
    patternClause.setForAllEvents(isForEvents);
    patternClause.setPatternStreamingInputNode(this.patternStreamingInputStack.pop());
    if (isWithinClauseAvailable) {
        patternClause.setWithinClause(this.withinClauseStack.pop());
    }
}
Also used : BLangMatchStmtPatternClause(org.wso2.ballerinalang.compiler.tree.statements.BLangMatch.BLangMatchStmtPatternClause) BLangPatternClause(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternClause) PatternClause(org.ballerinalang.model.tree.clauses.PatternClause)

Aggregations

PatternClause (org.ballerinalang.model.tree.clauses.PatternClause)3 BLangPatternClause (org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternClause)3 BLangMatchStmtPatternClause (org.wso2.ballerinalang.compiler.tree.statements.BLangMatch.BLangMatchStmtPatternClause)2 JoinStreamingInput (org.ballerinalang.model.tree.clauses.JoinStreamingInput)1 OrderByNode (org.ballerinalang.model.tree.clauses.OrderByNode)1 OutputRateLimitNode (org.ballerinalang.model.tree.clauses.OutputRateLimitNode)1 SelectClauseNode (org.ballerinalang.model.tree.clauses.SelectClauseNode)1 StreamingInput (org.ballerinalang.model.tree.clauses.StreamingInput)1 BLangJoinStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput)1 BLangOrderBy (org.wso2.ballerinalang.compiler.tree.clauses.BLangOrderBy)1 BLangOutputRateLimit (org.wso2.ballerinalang.compiler.tree.clauses.BLangOutputRateLimit)1 BLangPatternStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingInput)1 BLangSelectClause (org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause)1 BLangStreamAction (org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamAction)1 BLangStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput)1