[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lpeg-list match time capture discrepancy
- From: Wesley Smith <wesley.hoke@...>
- Date: Sat, 27 Mar 2010 16:45:54 +0100
There seems to be a discrepancy with match-time captures in lpeg-list
as compared to lpeg itself. Switching between strings and lists
creates errors saying "invalid position returned by match-time
capture".
local code = "ab"
--local code = {"a", "b"}
local patt = m.L"a" * m.Cmt(
m.L"b",
function(s, i)
return i
end
)
print(patt:match(code))
I would think that any match-time capture returning the index passed
in to it's second argument (function) would not produce an error, but
when the stream being matched is a list, it causes an error if the
match position is the last element in the list. Am I
misunderstanding match-time lists or is this a bug?
thanks,
wes