Add testing status to run
This commit is contained in:
parent
46817bd4e5
commit
b723532d1a
|
@ -30,33 +30,38 @@
|
||||||
(defn clean-out [value]
|
(defn clean-out [value]
|
||||||
#?(:clj value :cljs (clj->js value)))
|
#?(:clj value :cljs (clj->js value)))
|
||||||
|
|
||||||
(defn run [source]
|
(defn run
|
||||||
(let [user_scanned (s/scan source "user input")
|
([source] (run source false))
|
||||||
user_tokens (:tokens user_scanned)
|
([source testing?]
|
||||||
user_parsed (p/apply-parser g/script user_tokens)
|
(let [user_scanned (s/scan source "user input")
|
||||||
user_result (i/interpret-safe source user_parsed {})
|
user_tokens (:tokens user_scanned)
|
||||||
result_str (show/show user_result)
|
user_parsed (p/apply-parser g/script user_tokens)
|
||||||
post_scanned (s/scan pre/postlude "postlude")
|
user_result (i/interpret-safe source user_parsed {::i/testing? testing?})
|
||||||
post_tokens (:tokens post_scanned)
|
result_str (show/show user_result)
|
||||||
post_parsed (p/apply-parser g/script post_tokens)
|
post_scanned (s/scan pre/postlude "postlude")
|
||||||
post_result (i/interpret-safe source post_parsed {})
|
post_tokens (:tokens post_scanned)
|
||||||
ludus_result (assoc post_result :result result_str)
|
post_parsed (p/apply-parser g/script post_tokens)
|
||||||
clj_result (ld->clj ludus_result)
|
post_result (i/interpret-safe source post_parsed {})
|
||||||
]
|
ludus_result (assoc post_result :result result_str)
|
||||||
(cond
|
clj_result (ld->clj ludus_result)
|
||||||
(not-empty (:errors user_tokens))
|
]
|
||||||
(clean-out {:errors (:errors user_tokens)})
|
(cond
|
||||||
|
(not-empty (:errors user_tokens))
|
||||||
|
(clean-out {:errors (:errors user_tokens)})
|
||||||
|
|
||||||
(= :err (:status user_parsed))
|
(= :err (:status user_parsed))
|
||||||
(clean-out {:errors [(error/parse-error user_parsed)]})
|
(clean-out {:errors [(error/parse-error user_parsed)]})
|
||||||
|
|
||||||
(::data/error user_result)
|
(::data/error user_result)
|
||||||
(clean-out (assoc (ld->clj post_result) :errors [(error/run-error user_result)]))
|
(clean-out (assoc (ld->clj post_result) :errors [(error/run-error user_result)]))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(clean-out clj_result)
|
(clean-out clj_result)
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
)
|
||||||
|
|
||||||
|
(defn test [source] (run source true))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(def source "
|
(def source "
|
||||||
|
|
Loading…
Reference in New Issue
Block a user