1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-30 23:23:07 +00:00

Make coloring changes to the repl

This commit is contained in:
bakpakin
2017-07-02 20:51:52 -04:00
parent bfadf6ff12
commit 0cf278994d
7 changed files with 149 additions and 140 deletions

View File

@@ -8,4 +8,4 @@
(var i 0)
(while (< i 1000)
(print i)
(varset i (+ i 1)))
(varset! i (+ i 1)))

View File

@@ -1,27 +0,0 @@
(namespace-set! "gst.repl")
"Read a line"
(export! "readline" (fn []
(: b (buffer))
(read stdin 1 b)
(while (not (= (get "\n" 0) (get b (- (length b) 1))))
(read stdin 1 b)
)
(string b)
))
"Create a parser"
(export! "p" (parser))
"Run a simple repl."
(while 1
(write stdout ">> ")
(: t (thread (fn [line]
(: ret 1)
(while line
(: line (parse-charseq p line))
(if (parse-hasvalue p)
(: ret ((compile (parse-consume p))))))
ret)))
(: res (tran t (readline)))
(if (= (status t) "dead") (print (debugp res)) (print "Error: " (debugp res))))