use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.
the class SiddhiQueryBuilder method visit.
@Override
public void visit(BLangGroupBy groupBy) {
List<? extends ExpressionNode> varList = groupBy.getVariables();
Iterator<? extends ExpressionNode> iterator = varList.iterator();
groupByClause = new StringBuilder("group by ");
BLangSimpleVarRef simpleVarRef = (BLangSimpleVarRef) iterator.next();
addVarRefToClauseBuilder(simpleVarRef, groupByClause);
while (iterator.hasNext()) {
simpleVarRef = (BLangSimpleVarRef) iterator.next();
groupByClause.append(", ");
addVarRefToClauseBuilder(simpleVarRef, groupByClause);
}
}
use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method createFunctionInvocation.
public void createFunctionInvocation(DiagnosticPos pos, Set<Whitespace> ws, boolean argsAvailable) {
BLangInvocation invocationNode = (BLangInvocation) TreeBuilder.createInvocationNode();
invocationNode.pos = pos;
invocationNode.addWS(ws);
if (argsAvailable) {
List<ExpressionNode> exprNodes = exprNodeListStack.pop();
exprNodes.forEach(exprNode -> invocationNode.argExprs.add((BLangExpression) exprNode));
invocationNode.addWS(commaWsStack.pop());
}
BLangNameReference nameReference = nameReferenceStack.pop();
invocationNode.name = (BLangIdentifier) nameReference.name;
invocationNode.addWS(nameReference.ws);
invocationNode.pkgAlias = (BLangIdentifier) nameReference.pkgAlias;
addExpressionNode(invocationNode);
}
use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addThrowStmt.
public void addThrowStmt(DiagnosticPos poc, Set<Whitespace> ws) {
ExpressionNode throwExpr = this.exprNodeStack.pop();
BLangThrow throwNode = (BLangThrow) TreeBuilder.createThrowNode();
throwNode.pos = poc;
throwNode.addWS(ws);
throwNode.expr = (BLangExpression) throwExpr;
addStmtToCurrentBlock(throwNode);
}
use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addArrayInitExpr.
public void addArrayInitExpr(DiagnosticPos pos, Set<Whitespace> ws, boolean argsAvailable) {
List<ExpressionNode> argExprList;
BLangArrayLiteral arrayLiteral = (BLangArrayLiteral) TreeBuilder.createArrayLiteralNode();
if (argsAvailable) {
arrayLiteral.addWS(commaWsStack.pop());
argExprList = exprNodeListStack.pop();
} else {
argExprList = new ArrayList<>(0);
}
arrayLiteral.exprs = argExprList.stream().map(expr -> (BLangExpression) expr).collect(Collectors.toList());
arrayLiteral.pos = pos;
arrayLiteral.addWS(ws);
addExpressionNode(arrayLiteral);
}
use of org.wso2.carbon.identity.core.model.ExpressionNode in project ballerina by ballerina-lang.
the class SqlQueryBuilder method visit.
@Override
public void visit(BLangGroupBy groupBy) {
List<? extends ExpressionNode> varList = groupBy.getVariables();
Iterator<? extends ExpressionNode> iterator = varList.iterator();
groupByClause = new StringBuilder("group by ");
BLangExpression expr = (BLangExpression) iterator.next();
expr.accept(this);
groupByClause.append(exprStack.pop());
while (iterator.hasNext()) {
expr = (BLangExpression) iterator.next();
groupByClause.append(", ");
expr.accept(this);
groupByClause.append(exprStack.pop());
}
}
Aggregations