[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lpeg recursive patterns, bug ?
- From: Tony Finch <dot@...>
- Date: Mon, 21 Feb 2011 14:26:11 +0000
On Mon, 21 Feb 2011, Wim Langers wrote:
> The actual pattern creates objects from the match time captures. Since the
> data has a tree structure these objects combined with other data generate
> encapsulating objects etc...
That doesn't require match-time captures. You only need match-time
captures if you need to use Lua code to determine whether or not a match
occurred. Just constructing a parse tree should be done with normal
captures.
> Your explanation sounds logical (given my very limited knowledge of LPEG),
> but then why does the following example behave "as expected" (my pattern
> further stripped down) ?
No match-time captures. Normal captures are evaluated after matching has
completed, after all backtracking has been resolved.
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
Irish Sea: Southeast 4 or 5, occasionally 6 at first. Moderate becoming
slight. Occasional rain. Moderate or good, occasionally poor.