diff options
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 6d9982f64..f18b9f83d 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 11/20/09 18:25:17 +-- merge date : 11/21/09 11:50:03 do -- begin closure to overcome local limits and interference @@ -375,8 +375,8 @@ function string:checkedsplit(separator) local c = cache[separator] if not c then separator = P(separator) - local other = C((1 - separator)^1) - c = Ct(other * (separator^1 * other)^1) + local other = C((1 - separator)^0) + c = Ct(separator^0 * other * (separator^1 * other)^0) cache[separator] = c end return c:match(self) @@ -1437,12 +1437,8 @@ function file.dirname(name,default) return match(name,"^(.+)[/\\].-$") or (default or "") end ---~ function file.basename(name) ---~ return match(name,"^.+[/\\](.-)$") or name ---~ end - function file.basename(name) - return match(name,"^.*[/\\](.-)$") or name + return match(name,"^.+[/\\](.-)$") or name end function file.nameonly(name) @@ -1488,39 +1484,27 @@ end file.is_readable = file.isreadable file.is_writable = file.iswritable -local checkedsplit = string.checkedsplit +-- todo: lpeg -local winpath = (lpeg.R("AZ","az") * lpeg.P(":") * lpeg.P("/")) -local separator = lpeg.P(":") + lpeg.P(";") -local rest = (1-separator)^1 -local somepath = winpath * rest + rest -local splitter = lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0) +--~ function file.split_path(str) +--~ local t = { } +--~ str = gsub(str,"\\", "/") +--~ str = gsub(str,"(%a):([;/])", "%1\001%2") +--~ for name in gmatch(str,"([^;:]+)") do +--~ if name ~= "" then +--~ t[#t+1] = gsub(name,"\001",":") +--~ end +--~ end +--~ return t +--~ end + +local checkedsplit = string.checkedsplit function file.split_path(str,separator) str = gsub(str,"\\","/") - if separator then - return checkedsplit(str,separator) or { } - else - return splitter:match(str) or { } - end + return checkedsplit(str,separator or io.pathseparator) end --- special one for private usage - ---~ local winpath = lpeg.P("!!")^-1 * winpath ---~ local splitter= lpeg.Ct(lpeg.C(somepath) * (separator^1 + lpeg.C(somepath))^0) - ---~ function file.split_kpse_path(str) ---~ str = gsub(str,"\\","/") ---~ return splitter:match(str) or { } ---~ end - --- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]] --- --- str = os.getenv("PATH") -- --- str = [[/opt/texlive/2009/bin/i386-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/mine/bin:/home/mine/.local/bin]] --- str = [[c:/oeps:whatever]] - function file.join_path(tab) return concat(tab,io.pathseparator) -- can have trailing // end |