Ejemplo n.º 1
0
        private void compileBtn_Click(object sender, EventArgs e)
        {
            outputBox.Text = "";
            errorBox.Text = "";

            try
            {

                Compiler compiler = new Compiler();
                compiler.SetTimeRecording(true);
                outputBox.Text = compiler.Run(inputBox.Text);

            }
            catch (CompilerException ce)
            {
                /*
                if (ce.ErrorType.Equals("Antlr.Parser"))
                {
                    errorBox.Text = "Error (wrong syntax) on " + ce.Message;
                }
                else
                {
                    errorBox.Text = "Error (" + ce.ErrorType + ") on line " + ce.Line + ": " + ce.Message;
                }*/
            }
            catch (Exception ex)
            {
                outputBox.Text = "Es ist ein Fehler aufgetreten.";
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
		private void compileSBButton_Click(object sender, EventArgs e) {
			storyboardBox.Document.Text = "";
			errorBox.Text = "";

			// Visual stuff
			compilerPBar.Style = ProgressBarStyle.Marquee;
			statusLabel.Text = "Compiling...";

			try {
				//Console.WriteLine("input Text: " + SGLBox.Document.Text);
				Compiler compiler = new Compiler();
				//compiler.SetTimeRecording(false);
				storyboardBox.Document.Text = compiler.Run(SGLBox.Document.Text);

				statusLabel.Text = "";
				tabControl.SelectedTab = tabSB;

			} catch (CompilerException ce) {
				statusLabel.Text = "Error occured";
				errorBox.Text = ce.GetExceptionAsString();

			} catch (Exception ue) {
				statusLabel.Text = "Unexpected error occured";
				errorBox.Text = "An unexpected error occured:\r\n" + ue.Message + "\r\n" + ue.StackTrace;

			} finally {
				// Visual stuff
				compilerPBar.Style = ProgressBarStyle.Continuous;
			}
		}