Attempt better maxdeadcycles handling

This commit is contained in:
Marcel Fabian Krüger 2021-11-21 16:11:49 +01:00
parent 8494bde0a5
commit fc21983b16

View File

@ -124,8 +124,9 @@ local do_terminal_input do
end end
end end
do
local errorvalues = tex.geterrorvalues() local errorvalues = tex.geterrorvalues()
function callbacks.intercept_tex_error(mode, errortype) local function intercept(mode, errortype)
errortype = errorvalues[errortype] errortype = errorvalues[errortype]
if errortype == "eof" then if errortype == "eof" then
-- print('EOF', token.peek_next()) -- print('EOF', token.peek_next())
@ -169,4 +170,14 @@ function callbacks.intercept_tex_error(mode, errortype)
until false until false
return 3 return 3
end end
function callbacks.intercept_tex_error(mode, errortype)
local ret = intercept(mode, errortype)
if tex.deadcycles >= tex.maxdeadcycles then
tex.runtoks(function()
tex.sprint(1, '\\shipout\\box255')
end)
end
return ret
end
end
callbacks.__freeze'intercept_tex_error' callbacks.__freeze'intercept_tex_error'