Exemple #1
0
        private void OnBuild(object sender, EventArgs e)
        {
            if (FilePath != null)
            {
                this.SaveFile();

                this.Compiler = new PL0Compiler(FilePath);
                Compiler.compile();
                if (Compiler.EH.errItem.Count == 0)
                {
                    if (!codeList.Created)
                    {
                        codeList = new CodeList();
                        codeList.Show();
                    }
                    this.pCodeFile();
                    codeList.setCodeText(Compiler.listCode());
                }
                else
                {
                    if (!errList.Created)
                    {
                        errList = new ErrorList();
                        errList.Show();
                    }
                    errList.setErrText(Compiler.displayErr());
                }
            }
            else
            {
                string msg = "请新建或打开一个PL程序文件!";
                MessageBox.Show(msg, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #2
0
        private void OnExecute(object sender, EventArgs e)
        {
            if (FilePath != null)
            {
                this.SaveFile();

                this.Compiler = new PL0Compiler(FilePath);
                Compiler.compile();
                if (Compiler.EH.errItem.Count == 0)
                {
                    string CodeFile = pCodeFile();
                    if (CodeFile != "")
                    {
                        string curPath = Directory.GetCurrentDirectory();

                        Process pInte = new Process();
                        pInte.StartInfo.FileName  = curPath + "\\PL0CodeInterpreter.exe";
                        pInte.StartInfo.Arguments = CodeFile;
                        pInte.Start();
                    }
                }
                else
                {
                    if (!errList.Created)
                    {
                        errList = new ErrorList();
                        errList.Show();
                    }
                    errList.setErrText(Compiler.displayErr());
                }
            }
            else
            {
                string msg = "请新建或打开一个PL程序文件!";
                MessageBox.Show(msg, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }