Example #1
0
        /**
         * Me crea un variable temporal para guradar el resultado de las
         * operaciones como suma, resta, multiplicacion, division
         * retun: nombre variable temporal
         */
        public string demeTemporal(int tipo)
        {
            cont_temporal++;
            string temporal = "T" + cont_temporal;
            //guardar en la tabla de simbolos el temporal con el simbolo
            TDS variable = new TDS();

            variable.nametk = temporal;
            //variable.Numero = listaTDS.Count + 1;
            variable.type = tipo;
            switch (tipo)
            {
            case 1: variable.size = 4; break;

            case 2: variable.size = 8; break;

            case 3: variable.size = 1; break;

            case 4: variable.size = 80; break;

            case 5: variable.size = 1; break;
            }
            variable.value = null;
            listaTDS.Add(variable);

            return(temporal);
        }
Example #2
0
        void Hit(float dmg)
        {
            alpha = Mathf.Max(alphaMin, alpha);
            alpha = Mathf.Min(alpha + Mathf.Clamp(dmg, 0.005f, 0.5f), 1);

            TDS.CameraShake(Mathf.Min(dmg, 0.65f));
        }
Example #3
0
        public string DameTemporal(int tipo)
        {
            ntemporal++;

            string temporal = "T" + ntemporal.ToString();
            //guardar en TDS el temporal con el simbolo
            TDS variable = new TDS();
            variable.nombre = temporal;
            variable.nToken = listaTDS.Count + 1;
            variable.tipo = tipo;
            switch (tipo)
            {
                case 1: variable.size = 4; break;
                case 2: variable.size = 8; break;
                case 3: variable.size = 1; break;
                case 4: variable.size = 80; break;
                case 5: variable.size = 1; break;
            }

            variable.valor = null;
            listaTDS.Add(variable);
            return temporal;
        }
Example #4
0
        public void MostrarTDS()
        {
            TipoDato tipod = new TipoDato();
            int      n     = 0;

            for (int i = 0; i < Listorec.Count; i++)
            {
                String lexe        = Listorec[i].Lexema;
                string numerotoken = tipod.RecoTipo(Convert.ToInt16(Listorec[i].NumToken));

                if (tipod.RecoTipo(Convert.ToInt16(Listorec[i].NumToken)).Equals("tipo"))//analiza si es un tipo int,double,string,char.etc. con el metodo RecoTipo
                {
                    for (int j = i; j < Listorec.Count; i++)
                    {
                        char c = Listorec[j + 1].Lexema[0];


                        char lexema = Listorec[j + 2].Lexema[0];


                        if (!Listorec[j].Lexema.Equals(";"))
                        {
                            char signo = Listorec[j + 1].Lexema[0];

                            if (Listorec[j + 1].Lexema[0].Equals('#') && !Listorec[j + 2].Lexema.Equals(":="))
                            {
                                string lex          = Listorec[j + 1].Lexema;
                                string le           = lex.Remove(0, 1);
                                string tipo         = lexe;
                                int    analizartipo = tipod.TipoVariable(lexe);
                                n++;


                                TDS tds1 = new TDS(
                                    n,
                                    tipod.TipoVariable(lexe),
                                    Listorec[j + 3].Lexema.Length,
                                    le,
                                    ""
                                    );
                                tabla.Add(tds1);
                            }
                            //if (Listorec[j + 1].Lexema[0].Equals('#') && Listorec[j+2].Lexema.Equals(":="))
                            //{
                            //    string lex = Listorec[j + 1].Lexema;
                            //    string le = lex.Remove(0, 1);
                            //    string tipo = lexe;
                            //    int analizartipo = tipod.TipoVariable(lexe);



                            //    TDS tds1 = new TDS(
                            //    Convert.ToInt16(Listorec[j].NumToken),
                            //    tipod.TipoVariable(lexe),
                            //    Listorec[j + 3].Lexema.Length,
                            //    le,
                            //    Listorec[j + 3].Lexema
                            //    );
                            //    tabla.Add(tds1);

                            //}

                            j = j + 2;
                        }



                        else
                        {
                            break;
                        }
                    }
                }
                if (Listorec[i].Lexema.Equals("main"))
                {
                    break;
                }
            }

            // tbl_TDS.ItemsSource = tabla;
        }