Workaround for remaining engine bug

This commit is contained in:
Marcel Krüger 2020-06-12 21:52:35 +02:00
parent 39ed349241
commit 19d9ccbd76
2 changed files with 21 additions and 3 deletions

View File

@ -1,5 +1,5 @@
\begingroup \begingroup
\catcode`\^^^^ffff=11 \catcode`\^^^^fffe=11
\catcode`\@=11 \catcode`\@=11
\toks0{% \toks0{%
do do

View File

@ -78,11 +78,29 @@ do
end end
end end
callback_register('read_data_file', function(name) error[[TODO]]return kpse.find_file(name, 'tex', true) end) callback_register('read_data_file', function(name) error[[TODO]]return kpse.find_file(name, 'tex', true) end)
-- local file_meta = {\ local input_pattern do
local hex = lpeg.R('09', 'af')
local hexx = hex * hex
local tonumber = tonumber
local char = utf8.char
local sub = string.sub
local char = lpeg.Cg('^^' * (
('^^' * ('^^' * hexx)^-1 * hexx)^-1 * hexx/function(s)
local cp = tonumber(sub(s, #s/2), 16)
return cp == 0 and '^^@' or char(cp)
end
-- + lpeg.R'\0\63' / function(s) return char(s:byte()+64) end
-- + lpeg.R'\63\127' / function(s) return char(s:byte()-64) end
)) + 1
input_pattern = lpeg.Cs(char^0)
end
callback_register('open_data_file', function(name) callback_register('open_data_file', function(name)
local f = io.open(name) local f = io.open(name)
return setmetatable({ return setmetatable({
reader = function() return f:read() end, reader = function()
local line = f:read()
return line and input_pattern:match(line)
end,
close = function()error[[1]] return f:close() end, close = function()error[[1]] return f:close() end,
}, { }, {
__gc = function()f:close()end, __gc = function()f:close()end,