mirror of
https://github.com/pragma-/pbot.git
synced 2025-02-04 08:24:06 +01:00
CGrammar: replace parameters
with arguments
where appropriate
This commit is contained in:
parent
8b626cc81e
commit
e1ed0bb6b9
@ -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 => 700,
|
BUILD_REVISION => 701,
|
||||||
BUILD_DATE => "2014-07-03",
|
BUILD_DATE => "2014-07-04",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -389,14 +389,14 @@ close $fh;
|
|||||||
$output = `./c2eng.pl code2eng.c` if not defined $output;
|
$output = `./c2eng.pl code2eng.c` if not defined $output;
|
||||||
|
|
||||||
if(not $has_function and not $has_main) {
|
if(not $has_function and not $has_main) {
|
||||||
$output =~ s/Let .main. be a function taking no parameters and returning int.\s*To perform the function.\s*(return 0.)?//i;
|
$output =~ s/Let .main. be a function taking no arguments and returning int.\s*To perform the function.\s*(return 0.)?//i;
|
||||||
$output =~ s/\s*Return 0.\s*End of function .main..\s*//;
|
$output =~ s/\s*Return 0.\s*End of function .main..\s*//;
|
||||||
$output =~ s/\s*Return 0.$//;
|
$output =~ s/\s*Return 0.$//;
|
||||||
$output =~ s/\s*Do nothing.\s*$//;
|
$output =~ s/\s*Do nothing.\s*$//;
|
||||||
$output =~ s/^\s*(.)/\U$1/;
|
$output =~ s/^\s*(.)/\U$1/;
|
||||||
$output =~ s/\.\s+(\S)/. \U$1/g;
|
$output =~ s/\.\s+(\S)/. \U$1/g;
|
||||||
} elsif($has_function and not $has_main) {
|
} elsif($has_function and not $has_main) {
|
||||||
$output =~ s/\s*Let `main` be a function taking no parameters and returning int.\s*To perform the function, return 0.//;
|
$output =~ s/\s*Let `main` be a function taking no arguments and returning int.\s*To perform the function, return 0.//;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output =~ s/\s+/ /;
|
$output =~ s/\s+/ /;
|
||||||
|
@ -1317,10 +1317,10 @@ parameter_list:
|
|||||||
if (ref $parameter_list[$i] eq 'ARRAY') {
|
if (ref $parameter_list[$i] eq 'ARRAY') {
|
||||||
my @list = ::flatten @{$parameter_list[$i]};
|
my @list = ::flatten @{$parameter_list[$i]};
|
||||||
if (@list == 0) {
|
if (@list == 0) {
|
||||||
$return = "no parameters";
|
$return = "no arguments";
|
||||||
} elsif (@list == 1) {
|
} elsif (@list == 1) {
|
||||||
if ($list[0] eq 'void') {
|
if ($list[0] eq 'void') {
|
||||||
$return = "no parameters";
|
$return = "no arguments";
|
||||||
} else {
|
} else {
|
||||||
$return .= $list[0];
|
$return .= $list[0];
|
||||||
}
|
}
|
||||||
@ -1350,11 +1350,11 @@ parameter_declaration:
|
|||||||
declaration_specifiers declarator
|
declaration_specifiers declarator
|
||||||
{ $return = [$item{declaration_specifiers}, $item{declarator}]; }
|
{ $return = [$item{declaration_specifiers}, $item{declarator}]; }
|
||||||
| '...'
|
| '...'
|
||||||
{ $return = "variadic parameters"; }
|
{ $return = "variadic arguments"; }
|
||||||
| declaration_specifiers abstract_declarator(?)
|
| declaration_specifiers abstract_declarator(?)
|
||||||
{ $return = [$item{declaration_specifiers}, $item{'abstract_declarator(?)'}]; }
|
{ $return = [$item{declaration_specifiers}, $item{'abstract_declarator(?)'}]; }
|
||||||
| ''
|
| ''
|
||||||
{ $return = "unspecified parameters"; }
|
{ $return = "unspecified arguments"; }
|
||||||
|
|
||||||
abstract_declarator:
|
abstract_declarator:
|
||||||
pointer
|
pointer
|
||||||
@ -1405,7 +1405,7 @@ direct_abstract_declarator:
|
|||||||
| DAD '[' ']'
|
| DAD '[' ']'
|
||||||
| DAD '[' array_qualifiers(?) assignment_expression(?) ']'
|
| DAD '[' array_qualifiers(?) assignment_expression(?) ']'
|
||||||
| '(' ')'
|
| '(' ')'
|
||||||
{ $return = 'function taking unspecified parameters and returning'; }
|
{ $return = 'function taking unspecified arguments and returning'; }
|
||||||
| '(' parameter_type_list ')'
|
| '(' parameter_type_list ')'
|
||||||
{ $return = "function taking $item{parameter_type_list} and returning"; }
|
{ $return = "function taking $item{parameter_type_list} and returning"; }
|
||||||
| DAD '(' ')'
|
| DAD '(' ')'
|
||||||
|
Loading…
Reference in New Issue
Block a user