private void htmlMistakes() { Analyzerr analize = new Analyzerr(); StreamWriter write = new StreamWriter("C:\\Users\\CARLOS\\Documents\\universidad\\4to semestre\\Lenguajes Formales\\Laboratorio\\Proyecto 1\\Error.html"); write.WriteLine("<html>"); write.WriteLine("<head><h1> LISTA DE ERRORES</h1></head>"); write.WriteLine("<body>"); write.WriteLine("<p><h3> Aqui se muestra la lista de errores del archivo analizado </h3></p>"); write.WriteLine("<p></p>"); write.WriteLine("<table border='1'>"); write.WriteLine("<tr>"); write.WriteLine("<td>No.</td><td>Linea</td><td>Error</td><td>Columna</td><td>Descripción</td>"); foreach (Mistake mistakes in analize.mistakeList()) { write.WriteLine("<tr>"); write.WriteLine("<td>" + mistakes.getNumber() + "</td>"); write.WriteLine("<td>" + mistakes.getLine() + "</td>"); write.WriteLine("<td>" + mistakes.getMistake() + "</td>"); write.WriteLine("<td>" + mistakes.getColumn() + "</td>"); write.WriteLine("<td>" + mistakes.getDescripticion() + "</td>"); write.WriteLine("</tr>"); } write.WriteLine("</table>"); write.WriteLine("<p></p>"); write.WriteLine("<p><h4>Se obtuvo un total de:" + analize.mistakesNo() + " errores. </h4> </p>"); write.WriteLine("</body>"); write.WriteLine("</html>"); write.Close(); Process.Start("C:\\Users\\CARLOS\\Documents\\universidad\\4to semestre\\Lenguajes Formales\\Laboratorio\\Proyecto 1\\Error.html"); }
private void button1_Click(object sender, EventArgs e) { try { y++; pictureBox1.Visible = false; label1.Visible = false; label2.Visible = false; countryP.Visible = false; populationP.Visible = false; pictureBox2.Visible = false; Analyzerr analize = new Analyzerr(); Graphic g = new Graphic(); String text = ""; foreach (RichTextBox tab in Editor.SelectedTab.Controls) { if (tab.GetType().Equals(typeof(RichTextBox))) { text = tab.Text; } } tokenList = analize.scanner(text); if (analize.mistakesNo() == 0) { analize.printTokens(tokenList); htmlToken(); analize.setNumberTokens(0); MessageBox.Show("El archivo fue analizado correctamente", "Error léxico", MessageBoxButtons.OK, MessageBoxIcon.Information); foreach (RichTextBox tab in Editor.SelectedTab.Controls) { if (tab.GetType().Equals(typeof(RichTextBox))) { setNewColor(tab); } } Save s = new Save(); g = s.getFinalGraphic(tokenList); test = g; graphiz(g); z++; } else { analize.printTokens(tokenList); MessageBox.Show("El archivo que se analizo contiene errores", "Error léxico", MessageBoxButtons.OK, MessageBoxIcon.Information); analize.printMistakes(analize.mistakeList()); htmlMistakes(); htmlToken(); analize.setNumberTokens(0); analize.setMistakes(0); } } catch (Exception) { } }