summaryrefslogtreecommitdiff
path: root/tex/context/base/l-dir.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2008-04-18 14:17:00 +0200
committerHans Hagen <pragma@wxs.nl>2008-04-18 14:17:00 +0200
commitd948cb4eddff16f17051d8078b4c55cdd8e8f681 (patch)
tree633b47f4e9bf041c8b17002daf06d7e735bbc7b7 /tex/context/base/l-dir.lua
parent66c43ffc47e4bf28c112bc5c593d1853212f7715 (diff)
downloadcontext-d948cb4eddff16f17051d8078b4c55cdd8e8f681.tar.gz
stable 2008.04.18 14:17
Diffstat (limited to 'tex/context/base/l-dir.lua')
-rw-r--r--tex/context/base/l-dir.lua57
1 files changed, 29 insertions, 28 deletions
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua
index 0600d72fa..b6c70d264 100644
--- a/tex/context/base/l-dir.lua
+++ b/tex/context/base/l-dir.lua
@@ -85,29 +85,29 @@ if lfs then do
dir.glob_pattern = glob_pattern
- local function glob(pattern, action)
- local t = { }
- local path, rest, patt, recurse
- local action = action or function(name) t[#t+1] = name end
- local pattern = pattern:gsub("^%*%*","./**")
- local pattern = pattern:gsub("/%*/","/**/")
- path, rest = pattern:match("^(/)(.-)$")
- if path then
- path = path
- else
- path, rest = pattern:match("^([^/]*)/(.-)$")
- end
- if rest then
- patt = rest:gsub("([%.%-%+])", "%%%1")
- end
- patt = patt:gsub("%*", "[^/]*")
- patt = patt:gsub("%?", "[^/]")
- patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*")
- if path == "" then path = "." end
- recurse = patt:find("%.%*/") ~= nil
- glob_pattern(path,patt,recurse,action)
- return t
- end
+ --~ local function glob(pattern, action)
+ --~ local t = { }
+ --~ local path, rest, patt, recurse
+ --~ local action = action or function(name) t[#t+1] = name end
+ --~ local pattern = pattern:gsub("^%*%*","./**")
+ --~ local pattern = pattern:gsub("/%*/","/**/")
+ --~ path, rest = pattern:match("^(/)(.-)$")
+ --~ if path then
+ --~ path = path
+ --~ else
+ --~ path, rest = pattern:match("^([^/]*)/(.-)$")
+ --~ end
+ --~ if rest then
+ --~ patt = rest:gsub("([%.%-%+])", "%%%1")
+ --~ end
+ --~ patt = patt:gsub("%*", "[^/]*")
+ --~ patt = patt:gsub("%?", "[^/]")
+ --~ patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*")
+ --~ if path == "" then path = "." end
+ --~ recurse = patt:find("%.%*/") ~= nil
+ --~ glob_pattern(path,patt,recurse,action)
+ --~ return t
+ --~ end
local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V
@@ -121,13 +121,13 @@ if lfs then do
P("**") / ".*" +
P("*") / "[^/]*" +
P("?") / "[^/]" +
- P(".") / "%." +
- P("+") / "%+" +
- P("-") / "%-" +
+ P(".") / "%%." +
+ P("+") / "%%+" +
+ P("-") / "%%-" +
P(1)
)^0 )
- function glob(str)
+ local function glob(str)
local split = pattern:match(str)
if split then
local t = { }
@@ -136,7 +136,8 @@ if lfs then do
local recurse = base:find("**")
local start = root .. path
local result = filter:match(start .. base)
- -- print(str, start, result)
+--~ print(str, start, result)
+--~ print(start, result)
glob_pattern(start,result,recurse,action)
return t
else