[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Distinguishing LPeg match failure reasons
- From: Patrick Donnelly <batrick@...>
- Date: Mon, 29 Aug 2011 22:28:27 -0400
On Mon, Aug 29, 2011 at 10:07 PM, Jakub Piotr Cłapa <jpc-ml@zenburn.net> wrote:
> Hello everyone,
>
> I am writing a simple parser in LPeg and I would like to know if my the
> match failed because it reached the end of string or if it run into an
> invalid input character. By distinguishing these two cases I could wait for
> more input instead of raising an error when given incomplete data.
>
> In both these cases lpeg.match returns nil and I cannot think of any clever
> way to check how the match failed.
>
> I am sure somebody must have faced a similar problem before but I could not
> find anything on Google.
[1] may help.
[1] http://lua-users.org/lists/lua-l/2009-10/msg00774.html
--
- Patrick Donnelly