3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-27 06:19:25 +01:00

CGrammar: Fix array translation text

This commit is contained in:
Pragmatic Software 2014-06-11 12:50:16 +00:00
parent 026db04e4a
commit df1fa14b2a
2 changed files with 4 additions and 3 deletions

View File

@ -13,7 +13,7 @@ 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 => 631, BUILD_REVISION => 632,
BUILD_DATE => "2014-06-11", BUILD_DATE => "2014-06-11",
}; };

View File

@ -604,6 +604,7 @@ declaration_list:
declaration: declaration:
declaration_specifiers init_declarator_list(?) ';' declaration_specifiers init_declarator_list(?) ';'
{ {
print STDERR "wtf\n"; print STDERR ::Dumper \%item;
# This whole thing needs to be re-written to parse declarations inside-out. # This whole thing needs to be re-written to parse declarations inside-out.
my @init_list = defined $item{'init_declarator_list(?)'}->[0] ? @{$item{'init_declarator_list(?)'}->[0]} : (''); my @init_list = defined $item{'init_declarator_list(?)'}->[0] ? @{$item{'init_declarator_list(?)'}->[0]} : ('');
my $init_declaration_list; my $init_declaration_list;
@ -689,7 +690,7 @@ declaration:
$return .= ' be '; $return .= ' be ';
if($first_qualifier) { if($first_qualifier) {
if(@identifiers == 1) { if(@identifiers == 1 and $first_qualifier !~ /^(a|an)\s+/) {
$return .= $first_qualifier =~ m/^[aeiouy]/ ? 'an ' : 'a '; $return .= $first_qualifier =~ m/^[aeiouy]/ ? 'an ' : 'a ';
} }
$return .= "$first_qualifier $item{declaration_specifiers}"; $return .= "$first_qualifier $item{declaration_specifiers}";
@ -1024,7 +1025,7 @@ array_declarator:
{ {
my @array = @{$item[-1]}; my @array = @{$item[-1]};
if (@array) { if (@array) {
$return .= 'an array of ' . join('of an array of ' , @array) . 'of '; $return .= 'an array of ' . join('of an array of ' , @array) . 'of';
} else { } else {
undef; undef;
} }