public void InsertarErrores(List <ErrorSintactico> errores) { consola.ResetText(); for (int i = 0; i < errores.Count; i++) { ErrorSintactico t = errores[i]; Token token = t.Token2; consola.SelectionColor = Color.White; consola.AppendText("ERROR SINTACTICO EN "); consola.SelectionColor = Color.Black; consola.SelectionBackColor = System.Drawing.Color.LightGray; consola.AppendText(token.Lexema); consola.SelectionBackColor = System.Drawing.Color.Black; consola.SelectionColor = Color.White; consola.AppendText(" EN LA LINEA " + token.Fila + " COLUMNA " + token.Columna);; consola.SelectionColor = Color.Red; consola.SelectionBackColor = System.Drawing.Color.Pink; consola.AppendText(t.Mensaje + " \n"); consola.SelectionColor = Color.White; consola.AppendText("Se han descartado los siguientes tokens \n"); for (int j = 0; j < t.Descartados.Count; j++) { Token err = t.Descartados[j]; consola.AppendText("\t" + err.Lexema + " Fila: " + err.Fila + " Columna" + err.Columna + "\n"); } } }
public String EscribirErroresSintacticosHtml(List <Token> erroresLexicos, List <ErrorSintactico> erroesSintacticos) { String cuerpo = "<!DOCTYPE HTML> <html > <head > <title > TOKENS Y ERRORES</title>" + "<meta charset = \"utf-8\" >" + "<meta name = \"viewport\" content = \"width=device-width, initial-scale=1\" >" + "<link rel = \"stylesheet\" href = \"https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css\">" + " <script src = \"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js\" ></script >" + "<script src = \"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js\" ></script >" + "<script src = \"https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js\" ></script >" + "</tr </head >\n <body>" + "</tr></tr > \n<h1>ERRORES LEXICOS </h1> </tr > \n " + "<table class=\"table table-bordered\">\n" + "<thead class=\"thead-dark\">" + "<tr > \n" + "<th scope = \"col\" > tipo </th > \n" + "<th scope = \"col\" > Lexema </th > \n" + "<th scope = \"col\" > Fila </th > \n" + "<th scope = \"col\" > Columna </th > \n " + "</tr >\n" + "</thead >\n" + " <tbody>"; for (int i = 0; i < erroresLexicos.Count; i++) { Token token = erroresLexicos[i]; cuerpo = cuerpo + " <tr > " + "<td > error Lexico </td >\n" + "<td > " + token.Lexema + " </td > \n" + "<td > " + token.Columna + " </td > \n" + "<td > " + token.Fila + " </td > \n" + "</tr > "; } cuerpo = cuerpo + "</tbody>\n" + "</tr ></ tr >\n " + "</table>\n " + "</tr ></ tr >\n " + "<h1>ERRORES SINTACTICOS</h1> </tr >\n" + " <table class=\"table table-bordered\">\n " + "<thead class=\"thead-dark\"> \n" + "<tr> " + "<th scope = \"col\" > tipo </th > \n" + "<th scope = \"col\" > lexema </th > \n" + "<th scope = \"col\" > Fila </th > \n" + "<th scope = \"col\" > Columna </th > \n " + "<th scope = \"col\" > Mensaje </th > \n " + "<th scope = \"col\" > Descartados </th > \n " + "</tr > \n" + "</ thead > \n" + " <tbody> \n"; for (int i = 0; i < erroesSintacticos.Count; i++) { ErrorSintactico error = erroesSintacticos[i]; cuerpo = cuerpo + " <tr > " + "<td > " + "Sintactico" + " </td > \n" + "<td > " + error.Token2.Lexema + " </td >\n" + "<td > " + error.Token2.Columna + " </td > \n" + "<td > " + error.Token2.Fila + " </td > \n" + "<td > " + error.Mensaje + " </td > \n" + "<td > "; for (int j = 0; j < error.Descartados.Count; j++) { cuerpo = cuerpo + " <li>" + error.Descartados[j].Lexema + " Fila " + error.Descartados[j].Fila + " Columna " + error.Descartados[j].Columna + "</li>"; } cuerpo = cuerpo + " </td > \n" + "</tr > "; } cuerpo = cuerpo + "</tbody>" + "</table> " + "</tr ></tr >" + "</body>" + "</html>"; return(cuerpo); }