Branch: refs/heads/yves/fix_accept
Home: https://github.com/Perl/perl5
Commit: a082ad05d7af46438517cbd650b4324b8375198e
https://github.com/Perl/perl5/commit/a082ad05d7af46438517cbd650b4324b8375198e
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M regcomp.c
Log Message:
-----------
regcomp.c: ACCEPT inside of a (...)+ should disable mandatory substrings
GH Issue #19484 reported that
print "ABDE" =~ /(A (A|B(*ACCEPT)|C)+ D)(E)/x ? "yes: <$1-$2>" : "no";
does not output the expected 'AB-B', and instead does not match.
Removing the + quantifier behaves as expected.
This patch is 1/4 and fixes part of the problem: the regex optimizer
S_study_chunk() was not handling the ACCEPT properly and assuming the
pattern MUST contain 'A' and 'DE', however this is wrong, the ACCEPT
means that it must only contain 'A' and the 'DE' is actually optional.
Commit: c59757b9f43c9466fe016c887f7e64ea89580c38
https://github.com/Perl/perl5/commit/c59757b9f43c9466fe016c887f7e64ea89580c38
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M regexec.c
Log Message:
-----------
regexec.c: Fix up for ACCEPT inside of a (...)+ set lastopen in CURLYM
GH Issue #19484 reported that
print "ABDE" =~ /(A (A|B(*ACCEPT)|C)+ D)(E)/x ? "yes: <$1-$2>" : "no";
does not output the expected 'AB-B', and instead does not match.
Removing the + quantifier behaves as expected.
This patch is 2/4 and fixes part of the problem: lastopen was not
being set properly inside of the CURLYM optimization. lastopen is used
by the ACCEPT logic to know which parens need to be closed.
Commit: f4dc3573b1a0e112c99459df98b2f6fd3fa5c9f4
https://github.com/Perl/perl5/commit/f4dc3573b1a0e112c99459df98b2f6fd3fa5c9f4
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M regexec.c
Log Message:
-----------
regexec.c: ACCEPT inside of a (...)+ should stop looping (CURLYM optimization)
GH Issue #19484 reported that
print "ABDE" =~ /(A (A|B(*ACCEPT)|C)+ D)(E)/x ? "yes: <$1-$2>" : "no";
does not output the expected 'AB-B', and instead does not match.
Removing the + quantifier behaves as expected.
This patch is 3/4 and fixes part of the problem: the CURLYM optimization
was not terminating its loop properly when it contained an ACCEPT. This
patch adds a new variable 'is_accepted' which is used to ensure that the
CURLYM optimization stops after an ACCEPT regop is executed.
Commit: ccbf866c82310bc2a259369492dcd6e79d73f303
https://github.com/Perl/perl5/commit/ccbf866c82310bc2a259369492dcd6e79d73f303
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M regexec.c
Log Message:
-----------
regexec.c: make ACCEPT close logic handle SUCCEED/LOOKBEHIND_END opcodes
GH Issue #19484 reported that
print "ABDE" =~ /(A (A|B(*ACCEPT)|C)+ D)(E)/x ? "yes: <$1-$2>" : "no";
does not output the expected 'AB-B', and instead does not match.
Removing the + quantifier behaves as expected.
This patch is 4/4 of the patches to fix this problem: SUCCEED and
LOOKBEHIND_END regops are type 'END' which have a next_off of 0. This
was causing regnext() to return null inside of the loop iterator for the
logic in ACCEPT which closes any open capture buffers thus terminating
the loop prematurely and preventing some of the capture buffers from
being properly closed. SUCCEED is used to end a variety of structures,
including lookahead IFMATCH and UNLESSM, SUSPEND, and CURLYM, and
LOOKBEHIND_END serves the same purpose for lookbehind IFMATCH and
UNLESSM. Thus this patch fixes the original bug but also fixes a variety
of other cases involving ACCEPT.
Commit: 376470a5d56b24fc17bcbbdbfc1689fd59c35504
https://github.com/Perl/perl5/commit/376470a5d56b24fc17bcbbdbfc1689fd59c35504
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M t/re/re_tests
Log Message:
-----------
re_tests: ACCEPT with CURLYM optimization
Commit: a7e9ee8013f1579a4300239e9792d645e4085f4d
https://github.com/Perl/perl5/commit/a7e9ee8013f1579a4300239e9792d645e4085f4d
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M t/re/re_tests
Log Message:
-----------
re_tests: ACCEPT followed by SUSPEND
Commit: 29dbbf1f80f7772c9d835cf7acaf1e2be27c3c26
https://github.com/Perl/perl5/commit/29dbbf1f80f7772c9d835cf7acaf1e2be27c3c26
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M t/re/re_tests
Log Message:
-----------
re_tests: ACCEPT followed by IFMATCH fixed width pos lookbehind
Commit: 3677831fd61052777ee6f447433070cbd9808659
https://github.com/Perl/perl5/commit/3677831fd61052777ee6f447433070cbd9808659
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M regcomp.c
Log Message:
-----------
regcomp.c: enhance S_debug_studydata to show min/stopmin/delta
Also call it many more times during the study_chunk() process.
This is helpful for debuging minlen related issues.
Note this function is not in embed.fnc and is used strictly inside
of the regex engine, so no changes there.
Commit: 758f36b4763d68554b1a92e5cf0777cb805177e0
https://github.com/Perl/perl5/commit/758f36b4763d68554b1a92e5cf0777cb805177e0
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M regcomp.c
Log Message:
-----------
regcomp.c: reorder and comment S_study_chunk() internal vars
The list was kinda random and did not include many comments, which made
life difficult understanding what the purpose of the different vars.
This documents them, and includes a follow up to investigate that came
up during the documentation process: first_non_open seems a bit off.
Will investigate and improve further in a subsequent patch.
Commit: f7cb842ddc6d3d04da7787208de1bc6739d677e8
https://github.com/Perl/perl5/commit/f7cb842ddc6d3d04da7787208de1bc6739d677e8
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M regcomp.c
Log Message:
-----------
regcomp.c: minor blank line removal/insertion for clarity
Commit: a27d1b4d39a52a3bc3637338599a224ccf48b208
https://github.com/Perl/perl5/commit/a27d1b4d39a52a3bc3637338599a224ccf48b208
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M regcomp.c
Log Message:
-----------
regcomp.c: deal with stopmin and min properly
stopmin is set when we encounter an ACCEPT, it basically says "even
though the minlen might look like X it is actually a smaller Y". It also
implies that delta (which refers to the max length a pattern might
match) should be at least a certain size. This was not being handled
properly nor propagated to callers in all situations. This in particular
affected use of ACCEPT inside of lookbehind. This also made final_minlen
redundant and it has been removed.
Commit: c79d9bbdc0ce266c274852ba76ff19a0fb775fd0
https://github.com/Perl/perl5/commit/c79d9bbdc0ce266c274852ba76ff19a0fb775fd0
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M t/re/re_tests
Log Message:
-----------
re_tests: ACCEPT inside UNLESSM fixed width negative lookbehind
Commit: 14104d1268c82757336a5e85ef7186f92b0c8f81
https://github.com/Perl/perl5/commit/14104d1268c82757336a5e85ef7186f92b0c8f81
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M t/re/re_tests
Log Message:
-----------
re_tests: ACCEPT inside of named capture accessed via GOSUB
Commit: fc9984690c084592c4018ac98d746290d503ab28
https://github.com/Perl/perl5/commit/fc9984690c084592c4018ac98d746290d503ab28
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M t/re/re_tests
Log Message:
-----------
re_tests: ACCEPT in IFMATCH: variable positive lookbehind
Commit: db13a16f3e79fef220e4a0aaeb043a371444ebfc
https://github.com/Perl/perl5/commit/db13a16f3e79fef220e4a0aaeb043a371444ebfc
Author: Yves Orton <[email protected]>
Date: 2022-03-13 (Sun, 13 Mar 2022)
Changed paths:
M t/re/re_tests
Log Message:
-----------
re_tests: ACCEPT in UNLESSM variable negative lookbehind
Compare: https://github.com/Perl/perl5/compare/bc3e24ef8286...db13a16f3e79