From fb7351491334ff1407f3f1d43ce1cc6f43f1e5b3 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Tue, 7 Jan 2014 15:04:28 -0800 Subject: [PATCH] fix(frontends/lean/parser): parser aborted if the scanner throws an exception in the first call to scan(); position information was being shown twice for scanner exceptions Signed-off-by: Leonardo de Moura --- src/frontends/lean/parser_error.cpp | 62 +++++++++-------------------- src/frontends/lean/parser_imp.cpp | 22 +++++----- src/frontends/lean/parser_imp.h | 1 + 3 files changed, 32 insertions(+), 53 deletions(-) diff --git a/src/frontends/lean/parser_error.cpp b/src/frontends/lean/parser_error.cpp index b031f066a..a848a85b6 100644 --- a/src/frontends/lean/parser_error.cpp +++ b/src/frontends/lean/parser_error.cpp @@ -97,6 +97,14 @@ void parser_imp::display_error(tactic_cmd_error const & ex) { display_proof_state(ex.m_state); } +#define CATCH_CORE(ShowError, ThrowError) \ +m_found_errors = true; \ +if (m_show_errors) { ShowError ; } \ +sync(); \ +if (m_use_exceptions) { ThrowError ; } + +#define CATCH(ShowError) CATCH_CORE(ShowError, throw;) + /** \brief Execute the given function \c f, and handle exceptions occurring when executing \c f. @@ -106,63 +114,29 @@ void parser_imp::protected_call(std::function && f, std::function