summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-12-06 15:01:00 +0100
committerHans Hagen <pragma@wxs.nl>2012-12-06 15:01:00 +0100
commit2edaa5d6e850eab3fc4049ebb5e0159c141123a6 (patch)
tree0fb973e523623f0be5e33556db9e83fedae10335 /tex/generic
parent423ef4bd246d904114fc4498ef9a28d28af71de7 (diff)
downloadcontext-2edaa5d6e850eab3fc4049ebb5e0159c141123a6.tar.gz
beta 2012.12.06 15:01
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua166
1 files changed, 85 insertions, 81 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 8cad5d838..e4c16421f 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 12/06/12 12:15:07
+-- merge date : 12/06/12 15:01:05
do -- begin closure to overcome local limits and interference
@@ -2444,15 +2444,15 @@ function file.collapsepath(str,anchor)
end
end
---~ local function test(str)
---~ print(string.format("%-20s %-15s %-15s",str,file.collapsepath(str),file.collapsepath(str,true)))
---~ end
---~ test("a/b.c/d") test("b.c/d") test("b.c/..")
---~ test("/") test("c:/..") test("sys://..")
---~ test("") test("./") test(".") test("..") test("./..") test("../..")
---~ test("a") test("./a") test("/a") test("a/../..")
---~ test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..")
---~ test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..")
+-- local function test(str)
+-- print(string.format("%-20s %-15s %-15s",str,file.collapsepath(str),file.collapsepath(str,true)))
+-- end
+-- test("a/b.c/d") test("b.c/d") test("b.c/..")
+-- test("/") test("c:/..") test("sys://..")
+-- test("") test("./") test(".") test("..") test("./..") test("../..")
+-- test("a") test("./a") test("/a") test("a/../..")
+-- test("a/./b/..") test("a/aa/../b/bb") test("a/.././././b/..") test("a/./././b/..")
+-- test("a/b/c/../..") test("./a/b/c/../..") test("a/b/c/../..")
function file.robustname(str,strict)
str = gsub(str,"[^%a%d%/%-%.\\]+","-")
@@ -2463,6 +2463,20 @@ function file.robustname(str,strict)
end
end
+-- local pattern_a = lpeg.replacer(1-R("az","09","AZ","--",".."))
+-- local pattern_a = Cs((R("az","09","AZ","--","..") + P(1)/"-")^1)
+-- local whatever = P("-")^0 / ""
+-- local pattern_b = Cs(whatever * (1 - whatever * -1)^1)
+
+-- function file.robustname(str,strict)
+-- str = lpegmatch(pattern_a,str) or str
+-- if strict then
+-- return lpegmatch(pattern_b,str) or str -- two step is cleaner (less backtracking)
+-- else
+-- return str
+-- end
+-- end
+
file.readdata = io.loaddata
file.savedata = io.savedata
@@ -2472,92 +2486,82 @@ end
-- lpeg variants, slightly faster, not always
---~ local period = P(".")
---~ local slashes = S("\\/")
---~ local noperiod = 1-period
---~ local noslashes = 1-slashes
---~ local name = noperiod^1
+-- local period = P(".")
+-- local slashes = S("\\/")
+-- local noperiod = 1-period
+-- local noslashes = 1-slashes
+-- local name = noperiod^1
---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
+-- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * C(noperiod^1) * -1
---~ function file.suffixonly(name)
---~ return lpegmatch(pattern,name) or ""
---~ end
+-- function file.suffixonly(name)
+-- return lpegmatch(pattern,name) or ""
+-- end
---~ local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
+-- local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
---~ function file.removesuffix(name)
---~ return lpegmatch(pattern,name)
---~ end
+-- function file.removesuffix(name)
+-- return lpegmatch(pattern,name)
+-- end
---~ local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
+-- local pattern = (noslashes^0 * slashes)^1 * C(noslashes^1) * -1
---~ function file.basename(name)
---~ return lpegmatch(pattern,name) or name
---~ end
+-- function file.basename(name)
+-- return lpegmatch(pattern,name) or name
+-- end
---~ local pattern = (noslashes^0 * slashes)^1 * Cp() * noslashes^1 * -1
+-- local pattern = Cs ((1 - slashes * noslashes^1 * -1)^1)
---~ function file.dirname(name)
---~ local p = lpegmatch(pattern,name)
---~ if p then
---~ return sub(name,1,p-2)
---~ else
---~ return ""
---~ end
---~ end
+-- function file.dirname(name)
+-- return lpegmatch(pattern,name) or ""
+-- end
---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
+-- local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
---~ function file.addsuffix(name, suffix)
---~ local p = lpegmatch(pattern,name)
---~ if p then
---~ return name
---~ else
---~ return name .. "." .. suffix
---~ end
---~ end
+-- function file.addsuffix(name, suffix)
+-- local p = lpegmatch(pattern,name)
+-- if p then
+-- return name
+-- else
+-- return name .. "." .. suffix
+-- end
+-- end
---~ local pattern = (noslashes^0 * slashes)^0 * (noperiod^1 * period)^1 * Cp() * noperiod^1 * -1
+-- local suffix = period * (1-period-slashes)^1 * -1
+-- local pattern = Cs((1-suffix)^1)
---~ function file.replacesuffix(name,suffix)
---~ local p = lpegmatch(pattern,name)
---~ if p then
---~ return sub(name,1,p-2) .. "." .. suffix
---~ else
---~ return name .. "." .. suffix
---~ end
---~ end
+-- function file.replacesuffix(name,suffix)
+-- if suffix and suffix ~= "" then
+-- return lpegmatch(pattern,name) .. "." .. suffix
+-- else
+-- return name
+-- end
+-- end
---~ local pattern = (noslashes^0 * slashes)^0 * Cp() * ((noperiod^1 * period)^1 * Cp() + P(true)) * noperiod^1 * -1
+-- local path = noslashes^0 * slashes^1
+-- local suffix = period * (1-period-slashes)^1 * -1
+-- local pattern = path^0 * Cs((1-suffix)^1) * suffix^0
---~ function file.nameonly(name)
---~ local a, b = lpegmatch(pattern,name)
---~ if b then
---~ return sub(name,a,b-2)
---~ elseif a then
---~ return sub(name,a)
---~ else
---~ return name
---~ end
---~ end
+-- function file.nameonly(name)
+-- return lpegmatch(pattern,name) or name
+-- end
---~ local test = file.suffixonly
---~ local test = file.basename
---~ local test = file.dirname
---~ local test = file.addsuffix
---~ local test = file.replacesuffix
---~ local test = file.nameonly
-
---~ print(1,test("./a/b/c/abd.def.xxx","!!!"))
---~ print(2,test("./../b/c/abd.def.xxx","!!!"))
---~ print(3,test("a/b/c/abd.def.xxx","!!!"))
---~ print(4,test("a/b/c/def.xxx","!!!"))
---~ print(5,test("a/b/c/def","!!!"))
---~ print(6,test("def","!!!"))
---~ print(7,test("def.xxx","!!!"))
-
---~ local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim)
+-- local test = file.suffixonly
+-- local test = file.basename
+-- local test = file.dirname
+-- local test = file.addsuffix
+-- local test = file.replacesuffix
+-- local test = file.nameonly
+
+-- print(1,test("./a/b/c/abd.def.xxx","!!!"))
+-- print(2,test("./../b/c/abd.def.xxx","!!!"))
+-- print(3,test("a/b/c/abd.def.xxx","!!!"))
+-- print(4,test("a/b/c/def.xxx","!!!"))
+-- print(5,test("a/b/c/def","!!!"))
+-- print(6,test("def","!!!"))
+-- print(7,test("def.xxx","!!!"))
+
+-- local tim = os.clock() for i=1,250000 do local ext = test("abd.def.xxx","!!!") end print(os.clock()-tim)
-- also rewrite previous