mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 12:29:27 +01:00
CGrammar: Improve array translation and fix pointer pluralization
This commit is contained in:
parent
77f1005e03
commit
b2a0963abb
@ -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 => 648,
|
BUILD_REVISION => 649,
|
||||||
BUILD_DATE => "2014-06-17",
|
BUILD_DATE => "2014-06-17",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ declaration:
|
|||||||
if($first_qualifier) {
|
if($first_qualifier) {
|
||||||
if(@identifiers == 1 and $first_qualifier !~ /^(a|an)\s+/) {
|
if(@identifiers == 1 and $first_qualifier !~ /^(a|an)\s+/) {
|
||||||
$return .= $first_qualifier =~ m/^[aeiouy]/ ? 'an ' : 'a ';
|
$return .= $first_qualifier =~ m/^[aeiouy]/ ? 'an ' : 'a ';
|
||||||
} else {
|
} elsif(@identifiers > 1) {
|
||||||
$first_qualifier =~ s/pointer/pointers/;
|
$first_qualifier =~ s/pointer/pointers/;
|
||||||
}
|
}
|
||||||
$return .= "$first_qualifier $item{declaration_specifiers} ";
|
$return .= "$first_qualifier $item{declaration_specifiers} ";
|
||||||
@ -754,7 +754,7 @@ declaration:
|
|||||||
if($first_qualifier) {
|
if($first_qualifier) {
|
||||||
if(@identifiers == 1 and $first_qualifier !~ /^(a|an)\s+/) {
|
if(@identifiers == 1 and $first_qualifier !~ /^(a|an)\s+/) {
|
||||||
$return .= $first_qualifier =~ m/^[aeiouy]/ ? 'an ' : 'a ';
|
$return .= $first_qualifier =~ m/^[aeiouy]/ ? 'an ' : 'a ';
|
||||||
} else {
|
} elsif(@identifiers > 1) {
|
||||||
$first_qualifier =~ s/pointer/pointers/;
|
$first_qualifier =~ s/pointer/pointers/;
|
||||||
}
|
}
|
||||||
$return .= "$first_qualifier $item{declaration_specifiers}";
|
$return .= "$first_qualifier $item{declaration_specifiers}";
|
||||||
@ -1100,9 +1100,14 @@ array_declarator:
|
|||||||
( '[' assignment_expression(?) ']'
|
( '[' assignment_expression(?) ']'
|
||||||
{
|
{
|
||||||
if (@{$item{'assignment_expression(?)'}}) {
|
if (@{$item{'assignment_expression(?)'}}) {
|
||||||
$return = 'size '. join('',@{$item{'assignment_expression(?)'}}) . ' ';
|
my $size = join('', @{$item{'assignment_expression(?)'}});
|
||||||
|
if($size =~ /^(unsigned|long)*\s*1$/) {
|
||||||
|
$return = "$size element ";
|
||||||
|
} else {
|
||||||
|
$return = "$size elements ";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$return = 'unspecified size ';
|
$return = 'unspecified length ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)(s?)
|
)(s?)
|
||||||
|
Loading…
Reference in New Issue
Block a user