[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Distinguishing LPeg match failure reasons
- From: Jakub Piotr Cłapa <jpc-ml@...>
- Date: Tue, 30 Aug 2011 04:07:00 +0200
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.
Jakub Piotr Cłapa