Exemple #1
0
        private void analisisSintactico(string code)
        {
            var sintaxtTree = new SintaxTree();
            var parseTree   = sintaxtTree.analysisSintactico(code);

            ast = parseTree.Root;
            if (ast == null)
            {
                results.ForeColor   = Color.FromArgb(247, 46, 46);
                results.Text        = ">>>>> Se esperaba un ";
                rtxt_code.ForeColor = Color.FromArgb(247, 46, 46);
                //this.btn_run.Enabled = false;
                for (int i = 0; i < parseTree.ParserMessages.Count; i++)
                {
                    results.Text += "[ " + parseTree.ParserMessages[i].Message + " ]" + "\n>>>>>linea: " + parseTree.ParserMessages[i].Location.Line + "\n";
                }
            }
            else
            {
                results.ForeColor   = Color.Black;
                rtxt_code.ForeColor = Color.Black;
                results.Text        = ">>>>>Código sintacticamente correcto. \n>>>>>Listo para compilar :D, presiona el boton de ejecutar.";
                //this.btn_run.Enabled = true;
            }
        }
Exemple #2
0
        private void analisisSintactico(string code)
        {
            var       sintaxtTree = new SintaxTree();
            ParseTree parseTree   = sintaxtTree.analysisSintactico(code);

            ast = parseTree.Root;
            if (ast == null)
            {
                rtxt_code.ForeColor = this.FC_tabs_error_rtxt;
                //this.SetTextResultsError(parseTree);
            }
            else
            {
                rtxt_code.ForeColor = this.FC_tabs_succes_rtxt;
                //this.SetTextResultsCorrect("Código correcto!. Puedes ejecutarlo ahora.");
            }
        }