From 76cd4965f16dee1110fadbe37c6f32e99f785356 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 26 Apr 2014 15:17:11 +0000 Subject: [PATCH] compiler_vm: allow ()'s around function identifiers; e.g. int (main)(void) {} --- PBot/VERSION.pm | 4 ++-- modules/compiler_vm/compiler_vm_client.pl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 66bf647a..a2e6eff7 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 550, - BUILD_DATE => "2014-04-22", + BUILD_REVISION => 551, + BUILD_DATE => "2014-04-26", }; 1; diff --git a/modules/compiler_vm/compiler_vm_client.pl b/modules/compiler_vm/compiler_vm_client.pl index 8fa3e287..7dbfb2ab 100755 --- a/modules/compiler_vm/compiler_vm_client.pl +++ b/modules/compiler_vm/compiler_vm_client.pl @@ -865,7 +865,7 @@ if($lang eq 'C89' or $lang eq 'C99' or $lang eq 'C11' or $lang eq 'C++') { print "looking for functions, has main: $has_main\n" if $debug >= 2; - my $func_regex = qr/^([ *\w]+)\s+([*\w]+)\s*\(([^;{]*)\s*\)\s*({.*|<%.*|\?\?<.*)/ims; + my $func_regex = qr/^([ *\w]+)\s+([ ()*\w]+)\s*\(([^;{]*)\s*\)\s*({.*|<%.*|\?\?<.*)/ims; # look for potential functions to extract while($preprecode =~ /$func_regex/ms) { @@ -925,7 +925,7 @@ if($lang eq 'C89' or $lang eq 'C99' or $lang eq 'C11' or $lang eq 'C++') { print "final extract: [$ret][$ident][$params][$body]\n" if $debug; $code .= "$ret $ident($params) $body\n\n"; - $has_main = 1 if $ident eq 'main'; + $has_main = 1 if $ident =~ m/^\s*\(?\s*main\s*\)?\s*$/; } $precode =~ s/^\s+//;