This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ext/B/defsubs_h.PL: teach to allow exprs with <<
authorKarl Williamson <khw@khw-desktop.(none)>
Tue, 20 Jul 2010 03:51:32 +0000 (21:51 -0600)
committerRafael Garcia-Suarez <rgs@consttype.org>
Thu, 29 Jul 2010 10:10:18 +0000 (12:10 +0200)
Allow #defines which have left shift operators in them.

ext/B/defsubs_h.PL

index f8fa1ed..d8e1439 100644 (file)
@@ -84,7 +84,11 @@ foreach my $tuple (['op.h'],['cop.h'],['regexp.h','RXf_'])
   open(OPH,"$path") || die "Cannot open $path:$!";
   while (<OPH>)
    {  
-    doconst($1) if (/#define\s+($pfx\w+)\s+([\(\)\|\dx]+)\s*(?:$|\/\*)/);
+    doconst($1) if (/ \#define \s+ ( $pfx \w+ ) \s+
+                        ( [()|\dx]+             # Parens, '|', digits, 'x'
+                          | \(? \d+ \s* << .*?  # digits left shifted by anything
+                        ) \s* (?: $| \/ \* )    # ending at comment or $
+                   /x);
    }  
   close(OPH);
  }