This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Make sure no future ambiguity on new alpha assertions
authorKarl Williamson <khw@cpan.org>
Mon, 19 Feb 2018 19:01:51 +0000 (12:01 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 20 Feb 2018 03:47:10 +0000 (20:47 -0700)
This change adds a colon when checking if a string is an alpha
assertion.  This is defensive coding against an unlikely future change
wherein some new (*... construct is added that has the same initial
sequence as one of these assertions.  The colon acts as a terminator and
would automatically prevent any ambiguity.  One of these had the colon,
and hence was inconsistent with the rest.

Spotted by ilmari.

regcomp.c

index 864a1c7..a3fadf6 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11368,25 +11368,25 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                                          "pla:")
                                 || memBEGINs(RExC_parse + 1,
                                          (Size_t) (RExC_end - (RExC_parse + 1)),
-                                         "plb")
+                                         "plb:")
                                 || memBEGINs(RExC_parse + 1,
                                          (Size_t) (RExC_end - (RExC_parse + 1)),
-                                         "nla")
+                                         "nla:")
                                 || memBEGINs(RExC_parse + 1,
                                          (Size_t) (RExC_end - (RExC_parse + 1)),
-                                         "nlb")
+                                         "nlb:")
                                 || memBEGINs(RExC_parse + 1,
                                          (Size_t) (RExC_end - (RExC_parse + 1)),
-                                         "positive_lookahead")
+                                         "positive_lookahead:")
                                 || memBEGINs(RExC_parse + 1,
                                          (Size_t) (RExC_end - (RExC_parse + 1)),
-                                         "positive_lookbehind")
+                                         "positive_lookbehind:")
                                 || memBEGINs(RExC_parse + 1,
                                          (Size_t) (RExC_end - (RExC_parse + 1)),
-                                         "negative_lookahead")
+                                         "negative_lookahead:")
                                 || memBEGINs(RExC_parse + 1,
                                          (Size_t) (RExC_end - (RExC_parse + 1)),
-                                         "negative_lookbehind"))))
+                                         "negative_lookbehind:"))))
                 ) { /* Lookahead or eval. */
                     I32 flag;
                     regnode *tail;