Search in sources :

Example 1 with PatternStreamingEdgeInputNode

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

the class SiddhiQueryBuilder method visit.

@Override
public void visit(BLangPatternStreamingInput patternStreamingInput) {
    boolean isFollowedByPattern = patternStreamingInput.isFollowedBy();
    boolean enclosedInParanthesisPattern = patternStreamingInput.enclosedInParanthesis();
    List<PatternStreamingEdgeInputNode> patternStreamingEdgeInputs = patternStreamingInput.getPatternStreamingEdgeInputs();
    BLangPatternStreamingInput nestedPatternStreamingInput = (BLangPatternStreamingInput) patternStreamingInput.getPatternStreamingInput();
    if (isFollowedByPattern) {
        BLangPatternStreamingEdgeInput patternStreamingEdgeInput = (BLangPatternStreamingEdgeInput) patternStreamingEdgeInputs.get(0);
        patternStreamingEdgeInput.accept(this);
        patternStreamingClause.append(" -> ");
        ((BLangPatternStreamingInput) patternStreamingInput.getPatternStreamingInput()).accept(this);
    }
    if (enclosedInParanthesisPattern) {
        patternStreamingClause.append("( ");
        nestedPatternStreamingInput.accept(this);
        patternStreamingClause.append(" ) ");
    }
    if (!isFollowedByPattern && !enclosedInParanthesisPattern) {
        BLangPatternStreamingEdgeInput patternStreamingEdgeInput = (BLangPatternStreamingEdgeInput) patternStreamingEdgeInputs.get(0);
        patternStreamingEdgeInput.accept(this);
    }
}
Also used : BLangPatternStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingInput) BLangPatternStreamingEdgeInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingEdgeInput) PatternStreamingEdgeInputNode(org.ballerinalang.model.tree.clauses.PatternStreamingEdgeInputNode)

Example 2 with PatternStreamingEdgeInputNode

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

the class SemanticAnalyzer method visit.

@Override
public void visit(BLangPatternStreamingInput patternStreamingInput) {
    List<PatternStreamingEdgeInputNode> patternStreamingEdgeInputs = patternStreamingInput.getPatternStreamingEdgeInputs();
    for (PatternStreamingEdgeInputNode inputNode : patternStreamingEdgeInputs) {
        BLangPatternStreamingEdgeInput streamingInput = (BLangPatternStreamingEdgeInput) inputNode;
        streamingInput.accept(this);
    }
    BLangPatternStreamingInput nestedPatternStreamingInput = (BLangPatternStreamingInput) patternStreamingInput.getPatternStreamingInput();
    if (nestedPatternStreamingInput != null) {
        nestedPatternStreamingInput.accept(this);
    }
}
Also used : BLangPatternStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingInput) BLangPatternStreamingEdgeInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingEdgeInput) PatternStreamingEdgeInputNode(org.ballerinalang.model.tree.clauses.PatternStreamingEdgeInputNode)

Example 3 with PatternStreamingEdgeInputNode

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

the class BLangPackageBuilder method endPatternStreamingEdgeInputNode.

public void endPatternStreamingEdgeInputNode(DiagnosticPos pos, Set<Whitespace> ws, String alias) {
    PatternStreamingEdgeInputNode patternStreamingEdgeInputNode = this.patternStreamingEdgeInputStack.peek();
    ((BLangPatternStreamingEdgeInput) patternStreamingEdgeInputNode).pos = pos;
    patternStreamingEdgeInputNode.addWS(ws);
    if (exprNodeStack.size() == 2) {
        patternStreamingEdgeInputNode.setExpression(exprNodeStack.pop());
        patternStreamingEdgeInputNode.setStreamReference(exprNodeStack.pop());
    } else if (exprNodeStack.size() == 1) {
        patternStreamingEdgeInputNode.setStreamReference(exprNodeStack.pop());
    }
    if (!whereClauseStack.empty()) {
        patternStreamingEdgeInputNode.setWhereClause(whereClauseStack.pop());
    }
    patternStreamingEdgeInputNode.setAliasIdentifier(alias);
}
Also used : PatternStreamingEdgeInputNode(org.ballerinalang.model.tree.clauses.PatternStreamingEdgeInputNode)

Example 4 with PatternStreamingEdgeInputNode

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

the class BLangPackageBuilder method startPatternStreamingEdgeInputNode.

public void startPatternStreamingEdgeInputNode(DiagnosticPos pos, Set<Whitespace> ws) {
    PatternStreamingEdgeInputNode patternStreamingEdgeInputNode = TreeBuilder.createPatternStreamingEdgeInputNode();
    ((BLangPatternStreamingEdgeInput) patternStreamingEdgeInputNode).pos = pos;
    patternStreamingEdgeInputNode.addWS(ws);
    this.patternStreamingEdgeInputStack.push(patternStreamingEdgeInputNode);
}
Also used : PatternStreamingEdgeInputNode(org.ballerinalang.model.tree.clauses.PatternStreamingEdgeInputNode)

Aggregations

PatternStreamingEdgeInputNode (org.ballerinalang.model.tree.clauses.PatternStreamingEdgeInputNode)4 BLangPatternStreamingEdgeInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingEdgeInput)2 BLangPatternStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingInput)2