Search in sources :

Example 41 with ExpressionNode

use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

public void visit(BLangWindow windowClause) {
    ExpressionNode expressionNode = windowClause.getFunctionInvocation();
    ((BLangExpression) expressionNode).accept(this);
}
Also used : SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) ExpressionNode(org.ballerinalang.model.tree.expressions.ExpressionNode) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 42 with ExpressionNode

use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.

the class SiddhiQueryBuilder method visit.

@Override
public void visit(BLangPatternStreamingEdgeInput patternStreamingEdgeInput) {
    BLangExpression streamRef = (BLangExpression) patternStreamingEdgeInput.getStreamReference();
    streamRef.accept(this);
    streamIds.add(varRef);
    varRef = "";
    addInRefs(streamRef);
    String alias = patternStreamingEdgeInput.getAliasIdentifier();
    patternStreamingClause.append(alias).append(" = ").append(patternStreamingEdgeInput.getStreamReference());
    WhereNode whereNode = patternStreamingEdgeInput.getWhereClause();
    if (whereNode != null) {
        ((BLangWhere) whereNode).accept(this);
        patternStreamingClause.append(" ").append(whereClause);
        whereClause = new StringBuilder();
    }
    ExpressionNode expression = patternStreamingEdgeInput.getExpression();
    if (expression != null) {
        ((BLangExpression) expression).accept(this);
        patternStreamingClause.append(intRangeExpr.toString());
    }
}
Also used : SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) ExpressionNode(org.ballerinalang.model.tree.expressions.ExpressionNode) WhereNode(org.ballerinalang.model.tree.clauses.WhereNode) BLangWhere(org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 43 with ExpressionNode

use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addTupleDestructuringStatement.

public void addTupleDestructuringStatement(DiagnosticPos pos, Set<Whitespace> ws, boolean isVarsExist, boolean varDeclaration) {
    BLangTupleDestructure stmt = (BLangTupleDestructure) TreeBuilder.createTupleDestructureStatementNode();
    stmt.pos = pos;
    stmt.addWS(ws);
    if (isVarsExist) {
        stmt.setDeclaredWithVar(varDeclaration);
        stmt.expr = (BLangExpression) exprNodeStack.pop();
        List<ExpressionNode> lExprList = exprNodeListStack.pop();
        lExprList.forEach(expressionNode -> stmt.varRefs.add((BLangVariableReference) expressionNode));
    }
    // TODO: handle ParamList Destructue.
    addStmtToCurrentBlock(stmt);
}
Also used : ExpressionNode(org.ballerinalang.model.tree.expressions.ExpressionNode) SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) BLangVariableReference(org.wso2.ballerinalang.compiler.tree.expressions.BLangVariableReference) BLangTupleDestructure(org.wso2.ballerinalang.compiler.tree.statements.BLangTupleDestructure)

Example 44 with ExpressionNode

use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addReturnStatement.

public void addReturnStatement(DiagnosticPos pos, Set<Whitespace> ws, boolean exprAvailable) {
    BLangReturn retStmt = (BLangReturn) TreeBuilder.createReturnNode();
    retStmt.pos = pos;
    retStmt.addWS(ws);
    if (exprAvailable) {
        retStmt.addWS(commaWsStack.pop());
        for (ExpressionNode expr : this.exprNodeListStack.pop()) {
            retStmt.exprs.add((BLangExpression) expr);
        }
    }
    addStmtToCurrentBlock(retStmt);
}
Also used : ExpressionNode(org.ballerinalang.model.tree.expressions.ExpressionNode) SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) BLangReturn(org.wso2.ballerinalang.compiler.tree.statements.BLangReturn)

Example 45 with ExpressionNode

use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addForeachStatement.

public void addForeachStatement(DiagnosticPos pos, Set<Whitespace> ws) {
    BLangForeach foreach = (BLangForeach) TreeBuilder.createForeachNode();
    foreach.addWS(ws);
    foreach.pos = pos;
    foreach.setCollection(exprNodeStack.pop());
    foreach.addWS(commaWsStack.pop());
    List<ExpressionNode> lExprList = exprNodeListStack.pop();
    lExprList.forEach(expressionNode -> foreach.addVariable((BLangVariableReference) expressionNode));
    BLangBlockStmt foreachBlock = (BLangBlockStmt) this.blockNodeStack.pop();
    foreachBlock.pos = pos;
    foreach.setBody(foreachBlock);
    addStmtToCurrentBlock(foreach);
}
Also used : BLangForeach(org.wso2.ballerinalang.compiler.tree.statements.BLangForeach) BLangBlockStmt(org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt) ExpressionNode(org.ballerinalang.model.tree.expressions.ExpressionNode) SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) BLangVariableReference(org.wso2.ballerinalang.compiler.tree.expressions.BLangVariableReference)

Aggregations

ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)21 ArrayList (java.util.ArrayList)16 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)16 ExpressionNode (org.wso2.carbon.identity.core.model.ExpressionNode)15 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)12 BadRequestException (org.wso2.charon3.core.exceptions.BadRequestException)8 ExpressionNode (org.wso2.charon3.core.utils.codeutils.ExpressionNode)7 Map (java.util.Map)6 IdentityException (org.wso2.carbon.identity.base.IdentityException)6 Attribute (org.wso2.charon3.core.attributes.Attribute)6 ComplexAttribute (org.wso2.charon3.core.attributes.ComplexAttribute)6 MultiValuedAttribute (org.wso2.charon3.core.attributes.MultiValuedAttribute)6 SimpleAttribute (org.wso2.charon3.core.attributes.SimpleAttribute)6 Connection (java.sql.Connection)5 KubernetesPluginException (org.ballerinax.kubernetes.exceptions.KubernetesPluginException)5 JSONObject (org.json.JSONObject)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 Test (org.testng.annotations.Test)5 Node (org.wso2.carbon.identity.core.model.Node)5 IdpSearchResult (org.wso2.carbon.idp.mgt.model.IdpSearchResult)5