This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Script runs: was swallowing next char in pattern
authorKarl Williamson <khw@cpan.org>
Thu, 4 Jan 2018 19:13:23 +0000 (12:13 -0700)
committerKarl Williamson <khw@cpan.org>
Thu, 4 Jan 2018 19:38:51 +0000 (12:38 -0700)
In /(+script_run:foo)bar/, the 'b' was being swallowed without being
acted upon.  This would affect the '$' to mean match end of string

regcomp.c
t/re/script_run.t

index 116ad96..376b697 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -10848,8 +10848,6 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                     return NULL;
                 }
 
-                nextchar(pRExC_state);
-
                 return ret;
             }
         }
index be38479..7cb4d52 100644 (file)
@@ -17,7 +17,7 @@ $|=1;
 
 no warnings "experimental::script_run";
 
-my $script_run = qr/ (+script_run: ^ .+ $ ) /x;
+my $script_run = qr/ ^ (+script_run: .+ ) $ /x;
 
 unlike("\N{CYRILLIC SMALL LETTER ER}\N{CYRILLIC SMALL LETTER A}\N{CYRILLIC SMALL LETTER U}}\N{CYRILLIC SMALL LETTER ER}\N{CYRILLIC SMALL LETTER A}l", $script_run, "Cyrillic 'paypal' with a Latin 'l' is not a script run");
 unlike("A\N{GREEK CAPITAL LETTER GAMMA}", $script_run, "Latin followed by Greek isn't a script run");