[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Distinguishing LPeg match failure reasons
- From: Jakub Piotr Cłapa <jpc-ml@...>
- Date: Tue, 30 Aug 2011 11:35:34 +0200
On 30.08.11 04:28, Patrick Donnelly wrote:
On Mon, Aug 29, 2011 at 10:07 PM, Jakub Piotr Cłapa<firstname.lastname@example.org> wrote:
 may help.
Thanks. This is in fact one of the few things I have seen while googling
for a solution. But IIUC for it to work I would have to alternate each
character of each rule with an lpeg.Cmt checking i == #s.
I think I need a way to detect that lpeg tried to match beyond the end
of the string. If it did (and I did not add lpeg.P(-1) at the end of the
main rule) then I know that it failed because of too little data.
The problem with most "normal" solutions is that I after a match failure
the capture is immediately unwound and I do not know anything about it.
If I add an alternative then it will start from the beginning and a
pattern concatenation will never be reached when something failes before it.
Jakub Piotr Cłapa