From ce28c84696513f7bcc0316db68fdbe5a66e1465a Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 12 Jul 2021 20:13:02 -0400 Subject: [PATCH] Slightly better error-handling in Forbble --- src/examples/forbble.pbl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/examples/forbble.pbl b/src/examples/forbble.pbl index 088a50e..0a0334e 100755 --- a/src/examples/forbble.pbl +++ b/src/examples/forbble.pbl @@ -109,13 +109,15 @@ (if (= ":" _x) ( ; Compile a phrase into the next symbol (def var (at 1 list)) ; Collect the symbol to define, as a string (defe var (+ "_" var)) ; Add an underscore for the internal storage - (defe (+ "_" var) ()) ; Define internally as an empty list + (defe (+ "_" var) ()) ; Define _func internally as an empty list (def list (compile ; Overwrite list with output of (compile) (rest (rest list)) ; Current list, not including ':' or the symbol (+ "_" var)))) ; The internal variable name ( ; If none of the above hit, try to interpret as a compiled symbol - (def _e (eval _x)) - (if (iserr (len _e)) () (feval _e)) + (if (iserr _x) (prnl _x) ( + (def _e (eval _x)) + (if (iserr (len _e)) () (feval _e)) + )) ) )))))))))))) ; A switch/case operator might be good, to avoid huge closing-paren chains