[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPeg 0.9 bug (works in 0.8.1)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 17 Aug 2010 09:38:39 -0300
> [...]
> That would seem to indicate that the #lpeg.P(1) is not failing at the
> end of the input.
>
> If I replace #lpeg.P(1) with lpeg.P(1) it works, though since it consumes
> a character it makes writing the reported error position off by one.
>
> Any ideas?
This is a bug. It will be fixed in the next version. You may fix it
removing a wrong optimization in function 'pattand_l' (lpeg.c:1285):
if (isfail(p1) || issucc(p1))
lua_pushvalue(L, 1); /* &fail == fail; &true == true */
- else if (tocharset(p1, &st1) == ISCHARSET) {
- Instruction *p = newpatt(L, CHARSETINSTSIZE + 1);
- setinst(p, ISet, CHARSETINSTSIZE + 1);
- loopset(i, p[1].buff[i] = ~st1.cs[i]);
- setinst(p + CHARSETINSTSIZE, IFail, 0);
- }
else {
Instruction *p = newpatt(L, 1 + l1 + 2);
setinst(p++, IChoice, 1 + l1 + 1);
-- Roberto