Example #1
0
        object Expr.IVisitor <object> .Visit(Expr.Postfix _postfix)
        {
            object left = Evaluate(_postfix.left);

            CheckNumberOperand(_postfix.opp, left);

            switch (_postfix.opp.type)
            {
            case TokenType.PLUS_PLUS:
                return((double)left + 1);

            case TokenType.MINUS_MINUS:
                return((double)left - 1);

            default:
                break;
            }

            return(null);
        }
Example #2
0
 string Expr.IVisitor <string> .Visit(Expr.Postfix _postfix)
 {
     return(Parenthesize(_postfix.opp.lexeme));
 }
Example #3
0
        public object Visit(Expr.Postfix _postfix)
        {
            Resolve(_postfix.left);

            return(null);
        }