コード例 #1
0
ファイル: Input_Dlg.cs プロジェクト: Veggie13/raptor
        private void done_button_Click(object sender, System.EventArgs e)
        {
            result = interpreter_pkg.input_syntax(this.variableTextBox.Text, PAR);

            prompt_result = interpreter_pkg.output_syntax(this.exprTextBox.Text, false, PAR);

            PAR.is_input = true;

            if (result.valid && prompt_result.valid)
            {
                the_form.Make_Undoable();
                PAR.prompt              = this.exprTextBox.Text;
                PAR.Text                = this.variableTextBox.Text;
                PAR.parse_tree          = result.tree;
                PAR.prompt_tree         = prompt_result.tree;
                PAR.input_is_expression = true;
                PAR.changed();
                this.error = false;
                this.Close();
            }

            else
            {
                this.error = true;
                if (!result.valid)
                {
                    this.error_msg = result.message;
                }
                else
                {
                    this.error_msg = prompt_result.message;
                }
                this.Invalidate();
            }
        }
コード例 #2
0
ファイル: Assignment_Dlg.cs プロジェクト: TheFern2/raptor
 private void done_button_Click(object sender, System.EventArgs e)
 {
     if (Rec.Text != null && Rec.Text != "" &&
         Rec.Text.CompareTo(this.lhsTextBox.Text + ":=" +
                            this.assignment_Text.Text) == 0)
     {
         // nothing changed
         this.Close();
         return;
     }
     result = interpreter_pkg.assignment_syntax(this.lhsTextBox.Text,
                                                this.assignment_Text.Text, Rec);
     if (result.valid)
     {
         the_form.Make_Undoable();
         Rec.Text = this.lhsTextBox.Text + ":=" +
                    this.assignment_Text.Text;
         Rec.parse_tree = result.tree;
         Rec.changed();
         this.error = false;
         ((Visual_Flow_Form)the_form).flow_panel.Invalidate();
         this.Close();
     }
     else
     {
         this.error     = true;
         this.error_msg = result.message;
         this.Invalidate();
     }
 }
コード例 #3
0
ファイル: Control_Dlg.cs プロジェクト: Veggie13/raptor
        private void done_button_Click(object sender, System.EventArgs e)
        {
            if (this.Control_Text.Text.CompareTo(Cmp.Text) == 0)
            {
                // nothing changed
                this.Close();
                return;
            }
            result = interpreter_pkg.conditional_syntax(this.Control_Text.Text, Cmp);
            if (result.valid)
            {
                the_form.Make_Undoable();
                Cmp.Text       = this.Control_Text.Text;
                Cmp.parse_tree = result.tree;
                Cmp.changed();
                this.error = false;
                this.Close();
            }

            else
            {
                this.error     = true;
                this.error_msg = result.message;
                this.Invalidate();
            }
        }
コード例 #4
0
        private void done_button_Click(object sender, System.EventArgs e)
        {
            if (this.textBox1.Text.Contains("("))
            {
                result          = new interpreter.syntax_result();
                result.valid    = false;
                result.location = this.textBox1.Text.IndexOf("(") + 1;
                result.message  = "can not call function in RETURN";
            }
            else
            {
                result = interpreter_pkg.output_syntax(this.textBox1.Text,
                                                       false, RETURN);
            }

            if (result.valid)
            {
                the_form.Make_Undoable();
                RETURN.Text = this.textBox1.Text;

                RETURN.parse_tree = result.tree;

                RETURN.changed();
                this.error = false;
                this.Close();
            }

            else
            {
                this.error     = true;
                this.error_msg = result.message;
                this.Invalidate();
            }
        }
コード例 #5
0
		public virtual System.Drawing.Rectangle comment_footprint()
		{
			System.Drawing.Rectangle result,succ_rec;
			if (Successor != null)
			{
				succ_rec = Successor.comment_footprint();
			}
			else
			{
				succ_rec = new System.Drawing.Rectangle(0,0,0,0);
			}
			if (this.My_Comment != null && Component.view_comments)
			{
				result = this.My_Comment.Get_Bounds();
				return CommentBox.Union(result,succ_rec);
			}
			else
			{
				return succ_rec;
			}
		}
コード例 #6
0
ファイル: Call_Dialog.cs プロジェクト: TheFern2/raptor
        private void done_button_Click(object sender, System.EventArgs e)
        {
            if (this.assignment_Text.Text == "")
            {
                // must have entered something
                return;
            }
            if (Rec.Text != null && Rec.Text != "" && this.assignment_Text.Text.CompareTo(Rec.Text) == 0)
            {
                // nothing changed
                this.Close();
                return;
            }
            result = interpreter_pkg.call_syntax(this.assignment_Text.Text, Rec);
            if (!result.valid && this.assignment_Text.Text.Length >= 2)
            {
                if (CreateNewTab(this.assignment_Text.Text))
                {
                    return;
                }
            }

            if (result.valid)
            {
                the_form.Make_Undoable();
                Rec.Text       = this.assignment_Text.Text;
                Rec.parse_tree = result.tree;
                this.error     = false;
                Rec.changed();
                ((Visual_Flow_Form)the_form).flow_panel.Invalidate();
                this.Close();
            }
            else
            {
                this.error     = true;
                this.error_msg = result.message;
                this.Invalidate();
            }
        }
コード例 #7
0
ファイル: Call_Dialog.cs プロジェクト: TheFern2/raptor
        private bool CreateNewTab(string s)
        {
            for (int i = 0; i < s.Length; i++)
            {
                if (!(Char.IsLetterOrDigit(s[i]) || s[i] == '_'))
                {
                    return(false);
                }
            }
            if (!Char.IsLetter(s, 0) || !token_helpers_pkg.verify_id(s))
            {
                return(false);
            }
            DialogResult dialog_result = MessageBox.Show("Do you wish to create a new tab named "
                                                         + s, "Create new tab?", MessageBoxButtons.YesNo);

            if (dialog_result == DialogResult.Yes)
            {
                Subchart sc = new Subchart(the_form, s);
                Undo_Stack.Make_Add_Tab_Undoable(the_form, sc);
                the_form.Make_Undoable();
                the_form.carlisle.TabPages.Add(sc);
                result = interpreter_pkg.call_syntax(this.assignment_Text.Text, Rec);
                the_form.carlisle.SelectedTab = sc;
                Rec.Text       = this.assignment_Text.Text;
                Rec.parse_tree = result.tree;
                this.error     = false;
                Rec.changed();
                ((Visual_Flow_Form)the_form).flow_panel.Invalidate();
                this.Close();
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #8
0
        private void done_button_Click(object sender, System.EventArgs e)
        {
            result = interpreter_pkg.output_syntax(this.textBox1.Text,
                                                   this.new_line.Checked, PAR);

            PAR.is_input = false;
            if (result.valid)
            {
                the_form.Make_Undoable();
                PAR.Text       = this.textBox1.Text;
                PAR.parse_tree = result.tree;
                PAR.new_line   = this.new_line.Checked;
                PAR.changed();
                this.error = false;
                this.Close();
            }

            else
            {
                this.error     = true;
                this.error_msg = result.message;
                this.Invalidate();
            }
        }
コード例 #9
0
ファイル: Parallelogram.cs プロジェクト: Veggie13/raptor
        public Parallelogram(SerializationInfo info, StreamingContext ctxt)
            : base(info, ctxt)
        {
            prompt   = (string)info.GetValue("_prompt", typeof(string));
            is_input = (bool)info.GetValue("_is_input", typeof(bool));
            // is prompt an expression or just plain text?
            if (this.incoming_serialization_version >= 9 && this.is_input)
            {
                this.input_is_expression = info.GetBoolean("_input_expression");
            }
            else
            {
                this.input_is_expression = false;
            }

            if (this.incoming_serialization_version >= 5)
            {
                this.new_line = info.GetBoolean("_new_line");
            }
            else
            {
                this.new_line = true;
            }
            if (is_input)
            {
                result = interpreter_pkg.input_syntax(this.Text, this);
                if (this.input_is_expression)
                {
                    prompt_result = interpreter_pkg.output_syntax(this.prompt, false, this);
                }
            }
            else
            {
                result = interpreter_pkg.output_syntax(this.Text, this.new_line, this);
            }

            if (this.input_is_expression)
            {
                if (prompt_result.valid)
                {
                    this.prompt_tree = prompt_result.tree;
                }
                else
                {
                    this.prompt = "";
                }
            }

            if (result.valid)
            {
                this.parse_tree = result.tree;
            }
            else
            {
                if (!Component.warned_about_error && this.Text != "")
                {
                    MessageBox.Show("Unknown error: \n" +
                                    this.Text + "\n" +
                                    "is not recognized.");
                    Component.warned_about_error = true;
                }
                this.Text = "";
            }
        }