Ejemplo n.º 1
0
        public override Implementacion.Value Interpret()
        {
            var leftV  = OperadorIzquierdo.Interpret();
            var rightV = OperadorDerecho.Interpret();

            if (leftV is FloatValue && rightV is FloatValue)
            {
                return new FloatValue {
                           Value = (leftV as FloatValue).Value / (rightV as FloatValue).Value
                }
            }
            ;
            if (leftV is IntValue && rightV is FloatValue)
            {
                return new FloatValue {
                           Value = (leftV as IntValue).Value / (rightV as FloatValue).Value
                }
            }
            ;
            if (leftV is FloatValue && rightV is IntValue)
            {
                return new FloatValue {
                           Value = (leftV as FloatValue).Value / (rightV as IntValue).Value
                }
            }
            ;
            if (leftV is IntValue && rightV is IntValue)
            {
                return new FloatValue {
                           Value = (leftV as IntValue).Value / (rightV as IntValue).Value
                }
            }
            ;
            return(null);
        }
        public override Implementacion.Value Interpret()
        {
            Value valorID = null;
            string nombre = " ";
            if (OperadorIzquierdo is IdentificadorNode)
            {
                nombre = (OperadorIzquierdo as IdentificadorNode).value;
                foreach (var stack in ContenidoStack.InstanceStack.Stack)
                    if (stack.VariableExist(nombre))
                    {
                        valorID = stack.GetVariableValue(nombre);
                    }
            }
            var rightV = OperadorDerecho.Interpret();

            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 << (rightV as IntValue).Value });

                }
            }
            foreach (var stack in ContenidoStack.InstanceStack.Stack)
                if (stack.VariableExist(nombre))
                {
                    valorID = stack.GetVariableValue(nombre);
                }
            return valorID;
        }
Ejemplo n.º 3
0
        public override Implementacion.Value Interpret()
        {
            dynamic left  = OperadorIzquierdo.Interpret();
            dynamic right = OperadorDerecho.Interpret();

            return(new BoolValue {
                Value = (left.Value || right.Value)
            });
        }
Ejemplo n.º 4
0
        public override Implementacion.Value Interpret()
        {
            dynamic left  = OperadorIzquierdo.Interpret();
            dynamic right = OperadorDerecho.Interpret();

            if (left is BoolValue && right is BoolValue)
            {
                return new BoolValue {
                           Value = (left.Value | right.Value)
                }
            }
            ;
            if ((left is BooleanTipo || right is IntTipo) && (right is BooleanTipo || left is IntTipo))
            {
                return new IntValue {
                           Value = (left.Value | right.Value)
                }
            }
            ;
            return(null);
        }
        public override Implementacion.Value Interpret()
        {
            dynamic left  = OperadorIzquierdo.Interpret();
            dynamic right = OperadorDerecho.Interpret();

            if (!(right is IntValue))
            {
                if (left is IntValue)
                {
                    return new IntValue {
                               Value = (right as IntValue).Value >> (left as IntValue).Value
                    }
                }
                ;
                if (left is CharValue)
                {
                    return new IntValue {
                               Value = (right as CharValue).Value >> (left as IntValue).Value
                    }
                }
                ;
            }
            return(null);
        }
Ejemplo n.º 6
0
        public override Implementacion.Value Interpret()

        {
            var rightV = OperadorDerecho.Interpret();

            if (OperadorIzquierdo is IdentificadorNode)
            {
                var nombre = (OperadorIzquierdo as IdentificadorNode).value;
                foreach (var stack in ContenidoStack.InstanceStack.Stack)
                {
                    if (stack.VariableExist(nombre))
                    {
                        var valorID = stack.GetVariableValue(nombre);
                        if (valorID.GetType() == rightV.GetType())
                        {
                            stack.SetVariableValue(nombre, rightV);
                        }
                    }
                }
            }


            return(rightV);
        }