private DoubleConst compute0(int op, DoubleConst right) { int newType; if (this.type == TokenId.DoubleConstant || right.type == TokenId.DoubleConstant) newType = TokenId.DoubleConstant; else newType = TokenId.FloatConstant; return compute(op, this.value, right.value, newType); }
private DoubleConst compute0(int op, IntConst right) { return compute(op, this.value, (double)right.value, this.type); }
private DoubleConst compute0(int op, DoubleConst right) { int newType; if (this.type == TokenId.DoubleConstant || right.type == TokenId.DoubleConstant) newType = TokenId.DoubleConstant; else newType = TokenId.FloatConstant; return compute(op, this.value, right.value, newType); }
private DoubleConst compute0(int op, IntConst right) { return compute(op, this.value, right.value, this.type); }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; }
private DoubleConst compute0(int op, DoubleConst right) { int newType; if (this.type == TokenId.DoubleConstant || right.type == TokenId.DoubleConstant) newType = TokenId.DoubleConstant; else newType = TokenId.FloatConstant; return compute(op, this.value, right.value, newType); }
private DoubleConst compute0(int op, DoubleConst right) { int newType; if (this.type == TokenId.DoubleConstant || right.type == TokenId.DoubleConstant) newType = TokenId.DoubleConstant; else newType = TokenId.FloatConstant; return compute(op, this.value, right.value, newType); }
private DoubleConst compute0(int op, DoubleConst right) { int newType; if (this.type == TokenId.DoubleConstant || right.type == TokenId.DoubleConstant) newType = TokenId.DoubleConstant; else newType = TokenId.FloatConstant; return compute(op, this.value, right.value, newType); }
private DoubleConst compute0(int op, DoubleConst right) { int newType; if (this.type == TokenId.DoubleConstant || right.type == TokenId.DoubleConstant) newType = TokenId.DoubleConstant; else newType = TokenId.FloatConstant; return compute(op, this.value, right.value, newType); }
private DoubleConst compute0(int op, DoubleConst right) { int newType; if (this.type == TokenId.DoubleConstant || right.type == TokenId.DoubleConstant) newType = TokenId.DoubleConstant; else newType = TokenId.FloatConstant; return compute(op, this.value, right.value, newType); }
private DoubleConst compute0(int op, IntConst right) { return compute(op, this.value, (double)right.value, this.type); }
private DoubleConst compute0(int op, IntConst right) { return compute(op, this.value, (double)right.value, this.type); }
private DoubleConst compute0(int op, IntConst right) { return compute(op, this.value, (double)right.value, this.type); }
private DoubleConst compute0(int op, IntConst right) { return compute(op, this.value, (double)right.value, this.type); }
private DoubleConst compute0(int op, IntConst right) { return compute(op, this.value, (double)right.value, this.type); }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }
private boolean isConstant(BinExpr expr, int op, ASTree left, ASTree right) throws CompileError { left = stripPlusExpr(left); right = stripPlusExpr(right); ASTree newExpr = null; if (left instanceof StringL && right instanceof StringL && op == '+') newExpr = new StringL(((StringL)left).get() + ((StringL)right).get()); else if (left instanceof IntConst) newExpr = ((IntConst)left).compute(op, right); else if (left instanceof DoubleConst) newExpr = ((DoubleConst)left).compute(op, right); if (newExpr == null) return false; // not a constant expression else { expr.setOperator('+'); expr.setOprand1(newExpr); expr.setOprand2(null); newExpr.accept(this); // for setting exprType, arrayDim, ... return true; } }