From: Karl Williamson Date: Mon, 24 Aug 2015 18:50:47 +0000 (-0600) Subject: PATCH: [perl 125825] {n}+ possessive quantifier broken X-Git-Tag: if-0.0605~161 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/9a7bb2f73a8a1b561890191974201d576371e7f9?ds=sidebyside PATCH: [perl 125825] {n}+ possessive quantifier broken I was unaware of this construct when I wrote the commit that broke it, and there were no tests for it. Now there are. --- diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 9f66925..c91c981 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -350,6 +350,13 @@ files in F and F are best summarized in L. C no longer segfaults, giving a syntax error message instead. [perl #125805] +=item * + +Regular expression possesive quantifier v5.20 regression now fixed. +CIC<{>I,IC<}+>C is supposed to behave identically +to C>IC<{>I,IC<})/>. Since v5.20, this didn't +work if I and I were equal. [perl #125825] + =back =head1 Known Problems diff --git a/regcomp.c b/regcomp.c index 91e1603..982fdd1 100644 --- a/regcomp.c +++ b/regcomp.c @@ -10894,9 +10894,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) ret = reg_node(pRExC_state, OPFAIL); return ret; } - else if (min == max - && RExC_parse < RExC_end - && (*RExC_parse == '?' || *RExC_parse == '+')) + else if (min == max && RExC_parse < RExC_end && *RExC_parse == '?') { if (PASS2) { ckWARN2reg(RExC_parse + 1, diff --git a/t/re/re_tests b/t/re/re_tests index 6674a2a..9d5fa73 100644 --- a/t/re/re_tests +++ b/t/re/re_tests @@ -1924,5 +1924,7 @@ A+(*PRUNE)BC(?{}) AAABC y $& AAABC /w\zxy?\z/i \x{100}a\x{80}a n - - /w\z\R\z/i \x{100}a\x{80}a n - - +/(a+){1}+a/ aaa n - - # [perl #125825] + # Keep these lines at the end of the file # vim: softtabstop=0 noexpandtab diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t index d9d9d74..dd82949 100644 --- a/t/re/reg_mesg.t +++ b/t/re/reg_mesg.t @@ -504,7 +504,6 @@ my @warning = ( 'Useless (?c) - use /gc modifier {#} m/(?ogc{#})\x{100}/', ], '/a{1,1}?\x{100}/' => 'Useless use of greediness modifier \'?\' {#} m/a{1,1}?{#}\x{100}/', - '/b{3} +\x{100}/x' => 'Useless use of greediness modifier \'+\' {#} m/b{3} +{#}\x{100}/', "/(?[ [ % - % ] ])/" => "", "/(?[ [ : - \\x$colon_hex ] ])\\x{100}/" => "\": - \\x$colon_hex \" is more clearly written simply as \":\" {#} m/(?[ [ : - \\x$colon_hex {#}] ])\\x{100}/", "/(?[ [ \\x$colon_hex - : ] ])\\x{100}/" => "\"\\x$colon_hex\ - : \" is more clearly written simply as \":\" {#} m/(?[ [ \\x$colon_hex - : {#}] ])\\x{100}/",