private void RunHandler(object sender, EventArgs e)
 {
     if (p == null)
         p = new Parser(textArea.Text);
     terminated = false;
     while (p.IsRunning() && !terminated) {
         p.Interpret();
         UpdatePositions();
         p.Advance();
     }
     UpdateStreams();
     if (p.IsUpdateNeeded()) {
         UpdateSource();
     }
     p = null;
 }
        private void StepHandler(object sender, EventArgs e)
        {
            if (originalText == null)
                originalText = textArea.Text;
            if (p == null) {
                p = new Parser(textArea.Text);
            }

            if (p.IsRunning()) {
                p.Interpret();
                UpdatePositions();
                p.Advance();
            }

            UpdateStreams();

            if (p.IsUpdateNeeded()) {
                UpdateSource();
            }
            if (!p.IsRunning() || terminated) {
                p = null;
                timer.Enabled = false;
            }
        }
 private void ResetHandler(object sender, EventArgs e)
 {
     p = null;
     if (editedText != null && editedText != originalText)
         textArea.Text = (originalText ?? textArea.Text).TrimEnd();
     originalText = null;
     UpdateStreams();
 }