public Fichero(Pregunta p, String filtros, int linea, int col, String clase, String archivo)
        {
            this.linea   = linea;
            this.col     = col;
            this.clase   = clase;
            this.Archivo = archivo;

            this.filtros = filtros;
            this.p       = p;
            InitializeComponent();

            if (this.p.lectura == true)
            {
                this.button1.Enabled = false;
            }

            salida = Estatico.toHTMLTitle("(" + p.numeroPregunta + ") Fichero: " + p.idPregunta);
            if (!p.etiqueta.Equals("") || !p.etiqueta.Equals(" "))
            {
                salida = salida + Estatico.toHTMLCard("Etiqueta: " + p.etiqueta);
            }
            if (!p.sugerencia.Equals("") || !p.sugerencia.Equals(" "))
            {
                salida = salida + Estatico.toHTMLCard("Sugerencia: " + p.sugerencia);
            }
            if (!p.requeridoMsn.Equals(""))
            {
                salida = salida + Estatico.toHTMLCard(Estatico.toHTMLAlert(p.requeridoMsn));
            }

            Salida.DocumentText = Estatico.header() + salida + Estatico.footer();
        }
 private Ambito soobreEscribeParams(Constructor c, Ambito m, List <Object> valores)
 {
     try
     {
         if (valores.Count == c.parametros.Count)
         {
             for (int x = 0; x < valores.Count; x++)
             {
                 String   tipo = c.parametros.ElementAt(x).tipo.ToLower();
                 String   id   = c.parametros.ElementAt(x).idparam.ToLower();
                 Variable v    = new Variable(id, tipo, Estatico.Vibililidad.LOCAL, valores.ElementAt(x));
                 if (m.existeVariable(id.ToLower()))
                 {
                     Simbolo  s   = m.getSimbolo(id.ToLower());
                     Variable aux = (Variable)s;
                     aux.valor = v.valor;
                 }
             }
         }
     }
     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);
 }
Esempio n. 3
0
 public object Ejecutar(Ambito ambito)
 {
     try
     {
         Clave clave = new Clave(this.idfuncion.ToLower(), this.parametros, "");
         if (!ambito.existeFuncion(clave))
         {
             Funcion f = new Funcion(this.instrucciones, this.parametros, this.idfuncion.ToLower(), this.tipo, this.visibilidad, this.linea, this.columna, this.clase);
             ambito.agregarFuncionAlAmbito(clave, f);
         }
         else
         {
             TError error = new TError("Semantico", "Ya existe una definicion de Funcion: " + this.idfuncion + " con la misma cantidad de parametros y tipo | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
             Estatico.errores.Add(error);
             Estatico.ColocaError(error);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error en la ejecucion de Declaracion de Funcion: " + this.idfuncion + " | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Error: " + e.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(null);
 }
Esempio n. 4
0
 public object getValor(Ambito ambito)
 {
     try
     {
         //ESTA FUNCION AUN HAY QYE MEJORARLA
         object valorReal = this.exp.getValor(ambito);
         String tam       = valorReal.ToString();
         if (valorReal is Nulo)
         {
             return(0);
         }
         else
         {
             val = "entero";
             return(tam.Length);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al ejecutar la funcion: Tam() | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(0);
 }
Esempio n. 5
0
 public object Ejecutar(Ambito ambito)
 {
     try
     {
         List <Object> valores = getValoresParam(ambito);
         ClaveFuncion  clave   = new ClaveFuncion("padre", "vacio", getNodoParametros(ambito));
         Ambito        aux     = buscaElGlobal(ambito);
         Constructor   c       = aux.getConstructor(clave);
         if (c != null)
         {
             Ambito local = new Ambito(ambito, "padre", ambito.archivo);
             local = c.seteaParametrosLocales(local, valores);
             c.Ejecutar(local);
             return(new Nulo());
         }
         else if (c == null && this.expresiones.Count == 0)
         {
             return(new Nulo());
         }
         else
         {
             TError error = new TError("Ejecucion", "No existe un construcotr de la clase padre que contenga los parametros indicados en Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
             Estatico.errores.Add(error);
             Estatico.ColocaError(error);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al intentar ejecutar Super en Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Error: " + e.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(new Nulo());
 }
Esempio n. 6
0
 public object getValor(Ambito ambito)
 {
     try
     {
         if (retornaVacio)
         {
             this.ValorAux = new Vacio();
             NodoReturn n = new NodoReturn(this.ValorAux, "vacio");
             return(n);
         }
         else
         {
             this.ValorAux = this.expresion.getValor(ambito);
             NodoReturn n = new NodoReturn(this.ValorAux, getTipo(ambito).ToLower());
             return(n);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "No se ejecuto de buena forma el retorno: Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | " + e.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(new Vacio());
 }
 public object getValor(Ambito ambito)
 {
     try
     {
         Object valor = exp.getValor(ambito);
         if (valor is int)
         {
             int v = (int)valor;
             this.valor = Math.Tan(v);
             return(this.valor);
         }
         else if (valor is double)
         {
             double v = (double)valor;
             this.valor = Math.Tan(v);
             return(this.valor);
         }
         else
         {
             TError error = new TError("Semantico", "El parametro que reciba la Funcion Tan() puede ser Entero o Decimal | Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
             Estatico.errores.Add(error);
             Estatico.ColocaError(error);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al ejecutar la funcion Tan() | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     this.valor = 0.0;
     return(0.0);
 }
Esempio n. 8
0
 public object Ejecutar(Ambito ambito)
 {
     foreach (Instruccion instruccion in this.instrucciones)//PRIMERO EJECUTO EL GUARDADO DE FUNCIONES
     {
         if (instruccion is DeclaracionConstructor || instruccion is DeclaracionFuncion || instruccion is DeclaracionPregunta)
         {
             instruccion.Ejecutar(ambito);
         }
         if (Estatico.paraEjecucionPorCantidadErrores())
         {
             MessageBox.Show("Se han encontrado demasiados errores Semanticos, Revisa el reporte para Corregirlos! Se Pauso en: " + this.clase, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(null);
         }
     }
     foreach (Instruccion instruccion in this.instrucciones)//DESPUES LA DECLARACION DE ATRIBUTOS
     {
         if (instruccion is DeclaracionVar || instruccion is DeclaracionArreglo)
         {
             instruccion.Ejecutar(ambito);
         }
         if (Estatico.paraEjecucionPorCantidadErrores())
         {
             MessageBox.Show("Se han encontrado demasiados errores Semanticos, Revisa el reporte para Corregirlos! Se Pauso en: " + this.clase, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(null);
         }
     }
     return(null);
 }
 public object Ejecutar(Ambito ambito)
 {
     try
     {
         ClaveFuncion clave = new ClaveFuncion(this.clase.ToLower(), "vacio", this.parametros);
         if (!ambito.existeConstructor(clave))
         {
             Constructor c = new Constructor(this.parametros, instrucciones, this.linea, this.columna, this.clase);
             ambito.agregarConstructor(clave, c);
         }
         else
         {
             TError error = new TError("Semantico", "Ya existe una definicion de Constructor: " + this.clase + " con la misma cantidad de parametros y tipo | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
             Estatico.errores.Add(error);
             Estatico.ColocaError(error);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error en la ejecucion de Declaracion de Constructor: " + this.clase + " | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Error: " + e.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(null);
 }
 public object Ejecutar(Ambito ambito)
 {
     try
     {
         Object objeto = ObjetoAsignar.getValor(ambito);
         if (objeto is Objeto)
         {
             Objeto aux   = (Objeto)objeto;
             Ambito ambOb = aux.ambito;
             asignacionValor.Ejecutar(ambOb);
         }
         else //EN CASO DE QUE NO FUERA OBJETO
         {
             TError error = new TError("Semantico", "Se esta intentando asignar a un Tipo de dato que no es Objeto! | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
             Estatico.errores.Add(error);
             Estatico.ColocaError(error);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error de Ejecucion al intentar asignar posicion de un Arreglo | " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(null);
 }
 public object Ejecutar(Ambito ambito)
 {
     try
     {
         foreach (Object ob in this.instrucciones)
         {
             if (ob is Instruccion)
             {
                 Instruccion aux = (Instruccion)ob;
                 Object      res = aux.Ejecutar(ambito);
                 if (res is NodoReturn)
                 {
                     return(res);
                 }
             }
             else if (ob is Expresion)
             {
                 Expresion exp = (Expresion)ob;
                 Object    res = exp.getValor(ambito);
                 if (res is NodoReturn)
                 {
                     return(res);
                 }
             }
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al Ejecutar la funcion: " + idFuncion + " | Error: " + e.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(new NodoReturn(new Vacio(), "vacio"));
 }
        public object Ejecutar(Ambito ambito)
        {
            try
            {
                DamePregunta dame = new DamePregunta(identificador, parametros, clase, linea, columna, estilo.tipo, "", this.numero);
                Pregunta     p    = dame.getPregunta(ambito);
                if (p != null)
                {
                    Objeto ob       = dame.ob;
                    Ambito auxiliar = dame.ambPregu;

                    llamadaACalcular(auxiliar, null);

                    llamadaACalcular(auxiliar, null);

                    ob.ambito = dame.ambPregu;
                }
            }
            catch (Exception e)
            {
                TError error = new TError("Ejecucion", "Error al ejecutar el metodo Calcular: " + this.identificador + " | Clase: " + clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
                Estatico.ColocaError(error);
                Estatico.errores.Add(error);
            }
            return(new Nulo());
        }
Esempio n. 13
0
        private void declaracionApartirExp(Ambito ambito)
        {
            if (!ambito.existeVariable(this.idArr.ToLower()))
            {
                //TENGO QUE VER SI LO QUE ME RETORNA LA EXPRESION ES UN ARREGLO Y SI HACE MATCH CON LOS DATOS QUE TENGO
                Object arr     = this.exp.getValor(ambito);
                String tipoaux = this.exp.getTipo(ambito);
                if (arr is Arreglo)
                {
                    Arreglo arreglo = (Arreglo)arr;

                    if (this.NumDim == arreglo.numDimensiones)
                    {
                        if (arreglo.Tipo.Equals("nuevo"))
                        {
                            arreglo.setID(this.idArr);
                            arreglo.setTipo(this.tipo.ToLower());
                            arreglo.setVisibilidad(this.visibilidad);

                            ambito.agregarVariableAlAmbito(this.idArr.ToLower(), arreglo);
                        }
                        else if (arreglo.Tipo.ToLower().Equals(this.tipo.ToLower()))
                        {
                            ambito.agregarVariableAlAmbito(this.idArr.ToLower(), arreglo);
                        }
                        else
                        {
                            TError error = new TError("Semantico", "Los tipos del arreglo no concuerdan, se esperaba: \"" + this.tipo + "\" y se econtro: \"" + arreglo.Tipo.ToLower() + "\"" + "  | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
                            Estatico.errores.Add(error);
                            Estatico.ColocaError(error);
                        }
                    }
                    else
                    {
                        TError error = new TError("Semantico", "Para \"" + this.idArr.ToLower() + "\", Las dimensiones no concuerdan se esperaba: " + this.NumDim + ", dimensiones y se encontraron: " + arreglo.numDimensiones + "  | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
                        Estatico.errores.Add(error);
                        Estatico.ColocaError(error);
                    }
                }
                else if (arr is Nulo)
                {
                    ambito.agregarVariableAlAmbito(this.idArr.ToLower(), new Arreglo(new List <object>(), new List <int>(), this.NumDim, this.idArr.ToLower(), true, this.visibilidad, this.tipo));
                }
                else
                {
                    TError error = new TError("Semantico", "Se esperaba un arreglo como valor para: \"" + this.idArr + "\", se encontro: \"" + tipoaux + "\"  | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
                    Estatico.errores.Add(error);
                    Estatico.ColocaError(error);
                }
            }
            else
            {
                TError error = new TError("Semantico", "Ya existe una declaracion de: \"" + this.idArr + "\" en este Ambito | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
                Estatico.errores.Add(error);
                Estatico.ColocaError(error);
            }
        }
Esempio n. 14
0
 public object getValor(Ambito ambito)
 {
     try
     {
         Simbolo s = (Simbolo)ambito.getSimbolo(this.id.ToLower());
         if (s != null)
         {
             if (s is Arreglo)
             {
                 Arreglo    aux        = (Arreglo)s;
                 List <int> coordenada = getDimensiones(ambito);
                 if (coordenada != null)
                 {
                     if (aux.esCoordenadaValida(coordenada))
                     {
                         int    realIndex = aux.calcularPosicion(coordenada);
                         Object valor     = aux.getElementFromArray(realIndex);
                         this.ValorAux = valor;
                         return(valor);
                     }
                     else
                     {
                         TError error = new TError("Semantico", "Para el arreglo: \"" + this.id + "\" La Dimension no se encuentra dentro de los limites! | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
                         Estatico.errores.Add(error);
                         Estatico.ColocaError(error);
                     }
                 }
                 else
                 {
                     TError error = new TError("Semantico", "Para el arreglo: \"" + this.id + "\" No se ha proporcionado un Entero como Dimension del Mismo | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
                     Estatico.errores.Add(error);
                     Estatico.ColocaError(error);
                 }
             }
             else
             {
                 TError error = new TError("Semantico", "El simbolo: \"" + this.id + "\" No es un arreglo por lo que no se puede acceder al valor indicado | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
                 Estatico.errores.Add(error);
                 Estatico.ColocaError(error);
             }
         }
         else
         {
             TError error = new TError("Semantico", "No existe el Arreglo: \"" + this.id + "\" en este Ambito | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
             Estatico.errores.Add(error);
             Estatico.ColocaError(error);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al acceder al valor de arreglo: \"" + id + "\" | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     this.ValorAux = new Nulo();
     return(ValorAux);
 }
Esempio n. 15
0
        public object ejecutar(Entorno.Entorno ent)
        {
            Object ob = expresion.getValor(ent);

            if (ob != null)
            {
                Estatico.agregarMensaje("[+MESSAGE]\n" + ob.ToString() + "\n[-MESSAGE]\n");
            }
            return(null);
        }
Esempio n. 16
0
        public object getValor(Ambito ambito)
        {
            try
            {
                Object cad     = cadena.getValor(ambito);
                String tipocad = cadena.getTipo(ambito);

                Object inf     = num1.getValor(ambito);
                String tipoInf = num1.getTipo(ambito);

                Object sup     = num2.getValor(ambito);
                String tipoSup = num2.getTipo(ambito);

                if (cad is String && inf is int && sup is int)
                {
                    String cadena   = (String)cad;
                    int    inferior = (int)inf;
                    int    superior = (int)sup;

                    if (inferior >= 0 && superior >= 0)
                    {
                        if (superior < cadena.Length)
                        {
                            tipo = cadena.Substring(inferior, superior);
                            return(tipo);
                        }
                        else
                        {
                            TError error = new TError("Semantico", "El limite superior no debe ser menor al largo de la cadena! | Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                            Estatico.errores.Add(error);
                            Estatico.ColocaError(error);
                        }
                    }
                    else
                    {
                        TError error = new TError("Semantico", "Parametros de Funcion SubCadena deben ser mayores a 0 | Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                        Estatico.errores.Add(error);
                        Estatico.ColocaError(error);
                    }
                }
                else
                {
                    TError error = new TError("Semantico", "Funcion SubCade requiere parametros: (cadena, entero, entero) y se encontro: (" + tipocad + "," + tipoInf + "," + tipoSup + ") | Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                    Estatico.errores.Add(error);
                    Estatico.ColocaError(error);
                }
            }
            catch (Exception e)
            {
                TError error = new TError("Ejecucion", "Error al ejecutar la funcion SubCadena | Clase: " + clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
                Estatico.errores.Add(error);
                Estatico.ColocaError(error);
            }
            return(new Nulo());
        }
        public Cadenas(Pregunta p, int linea, int col, String clase, String archivo, int max, int min, int fil, Boolean tomaEnCuentaParams)
        {
            this.p = p;

            this.linea   = linea;
            this.col     = col;
            this.clase   = clase;
            this.archivo = archivo;

            this.min = min;
            this.fil = fil;
            this.max = max;

            if (this.min < 0)
            {
                this.min = 0;
            }
            if (this.fil < 0)
            {
                this.fil = 10;
            }


            this.tomaEnCuentaParams = tomaEnCuentaParams;

            InitializeComponent();

            if (this.p.lectura == true)
            {
                this.button1.Enabled = false;
            }

            String salida = Estatico.toHTMLTitle("(" + p.numeroPregunta + ") Texto: " + p.idPregunta);

            if (!p.etiqueta.Equals(""))
            {
                salida = salida + Estatico.toHTMLCard("Etiquerta: " + p.etiqueta);
            }
            if (!p.sugerencia.Equals(""))
            {
                salida = salida + Estatico.toHTMLCard("Sugerencia: " + p.sugerencia);
            }
            if (!p.requeridoMsn.Equals(""))
            {
                salida = salida + Estatico.toHTMLCard(Estatico.toHTMLAlert(p.requeridoMsn));
            }

            if (max > 0)
            {
                this.Input.MaxLength = max;
            }

            Salida.DocumentText = Estatico.header() + salida + Estatico.footer();
        }
Esempio n. 18
0
 /// <summary>
 /// Awakes this instance.
 /// </summary>
 private void Awake()
 {
     if (e == null)
     {
         e = this;
     }
     else if (e != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
Esempio n. 19
0
        public object Ejecutar(Ambito ambito)
        {
            /// YA QUE LO VOY A TRATAR COMO UN OBJETO:
            /// 1) DEBO DE COLOCARLE UN CONSTRUCTOR AL CUAL ME VA A SERVIR PARA PODER MANDARLE LOS PARAMETROS CUANDO ESTA SE LLAME
            /// 2) AL MOMENTO DE LLAMAR LA PREGUNTA DEBO DE MANDARLE LOS MISMOS PARAMETROS PARA INSTANCIAR LA PREGUNTA QUE EN TEORIA DEBERIAN SER LOS MISMOS
            /// 3) LA PREGUNTA LA VOY A GUARDAR COMO UN OBJETO DENTRO DEL AMBITO DE LA CLASE LA CUAL VA A GUARDAR COMO UNA VARIABLE QUE A GUARDAR COMO VALOR OBJETO DE TIPO
            /// PREGUNTA
            try
            {
                if (!ambito.existeVariable(this.identificador.ToLower()))
                {
                    Ambito amPregunta = new Ambito(ambito, this.identificador.ToLower(), ambito.archivo);

                    /*CREO EL CONSTRUCTOR DE LA PREGUNTA QUE ME VA A SERVIR PARA PODER DECLARAR EN EL AMBITO LAS VARIABLES*/
                    Constructor c = new Constructor(this.parametros, new List <Instruccion>(), linea, columna, clase);

                    /*AGREGO EL CONSTRUCTOR DE LA PREGUNTA AL AMBITO*/
                    amPregunta.agregarConstructor(new ClaveFuncion(this.identificador.ToLower(), "vacio", parametros), c);

                    /*VOY A A GREGAR UNA VARIABLE TEMPORAL PARA QUE ENTONCES PUEDA GUARDAR LAS INSTRUCCIONES :) */
                    Variable v = new Variable("instr", "vale", Estatico.Vibililidad.PRIVADO, this.declaraciones);

                    /*LA AGREGO AL AMBITO DE ESTA PREGUNTA :)*/
                    amPregunta.agregarVariableAlAmbito("instr", v);

                    /*CREO EL OBJETO DE TIPO PREGUNTA*/
                    Objeto pregunta = new Objeto("pregunta", amPregunta);

                    /*AGREGO LA VARIABLE AL AMBITO ACTUAL PARA PODER ACCERDER A LA PREGUNTA EN UN LLAMADO A LA MISMA*/
                    Variable p = new Variable(this.identificador.ToLower(), "pregunta", Estatico.Vibililidad.PRIVADO, pregunta);

                    /*AGREGO LA VARIABLE EN EL AMBITO Y TERMINA*/
                    ambito.agregarVariableAlAmbito(this.identificador.ToLower(), p);

                    return(new Nulo());
                }
                else
                {
                    TError error = new TError("Semantico", "Ya existe una definicion de un simbolo: \"" + identificador + "\", las preguntas se tratan como objetos por lo que no pueden haber multiples definiciones de un objeto con el mismo nombre | Clase"
                                              + clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                    Estatico.ColocaError(error);
                    Estatico.errores.Add(error);
                }
            }
            catch (Exception e)
            {
                TError erro = new TError("Ejecucion", "Error al intentar ejecutar la declaracion de una pregunta | Clase: " + clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
                Estatico.errores.Add(erro);
                Estatico.ColocaError(erro);
            }
            return(new Nulo());
        }
Esempio n. 20
0
 public object getValor(Ambito ambito)
 {
     try
     {
         return(Math.Round(Math.PI, 5));
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al ejecutar la funcion Pi() | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(0.0);
 }
Esempio n. 21
0
 private void declaracionVacia(Ambito ambito)
 {
     if (!ambito.existeVariable(this.idArr.ToLower()))
     {
         Arreglo arr = new Arreglo(new List <object>(), new List <object>(), new List <int>(), this.NumDim, this.idArr.ToLower(), true, this.visibilidad, this.tipo);
         ambito.agregarVariableAlAmbito(this.idArr.ToLower(), arr);
     }
     else
     {
         TError error = new TError("Semantico", "Ya existe una declaracion de: \"" + this.idArr + "\" en este Ambito | Clase: " + this.clase + " | Archivo: " + ambito.archivo, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
 }
        public object getValor(Ambito ambito)
        {
            try
            {
                object basse = expresion.getValor(ambito);
                object pot   = potencia.getValor(ambito);

                if (basse is int && pot is int)
                {
                    int b = (int)basse;
                    int p = (int)pot;
                    this.valor = Math.Pow(b, p);
                    return(this.valor);
                }
                else if (basse is int && pot is double)
                {
                    int    b = (int)basse;
                    double p = (double)pot;
                    this.valor = Math.Pow(b, p);
                    return(this.valor);
                }
                else if (basse is double && pot is int)
                {
                    double b = (double)basse;
                    int    p = (int)pot;
                    this.valor = Math.Pow(b, p);
                    return(this.valor);
                }
                else if (basse is double && pot is double)
                {
                    double b = (double)basse;
                    double p = (double)pot;
                    this.valor = Math.Pow(b, p);
                    return(this.valor);
                }
                else
                {
                    TError error = new TError("Semantico", "La funcion Pow() no se encontro parametros validos, se esperan: Pow(entero/decimal, entero/decimal) | Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                    Estatico.errores.Add(error);
                    Estatico.ColocaError(error);
                }
            }
            catch (Exception e)
            {
                TError error = new TError("Ejecucion", "Error al ejecutar la funcion Pow | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
                Estatico.errores.Add(error);
                Estatico.ColocaError(error);
            }
            return(0.0);
        }
 public object Ejecutar(Ambito ambito)
 {
     try
     {
         Simbolo s = (Simbolo)ambito.getSimbolo(this.id.ToLower());
         if (s != null)
         {
             if (s is Variable && (s.Tipo.ToLower().Equals("entero") || s.Tipo.ToLower().Equals("decimal")))
             {
                 Variable v = (Variable)s;
                 if (v.valor is int)
                 {
                     int aux = (int)v.valor;
                     v.valor = aux - 1;
                 }
                 else if (v.valor is Double)
                 {
                     double aux = (double)v.valor;
                     v.valor = aux - 1;
                 }
                 else
                 {
                     TError error = new TError("Semantico", "El Simbolo: \"" + this.id.ToLower() + "\" Posiblemente no ha sido inicializada! | Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                     Estatico.errores.Add(error);
                     Estatico.ColocaError(error);
                 }
             }
             else
             {
                 TError error = new TError("Semantico", "El Simbolo: \"" + this.id.ToLower() + "\" No hace referencia a una variable que se pueda aplicar el decremento: \"" + s.Tipo + "\"| Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                 Estatico.errores.Add(error);
                 Estatico.ColocaError(error);
             }
         }
         else
         {
             TError error = new TError("Semantico", "El Simbolo: \"" + this.id.ToLower() + "\" al cual se hace referencia no existe en este contexto | Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
             Estatico.errores.Add(error);
             Estatico.ColocaError(error);
         }
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al intentar ejecutar un decremento | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(new Nulo());
 }
Esempio n. 24
0
 public object getValor(Ambito ambito)
 {
     try
     {
         DateTime ahora = DateTime.Now;
         return(ahora);
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al ejecutar la funcion ahora() | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(new Nulo());
 }
Esempio n. 25
0
 object Instruccion.Ejecutar(Ambito ambito)
 {
     try
     {
         Object valor = expresion.getValor(ambito);
         Estatico.imprimeConsola(valor.ToString());
     }
     catch (Exception ex)
     {
         TError error = new TError("Ejecucion", "Error al Imprimir en Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | " + ex.Message, this.linea, this.columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(null);
 }
Esempio n. 26
0
 public object Ejecutar(Ambito ambito)
 {
     try
     {
         Object valor = this.valor.getValor(ambito);
         MessageBox.Show(valor.ToString(), "Mensajes");
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al ejecutar Mensajes: | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(new Nulo());
 }
        public object Ejecutar(Ambito ambito)
        {
            try
            {
                object path      = ruta.getValor(ambito);
                object condicion = condicional.getValor(ambito);
                if (path is String && condicion is Boolean)
                {
                    //String currentDir = System.IO.Directory.GetCurrentDirectory() + "\\";

                    String currentDir = Estatico.PROYECT_PATH + "\\";

                    String  cad  = (String)path;
                    Boolean cond = (Boolean)condicion;

                    if (System.IO.File.Exists(cad))
                    {
                        XForms.GUI.Funciones.DisplayImage im = new GUI.Funciones.DisplayImage(cad);
                        im.ShowDialog();
                    }
                    else if (System.IO.File.Exists(currentDir + cad))
                    {
                        XForms.GUI.Funciones.DisplayImage im = new GUI.Funciones.DisplayImage(currentDir + cad);
                        im.ShowDialog();
                    }
                    else
                    {
                        TError error = new TError("Semantico", "La ruta de la Imagen a desplegar no existe, Ruta: \"" + cad + "\" | Tampoco se encontro en el directorio raiz: \"" + currentDir + "\" | Clase: " + clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                        Estatico.ColocaError(error);
                        Estatico.errores.Add(error);
                    }
                    return(new Nulo());
                }
                else
                {
                    TError error = new TError("Semantico", "La funcion Imagen() recibe como parametros unicamente: (Cadena, Booleano) | Clase: " + clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                    Estatico.ColocaError(error);
                    Estatico.errores.Add(error);
                }
            }
            catch (Exception e)
            {
                TError error = new TError("Ejecucion", "Error al ejecutar la funcion Imagen() | Clase: " + clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
                Estatico.ColocaError(error);
                Estatico.errores.Add(error);
            }
            return(new Nulo());
        }
Esempio n. 28
0
 public object getValor(Ambito ambito)
 {
     try
     {
         Object val = this.valor.getValor(ambito);
         this.val = val.ToString();
         return(this.val);
     }
     catch (Exception e)
     {
         TError error = new TError("Ejecucion", "Error al intentar comventir en cadena: Funcion: Cadena() | Clase: " + this.clase + " | Archivo: " + ambito.archivo + " | Mensaje: " + e.Message, linea, columna, false);
         Estatico.errores.Add(error);
         Estatico.ColocaError(error);
     }
     return(new Nulo());
 }
        public object Ejecutar(Ambito ambito)
        {
            try
            {
                call.getValor(ambito);

                return(new Nulo());
            }
            catch
            {
                TError error = new TError("", "Error en la ejecucion de la llamada a funcion | Clase: " + this.clase + " | Archivo: " + ambito.archivo, linea, columna, false);
                Estatico.errores.Add(error);
                Estatico.ColocaError(error);
            }
            return(new Nulo());
        }
Esempio n. 30
0
        public Numerico(Pregunta p, int linea, int col, int inferior, int superior, Boolean tomaParams, Boolean esDecimal)
        {
            this.col      = col;
            this.linea    = linea;
            this.inferior = inferior;
            this.superior = superior;

            this.p          = p;
            this.tomaParams = tomaParams;

            InitializeComponent();

            if (tomaParams)
            {
                this.Input.Minimum = inferior;
                this.Input.Maximum = superior;
            }

            if (esDecimal)
            {
                this.Input.DecimalPlaces = 4;
                this.Input.Increment     = 0.1m;
            }

            if (this.p.lectura == true)
            {
                this.button1.Enabled = false;
            }

            String salida = Estatico.toHTMLTitle("(" + p.numeroPregunta + ") Texto: " + p.idPregunta);

            if (!p.etiqueta.Equals(""))
            {
                salida = salida + Estatico.toHTMLCard("Etiquerta: " + p.etiqueta);
            }
            if (!p.sugerencia.Equals(""))
            {
                salida = salida + Estatico.toHTMLCard("Sugerencia: " + p.sugerencia);
            }
            if (!p.requeridoMsn.Equals(""))
            {
                salida = salida + Estatico.toHTMLCard(Estatico.toHTMLAlert(p.requeridoMsn));
            }

            Salida.DocumentText = Estatico.header() + salida + Estatico.footer();
        }