private void runSemantico() { CodeTabPage tabPage = (CodeTabPage)codeTabControl.SelectedTab; Process process = new Process(); semanticErrorTextBox.Text = ""; CheckForIllegalCrossThreadCalls = false; process.StartInfo.FileName = @"cmd"; process.StartInfo.Arguments = "/c tiny -c \"" + tabPage.getCodeEditor().getPath() + "\""; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandlerSemantic); process.Start(); //* Read one element asynchronously process.BeginErrorReadLine(); //* Read the other one synchronously semanticJsonText = ""; string output = process.StandardOutput.ReadToEnd(); //Console.Write(output); semanticJsonText += output; process.Close(); }
private void codeTabControl_SelectedIndexChanged(object sender, EventArgs e) { CodeTabPage tabPage = (CodeTabPage)codeTabControl.SelectedTab; if (tabPage != null && tabPage.getCodeEditor().hasPath()) { enableCompilationButtons(); } else { disableCompilationButtons(); } }
/* private void gestorDeArchivosToolStripMenuItem_Click(object sender, EventArgs e) * { * if (!gestorDeArchivosToolStripMenuItem.Checked) * { * gestorDeArchivosToolStripMenuItem.Checked = true; * showFilesWindow(); * } * else * { * gestorDeArchivosToolStripMenuItem.Checked = false; * hideFilesWindow(); * } * }*/ private void guardarComoToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Any File (*.*) | *.*"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { string pathToSaveFile = saveFileDialog.FileName; CodeTabPage tabPage = (CodeTabPage)codeTabControl.SelectedTab; tabPage.saveFile(pathToSaveFile); enableCompilationButtons(); } }
private void runLexico(object sender, EventArgs e) { runLexico(); runSintactico(); runSemantico(); sintaxTreeView.Nodes.Clear(); semanticTreeView.Nodes.Clear(); //READ SINTAX TREE Node root = JsonConvert.DeserializeObject <Node>(sintaxJsonText); //TreeNode rootNode = populateSintaxTree(root); TreeNode rootNode = new TreeNode(root.name); populateTreeV2(rootNode, root); sintaxTreeView.Nodes.Add(rootNode); sintaxTreeView.ExpandAll(); //READ SEMANTIC TREE Node2 rootSemantic = JsonConvert.DeserializeObject <Node2>(semanticJsonText); //TreeNode rootNode = populateSintaxTree(root); TreeNode semanticRootNode = new TreeNode(rootSemantic.name); populateTreeV2Semantic(semanticRootNode, rootSemantic); semanticTreeView.Nodes.Add(semanticRootNode); semanticTreeView.ExpandAll(); //Leer hash table: hashTableTextBox CodeTabPage tabPage = (CodeTabPage)codeTabControl.SelectedTab; Char delimiter = '.'; String fName = tabPage.getCodeEditor().getName().Split(delimiter)[0]; String fullName = tabPage.getCodeEditor().getName(); String path = tabPage.getCodeEditor().getPath(); String okPath = path.Substring(0, path.Length - fullName.Length); String filePath = okPath + "/target_" + fName + "/sem/tabla.sem"; cargarTabla(filePath); lexerErrTextBox.Text.Contains('E'); MessageBox.Show("Resultados de errores: " + lexerErrTextBox.Text.Contains('E') + " " + semanticErrorTextBox.Text.Contains('S') + " " + sintaxErrorTextBox.Text.Contains('S')); if (!lexerErrTextBox.Text.Contains('E') && !sintaxErrorTextBox.Text.Contains('S')) { runCodeGen(); tabContenedor.SelectedIndex = 4; Consola.ClearOutput(); Consola.StopProcess(); Consola.StartProcess(@"cmd", "/c tinym code.tm"); } else { MessageBox.Show("No se puede ejecutar ya que hay errores."); } }
private void runCodeGen() { CodeTabPage tabPage = (CodeTabPage)codeTabControl.SelectedTab; Process process = new Process(); semanticErrorTextBox.Text = ""; CheckForIllegalCrossThreadCalls = false; process.StartInfo.FileName = @"cmd"; process.StartInfo.Arguments = "/c tiny -g \"" + tabPage.getCodeEditor().getPath() + "\""; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = false; process.Start(); //* Read one element asynchronously //* Read the other one synchronously string output = process.StandardOutput.ReadToEnd(); //Console.Write(output); process.Close(); cargarCodigoIntermedio(); }