Mercurial > octave
changeset 29526:b65824235c7f
also reset parser when interpreter recovers from exception
* pt-eval.h, pt-eval.cc (tree_evaluator::reset): New function.
(tree_evaluator::server_loop): Don't reset parser at the top of each
trip through the loop.
* interpreter.cc (interpreter::recover_from_exception): Call it.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 13 Apr 2021 06:25:20 -0400 |
parents | d6b2d9f9e1e0 |
children | c7569a4224bd |
files | libinterp/corefcn/interpreter.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h |
diffstat | 3 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc Mon Apr 12 23:03:11 2021 +0200 +++ b/libinterp/corefcn/interpreter.cc Tue Apr 13 06:25:20 2021 -0400 @@ -1983,6 +1983,8 @@ octave_signal_caught = 0; octave_restore_signal_mask (); catch_interrupts (); + + m_evaluator.reset (); } void interpreter::mark_for_deletion (const std::string& file)
--- a/libinterp/parse-tree/pt-eval.cc Mon Apr 12 23:03:11 2021 +0200 +++ b/libinterp/parse-tree/pt-eval.cc Tue Apr 13 06:25:20 2021 -0400 @@ -621,6 +621,10 @@ else incomplete_parse = true; + // FIXME: Should we be checking m_exit_status or incomplete_parse or + // both here? Could EOF have a value other than -1, and is there + // possible confusion between that state and the parser returning -1? + if (m_exit_status == -1) m_exit_status = 0; else @@ -777,8 +781,6 @@ do { - m_parser->reset (); - try { // FIXME: Should we call octave_quit in the octave::sleep @@ -820,9 +822,7 @@ es.display_exception (ee); if (m_interpreter.interactive ()) - { - m_interpreter.recover_from_exception (); - } + m_interpreter.recover_from_exception (); else { // We should exit with a nonzero status. @@ -1208,6 +1208,12 @@ } void + tree_evaluator::reset (void) + { + m_parser->reset (); + } + + void tree_evaluator::reset_debug_state (void) { m_debug_mode = (m_bp_table.have_breakpoints ()
--- a/libinterp/parse-tree/pt-eval.h Mon Apr 12 23:03:11 2021 +0200 +++ b/libinterp/parse-tree/pt-eval.h Tue Apr 13 06:25:20 2021 -0400 @@ -308,6 +308,10 @@ bool statement_printing_enabled (void); + // Currently called from interpreter::recover_from_exception to + // reset parser state. + void reset (void); + void reset_debug_state (void); void reset_debug_state (bool mode);