mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
compiler_vm: allow ()'s around function identifiers; e.g. int (main)(void) {}
This commit is contained in:
parent
fc1e372908
commit
76cd4965f1
@ -13,8 +13,8 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 550,
|
BUILD_REVISION => 551,
|
||||||
BUILD_DATE => "2014-04-22",
|
BUILD_DATE => "2014-04-26",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -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;
|
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
|
# look for potential functions to extract
|
||||||
while($preprecode =~ /$func_regex/ms) {
|
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;
|
print "final extract: [$ret][$ident][$params][$body]\n" if $debug;
|
||||||
$code .= "$ret $ident($params) $body\n\n";
|
$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+//;
|
$precode =~ s/^\s+//;
|
||||||
|
Loading…
Reference in New Issue
Block a user