summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/luatools.lua60
-rw-r--r--scripts/context/lua/mtxrun.lua60
-rw-r--r--scripts/context/stubs/mswin/luatools.lua60
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua60
-rwxr-xr-xscripts/context/stubs/unix/luatools60
-rwxr-xr-xscripts/context/stubs/unix/mtxrun60
6 files changed, 186 insertions, 174 deletions
diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua
index a96474620..cd5e725d5 100644
--- a/scripts/context/lua/luatools.lua
+++ b/scripts/context/lua/luatools.lua
@@ -410,7 +410,7 @@ function string:checkedsplit(separator)
if not c then
separator = P(separator)
local other = C((1 - separator)^1)
- c = Ct(other * (separator^1 + other)^1)
+ c = Ct(other * (separator^1 * other)^1)
cache[separator] = c
end
return c:match(self)
@@ -4814,6 +4814,32 @@ end
-- work that well; the parsing is ok, but dealing with the resulting
-- table is a pain because we need to work inside-out recursively
+local function do_first(a,b)
+ local t = { }
+ for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_second(a,b)
+ local t = { }
+ for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_both(a,b)
+ local t = { }
+ for sa in gmatch(a,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do
+ t[#t+1] = sa .. sb
+ end
+ end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_three(a,b,c)
+ return a .. b.. c
+end
+
local function splitpathexpr(str, t, validate)
-- no need for further optimization as it is only called a
-- few times, we can use lpeg for the sub; we could move
@@ -4823,28 +4849,6 @@ local function splitpathexpr(str, t, validate)
str = gsub(str,"{,","{@,")
-- str = "@" .. str .. "@"
local ok, done
- local function do_first(a,b)
- local t = { }
- for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_second(a,b)
- local t = { }
- for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_both(a,b)
- local t = { }
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
- t[#t+1] = sa .. sb
- end
- end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_three(a,b,c)
- return a .. b.. c
- end
while true do
done = false
while true do
@@ -5353,22 +5357,20 @@ function resolvers.split_path(str) -- overkill but i need to check this module a
if type(str) == 'table' then
return str
else
+ str = gsub(str,"\\","/")
local s = cache[str]
if s then
return s -- happens seldom
else
s = { }
end
- local t = { }
- splitpathexpr(str,t)
+ local t = string.checkedsplit(str,io.pathseparator) or { str }
for _, p in ipairs(t) do
- for _, pp in ipairs(split_kpse_path(p)) do
- s[#s+1] = pp
- end
+ splitpathexpr(p,s)
end
+ --~ print(str,table.serialize(s))
cache[str] = s
return s
- --~ return file.split_path(str)
end
end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 4ed4dbdd1..538d394a7 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -419,7 +419,7 @@ function string:checkedsplit(separator)
if not c then
separator = P(separator)
local other = C((1 - separator)^1)
- c = Ct(other * (separator^1 + other)^1)
+ c = Ct(other * (separator^1 * other)^1)
cache[separator] = c
end
return c:match(self)
@@ -7542,6 +7542,32 @@ end
-- work that well; the parsing is ok, but dealing with the resulting
-- table is a pain because we need to work inside-out recursively
+local function do_first(a,b)
+ local t = { }
+ for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_second(a,b)
+ local t = { }
+ for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_both(a,b)
+ local t = { }
+ for sa in gmatch(a,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do
+ t[#t+1] = sa .. sb
+ end
+ end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_three(a,b,c)
+ return a .. b.. c
+end
+
local function splitpathexpr(str, t, validate)
-- no need for further optimization as it is only called a
-- few times, we can use lpeg for the sub; we could move
@@ -7551,28 +7577,6 @@ local function splitpathexpr(str, t, validate)
str = gsub(str,"{,","{@,")
-- str = "@" .. str .. "@"
local ok, done
- local function do_first(a,b)
- local t = { }
- for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_second(a,b)
- local t = { }
- for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_both(a,b)
- local t = { }
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
- t[#t+1] = sa .. sb
- end
- end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_three(a,b,c)
- return a .. b.. c
- end
while true do
done = false
while true do
@@ -8081,22 +8085,20 @@ function resolvers.split_path(str) -- overkill but i need to check this module a
if type(str) == 'table' then
return str
else
+ str = gsub(str,"\\","/")
local s = cache[str]
if s then
return s -- happens seldom
else
s = { }
end
- local t = { }
- splitpathexpr(str,t)
+ local t = string.checkedsplit(str,io.pathseparator) or { str }
for _, p in ipairs(t) do
- for _, pp in ipairs(split_kpse_path(p)) do
- s[#s+1] = pp
- end
+ splitpathexpr(p,s)
end
+ --~ print(str,table.serialize(s))
cache[str] = s
return s
- --~ return file.split_path(str)
end
end
diff --git a/scripts/context/stubs/mswin/luatools.lua b/scripts/context/stubs/mswin/luatools.lua
index a96474620..cd5e725d5 100644
--- a/scripts/context/stubs/mswin/luatools.lua
+++ b/scripts/context/stubs/mswin/luatools.lua
@@ -410,7 +410,7 @@ function string:checkedsplit(separator)
if not c then
separator = P(separator)
local other = C((1 - separator)^1)
- c = Ct(other * (separator^1 + other)^1)
+ c = Ct(other * (separator^1 * other)^1)
cache[separator] = c
end
return c:match(self)
@@ -4814,6 +4814,32 @@ end
-- work that well; the parsing is ok, but dealing with the resulting
-- table is a pain because we need to work inside-out recursively
+local function do_first(a,b)
+ local t = { }
+ for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_second(a,b)
+ local t = { }
+ for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_both(a,b)
+ local t = { }
+ for sa in gmatch(a,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do
+ t[#t+1] = sa .. sb
+ end
+ end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_three(a,b,c)
+ return a .. b.. c
+end
+
local function splitpathexpr(str, t, validate)
-- no need for further optimization as it is only called a
-- few times, we can use lpeg for the sub; we could move
@@ -4823,28 +4849,6 @@ local function splitpathexpr(str, t, validate)
str = gsub(str,"{,","{@,")
-- str = "@" .. str .. "@"
local ok, done
- local function do_first(a,b)
- local t = { }
- for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_second(a,b)
- local t = { }
- for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_both(a,b)
- local t = { }
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
- t[#t+1] = sa .. sb
- end
- end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_three(a,b,c)
- return a .. b.. c
- end
while true do
done = false
while true do
@@ -5353,22 +5357,20 @@ function resolvers.split_path(str) -- overkill but i need to check this module a
if type(str) == 'table' then
return str
else
+ str = gsub(str,"\\","/")
local s = cache[str]
if s then
return s -- happens seldom
else
s = { }
end
- local t = { }
- splitpathexpr(str,t)
+ local t = string.checkedsplit(str,io.pathseparator) or { str }
for _, p in ipairs(t) do
- for _, pp in ipairs(split_kpse_path(p)) do
- s[#s+1] = pp
- end
+ splitpathexpr(p,s)
end
+ --~ print(str,table.serialize(s))
cache[str] = s
return s
- --~ return file.split_path(str)
end
end
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 4ed4dbdd1..538d394a7 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -419,7 +419,7 @@ function string:checkedsplit(separator)
if not c then
separator = P(separator)
local other = C((1 - separator)^1)
- c = Ct(other * (separator^1 + other)^1)
+ c = Ct(other * (separator^1 * other)^1)
cache[separator] = c
end
return c:match(self)
@@ -7542,6 +7542,32 @@ end
-- work that well; the parsing is ok, but dealing with the resulting
-- table is a pain because we need to work inside-out recursively
+local function do_first(a,b)
+ local t = { }
+ for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_second(a,b)
+ local t = { }
+ for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_both(a,b)
+ local t = { }
+ for sa in gmatch(a,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do
+ t[#t+1] = sa .. sb
+ end
+ end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_three(a,b,c)
+ return a .. b.. c
+end
+
local function splitpathexpr(str, t, validate)
-- no need for further optimization as it is only called a
-- few times, we can use lpeg for the sub; we could move
@@ -7551,28 +7577,6 @@ local function splitpathexpr(str, t, validate)
str = gsub(str,"{,","{@,")
-- str = "@" .. str .. "@"
local ok, done
- local function do_first(a,b)
- local t = { }
- for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_second(a,b)
- local t = { }
- for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_both(a,b)
- local t = { }
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
- t[#t+1] = sa .. sb
- end
- end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_three(a,b,c)
- return a .. b.. c
- end
while true do
done = false
while true do
@@ -8081,22 +8085,20 @@ function resolvers.split_path(str) -- overkill but i need to check this module a
if type(str) == 'table' then
return str
else
+ str = gsub(str,"\\","/")
local s = cache[str]
if s then
return s -- happens seldom
else
s = { }
end
- local t = { }
- splitpathexpr(str,t)
+ local t = string.checkedsplit(str,io.pathseparator) or { str }
for _, p in ipairs(t) do
- for _, pp in ipairs(split_kpse_path(p)) do
- s[#s+1] = pp
- end
+ splitpathexpr(p,s)
end
+ --~ print(str,table.serialize(s))
cache[str] = s
return s
- --~ return file.split_path(str)
end
end
diff --git a/scripts/context/stubs/unix/luatools b/scripts/context/stubs/unix/luatools
index a96474620..cd5e725d5 100755
--- a/scripts/context/stubs/unix/luatools
+++ b/scripts/context/stubs/unix/luatools
@@ -410,7 +410,7 @@ function string:checkedsplit(separator)
if not c then
separator = P(separator)
local other = C((1 - separator)^1)
- c = Ct(other * (separator^1 + other)^1)
+ c = Ct(other * (separator^1 * other)^1)
cache[separator] = c
end
return c:match(self)
@@ -4814,6 +4814,32 @@ end
-- work that well; the parsing is ok, but dealing with the resulting
-- table is a pain because we need to work inside-out recursively
+local function do_first(a,b)
+ local t = { }
+ for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_second(a,b)
+ local t = { }
+ for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_both(a,b)
+ local t = { }
+ for sa in gmatch(a,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do
+ t[#t+1] = sa .. sb
+ end
+ end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_three(a,b,c)
+ return a .. b.. c
+end
+
local function splitpathexpr(str, t, validate)
-- no need for further optimization as it is only called a
-- few times, we can use lpeg for the sub; we could move
@@ -4823,28 +4849,6 @@ local function splitpathexpr(str, t, validate)
str = gsub(str,"{,","{@,")
-- str = "@" .. str .. "@"
local ok, done
- local function do_first(a,b)
- local t = { }
- for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_second(a,b)
- local t = { }
- for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_both(a,b)
- local t = { }
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
- t[#t+1] = sa .. sb
- end
- end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_three(a,b,c)
- return a .. b.. c
- end
while true do
done = false
while true do
@@ -5353,22 +5357,20 @@ function resolvers.split_path(str) -- overkill but i need to check this module a
if type(str) == 'table' then
return str
else
+ str = gsub(str,"\\","/")
local s = cache[str]
if s then
return s -- happens seldom
else
s = { }
end
- local t = { }
- splitpathexpr(str,t)
+ local t = string.checkedsplit(str,io.pathseparator) or { str }
for _, p in ipairs(t) do
- for _, pp in ipairs(split_kpse_path(p)) do
- s[#s+1] = pp
- end
+ splitpathexpr(p,s)
end
+ --~ print(str,table.serialize(s))
cache[str] = s
return s
- --~ return file.split_path(str)
end
end
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 4ed4dbdd1..538d394a7 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -419,7 +419,7 @@ function string:checkedsplit(separator)
if not c then
separator = P(separator)
local other = C((1 - separator)^1)
- c = Ct(other * (separator^1 + other)^1)
+ c = Ct(other * (separator^1 * other)^1)
cache[separator] = c
end
return c:match(self)
@@ -7542,6 +7542,32 @@ end
-- work that well; the parsing is ok, but dealing with the resulting
-- table is a pain because we need to work inside-out recursively
+local function do_first(a,b)
+ local t = { }
+ for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_second(a,b)
+ local t = { }
+ for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_both(a,b)
+ local t = { }
+ for sa in gmatch(a,"[^,]+") do
+ for sb in gmatch(b,"[^,]+") do
+ t[#t+1] = sa .. sb
+ end
+ end
+ return "{" .. concat(t,",") .. "}"
+end
+
+local function do_three(a,b,c)
+ return a .. b.. c
+end
+
local function splitpathexpr(str, t, validate)
-- no need for further optimization as it is only called a
-- few times, we can use lpeg for the sub; we could move
@@ -7551,28 +7577,6 @@ local function splitpathexpr(str, t, validate)
str = gsub(str,"{,","{@,")
-- str = "@" .. str .. "@"
local ok, done
- local function do_first(a,b)
- local t = { }
- for s in gmatch(b,"[^,]+") do t[#t+1] = a .. s end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_second(a,b)
- local t = { }
- for s in gmatch(a,"[^,]+") do t[#t+1] = s .. b end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_both(a,b)
- local t = { }
- for sa in gmatch(a,"[^,]+") do
- for sb in gmatch(b,"[^,]+") do
- t[#t+1] = sa .. sb
- end
- end
- return "{" .. concat(t,",") .. "}"
- end
- local function do_three(a,b,c)
- return a .. b.. c
- end
while true do
done = false
while true do
@@ -8081,22 +8085,20 @@ function resolvers.split_path(str) -- overkill but i need to check this module a
if type(str) == 'table' then
return str
else
+ str = gsub(str,"\\","/")
local s = cache[str]
if s then
return s -- happens seldom
else
s = { }
end
- local t = { }
- splitpathexpr(str,t)
+ local t = string.checkedsplit(str,io.pathseparator) or { str }
for _, p in ipairs(t) do
- for _, pp in ipairs(split_kpse_path(p)) do
- s[#s+1] = pp
- end
+ splitpathexpr(p,s)
end
+ --~ print(str,table.serialize(s))
cache[str] = s
return s
- --~ return file.split_path(str)
end
end