Slightly better error-handling in Forbble

This commit is contained in:
Sage Vaillancourt 2021-07-12 20:13:02 -04:00
parent b222df047d
commit ce28c84696
1 changed files with 5 additions and 3 deletions

View File

@ -109,13 +109,15 @@
(if (= ":" _x) ( ; Compile a phrase into the next symbol (if (= ":" _x) ( ; Compile a phrase into the next symbol
(def var (at 1 list)) ; Collect the symbol to define, as a string (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 (+ "_" 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) (def list (compile ; Overwrite list with output of (compile)
(rest (rest list)) ; Current list, not including ':' or the symbol (rest (rest list)) ; Current list, not including ':' or the symbol
(+ "_" var)))) ; The internal variable name (+ "_" var)))) ; The internal variable name
( ; If none of the above hit, try to interpret as a compiled symbol ( ; If none of the above hit, try to interpret as a compiled symbol
(def _e (eval _x)) (if (iserr _x) (prnl _x) (
(if (iserr (len _e)) () (feval _e)) (def _e (eval _x))
(if (iserr (len _e)) () (feval _e))
))
) )
)))))))))))) ))))))))))))
; A switch/case operator might be good, to avoid huge closing-paren chains ; A switch/case operator might be good, to avoid huge closing-paren chains