diff options
author | Karl Williamson <khw@cpan.org> | 2020-02-17 12:07:07 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-02-19 18:18:40 -0700 |
commit | d8d1dede53afc4f33cf63203b0992459fe964dc3 (patch) | |
tree | 4ef95497f184f170a82322bd09f7720887d38711 /proto.h | |
parent | 9f55257555c98b527185e6747eb633b2bdb70c0b (diff) | |
download | perl-d8d1dede53afc4f33cf63203b0992459fe964dc3.tar.gz |
Improve handling of nested qr/(?[...])/
A set operations expression can contain a previously-compiled one
interpolated in. Prior to this commit, some heuristics were employed
to verify it actually was such a thing, and not a sort of look-alike
that wasn't necessarily valid. The heuristics actually forbade legal
ones. I don't know of any illegal ones that were let through, but it is
certainly possible. Also, the error/warning messages referred to the
heuristics, and were unhelpful at best.
The technique used instead in this commit is to return a regop only used
by this feature for any nested compilations. This guarantees that the
caller can determine if the result is valid, and what that result is
without having to do any heuristics or inspecting any flags. The
error/warning messages are changed to reflect this, and I believe are
now helpful.
This fixes the bugs in #16779
https://github.com/Perl/perl5/issues/16779#issuecomment-563987618
Diffstat (limited to 'proto.h')
-rw-r--r-- | proto.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -5715,6 +5715,9 @@ STATIC regnode_offset S_regnode_guts(pTHX_ RExC_state_t *pRExC_state, const U8 o STATIC regnode_offset S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth); #define PERL_ARGS_ASSERT_REGPIECE \ assert(pRExC_state); assert(flagp) +STATIC regnode_offset S_regpnode(pTHX_ RExC_state_t *pRExC_state, U8 op, void * arg); +#define PERL_ARGS_ASSERT_REGPNODE \ + assert(pRExC_state); assert(arg) STATIC bool S_regtail(pTHX_ RExC_state_t * pRExC_state, const regnode_offset p, const regnode_offset val, const U32 depth) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_REGTAIL \ |