Add inner interpret loop

This commit is contained in:
Koichi Nakamura 2021-01-10 11:28:28 +09:00
parent fbe4a77dc4
commit ce31b9160e

View file

@ -1836,6 +1836,10 @@ stdin_ push-inputstream
: interpret : interpret
word \ read name from input word \ read name from input
: interpret-inner
begin
word \ read name from input
\ EOF at this point is not an error \ EOF at this point is not an error
UNEXPECTED-EOF-ERROR = if QUIT throw then UNEXPECTED-EOF-ERROR = if QUIT throw then
@ -1867,11 +1871,12 @@ stdin_ push-inputstream
[compile] literal [compile] literal
then then
then then
again
; ;
: interpret-loop : interpret-outer
begin begin
['] interpret catch ['] interpret-inner catch
?dup if ?dup if
\ lookup error code \ lookup error code
dup QUIT = if throw then dup QUIT = if throw then
@ -1902,7 +1907,7 @@ stdin_ push-inputstream
:noname :noname
rp0 rp! \ drop 3rd stage rp0 rp! \ drop 3rd stage
['] interpret-loop catch bye ['] interpret-outer catch bye
; execute ; execute
( === [if]..[else]..[then] === ) ( === [if]..[else]..[then] === )
@ -2293,7 +2298,7 @@ need-defined (read)
: included ( c-addr -- ) : included ( c-addr -- )
R/O open-file throw R/O open-file throw
push-inputstream push-inputstream
['] interpret-loop catch drop ['] interpret-outer catch drop
pop-inputstream close-file throw pop-inputstream close-file throw
; ;