lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I read test.lua script from lpeg-0.9 and had a little confusion to code snippet below:
t = {m.match({[1] = m.C(m.C(1) * m.V(1) + -1)}, "abc")}
checkeq(t, {"abc", "a", "bc", "b", "c", "c", ""})
Who could give me some comments of above code? Why the output is {"abc", "a", "bc", "b", "c", "c", ""} sequence?
The same question was given as following too,
t = m.match(m.Ct(m.C(m.C(1) * 1 * m.C(1))), "alo")
checkeq(t, {"alo", "a", "o"}) 
Thanks a lot.