Example #1
0
        private void AnalisisDeExtends(List <String> Extends)
        {
            foreach (TabPage t in tabControl1.TabPages)
            {
                foreach (String name in Extends)
                {
                    if (name + ".lz" == t.Text)
                    {
                        Sintactico.raizDeArbol = null;
                        Sintactico.errores.Clear();
                        TabPage     aux    = t;
                        RichTextBox aux1   = (RichTextBox)t.Controls[0].Controls[1];
                        bool        result = Sintactico.analizar(aux1.Text);
                        if (result)
                        {
                            if (Sintactico.errores.Count() > 0)//SI EXISTEN ERRORES
                            {
                                foreach (ErrorEnAnalisis er in Sintactico.errores)
                                {
                                    this.Errores.Add(er);
                                }
                            }
                            Tabla_Simbolos tabla = new Tabla_Simbolos(Sintactico.raizDeArbol);
                            tabla.generarme_tabla();

                            Lienzo nuevo = new Lienzo(tabla.getProcedimientos(), tabla.getFunciones(), tabla.getVariables(), tabla.getExtends(), tabla.getNombre(), tabla.getVisibilidad());

                            this.LienzosCompilados.Add(nuevo);

                            AnalisisDeExtends(tabla.getExtends());

                            MeterDatosAListasGenerales(tabla.semanticos(), tabla.getTable());
                        }
                        else
                        {
                            foreach (ErrorEnAnalisis er in Sintactico.errores)//ERRORES FALTALES
                            {
                                this.Errores.Add(er);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (tabControl1.TabPages.Count > 0)
            {
                this.Errores.Clear();
                this.TablaGenera.Clear();
                this.LienzosCompilados.Clear();
                Sintactico.raizDeArbol = null;
                Sintactico.errores.Clear();
                TabPage     tab             = (TabPage)tabControl1.TabPages[tabControl1.SelectedIndex];
                RichTextBox EntradaAnalizar = (RichTextBox)tabControl1.TabPages[tabControl1.SelectedIndex].Controls[0].Controls[1];
                bool        restult         = Sintactico.analizar(EntradaAnalizar.Text);
                if (restult)
                {
                    Resultado.Text      = "Válido";
                    Resultado.ForeColor = Color.Green;
                    if (Sintactico.errores.Count > 0)
                    {
                        MessageBox.Show("El analisis del archivo aun contiene errores", "Errores en Entrada", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        Tabla_Simbolos tabla = new Tabla_Simbolos(Sintactico.raizDeArbol);
                        tabla.generarme_tabla();
                        //List<Simbolo> simbolos = tabla.getTable();

                        //TablaSimbolosHTML reporte = new TablaSimbolosHTML(simbolos);
                        //reporte.generarTablaHTML();

                        Lienzo l = new Lienzo(tabla.getProcedimientos(), tabla.getFunciones(), tabla.getVariables(), tabla.getExtends(), tabla.getNombre(), tabla.getVisibilidad());
                        this.LienzosCompilados.Add(l);
                        AnalisisDeExtends(tabla.getExtends());
                        //Reporte re = new Reporte();
                        //re.ReporteDeErrores(tabla.semanticos(), "Errores");
                        MeterDatosAListasGenerales(tabla.semanticos(), tabla.getTable());

                        if (this.Errores.Count() > 0)
                        {
                            InfoErr.Text = "Existen Errores Semanticos";
                        }
                        else
                        {
                            Ejecucion  ej    = new Ejecucion(this.LienzosCompilados, this.TablaGenera);
                            AreaImagen nuevo = new AreaImagen();
                            nuevo.Show();
                            ej.IniciarEjecucion();
                            if (ej.getErrores().Count() > 0)
                            {
                                InfoErr.Text = "Existen Errores Semánticos";
                                foreach (ErrorEnAnalisis er in ej.getErrores())
                                {
                                    this.Errores.Add(er);
                                }
                            }
                            else
                            {
                                InfoErr.Text     = "Compilación Terminada";
                                this.TablaGenera = ej.getTablaNueva();
                                nuevo.Visible    = true;
                            }
                        }

                        /*MessageBox.Show("Lienzos Compilados: " + this.LienzosCompilados.Count());
                         * foreach (Lienzo h in this.LienzosCompilados)
                         * {
                         *  h.ReporteDeLienzo();
                         * }*/
                    }
                }
                else
                {
                    Resultado.Text = "Inválido";
                    MessageBox.Show("El analisis del archivo aun contiene errores sin recuperación", "Errores en Entrada", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Resultado.ForeColor = Color.Red;
                }
            }
            else
            {
                MessageBox.Show("No hay Pestañas abiertas", "Error al Ejecutar", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }