public object visitUnaryExpr(Expr.Unary expr) { object right = evaluate(expr.right); switch (expr.operator_.type) { case TokenType.BANG: return(!isTruthy(right)); case TokenType.MINUS: checkNumberOperand(expr.operator_, right); return(-(double)right); } // Unreachable return(null); }
public string visitUnaryExpr(Expr.Unary expr) { return(parenthesize(expr.operator_.lexeme, expr.right)); }
public object visitUnaryExpr(Expr.Unary expr) { resolve(expr.right); return(null); }