[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPeg captures into a table
- From: Sean Conner <sean@...>
- Date: Tue, 4 Aug 2015 11:53:39 -0400
It was thus said that the Great Patrick Donnelly once stated:
>
> What's wrong with using a back capture for the table and then using a
> function capture? Something like:
>
> patt = lpeg.P {
> foo = lpeg.Cg(lpeg.Ct "", "tab") * V "bar";
> bar = (lpeg.Cb("tab") * V "stuff") / function (t, ...) end;
> }
>
> Best part is that you can have nested matches of foo and the most
> "complete outermost capture" [1] of "tab" is used in bar. I use this
> to great effect in my lua formatter [2].
I've never had luck with back captures as I can't seem to grok what
exactly they are or how they work.
-spc