Пример #1
0
        /*METODO PARA BUSCAR UNA VARIABLE DENTRO DEL AMBITO*/

        public Simbolo getSimbolo(String id)
        {
            Ambito auxiliar = this;

            while (auxiliar != null)
            {
                if (auxiliar.tablaVars.ExisteVariable(id))
                {
                    return(auxiliar.tablaVars.getVariable(id));
                }

                auxiliar = auxiliar.Anterior; //ME MUEVO AL ANTERIOR
            }

            return(null);//EN CASO DE NO ENCONTRAR LA VARIABLE MARCARIA UN ERROR
        }
 public object Ejecutar(Ambito ambito)
 {
     try
     {
         foreach (Instruccion i in this.instrucciones)
         {
             i.Ejecutar(ambito);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Ejecutando Constructor: " + this.clase + " | Archivo: " + ambito.archivo + " | Error: " + e.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(null);
 }
Пример #3
0
 public object Ejecutar(Ambito ambito)
 {
     AST.Ejecutar(ambito);
     if (this.Hereda)
     {
         Clase padre = Estatico.clasesDisponibles.getClase(this.Padre.ToLower());
         if (padre != null)
         {
             Ambito tata = new Ambito(null, this.Padre.ToLower() + " " + this.idClase, ambito.archivo);
             tata = (Ambito)padre.Ejecutar(tata);
             ambito.HeredaAmbito(tata);
         }
         else
         {
             TError error = new TError("Semantico", "Se intenta heredar: \"" + padre + "\" la cual no existe, desde clase: \"" + this.idClase + "\" | Clase: " + this.idClase + " | Archivo: " + ambito.archivo, 0, 0, false);
             Estatico.ColocaError(error);
             Estatico.errores.Add(error);
         }
     }
     return(ambito);
 }
 public Ambito seteaParametrosLocales(Ambito m, List <Object> valores)
 {
     try
     {
         if (valores.Count == this.parametros.Count)
         {
             for (int x = 0; x < valores.Count; x++)
             {
                 String   tipo = this.parametros.ElementAt(x).tipo.ToLower();
                 String   id   = this.parametros.ElementAt(x).idparam.ToLower();
                 Variable v    = new Variable(id, tipo, Estatico.Vibililidad.LOCAL, valores.ElementAt(x));
                 m.agregarVariableAlAmbito(id, v);
             }
         }
     }
     catch
     {
         TError error = new TError("Ejecucion", "Error al ejecutar los parametros en clase: " + this.clase, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(m);
 }
Пример #5
0
 public void HeredaAmbito(Ambito padre)
 {
     heredaAtributos(padre.tablaVars);
     heredaMetodosFunciones(padre.tablaFuns);
     heredaConstructores(padre.tablaConst);
 }
Пример #6
0
 public void tomaValoresDelAmbito(Ambito padre, bool ignoravisibilidad)
 {
     tomaVariables(padre.tablaVars, ignoravisibilidad);
     tomaFunciones(padre.tablaFuns, ignoravisibilidad);
     tomarConstructores(padre.tablaConst);
 }
Пример #7
0
 public Opciones(string idClase, Ambito ambito) : base(idClase, ambito)
 {
     listados = new List <List <object> >();
     //EL AMBITO NI LO VOY A USAR
 }
Пример #8
0
 public Objeto(String idClase, Ambito ambito)
 {
     this.idClase = idClase;
     this.ambito  = ambito;
 }