comparison src/parse.y @ 7903:8018e10d2b87

save and restore global_command as needed
author John W. Eaton <jwe@octave.org>
date Wed, 09 Jul 2008 10:58:12 -0400
parents 3e4c9b69069d
children 0d607e8dbbfa
comparison
equal deleted inserted replaced
7902:c51ae36fcbce 7903:8018e10d2b87
3717 parser_end_of_input = false; 3717 parser_end_of_input = false;
3718 line_editing = false; 3718 line_editing = false;
3719 3719
3720 current_eval_string = s; 3720 current_eval_string = s;
3721 3721
3722 unwind_protect_ptr (global_command);
3723
3724 YY_BUFFER_STATE old_buf = current_buffer (); 3722 YY_BUFFER_STATE old_buf = current_buffer ();
3725 YY_BUFFER_STATE new_buf = create_buffer (0); 3723 YY_BUFFER_STATE new_buf = create_buffer (0);
3726 3724
3727 unwind_protect::add (restore_input_buffer, old_buf); 3725 unwind_protect::add (restore_input_buffer, old_buf);
3728 unwind_protect::add (delete_input_buffer, new_buf); 3726 unwind_protect::add (delete_input_buffer, new_buf);
3731 3729
3732 do 3730 do
3733 { 3731 {
3734 reset_parser (); 3732 reset_parser ();
3735 3733
3734 unwind_protect_ptr (global_command);
3735
3736 parse_status = yyparse (); 3736 parse_status = yyparse ();
3737 3737
3738 tree_statement_list *command = global_command; 3738 tree_statement_list *command = global_command;
3739
3740 // Restore previous value of global_command.
3741 unwind_protect::run ();
3739 3742
3740 if (parse_status == 0) 3743 if (parse_status == 0)
3741 { 3744 {
3742 if (command) 3745 if (command)
3743 { 3746 {