diff options
| author | mryouse | 2022-07-10 20:34:19 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-10 20:34:19 +0000 |
| commit | 666179df6d54ec5413f44c7002982ccb6c2c4732 (patch) | |
| tree | 0a0721a98c1797bb9f04f9ddfe0102ef11e8b674 | |
| parent | 4fb8873f45c8596ba044c87060191778b8238952 (diff) | |
bugfix: definitions weren't registering (falling out of env)
| -rw-r--r-- | repl.neb | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -26,18 +26,22 @@ (print "version: < 0") (def next-cmd-num 1) - (func evaluate-cmd (cmd) - (def evaluated (parse-neb cmd)) - (print (concat "=> " (->string evaluated))) - (redef next-cmd-num (+ 1 next-cmd-num)) - (redef _history_ (append _history_ cmd))) + + (func get-non-empty-input () + (def tmp "") + (while (eq? "" tmp) + (redef tmp (strip (read-line (prompt next-cmd-num))))) + tmp) ; this is the actual loop part (while #true - (def this-cmd (strip (read-line (prompt next-cmd-num)))) - (if (not (eq? "" this-cmd)) + (def this-cmd (get-non-empty-input)) + (def evaluated (try - (evaluate-cmd this-cmd) - (print (concat "panic! " _panic_)))))) + (eval (parse-neb this-cmd)) + _panic_)) + (print (concat "=> " (->string evaluated))) + (redef next-cmd-num (+ 1 next-cmd-num)) + (redef _history_ (append _history_ this-cmd)))) (repl) |
