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
1 changed files with 51 additions and 40 deletions

View File

@ -124,8 +124,9 @@ local do_terminal_input do
end
end
do
local errorvalues = tex.geterrorvalues()
function callbacks.intercept_tex_error(mode, errortype)
local function intercept(mode, errortype)
errortype = errorvalues[errortype]
if errortype == "eof" then
-- print('EOF', token.peek_next())
@ -169,4 +170,14 @@ function callbacks.intercept_tex_error(mode, errortype)
until false
return 3
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'