Beispiel #1
0
        public object VisitUnaryExpr(Expr.Unary expr)
        {
            object right = Evaluate(expr.right);

            switch (expr.op.type)
            {
            case TokenType.MINUS:
                CheckNumberOperand(expr.op, right);
                return(-(double)right);
            }

            return(null);
        }
Beispiel #2
0
 public string VisitUnaryExpr(Expr.Unary expr)
 {
     return(Parenthesize(expr.op.lexeme, expr.right));
 }
 public MyVoid VisitUnaryExpr(Expr.Unary expr)
 {
     resolve(expr.right);
     return(null);
 }