Search in sources :

Example 1 with StreamingQueryStatementNode

use of org.ballerinalang.model.tree.statements.StreamingQueryStatementNode in project ballerina by ballerina-lang.

the class BLangPackageBuilder method endStreamingQueryStatementNode.

public void endStreamingQueryStatementNode(DiagnosticPos pos, Set<Whitespace> ws) {
    StreamingQueryStatementNode streamingQueryStatementNode = this.streamingQueryStatementStack.peek();
    ((BLangStreamingQueryStatement) streamingQueryStatementNode).pos = pos;
    streamingQueryStatementNode.addWS(ws);
    if (!streamingInputStack.empty()) {
        streamingQueryStatementNode.setStreamingInput(streamingInputStack.pop());
        if (!joinStreamingInputsStack.empty()) {
            streamingQueryStatementNode.setJoinStreamingInput(joinStreamingInputsStack.pop());
        }
    } else if (!patternClauseStack.empty()) {
        streamingQueryStatementNode.setPatternClause(patternClauseStack.pop());
    }
    if (!selectClausesStack.empty()) {
        streamingQueryStatementNode.setSelectClause(selectClausesStack.pop());
    }
    if (!orderByClauseStack.empty()) {
        streamingQueryStatementNode.setOrderByClause(orderByClauseStack.pop());
    }
    if (!outputRateLimitStack.empty()) {
        streamingQueryStatementNode.setOutputRateLimitNode(outputRateLimitStack.pop());
    }
    streamingQueryStatementNode.setStreamingAction(streamActionNodeStack.pop());
}
Also used : StreamingQueryStatementNode(org.ballerinalang.model.tree.statements.StreamingQueryStatementNode)

Example 2 with StreamingQueryStatementNode

use of org.ballerinalang.model.tree.statements.StreamingQueryStatementNode in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

// Streaming related methods.
public void visit(BLangForever foreverStatement) {
    for (StreamingQueryStatementNode streamingQueryStatement : foreverStatement.gettreamingQueryStatements()) {
        analyzeStmt((BLangStatement) streamingQueryStatement, env);
    }
    List<BLangVariable> globalVariableList = this.env.enclPkg.globalVars;
    if (globalVariableList != null) {
        for (BLangVariable variable : globalVariableList) {
            if (((variable).type.tsymbol) != null) {
                if ("stream".equals((((variable).type.tsymbol)).name.value)) {
                    foreverStatement.addGlobalVariable(variable);
                }
            }
        }
    }
    List<BVarSymbol> functionParameterList = ((BInvokableSymbol) this.env.scope.owner).getParameters();
    for (BVarSymbol varSymbol : functionParameterList) {
        if ("stream".equals((((varSymbol).type.tsymbol)).name.value)) {
            foreverStatement.addFunctionVariable(varSymbol);
        }
    }
}
Also used : StreamingQueryStatementNode(org.ballerinalang.model.tree.statements.StreamingQueryStatementNode) BInvokableSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BInvokableSymbol) BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable) BVarSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)

Example 3 with StreamingQueryStatementNode

use of org.ballerinalang.model.tree.statements.StreamingQueryStatementNode in project ballerina by ballerina-lang.

the class Desugar method addFunctionPointersToArgs.

private void addFunctionPointersToArgs(List<BLangExpression> args, List<StreamingQueryStatementNode> streamingStmts) {
    BLangArrayLiteral funcPointers = createArrayLiteralExprNode();
    for (StreamingQueryStatementNode stmt : streamingStmts) {
        funcPointers.exprs.add(rewrite((BLangExpression) stmt.getStreamingAction().getInvokableBody(), env));
    }
    args.add(funcPointers);
}
Also used : StreamingQueryStatementNode(org.ballerinalang.model.tree.statements.StreamingQueryStatementNode) BLangArrayLiteral(org.wso2.ballerinalang.compiler.tree.expressions.BLangArrayLiteral) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 4 with StreamingQueryStatementNode

use of org.ballerinalang.model.tree.statements.StreamingQueryStatementNode in project ballerina by ballerina-lang.

the class BLangPackageBuilder method startStreamingQueryStatementNode.

public void startStreamingQueryStatementNode(DiagnosticPos pos, Set<Whitespace> ws) {
    StreamingQueryStatementNode streamingQueryStatementNode = TreeBuilder.createStreamingQueryStatementNode();
    ((BLangStreamingQueryStatement) streamingQueryStatementNode).pos = pos;
    streamingQueryStatementNode.addWS(ws);
    this.streamingQueryStatementStack.push(streamingQueryStatementNode);
}
Also used : StreamingQueryStatementNode(org.ballerinalang.model.tree.statements.StreamingQueryStatementNode)

Aggregations

StreamingQueryStatementNode (org.ballerinalang.model.tree.statements.StreamingQueryStatementNode)4 BInvokableSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BInvokableSymbol)1 BVarSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)1 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)1 BLangArrayLiteral (org.wso2.ballerinalang.compiler.tree.expressions.BLangArrayLiteral)1 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)1