Ejemplo n.º 1
0
        public Simbolo execute_no_clonador(Entorno entorno)
        {
            if (this.llamada_anterior == null)
            {
                Simbolo simbolo_retorno = entorno.GetSimbolo(this.nombre_variable);
                if (simbolo_retorno == null)
                {
                    Error error = new Error(base.getLinea(), base.getColumna(), Error.Errores.Semantico,
                                            "se esperaba un identificador de variable");
                    Maestra.getInstancia.addError(error);
                    throw new Exception("se esperaba un identificador de variable");
                }

                if (simbolo_retorno.getValor().getTipo() == Objeto.TipoObjeto.ARRAY)
                {
                    return(Recorrer_array(entorno, simbolo_retorno));
                }

                return(simbolo_retorno);
            }
            else
            {
                Simbolo simbolo_retorno = llamada_anterior.retornar_simbolo(entorno);

                if (simbolo_retorno.getValor().getTipo() == Objeto.TipoObjeto.ARRAY)
                {
                    simbolo_retorno = Recorrer_array(entorno, simbolo_retorno);
                }

                Validar_Nivel(simbolo_retorno);

                Simbolo atributo_objeto = simbolo_retorno.getValor().get_atributo(this.nombre_variable);
                if (atributo_objeto == null)
                {
                    Error error = new Error(base.getLinea(), base.getColumna(), Error.Errores.Semantico,
                                            "Se esperaba un identificador de variable");
                    Maestra.getInstancia.addError(error);
                    throw new Exception("se esperaba un identificador de variable");
                }

                return(atributo_objeto);
            }
        }
Ejemplo n.º 2
0
        public Simbolo retornar_asignacion(Entorno entorno)
        {
            Simbolo simbolo = null;

            try
            {
                simbolo = asignar.retornar_simbolo(entorno);
            }catch (Exception e)
            {
                Console.WriteLine(e);
                throw new Exception(e.ToString());
            }

            return(simbolo);
        }