summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/data-tex.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-11-04 10:09:33 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-11-04 10:09:33 +0100
commit343fdd99ef79884fca1f86b49c950e03939aeedf (patch)
treeb16fa5f5a68b01d88a0784e232a31b431b82d593 /tex/context/base/mkiv/data-tex.lua
parent10148cf24f5cdb6a67c8ba46ff62cea67affc44c (diff)
downloadcontext-343fdd99ef79884fca1f86b49c950e03939aeedf.tar.gz
2020-11-04 09:31:00
Diffstat (limited to 'tex/context/base/mkiv/data-tex.lua')
-rw-r--r--tex/context/base/mkiv/data-tex.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/tex/context/base/mkiv/data-tex.lua b/tex/context/base/mkiv/data-tex.lua
index e4795d09d..2e8642cdd 100644
--- a/tex/context/base/mkiv/data-tex.lua
+++ b/tex/context/base/mkiv/data-tex.lua
@@ -143,8 +143,9 @@ local function textopener(tag,filename,filehandle,coding)
lines[noflines] = nil
end
pushinputname(filename)
- local currentline, noflines = 0, noflines
- local t = {
+ local currentline = 0
+ local noflines = noflines
+ local handler = {
filename = filename,
noflines = noflines,
-- currentline = 0,
@@ -153,10 +154,11 @@ local function textopener(tag,filename,filehandle,coding)
if trace_locating then
report_tex("%a closer: %a closed",tag,filename)
end
- t = nil
+ handler = nil
+ lines = nil
end,
reader = function(self)
- self = self or t
+ self = self or handler
-- local currentline, noflines = self.currentline, self.noflines
if currentline >= noflines then
return nil
@@ -164,6 +166,7 @@ local function textopener(tag,filename,filehandle,coding)
currentline = currentline + 1
-- self.currentline = currentline
local content = lines[currentline]
+-- lines[currentline] = nil
if content == "" then
return ""
-- elseif content == ctrl_d or ctrl_z then
@@ -181,14 +184,14 @@ local function textopener(tag,filename,filehandle,coding)
end
end
}
- setmetatableindex(t,function(t,k)
+ setmetatableindex(handler,function(t,k)
if k == "currentline" then
return currentline
else
-- no such key
end
end)
- return t
+ return handler
end
helpers.settextopener(textopener) -- can only be done once