Esempio n. 1
0
        public object visitExprUnaryExpr(ExprUnary expr)
        {
            object right = evaluate(expr.right);

            switch (expr.eOperator.type)
            {
            case TokenType.MINUS:
                checkNumberOperand(expr.eOperator, right);
                return(-(double)right);

            case TokenType.BANG:
                return(!isTruthy(right));

            default:
                return(null);
            }
        }
Esempio n. 2
0
 public object visitExprUnaryExpr(ExprUnary expr)
 {
     resolve(expr.right);
     return(null);
 }
Esempio n. 3
0
 public object visitExprUnaryExpr(ExprUnary expr)
 {
     return(parenthesize(expr.eOperator.lexeme, expr.right));
 }