lua-users home
lua-l archive

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


> Here is a small testcase (note that shortening the string eliminates the
> error):
> 
> local lpeg = require 'lpeg'
> local P,Cs,Cmt = lpeg.P, lpeg.Cs, lpeg.Cmt
> local pat1 = P"a" / "b" + Cmt(P"c", function(_,p) return p,"d" end) + P(1)
> local pat = Cs(pat1^1)
> print(pat:match("abcdabcdabcdabcdabcdabcdabcdabc"))'
> 
> -- 
> Andrew.

What is above test code supposed to show ?
I tried it on lpeg 1.0.1 without problem ...

OTTH, if string is longer than ('abcd'):rep(5510), it did *crash*
Your 1 char patch, (n + 2) to (n + 1) seems to fix it.

Thanks.