perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r23914 - trunk/lib/Parrot

Subject: [svn:parrot] r23914 - trunk/lib/Parrot
From:
Date: Sat, 15 Dec 2007 00:14:50 -0800 PST
Newsgroups: perl.cvs.parrot

Author: petdance
Date: Sat Dec 15 00:14:49 2007
New Revision: 23914

Modified:
   trunk/lib/Parrot/Vtable.pm

Log:
vtable dumper can now handle const args in methods

Modified: trunk/lib/Parrot/Vtable.pm
==============================================================================
--- trunk/lib/Parrot/Vtable.pm  (original)
+++ trunk/lib/Parrot/Vtable.pm  Sat Dec 15 00:14:49 2007
@@ -45,7 +45,8 @@
 
 my $ident_re   = make_re('[A-Za-z_][A-Za-z0-9_]*');
 my $type_re    = make_re( '(?:(?:struct\s+)|(?:union\s+))?' . $ident_re . 
'\**' );
-my $param_re   = make_re( $type_re . '\s+' . $ident_re );
+my $const_re   = make_re( '(?:const\s+)?' );
+my $param_re   = make_re( $const_re . $type_re . '\s+' . $ident_re );
 my $arglist_re = make_re( '(?:' . $param_re . '(?:\s*,\s*' . $param_re . 
')*)?' );
 my $method_re =
     make_re( '^\s*(' . $type_re . ')\s+(' . $ident_re . ')\s*\((' . 
$arglist_re . ')\)\s*$' );
@@ -84,7 +85,8 @@
     while (<$fh>) {
         chomp;
 
-        next if /^\s*#/ or /^\s*$/;
+        s/\s+$//;
+        next if /^\s*#/ or /^$/;
 
         if (/^\[(\w+)\]\s*($attrs_re)/) {
             $section       = $1;
@@ -115,7 +117,7 @@
 
     # We probably should sort on insert, but this is easier for now. And it's
     # compile time, so it's not all that important.
-    return [ @$mmd, sort { $a->[1] cmp $b->[1] } @$vtable ];
+    return [ @{$mmd}, sort { $a->[1] cmp $b->[1] } @{$vtable} ];
 }
 
 =item C<vtbl_defs($vtable)>
@@ -214,7 +216,7 @@
         next if ( $entry->[4] =~ /MMD_/ );
         my @args = split /,\s*/, $entry->[2];
         unshift @args, "i interp", "p pmc";
-        my $args = join ', ', map { ( split / /, $args[$_] )[1] } ( 0 .. 
$#args );
+        my $args = join ', ', map { ( split / /, $args[$_] )[-1] } ( 0 .. 
$#args );
         $macros .= <<"EOM";
 #define VTABLE_$entry->[1]($args) \\
     (pmc)->vtable->$entry->[1]($args)

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r23914 - trunk/lib/Parrot, petdance <=