From e131e81e72f37d29bd237d0052bb9f6febd7ffd0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 6 Sep 2017 22:26:31 -0700 Subject: txr -i honored despite parse-time exception. If an error is thrown while parsing a .txr file or while reading and evaluating the forms of a .tl file. * parser.y (parse_once, parse): Wording change in message when exception is caught. Only exceptions derived from error are caught. * txr.c (parse_once_noerr, read_eval_stream_noerr): New static functions. (txr_main): Use parse_once_noerr and read_eval_stream_noerr instead of parse_once and read_eval_stream. Don't exit if a TXR file has parser errors; in that situation, exit only if interactive mode is not requested, otherwise go interactive. Make sure *self-path* is registered to the name of the input source in this case also. * unwind.h (ignerr_func_body): New macro. --- unwind.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'unwind.h') diff --git a/unwind.h b/unwind.h index a173e39d..5c4786f3 100644 --- a/unwind.h +++ b/unwind.h @@ -276,3 +276,14 @@ noreturn val type_mismatch(val, ...); internal_error("assertion " \ #EXPR \ " failed") + +#define ignerr_func_body(type, init, expr, exsym, \ + exargs, stream, prefix) \ + type (_r_e_t) = (init); \ + uw_catch_begin (cons(error_s, nil), exsym, exargs); \ + _r_e_t = expr; \ + uw_catch(exsym, exargs) \ + error_trace(exsym, exargs, stream, prefix); \ + uw_unwind { } \ + uw_catch_end; \ + return _r_e_t; -- cgit v1.2.3