[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lpeg re.lua bug and provided fix
- From: albertmcchan <albertmcchan@...>
- Date: Tue, 30 Jan 2018 21:50:20 -0500
= re.match("aaand", "[a]^2")
.\re.lua: attempt to perform arithmetic on local 'p' (a string value)
the fix is simple, just make sure class range ALWAYS return lpeg object
Since class complement function always run, just fix it:
< function(c, p) return c == "^" and any - p or p end
---
> function(c, p) return c == "^" and any - p or m.P(p) end
redo above
= re.match("aaand", "[a]^2")
3