[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] LPeg 0.11
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 3 Apr 2013 09:35:08 -0300
> [So basically I could just define my suggested "lpeg.flush" like:
>
> function lpeg_flush (pattern)
> return lpeg.Cmt (pattern, function () return true end)
> end
Yes. (This "flush" flushes all captures and throws away any occasional
results.)
> Are you saying I can just do:
>
> FILE =
> (lpeg.P"begin"
> * lpeg.Cmt(SUPER_COMPLEX_GRAMMAR_WITH_LOTS_OF_CAPTURES,
> function () return true end)^0
> * lpeg.P"end")
>
> ?
Yes.
> Will the use of Cmt here affect the speed of
> SUPER_COMPLEX_GRAMMAR_WITH_LOTS_OF_CAPTURES?
Only real measure can answer that question, but a match-time capture is
only a little more expensive than a function capture (the kind you are
already using to create your side effects).
-- Roberto