Ejemplo n.º 1
0
        public void addError(String lexema, String idToken, int linea, int columna)
        {
            ErroresToken errtok = new ErroresToken(lexema, idToken, linea, columna);

            listaErrores.Add(errtok);
        }
Ejemplo n.º 2
0
        /*verifica si es tipo*/

        /*reporte de Errores*/
        public void Html_Errores()
        {
            String Contenido_html;

            Contenido_html = "<html>" +
                             "<body>" +
                             "<h1 align='center'>ERRORES ENCONTRADOS</h1></br>" +
                             "<table cellpadding='10' border = '1' align='center'>" +
                             "<tr>" +
                             "<td><strong>No." +
                             "</strong></td>" +

                             "<td><strong>Error" +
                             "</strong></td>" +

                             "<td><strong>Descripción" +
                             "</strong></td>" +

                             "<td><strong>Linea" +
                             "</strong></td>" +

                             "<td><strong>Columna" +
                             "</strong></td>" +

                             "</tr>";

            String Cad_tokens = "";
            String tempo_tokens;

            for (int i = 0; i < listaErrores.Count; i++)
            {
                ErroresToken sen_pos = listaErrores.ElementAt(i);


                tempo_tokens = "";
                tempo_tokens = "<tr>" +
                               "<td><strong>" + (i + 1).ToString() +
                               "</strong></td>" +

                               "<td>" + sen_pos.getLexema() +
                               "</td>" +

                               "<td>" + sen_pos.getIdToken() +
                               "</td>" +

                               "<td>" + sen_pos.getLinea() +
                               "</td>" +

                               "<td>" + sen_pos.getColumna() +
                               "</td>" +

                               "</tr>";
                Cad_tokens = Cad_tokens + tempo_tokens;
            }

            Contenido_html = Contenido_html + Cad_tokens +
                             "</table>" +
                             "</body>" +
                             "</html>";
            /*creando archivo html*/
            File.WriteAllText("Reporte de Errores.html", Contenido_html);
            System.Diagnostics.Process.Start("Reporte de Errores.html");
        }