Skip to content

Instantly share code, notes, and snippets.

@pcapriotti
Created October 27, 2010 17:41
Show Gist options
  • Save pcapriotti/649556 to your computer and use it in GitHub Desktop.
Save pcapriotti/649556 to your computer and use it in GitHub Desktop.
From ba220db019793794ed068a4c1441eecee330ea65 Mon Sep 17 00:00:00 2001
From: Paolo Capriotti <[email protected]>
Date: Wed, 27 Oct 2010 18:32:26 +0100
Subject: [PATCH] Simplify function regexp and fix bug for pointer and reference return types.
---
vim-protodef/pullproto.pl | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/vim-protodef/pullproto.pl b/vim-protodef/pullproto.pl
index f38fab5..03d4785 100644
--- a/vim-protodef/pullproto.pl
+++ b/vim-protodef/pullproto.pl
@@ -77,11 +77,11 @@ while (<STDIN>)
}
else
{
- my @a = $content =~ m/(const)?\s*(unsigned)?\s*(\S+)\s*(\Q$function\E$matched?)\s*(\([^\)]*\)[^;]*);/m; # (Matt Spear) added \Q\E and $matched
- my $str = join(" ", @a);
- ($pre, $fname, $post) = $str =~ m/(.*\s)(\Q$function\E$matched?)\s(.*)/s; # (Matt Spear) added \Q\E and $matched
- $pre =~ s/\s+/ /g;
- $pre =~ s/^\s+//g;
+ my @a = $content =~ m/((const)?\s*(unsigned)?\s*\S+\s*[\*&]?)(\Q$function\E$matched?)\s*(\([^\)]*\)[^;]*);/m; # (Matt Spear) added \Q\E and $matched
+
+ $pre = @a[0];
+ $fname = @a[3];
+ $post = @a[4];
}
print "==\n";
if ($class ne "")
--
1.7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment