summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-02-04 23:45:03 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-02-04 23:45:03 -0800
commit4042efd3e88ad10620e257c25080fd16a228fbf7 (patch)
tree4630b23c06624a225eb9ca8cb3c8801f70021221 /parser.c
parent022ea8cfd80b97221abfbf2ba09110c0ecef3dc6 (diff)
downloadtxr-4042efd3e88ad10620e257c25080fd16a228fbf7.tar.gz
txr-4042efd3e88ad10620e257c25080fd16a228fbf7.tar.bz2
txr-4042efd3e88ad10620e257c25080fd16a228fbf7.zip
repl: catch exceptions during completion.
This fixes the issue that TXR exits if an exception occurs during Tab completion in the interactive listener. This could happen when loading a file fails for whatever reason, such as a corrupt or incomplete installation of the library files or whatever. * parser.c (provide_completions): Set up a catch all handler here around everything, like we already did in provide_atom.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index 6f21f62e..8746f4c8 100644
--- a/parser.c
+++ b/parser.c
@@ -924,15 +924,17 @@ static void provide_completions(const wchar_t *data,
(void) ctx;
+ uw_catch_begin (catch_all, exsym, exvals);
+
if (!ptr)
- return;
+ goto out;
while ((iswalnum(convert(wint_t, *ptr)) || wcschr(gly, *ptr)) &&
(sym = ptr) && ptr > data)
ptr--;
if (!sym)
- return;
+ goto out;
end = sym;
@@ -999,6 +1001,16 @@ static void provide_completions(const wchar_t *data,
sym_pfx, line_pfx, kind, if2(package, null(keyword)));
}
}
+
+out:
+ uw_catch (exsym, exvals) {
+ (void) exsym;
+ (void) exvals;
+ }
+
+ uw_unwind;
+
+ uw_catch_end;
}
static wchar_t *provide_atom(lino_t *l, const wchar_t *str, int n, void *ctx)