From c15a34bfb4f54341de8e463d45b5bcbaad235350 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Wed, 23 Feb 2022 07:06:22 +0100 Subject: regcomp.c: Reduce scope of experimental warnings with lookbehind The only case where we need to warn about variable length lookbehind is when capturing buffers are involved. --- t/re/reg_mesg.t | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 't') diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t index 17b337a537..f5910a04cc 100644 --- a/t/re/reg_mesg.t +++ b/t/re/reg_mesg.t @@ -142,6 +142,7 @@ my @death = '/(?<= a{200}b{55})/' => 'Lookbehind longer than 255 not implemented in regex m/(?<= a{200}b{55})/', '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented in regex m/(?<= x{1000})/', + '/(?<= (?&x))(?x+)/' => 'Lookbehind longer than 255 not implemented in regex m/(?<= (?&x))(?x+)/', '/(?@)/' => 'Sequence (?@...) not implemented {#} m/(?@{#})/', @@ -733,6 +734,25 @@ my @experimental_regex_sets = ( '/noutf8 ネ (?[ [\tネ] ])/' => 'The regex_sets feature is experimental {#} m/noutf8 ネ (?[{#} [\tネ] ])/', ); +my @experimental_vlb = ( + '/(?<=(p|qq|rrr))/' => 'Variable length positive lookbehind with capturing' . + ' is experimental {#} m/(?<=(p|qq|rrr)){#}/', + '/(? 'Variable length negative lookbehind with capturing' . + ' is experimental {#} m/(? 'Variable length positive lookbehind with capturing' . + ' is experimental {#} m/(?| (?=(foo)) | (?<=(foo)|p) ){#}/', + '/(?| (?=(foo)) | (?<=(foo)|p) )/x' + => 'Variable length positive lookbehind with capturing' . + ' is experimental {#} m/(?| (?=(foo)) | (?<=(foo)|p) ){#}/', + '/(?| (?=(foo)) | (? 'Variable length negative lookbehind with capturing' . + ' is experimental {#} m/(?| (?=(foo)) | (? 'Variable length negative lookbehind with capturing' . + ' is experimental {#} m/(?| (?=(foo)) | (? [ @@ -829,11 +849,13 @@ for my $strict ("", "no warnings 'experimental::re_strict'; use re 'strict';") } } - foreach my $ref (\@warning_tests, - \@experimental_regex_sets, - \@wildcard, - \@deprecated) - { + foreach my $ref ( + \@warning_tests, + \@experimental_regex_sets, + \@wildcard, + \@deprecated, + \@experimental_vlb, + ){ my $warning_type; my $turn_off_warnings = ""; my $default_on; @@ -854,6 +876,10 @@ for my $strict ("", "no warnings 'experimental::re_strict'; use re 'strict';") $warning_type = 'experimental::regex_sets, experimental::uniprop_wildcards'; $default_on = 1; } + elsif ($ref == \@experimental_vlb) { + $warning_type = 'experimental::vlb'; + $default_on = 1; + } else { fail("$0: Internal error: Unexpected loop variable"); } -- cgit v1.2.1