Search in sources :

Example 1 with BLangSelectExpression

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression in project ballerina by ballerina-lang.

the class TypeChecker method visit.

@Override
public void visit(BLangSelectExpression selectExpression) {
    BLangExpression expr = (BLangExpression) selectExpression.getExpression();
    expr.accept(this);
}
Also used : BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 2 with BLangSelectExpression

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

public void visit(BLangSelectClause selectClause) {
    GroupByNode groupByNode = selectClause.getGroupBy();
    if (groupByNode != null) {
        ((BLangGroupBy) groupByNode).accept(this);
    }
    HavingNode havingNode = selectClause.getHaving();
    if (havingNode != null) {
        ((BLangHaving) havingNode).accept(this);
    }
    List<? extends SelectExpressionNode> selectExpressionsList = selectClause.getSelectExpressions();
    if (selectExpressionsList != null) {
        for (SelectExpressionNode selectExpressionNode : selectExpressionsList) {
            ((BLangSelectExpression) selectExpressionNode).accept(this);
        }
    }
}
Also used : HavingNode(org.ballerinalang.model.tree.clauses.HavingNode) SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) BLangSelectExpression(org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression) GroupByNode(org.ballerinalang.model.tree.clauses.GroupByNode) BLangGroupBy(org.wso2.ballerinalang.compiler.tree.clauses.BLangGroupBy) BLangHaving(org.wso2.ballerinalang.compiler.tree.clauses.BLangHaving)

Example 3 with BLangSelectExpression

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

public void visit(BLangSelectExpression selectExpression) {
    ExpressionNode expressionNode = selectExpression.getExpression();
    ((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 4 with BLangSelectExpression

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression in project ballerina by ballerina-lang.

the class SiddhiQueryBuilder method createSiddhiSelectExpressionClause.

private void createSiddhiSelectExpressionClause(BLangSelectClause select) {
    List<? extends SelectExpressionNode> selectExprList = select.getSelectExpressions();
    selectExprClause = new StringBuilder();
    selectExprClause.append("select ");
    if (selectExprList != null && !selectExprList.isEmpty()) {
        Iterator<? extends SelectExpressionNode> iterator = selectExprList.iterator();
        BLangSelectExpression selectExpression = (BLangSelectExpression) iterator.next();
        selectExpression.accept(this);
        selectExprClause.append(selectExpr);
        while (iterator.hasNext()) {
            selectExpression = (BLangSelectExpression) iterator.next();
            selectExprClause.append(", ");
            selectExpression.accept(this);
            selectExprClause.append(selectExpr);
        }
    } else if (select.isSelectAll()) {
        selectExprClause.append("* ");
    }
}
Also used : BLangSelectExpression(org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression)

Example 5 with BLangSelectExpression

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression in project ballerina by ballerina-lang.

the class SiddhiQueryBuilder method visit.

@Override
public void visit(BLangSelectExpression selectExpression) {
    BLangExpression expr = (BLangExpression) selectExpression.getExpression();
    selectExpr = new StringBuilder();
    addVarRefToClauseBuilder(expr, selectExpr);
    String identifier = selectExpression.getIdentifier();
    if (identifier != null) {
        selectExpr.append(" as ").append(identifier);
    }
}
Also used : BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Aggregations

BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)4 BLangSelectExpression (org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectExpression)3 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)2 BLangGroupBy (org.wso2.ballerinalang.compiler.tree.clauses.BLangGroupBy)2 BLangHaving (org.wso2.ballerinalang.compiler.tree.clauses.BLangHaving)2 GroupByNode (org.ballerinalang.model.tree.clauses.GroupByNode)1 HavingNode (org.ballerinalang.model.tree.clauses.HavingNode)1 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)1