boxed console printing works, but not janet print
s
This commit is contained in:
parent
8ac289cc9d
commit
176feb5ae2
|
@ -9,25 +9,23 @@
|
||||||
|
|
||||||
(defn parse-error [e]
|
(defn parse-error [e]
|
||||||
(def msg (e :msg))
|
(def msg (e :msg))
|
||||||
(def line-num (get-in e [:token :line]))
|
(def {:line line-num :input input :soure source} (e :token))
|
||||||
(def source (get-in e [:token :source]))
|
|
||||||
(def source-line (get-line source line-num))
|
(def source-line (get-line source line-num))
|
||||||
(print "Parsing error: " msg)
|
(print "Parsing error: " msg)
|
||||||
(print "On line " line-num ":")
|
(print "On line " line-num " in " input)
|
||||||
(print source-line)
|
(print source-line)
|
||||||
e)
|
e)
|
||||||
|
|
||||||
|
|
||||||
(defn validation-error [e]
|
(defn validation-error [e]
|
||||||
(def msg (e :msg))
|
(def msg (e :msg))
|
||||||
(def line-num (get-in e [:node :token :line]))
|
(def {:line line-num :input input :source source} (get-in e [:node :token]))
|
||||||
(def source (get-in e [:node :token :source]))
|
|
||||||
(def source-line (get-line source line-num))
|
(def source-line (get-line source line-num))
|
||||||
(case msg
|
(case msg
|
||||||
"unbound name"
|
"unbound name"
|
||||||
(do
|
(do
|
||||||
(print "Validation error: " msg " " (get-in e [:node :data]))
|
(print "Validation error: " msg " " (get-in e [:node :data]))
|
||||||
(print "on line " line-num)
|
(print "on line " line-num " in " input)
|
||||||
(print source-line))
|
(print source-line))
|
||||||
(do
|
(do
|
||||||
(print "Validation error: " msg)
|
(print "Validation error: " msg)
|
||||||
|
@ -37,10 +35,9 @@
|
||||||
|
|
||||||
(defn- fn-no-match [e]
|
(defn- fn-no-match [e]
|
||||||
(print "Ludus panicked! no match")
|
(print "Ludus panicked! no match")
|
||||||
(def line-num (get-in e [:node :token :line]))
|
(def {:line line-num :source source :input input} (get-in e [:node :token]))
|
||||||
(def source (get-in e [:node :token :source]))
|
|
||||||
(def source-line (get-line source line-num))
|
(def source-line (get-line source line-num))
|
||||||
(print "on line " line-num)
|
(print "on line " line-num " in " input)
|
||||||
(def called (e :called))
|
(def called (e :called))
|
||||||
(print "calling " (b/show called))
|
(print "calling " (b/show called))
|
||||||
(def value (e :value))
|
(def value (e :value))
|
||||||
|
@ -52,10 +49,9 @@
|
||||||
|
|
||||||
(defn- let-no-match [e]
|
(defn- let-no-match [e]
|
||||||
(print "Ludus panicked! no match")
|
(print "Ludus panicked! no match")
|
||||||
(def line-num (get-in e [:node :token :line]))
|
(def {:line line-num :source source :input input} (get-in e [:node :token]))
|
||||||
(def source (get-in e [:node :token :source]))
|
|
||||||
(def source-line (get-line source line-num))
|
(def source-line (get-line source line-num))
|
||||||
(print "on line " line-num)
|
(print "on line " line-num " in " input)
|
||||||
(print "binding " (b/show (e :value)))
|
(print "binding " (b/show (e :value)))
|
||||||
(def pattern (get-in e [:node :data 0]))
|
(def pattern (get-in e [:node :data 0]))
|
||||||
(print "to " (b/show-patt pattern))
|
(print "to " (b/show-patt pattern))
|
||||||
|
@ -63,19 +59,18 @@
|
||||||
|
|
||||||
(defn- generic-panic [e]
|
(defn- generic-panic [e]
|
||||||
(def msg (e :msg))
|
(def msg (e :msg))
|
||||||
(def line-num (get-in e [:node :token :line]))
|
(def {:line line-num :source source :input input} (get-in e [:node :token]))
|
||||||
(def source (get-in e [:node :token :source]))
|
|
||||||
(def source-line (get-line source line-num))
|
(def source-line (get-line source line-num))
|
||||||
(print "Ludus panicked! " msg)
|
(print "Ludus panicked! " msg)
|
||||||
(print "on line " line-num)
|
(print "on line " line-num " in " input)
|
||||||
(print source-line)
|
(print source-line)
|
||||||
)
|
)
|
||||||
|
|
||||||
(defn- unbound-name [e]
|
(defn- unbound-name [e]
|
||||||
(def {:line line-num :source source :lexeme name} (get-in e [:node :token]))
|
(def {:line line-num :source source :lexeme name :input input} (get-in e [:node :token]))
|
||||||
(def source-line (get-line source line-num))
|
(def source-line (get-line source line-num))
|
||||||
(print "Ludus panicked! unbound name " name)
|
(print "Ludus panicked! unbound name " name)
|
||||||
(print "on line " line-num)
|
(print "on line " line-num " in " input)
|
||||||
(print source-line)
|
(print source-line)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
(def pkg (do
|
(def pkg (do
|
||||||
(def prelude-ctx @{:^parent {"base" b/base}})
|
(def prelude-ctx @{:^parent {"base" b/base}})
|
||||||
(def prelude-src (slurp "prelude.ld"))
|
(def prelude-src (slurp "prelude.ld"))
|
||||||
(def prelude-scanned (s/scan prelude-src))
|
(def prelude-scanned (s/scan prelude-src :prelude))
|
||||||
(def prelude-parsed (p/parse prelude-scanned))
|
(def prelude-parsed (p/parse prelude-scanned))
|
||||||
(def parse-errors (prelude-parsed :errors))
|
(def parse-errors (prelude-parsed :errors))
|
||||||
(when (any? parse-errors) (each err parse-errors (e/parse-error err)) (break :error))
|
(when (any? parse-errors) (each err parse-errors (e/parse-error err)) (break :error))
|
||||||
|
|
|
@ -51,9 +51,10 @@ This new scene will have to return a JSON POJSO:
|
||||||
|
|
||||||
(do
|
(do
|
||||||
(def source `
|
(def source `
|
||||||
print! ("hello")
|
|
||||||
`)
|
`)
|
||||||
|
|
||||||
(-> source run)
|
(-> source run)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user