//metodo para el reporte de token public void mostrarReporteToken() { TextWriter archivo; archivo = new StreamWriter("Reportetoken.html"); archivo.WriteLine("<html>"); archivo.WriteLine("<head><title>Reporte</title></head>"); archivo.WriteLine("<body>"); //archivo.WriteLine("<center>"); archivo.WriteLine("<h1 ALIGN=LEFT >TOKENS</h1>"); //archivo.WriteLine("</center>"); //archivo.WriteLine("<center>"); archivo.WriteLine("<table border=\"6\" bordercolor=\"blue\" ALIGN=LEFT >"); archivo.WriteLine("<tr>"); archivo.WriteLine("<td><strong>LEXEMA</strong></td>"); archivo.WriteLine("<td><strong>IDTOKEN</strong></td>"); archivo.WriteLine("<td><strong>FILA</strong></td>"); archivo.WriteLine("<td><strong>COLUMNA</strong></td>"); archivo.WriteLine("</tr>"); for (int i = 0; i < listadoTokens.Count; i++) { Token actual = listadoTokens.ElementAt(i); archivo.WriteLine("<tr>"); archivo.WriteLine("<td><strong>" + actual.getLexema() + "</strong></td>"); archivo.WriteLine("<td><strong>" + actual.getIdToken() + "</strong></td>"); archivo.WriteLine("<td><strong>" + actual.getLinea() + "</strong></td>"); archivo.WriteLine("<td><strong>" + actual.getColumna() + "</strong></td>"); archivo.WriteLine("</tr>"); } archivo.WriteLine("</table>"); //archivo.WriteLine("</center>"); archivo.WriteLine("<h1 ALIGN=RIGHT >ERRORES</h1>"); archivo.WriteLine("<table border=\"6\" bordercolor=\"blue\" ALIGN=RIGHT >"); archivo.WriteLine("<tr>"); archivo.WriteLine("<td><strong>LEXEMA</strong></td>"); archivo.WriteLine("<td><strong>IDTOKEN</strong></td>"); archivo.WriteLine("<td><strong>FILA</strong></td>"); archivo.WriteLine("<td><strong>COLUMNA</strong></td>"); archivo.WriteLine("</tr>"); for (int i = 0; i < listadoErrores.Count; i++) { ListaErrores actual = listadoErrores.ElementAt(i); archivo.WriteLine("<tr>"); archivo.WriteLine("<td><strong>" + actual.getLexema() + "</strong></td>"); archivo.WriteLine("<td><strong>" + actual.getIdToken() + "</strong></td>"); archivo.WriteLine("<td><strong>" + actual.getLinea() + "</strong></td>"); archivo.WriteLine("<td><strong>" + actual.getColumna() + "</strong></td>"); archivo.WriteLine("</tr>"); } archivo.WriteLine("</table>"); archivo.Close(); }
//metodo para agregar a la lista de errores public void addErrorToken(String lexema, String idToken, int linea, int columna) { ListaErrores nuevotoken = new ListaErrores(lexema, idToken, linea, columna); listadoErrores.Add(nuevotoken); }