# HG changeset patch # User John W. Eaton # Date 1362015162 18000 # Node ID e309eb7940be70aa5e8cde0ead012079d1e9dc61 # Parent 891a2a4df71fb98a6c8b056d1a51f214a7e4fa94 parser tweaks * input.cc (get_debug_input): Create parser outside of loop. * toplev.cc (main_loop): Likewise. * oct-parse.yy (parse_fcn_file): Don't reset newly created parser. diff --git a/libinterp/interpfcn/input.cc b/libinterp/interpfcn/input.cc --- a/libinterp/interpfcn/input.cc +++ b/libinterp/interpfcn/input.cc @@ -669,16 +669,16 @@ get_input_from_eval_string = false; } + // octave_parser constructor sets this for us. + frame.protect_var (CURR_LEXER); + + octave_parser *curr_parser = new octave_parser (); + frame.add_fcn (octave_parser::cleanup, curr_parser); + while (Vdebugging) { unwind_protect middle_frame; - // octave_parser constructor sets this for us. - middle_frame.protect_var (CURR_LEXER); - - octave_parser *curr_parser = new octave_parser (); - middle_frame.add_fcn (octave_parser::cleanup, curr_parser); - reset_error_handler (); curr_parser->reset (); diff --git a/libinterp/interpfcn/toplev.cc b/libinterp/interpfcn/toplev.cc --- a/libinterp/interpfcn/toplev.cc +++ b/libinterp/interpfcn/toplev.cc @@ -559,18 +559,20 @@ // The big loop. + unwind_protect frame; + + // octave_parser constructor sets this for us. + frame.protect_var (CURR_LEXER); + + octave_parser *curr_parser = new octave_parser (); + frame.add_fcn (octave_parser::cleanup, curr_parser); + int retval = 0; do { try { - unwind_protect frame; - - // octave_parser constructor sets this for us. - frame.protect_var (CURR_LEXER); - - octave_parser *curr_parser = new octave_parser (); - frame.add_fcn (octave_parser::cleanup, curr_parser); + unwind_protect inner_frame; reset_error_handler (); @@ -583,9 +585,9 @@ // the forced variables will be unmarked in the event of an // interrupt. symbol_table::scope_id scope = symbol_table::top_scope (); - frame.add_fcn (symbol_table::unmark_forced_variables, scope); + inner_frame.add_fcn (symbol_table::unmark_forced_variables, scope); - frame.protect_var (global_command); + inner_frame.protect_var (global_command); global_command = 0; diff --git a/libinterp/parse-tree/oct-parse.yy b/libinterp/parse-tree/oct-parse.yy --- a/libinterp/parse-tree/oct-parse.yy +++ b/libinterp/parse-tree/oct-parse.yy @@ -3407,8 +3407,6 @@ octave_parser *curr_parser = new octave_parser (); frame.add_fcn (octave_parser::cleanup, curr_parser); - curr_parser->reset (); - std::string help_txt = gobble_leading_white_space (ffile, eof,