This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
don't croak when the \K follows the lookaround assertion
authorTony Cook <tony@develop-help.com>
Mon, 14 Sep 2020 06:00:28 +0000 (16:00 +1000)
committerTony Cook <tony@develop-help.com>
Wed, 4 Nov 2020 04:26:48 +0000 (04:26 +0000)
commit80f44cf4982e395989f886220e05dd2071bb205a
treef4bcd88f371a1e39fbd275b88c1bdd9c6eaeca1f
parenta2f2a4e3143a7f85d874450cced74b7399fd6977
don't croak when the \K follows the lookaround assertion

this also simplifies the flagging for these assertions, since this
error is now the only thing using in_lookhead and in_lookbehind they
can be combined into a single in_lookaround.

Rather than conditional increment/decrement as we recurse into S_reg
I simply save the value of in_lookaround and restore it before
returning.  Some unsuccessful or restart paths don't do the restore,
but they either result in a croak(), or a restart which reinitialises
in_lookaround anyway.

Also added tests to ensure that all the different zero-width assertions
with content trigger the error.
regcomp.c
t/lib/croak/regcomp