CGrammar: Fix functions taking function pointer as parameter

This commit is contained in:
Pragmatic Software 2014-06-20 23:16:04 +00:00
parent a501557d35
commit c18af75b63
2 changed files with 7 additions and 2 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 660,
BUILD_REVISION => 661,
BUILD_DATE => "2014-06-20",
};

View File

@ -1112,17 +1112,22 @@ parameter_list:
for(my $i = 0; $i < @parameter_list; $i++) {
$return .= $comma;
if(ref $parameter_list[$i] eq 'ARRAY') {
my @list = @{$parameter_list[$i]};
my @list = ::flatten @{$parameter_list[$i]};
if(@list == 0) {
$return = "no parameters";
} elsif (@list == 1) {
$return .= $list[0];
} else {
if(grep { /function.*returning/ } @list) {
push @list, shift @list;
push @list, shift @list;
}
$return .= join(' ', @list);
}
} else {
$return .= $parameter_list[$i];
}
if($i == $#parameter_list - 1) {
$comma = ' and ';
} else {