[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Parse error handling
- From: Gavin Wraith <gavin@...>
- Date: Tue, 29 Apr 2008 22:23:07 +0100
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/