This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/apicheck.pl: Add white-space to m//x for readability
authorKarl Williamson <khw@cpan.org>
Wed, 14 Aug 2019 19:04:14 +0000 (13:04 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:29 +0000 (16:39 -0600)
And some comments to regex

(cherry picked from commit a76243946786233602fab339e55b29851c3785e9)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/parts/apicheck.pl

index 88869d6..1ac8eb5 100644 (file)
@@ -259,10 +259,11 @@ for $f (@f) {   # Loop through all the tests to add
     }
 
     # Split this type into its components
-    my($n, $p, $d) = $a =~ /^ (\w+(?:\s+\w+)*)\s*  # type name  => $n
-                              (\**)                # pointer    => $p
-                              (?:\s*\bconst\b\s*)? # const
-                              ((?:\[[^\]]*\])*)    # dimension  => $d
+    my($n, $p, $d) = $a =~ /^ ( \w+ (?: \s+ \w+ )* )     # type name  => $n
+                              \s*
+                              ( \** )                 # optional pointer(s) => $p
+                              (?: \s* \b const \b \s* )? # opt. const
+                              ( (?: \[ [^\]]* \] )* )    # opt. dimension(s)=> $d
                             $/x
                      or die "$0 - cannot parse argument: [$a]\n";