예제 #1
0
        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.");
            }
        }