コード例 #1
0
        /*
         |-------------------------------------------------------------------------------------------------------------------
         | Funciones ope Tipo
         |-------------------------------------------------------------------------------------------------------------------
         |
         */

        public override itemValor ope_tipo(elementoEntorno elem)
        {
            itemValor retorno = new itemValor();

            retorno.setTypeNulo();

            if (hayErrores())
            {
                return(retorno);
            }

            if (hijos.Count != 1)
            {
                return(retorno);
            }



            _E nodoE2 = (_E)hijos[0];

            if (hayErrores())
            {
                return(retorno);
            }


            itemValor itemInicio = nodoE2.getValor(elem);



            if (itemInicio.isTypeFecha())
            {
                return(itemInicio);
            }
            else if (itemInicio.isTypeCadena())
            {
                itemValor tel = new itemValor();
                tel.convertirCadena(itemInicio.getCadena());

                if (tel.isTypeFecha())
                {
                    retorno = tel;
                    return(retorno);
                }
                else
                {
                    tablaSimbolos.tablaErrores.insertErrorSemantic("No se pudo parsear a fecha", lstAtributos.getToken(0));
                    return(retorno);
                }
            }
            else
            {
                tablaSimbolos.tablaErrores.insertErrorSemantic("No se pueden parsear a fecha expresiones que no sean cadenas", lstAtributos.getToken(0));
                return(retorno);
            }
        }
コード例 #2
0
ファイル: _AHORA.cs プロジェクト: Caceres-Joseph/FORM_USAC
        /*
         |-------------------------------------------------------------------------------------------------------------------
         | Funciones ope Tipo
         |-------------------------------------------------------------------------------------------------------------------
         |
         */


        public override itemValor ope_tipo(elementoEntorno elem)
        {
            itemValor retorno = new itemValor();

            retorno.setTypeNulo();

            if (hayErrores())
            {
                return(retorno);
            }


            String temP = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss");

            retorno.convertirCadena(temP);
            println(temP);

            return(retorno);
        }
コード例 #3
0
ファイル: _E.cs プロジェクト: Caceres-Joseph/FORM_USAC
        public itemValor parseandoDato(itemAtributo tok)
        {
            itemValor retorno = new itemValor();

            retorno.setTypeNulo();

            if (hayErrores())
            {
                return(retorno);
            }

            switch (tok.nombretoken)
            {
            case "valBoolean":
                retorno = new itemValor();
                retorno.setTypeBooleano();
                switch (tok.tok.valLower)
                {
                case "false":
                    retorno.valor = false;
                    return(retorno);

                case "true":
                    retorno.valor = true;
                    return(retorno);

                case "verdadero":
                    retorno.valor = true;
                    return(retorno);

                case "falso":
                    retorno.valor = false;
                    return(retorno);

                default:
                    tablaSimbolos.tablaErrores.insertErrorSemantic("No se puede parser a booleano el tipo:" + tok.tok.val, tok.tok);
                    return(retorno);
                }

            case "valCaracter":
                retorno = new itemValor();
                retorno.setTypeNulo();
                retorno.convertirCadena(tok.tok.valLower);

                return(retorno);

            case "valCadena":


                retorno = new itemValor();
                retorno.setTypeNulo();
                retorno.convertirCadena(tok.tok.val);
                return(retorno);

            case "valCadena2":


                retorno = new itemValor();
                retorno.setTypeNulo();
                retorno.convertirCadena2(tok.tok.val);
                return(retorno);

            case "valNumero":
                try
                {
                    retorno = new itemValor();
                    retorno.setTypeEntero();
                    retorno.valor = int.Parse(tok.tok.valLower);
                    return(retorno);
                }
                catch (FormatException e)
                {
                    tablaSimbolos.tablaErrores.insertErrorSemantic("No se pudo parsear a entero el valor: " + tok.tok.val, tok.tok);
                    return(retorno);
                }

            case "valDecimal":
                try
                {
                    retorno = new itemValor();
                    retorno.setTypeDecimal();
                    retorno.valor = double.Parse(tok.tok.valLower);
                    return(retorno);
                }
                catch (FormatException e)
                {
                    tablaSimbolos.tablaErrores.insertErrorSemantic("No se pudo parsear a decimal el valor: " + tok.tok.val, tok.tok);
                    return(retorno);
                }

            case "nulo":
                retorno = new itemValor();
                retorno.setTypeNulo();
                return(retorno);

            case "nada":
                retorno = new itemValor();
                retorno.setTypeNulo();
                return(retorno);

            default:
                tablaSimbolos.tablaErrores.insertErrorSemantic("No se reconoce el tipo: " + tok.tok.val, tok.tok);
                return(retorno);
            }

            //return retorno;
        }