Exemple #1
0
        object Expr.IVisitor <object> .Visit(Expr.Prefix _prefix)
        {
            object right = Evaluate(_prefix.right);

            switch (_prefix.opp.type)
            {
            case TokenType.MINUS:
                CheckNumberOperand(_prefix.opp, right);
                return(-(double)right);

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

            default:
                break;
            }

            //unreachable
            return(null);
        }
 string Expr.IVisitor <string> .Visit(Expr.Prefix _prefix)
 {
     return(Parenthesize(_prefix.opp.lexeme, _prefix.right));
 }
Exemple #3
0
        public object Visit(Expr.Prefix _prefix)
        {
            Resolve(_prefix.right);

            return(null);
        }