From c2680687d148820847607e13ed7100e60d94c79e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 19 Jul 2019 16:55:37 -0300 Subject: Bug: IBackCommit must remove dynamic captures, too Like a fail, a IBackCommit instruction must remove any dynamic capture made inside an 'and' pattern. (The added test for this problem needs assertions on to detect the bug.) --- test.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test.lua') diff --git a/test.lua b/test.lua index 403aa09..4263ff4 100755 --- a/test.lua +++ b/test.lua @@ -1032,6 +1032,17 @@ local function id (s, i, ...) return true, ... end +do -- run-time capture in an end predicate (should discard its value) + local x = 0 + function foo (s, i) + x = x + 1 + return true, x + end + + local p = #(m.Cmt("", foo) * "xx") * m.Cmt("", foo) + assert(p:match("xx") == 2) +end + assert(m.Cmt(m.Cs((m.Cmt(m.S'abc' / { a = 'x', c = 'y' }, id) + m.R'09'^1 / string.char + m.P(1))^0), id):match"acb98+68c" == "xyb\98+\68y") -- cgit v1.2.3-55-g6feb