aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormryouse2022-07-10 20:41:54 +0000
committermryouse2022-07-10 20:41:54 +0000
commita876130d9a0819f13998b2eb591df7e0726dba25 (patch)
tree7c4eee55579c7d99b4ee84ab6fd8bab98e7bb1e1
parent666179df6d54ec5413f44c7002982ccb6c2c4732 (diff)
bugfix: panics shouldn't increment or be included in history
-rw-r--r--repl.neb14
1 files changed, 10 insertions, 4 deletions
diff --git a/repl.neb b/repl.neb
index c661716..77faed6 100644
--- a/repl.neb
+++ b/repl.neb
@@ -36,12 +36,18 @@
; this is the actual loop part
(while #true
(def this-cmd (get-non-empty-input))
+ (def panicked #false) ; we may not need this two-step if there's a :panic type
(def evaluated
(try
(eval (parse-neb this-cmd))
- _panic_))
- (print (concat "=> " (->string evaluated)))
- (redef next-cmd-num (+ 1 next-cmd-num))
- (redef _history_ (append _history_ this-cmd))))
+ (block
+ (redef panicked #true)
+ _panic_)))
+ (if panicked
+ (print (concat "panic! " evaluated))
+ (block
+ (print (concat "=> " (->string evaluated)))
+ (redef next-cmd-num (+ 1 next-cmd-num))
+ (redef _history_ (append _history_ this-cmd))))))
(repl)