lua-users home
lua-l archive

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


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/