pcall the read, and skip calling clearstream for now
This commit is contained in:
parent
dd418aa196
commit
22487ce192
|
@ -30,11 +30,13 @@
|
|||
(while true
|
||||
(prompt)
|
||||
(set input "")
|
||||
(let [(ok ast) (read)]
|
||||
(let [(ok ast) (pcall read)]
|
||||
(if (not ok)
|
||||
(do
|
||||
(display (.. "Error:" (view ast) "\n"))
|
||||
(clearstream))
|
||||
(display (.. "Parse error:" ast "\n"))
|
||||
;; fixme: not sure why the following fails
|
||||
;; (clearstream)
|
||||
)
|
||||
(do
|
||||
(love.event.push event input)
|
||||
(display (: channel :demand))))))))
|
||||
|
|
|
@ -32,11 +32,10 @@ local function _0_(...)
|
|||
prompt()
|
||||
input = ""
|
||||
do
|
||||
local ok, ast = read()
|
||||
local ok, ast = pcall(read)
|
||||
local function _1_(...)
|
||||
if not ok then
|
||||
display(("Error:" .. view(ast) .. "\n"))
|
||||
return clearstream()
|
||||
return display(("Parse error:" .. ast .. "\n"))
|
||||
else
|
||||
love.event.push(event, input)
|
||||
return display(channel:demand())
|
||||
|
|
Loading…
Reference in a new issue