public object visitUnaryExpr(Expr.UnaryExpr unaryExpr) { object right = evaluate(unaryExpr.right); switch (unaryExpr.operatorToken.type) { case TokenType.EXCLAMATION: return(!isTruthy(right)); case TokenType.MINUS: checkNumberOperand(unaryExpr.operatorToken, right); return(-(double)right); case TokenType.MINUS_MINUS: checkNumberOperand(unaryExpr.operatorToken, right); return((double)right - 1.0); case TokenType.PLUS_PLUS: checkNumberOperand(unaryExpr.operatorToken, right); return((double)right + 1.0); } return(null); }
public object visitUnaryExpr(Expr.UnaryExpr unaryExpr) { resolve(unaryExpr.right); return(null); }
public string VisitUnaryExpr(Expr.UnaryExpr expr) { return(Parenthesize(expr.Operator.Lexeme, expr.Right)); }
public string visitUnaryExpr(Expr.UnaryExpr expr) { return(parenthesize(expr.operatorToken.lexeme, new Expr[] { expr.right })); }
public object VisitUnaryExpr(Expr.UnaryExpr expr) { Resolve(expr.Right); return(null); }