diff -r 6700d4722be7 -r a40db377a1b5 ndp.lua --- a/ndp.lua Sun Jun 21 19:13:16 2009 +0100 +++ b/ndp.lua Sun Jun 21 19:16:54 2009 +0100 @@ -157,9 +157,9 @@ } local ret, min_pos, max_pos; + local function check_min_pos(start) start = start - 1; if not min_pos or start < min_pos then min_pos = start; end end; for _, pattern in pairs(patterns) do - ret = lpeg.match(lpeg.P{ lpeg.Cp()*pattern[1] + 1 * lpeg.V(1) } - /function (start) start = start - 1; if not min_pos or start < min_pos then min_pos = start; end end, str); + ret = lpeg.match(lpeg.P{ lpeg.Cp()*pattern[1] + 1 * lpeg.V(1) }/check_min_pos, str); if ret then if not max_pos or ret > max_pos then max_pos = ret; end --print("Matches ".._.." until "..ret);