~subsetpark/ec

8c90cfc6ae2baefd4800e61a5894a97ba4a8367b — Zach Smith 9 months ago 069d4dd
Basic error handling
1 files changed, 7 insertions(+), 1 deletions(-)

M main.janet
M main.janet => main.janet +7 -1
@@ 16,6 16,7 @@
(defn handle-commands
  [in s]
  (case (freeze (string/trim in))
    "" (os/exit 0)
    "." (display (calc/peek s))
    "p" (display (calc/pop s))
    "s" (display-all (s :data))


@@ 30,7 31,12 @@
            in (getline prompt buf parser/dictionary)
            after-commands (handle-commands in s)
            parsed (parser/parse after-commands)]
        (calc/push-all s parsed)))))

        (let [bak (array/slice (s :data))]
          (try (calc/push-all s parsed)
               ([err]
                (eprint err)
                (put s :data bak))))))))

(defn handle-line
  [line]