[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPEG filtering
- From: Gavin Wraith <gavin@...>
- Date: Tue, 03 Jun 2008 21:01:58 +0100
In message <87bq2iik8l.fsf@catnip.gol.com> you wrote:
> Mark Hamburg <mark_hamburg@baymoon.com> writes:
> > Is it possible as part of the semantic action/capture logic in LPEG to
> > attach filter functions? For example, could I match a number using the
> > LPEG patterns and then range check it with a Lua function? Or would I
> > need to do that work after the pattern match finishes?
If you are using Lpeg 8 then you can use lpeg.Cmt to evaluate the
capture before the pattern-matching finishes. See the docs for
Lpeg 8 and the example on the wiki of a pattern that matches
only sequences of consecutive integers.
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/