@Override public String toString() { return expr + "[" + (startIndexExpression + ":" + (hasEndExpression() ? endIndexExpression : "")) + "]"; } }
@Override void setExpression(Expression expr) { fieldBinding.setRightExpr(expr); } };
@Override Expression getExpression() { return fieldBinding.getRightExpr(); }
@Override public Expression visit(RecordConstructor rc, ILangExpression arg) throws CompilationException { for (FieldBinding binding : rc.getFbList()) { binding.setLeftExpr(visit(binding.getLeftExpr(), rc)); binding.setRightExpr(visit(binding.getRightExpr(), rc)); } return rc; }
private Expression createOperatorExpression(OperatorType opType, Expression lhs, Expression rhs, List<IExpressionAnnotation> hints, SourceLocation sourceLoc) { OperatorExpr comparison = new OperatorExpr(); comparison.addOperand(lhs); comparison.addOperand(rhs); comparison.addOperator(opType); comparison.setSourceLocation(sourceLoc); if (hints != null) { for (IExpressionAnnotation hint : hints) { comparison.addHint(hint); } } return comparison; }
@Override public Boolean visit(RecordConstructor rc, ILangExpression arg) throws CompilationException { for (FieldBinding fb : rc.getFbList()) { if (visit(fb.getLeftExpr(), arg)) { return true; } if (visit(fb.getRightExpr(), arg)) { return true; } } return false; }
private Expression processConcatOperator(OperatorExpr operatorExpr) { // All operators have to be "||"s (according to the grammar). CallExpr callExpr = new CallExpr(new FunctionSignature(FunctionConstants.ASTERIX_NS, FunctionMapUtil.CONCAT, 1), operatorExpr.getExprList()); callExpr.setSourceLocation(operatorExpr.getSourceLocation()); return callExpr; }
@Override public Void visit(ListConstructor lc, Integer step) throws CompilationException { boolean ordered = false; if (lc.getType().equals(ListConstructor.Type.ORDERED_LIST_CONSTRUCTOR)) { ordered = true; } out.print(ordered ? "[" : "{{"); printDelimitedExpressions(lc.getExprList(), COMMA, step + 2); out.print(ordered ? "]" : "}}"); return null; }
@Override public Boolean visit(CallExpr pf, List<FunctionDecl> arg) throws CompilationException { Pair<Boolean, List<Expression>> p = inlineUdfsInExprList(pf.getExprList(), arg); pf.setExprList(p.second); return p.first; }
public void addOperand(Expression operand) { addOperand(operand, false); }
@Override public Void visit(OrderedListTypeDefinition x, Integer step) throws CompilationException { out.print("OrderedList ["); x.getItemTypeExpression().accept(this, step + 2); out.println("]"); return null; }
@Override public Void visit(UnorderedListTypeDefinition x, Integer step) throws CompilationException { out.print("{{"); x.getItemTypeExpression().accept(this, step + 2); out.print("}}"); return null; }
@Override public Expression visit(RecordConstructor rc, ILangExpression arg) throws CompilationException { for (FieldBinding binding : rc.getFbList()) { binding.setLeftExpr(visit(binding.getLeftExpr(), rc)); binding.setRightExpr(visit(binding.getRightExpr(), rc)); } return rc; }
@Override public Void visit(RecordConstructor rc, Void arg) throws CompilationException { for (FieldBinding fb : rc.getFbList()) { fb.getLeftExpr().accept(this, arg); fb.getRightExpr().accept(this, arg); } return null; }
@Override public Void visit(OrderedListTypeDefinition x, Integer step) throws CompilationException { out.print("["); x.getItemTypeExpression().accept(this, step + 2); out.print("]"); return null; }
@Override public Void visit(UnorderedListTypeDefinition x, Integer step) throws CompilationException { out.print("UnorderedList <"); x.getItemTypeExpression().accept(this, step + 2); out.println(">"); return null; }
@Override public Boolean visit(RecordConstructor rc, List<FunctionDecl> arg) throws CompilationException { boolean changed = false; for (FieldBinding b : rc.getFbList()) { Pair<Boolean, Expression> leftExprInlined = inlineUdfsInExpr(b.getLeftExpr(), arg); b.setLeftExpr(leftExprInlined.second); changed = changed || leftExprInlined.first; Pair<Boolean, Expression> rightExprInlined = inlineUdfsInExpr(b.getRightExpr(), arg); b.setRightExpr(rightExprInlined.second); changed = changed || rightExprInlined.first; } return changed; }
@Override public Void visit(RecordConstructor rc, Collection<VariableExpr> freeVars) throws CompilationException { for (FieldBinding binding : rc.getFbList()) { binding.getLeftExpr().accept(this, freeVars); binding.getRightExpr().accept(this, freeVars); } return null; }
@Override public Boolean visit(RecordConstructor rc, ILangExpression parentSelectBlock) throws CompilationException { for (FieldBinding fieldBinding : rc.getFbList()) { ILangExpression leftExpr = fieldBinding.getLeftExpr(); ILangExpression rightExpr = fieldBinding.getRightExpr(); if (leftExpr.accept(this, parentSelectBlock)) { return true; } if (rightExpr.accept(this, parentSelectBlock)) { return true; } } return false; }