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