diff options
-rw-r--r-- | repl.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/repl.lua b/repl.lua index 556525c..93e430c 100644 --- a/repl.lua +++ b/repl.lua | |||
@@ -33,8 +33,17 @@ function m.repl (prompt, infile, out) | |||
33 | end | 33 | end |
34 | local x = read.read(inport) | 34 | local x = read.read(inport) |
35 | if x then | 35 | if x then |
36 | local val = eval.eval(x) | 36 | local ok, val = |
37 | if out ~= false then | 37 | xpcall( |
38 | function () return eval.eval(x) end, | ||
39 | function (e) | ||
40 | local start = e:find(": ") | ||
41 | return e:sub(start+2) | ||
42 | end | ||
43 | ) | ||
44 | if not ok then | ||
45 | print("not ok: " .. val) | ||
46 | elseif out ~= false then | ||
38 | schemeprint(val) | 47 | schemeprint(val) |
39 | end | 48 | end |
40 | end | 49 | end |