lua-users home
lua-l archive

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


I have been fascinated by Lpeg. One thing, though, that I have
found difficult is how to use Lpeg in a way that reports
useful error messages when a pattern fails. I would like to see
some educational recipes that cope with this.
When lpeg.match succeeds on its arguments it may return all
sorts of non-nil values, depending on what capture facilities
the pattern-argument has been endowed with. But when it fails
it returns nil. What else does it return after the nil? It
would be useful for error handling if as much of the lpeg-vm
state as possible was also returned. The manual does not say
anything about this as far as I can see.

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/