Ejemplo n.º 1
0
        public override Implementacion.Value Interpret()
        {
            var valor = Operando.Interpret();

            if (valor is BoolValue)
            {
                return new BoolValue()
                       {
                           Value = !(valor as BoolValue).Value
                       }
            }
            ;
            return(null);
        }
        public override Implementacion.Value Interpret()
        {
            Value  valorID = Operando.Interpret();
            string nombre  = " ";

            if (Operando is IdentificadorNode)
            {
                nombre = (Operando as IdentificadorNode).value;
                foreach (var stack in ContenidoStack.InstanceStack.Stack)
                {
                    if (stack.VariableExist(nombre))
                    {
                        if (valorID is IntValue)
                        {
                            stack.SetVariableValue(nombre, new IntValue {
                                Value = --(valorID as IntValue).Value
                            });
                        }
                        if (valorID is FloatValue)
                        {
                            stack.SetVariableValue(nombre, new FloatValue {
                                Value = --(valorID as FloatValue).Value
                            });
                        }
                        if (valorID is CharValue)
                        {
                            stack.SetVariableValue(nombre, new CharValue {
                                Value = --(valorID as CharValue).Value
                            });
                        }
                    }
                }
            }
            foreach (var stack in ContenidoStack.InstanceStack.Stack)
            {
                if (stack.VariableExist(nombre))
                {
                    valorID = stack.GetVariableValue(nombre);
                }
            }
            return(valorID);
        }
        public override Implementacion.Value Interpret()
        {
            var expresion = Operando.Interpret();

            if (expresion is IntValue)
            {
                return new IntValue {
                           Value = -(expresion as IntValue).Value
                }
            }
            ;
            if (expresion is FloatValue)
            {
                return new FloatValue {
                           Value = -(expresion as FloatValue).Value
                }
            }
            ;
            return(null);
        }
        public override Implementacion.Value Interpret()
        {
            var valor = Operando.Interpret();

            if (valor is IntValue)
            {
                return new IntValue()
                       {
                           Value = ~(valor as IntValue).Value
                       }
            }
            ;
            if (valor is CharValue)
            {
                return new IntValue()
                       {
                           Value = ~(valor as CharValue).Value
                       }
            }
            ;
            return(null);
        }