This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow some optimizations of qr/(?[...])/
authorKarl Williamson <khw@cpan.org>
Fri, 13 Sep 2019 02:19:07 +0000 (20:19 -0600)
committerKarl Williamson <khw@cpan.org>
Sun, 17 Nov 2019 19:25:15 +0000 (12:25 -0700)
Prior to this commit, this construct always returned an ANYOF node, even
if it could be optimized into something else.

regcomp.c

index 6468ab5..9b4a049 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -16521,7 +16521,11 @@ redo_curchar:
                              well have generated non-portable code points, but
                              they're valid on this machine */
                     FALSE, /* similarly, no need for strict */
-                    FALSE, /* Require return to be an ANYOF */
+
+                    /* We can optimize into something besides an ANYOF, except
+                     * under /l, which needs to be ANYOF because of runtime
+                     * checks for locale sanity, etc */
+                  ! in_locale,
                     NULL
                 );