Search in sources :

Example 21 with ExpressionNode

use of org.wso2.charon3.core.utils.codeutils.ExpressionNode in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

public void visit(BLangBinaryExpr binaryExpr) {
    ExpressionNode leftExpression = binaryExpr.getLeftExpression();
    ((BLangExpression) leftExpression).accept(this);
    ExpressionNode rightExpression = binaryExpr.getRightExpression();
    ((BLangExpression) rightExpression).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 22 with ExpressionNode

use of org.wso2.charon3.core.utils.codeutils.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 23 with ExpressionNode

use of org.wso2.charon3.core.utils.codeutils.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 24 with ExpressionNode

use of org.wso2.charon3.core.utils.codeutils.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 25 with ExpressionNode

use of org.wso2.charon3.core.utils.codeutils.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)

Aggregations

SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)16 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)16 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)11 BadRequestException (org.wso2.charon3.core.exceptions.BadRequestException)8 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 Map (java.util.Map)4 JSONObject (org.json.JSONObject)3 BLangInvocation (org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)3 AbstractSCIMObject (org.wso2.charon3.core.objects.AbstractSCIMObject)3 AttributeSchema (org.wso2.charon3.core.schema.AttributeSchema)3 Iterator (java.util.Iterator)2 List (java.util.List)2 JSONArray (org.json.JSONArray)2 BLangNameReference (org.wso2.ballerinalang.compiler.tree.BLangNameReference)2 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)2 BLangVariableReference (org.wso2.ballerinalang.compiler.tree.expressions.BLangVariableReference)2 NotImplementedException (org.wso2.charon3.core.exceptions.NotImplementedException)2