lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Here's a bug that I found in lpeg-0.5... compare the two transcripts
> below, the output "foo>" is wrong.
> 
> [...]

Many thanks for the feedback. Follows the patch:

@@ -467,7 +467,7 @@
         assert(captop > 0);
         if (capture[captop - 1].siz == 0 &&
             s - capture[captop - 1].s < UCHAR_MAX) {
-          capture[captop - 1].siz = s - capture[captop - 1].s + 1;
+          capture[captop - 1].siz = (s - getoff(p)) - capture[captop - 1].s + 1;
           p++;
           continue;
         }


-- Roberto