Example #1
0
 public double Visit(UnaryExpr un)
 {
     un.Right.accept(this);
     if (un.OP == OPERATOR.PLUS)
     {
         Console.Write("  + ");
     }
     else if (un.OP == OPERATOR.MINUS)
     {
         Console.Write("  - ");
     }
     return(Double.NaN);
 }
Example #2
0
 public double Visit(UnaryExpr un)
 {
     un.Right.accept(this);
     if (un.OP == OPERATOR.PLUS)
     {
         eval_stack.Push(eval_stack.Pop());
     }
     else if (un.OP == OPERATOR.MINUS)
     {
         eval_stack.Push(-eval_stack.Pop());
     }
     return(Double.NaN);
 }
Example #3
0
        public double Visit(UnaryExpr un)

        {
            if (un.OP == OPERATOR.PLUS)
            {
                return(+un.Right.accept(this));
            }
            else if (un.OP == OPERATOR.MINUS)
            {
                return(-un.Right.accept(this));
            }
            return(Double.NaN);
        }