[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Multiple captures with patt/function in LPEG
- From: Paul K <paul@...>
- Date: Fri, 29 Aug 2014 06:42:31 +0000
Hi All,
I have this small issue with an LPEG capture pattern I'm working with
and hope someone can explain what may be going on. I'm missing
something simple here, but I can't figure out why I only get one
capture with the following:
lpeg.match(((lpeg.Cp() * lpeg.R('04')) / print)^1, "4123")
This prints 1 2 3 4 (four lines), which is what the positions of the
matches are. If I remove Cp, I get 4 1 2 3 (four lines), which is what
I expect. Why don't I get
1 4
2 1
3 2
4 3
from the first example? I expect "print" to get "all captures made by
patt as arguments", which are 1 (from Cp) and 4 from R('04'), no?
Thank you.
Paul.