lua-users home
lua-l archive

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


Ok ,

Thanks for explaining that to me.  I changed my code to use "patt / function" instead and I'm back on track (a wiser man, trying to hunt down the original problem :-)

Cheers ,

Wim


On Mon, Feb 21, 2011 at 3:26 PM, Tony Finch <dot@dotat.at> wrote:
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.