3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-25 04:02:37 +01:00

CGrammar: Fix a|an substitution to an|a

This commit is contained in:
Pragmatic Software 2014-08-10 05:31:29 +00:00
parent 527e8490a3
commit c03a1288b6
2 changed files with 6 additions and 6 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 => 771, BUILD_REVISION => 772,
BUILD_DATE => "2014-08-09", BUILD_DATE => "2014-08-09",
}; };

View File

@ -800,7 +800,7 @@ declaration:
$item{declaration_specifiers} = ''; $item{declaration_specifiers} = '';
} }
if (@identifiers == 1 and $first_qualifier !~ /^(a|an)\s+/) { if (@identifiers == 1 and $first_qualifier !~ /^(an|a)\s+/) {
$return .= $first_qualifier =~ m/^[aeiou]/ ? 'an ' : 'a '; $return .= $first_qualifier =~ m/^[aeiou]/ ? 'an ' : 'a ';
} elsif (@identifiers > 1 and not $typedef) { } elsif (@identifiers > 1 and not $typedef) {
$first_qualifier =~ s/pointer/pointers/; $first_qualifier =~ s/pointer/pointers/;
@ -809,7 +809,7 @@ declaration:
$return .= "$first_qualifier"; $return .= "$first_qualifier";
$return .= " $item{declaration_specifiers}" if $item{declaration_specifiers}; $return .= " $item{declaration_specifiers}" if $item{declaration_specifiers};
} else { } else {
if (@identifiers == 1 and $item{declaration_specifiers} !~ /^(a|an)\s+/) { if (@identifiers == 1 and $item{declaration_specifiers} !~ /^(an|a)\s+/) {
$return .= $item{declaration_specifiers} =~ m/^[aeiou]/ ? 'an ' : 'a '; $return .= $item{declaration_specifiers} =~ m/^[aeiou]/ ? 'an ' : 'a ';
} }
$return .= $item{declaration_specifiers}; $return .= $item{declaration_specifiers};
@ -839,7 +839,7 @@ declaration:
$first_qualifier =~ s/ returning$//; $first_qualifier =~ s/ returning$//;
} }
if (@identifiers == 1 and $first_qualifier !~ /^(a|an)\s+/) { if (@identifiers == 1 and $first_qualifier !~ /^(an|a)\s+/) {
$return .= $first_qualifier =~ m/^[aeiou]/ ? 'an ' : 'a '; $return .= $first_qualifier =~ m/^[aeiou]/ ? 'an ' : 'a ';
} elsif (@identifiers > 1 and not $typedef) { } elsif (@identifiers > 1 and not $typedef) {
$first_qualifier =~ s/pointer/pointers/; $first_qualifier =~ s/pointer/pointers/;
@ -848,7 +848,7 @@ declaration:
$return .= "$first_qualifier "; $return .= "$first_qualifier ";
$return .= $item{declaration_specifiers}; $return .= $item{declaration_specifiers};
} else { } else {
if (@identifiers == 1 and $item{declaration_specifiers} !~ /^(a|an)\s+/) { if (@identifiers == 1 and $item{declaration_specifiers} !~ /^(an|a)\s+/) {
$return .= $item{declaration_specifiers} =~ m/^[aeiou]/ ? 'an ' : 'a '; $return .= $item{declaration_specifiers} =~ m/^[aeiou]/ ? 'an ' : 'a ';
} }
$return .= $item{declaration_specifiers}; $return .= $item{declaration_specifiers};
@ -1731,7 +1731,7 @@ struct_or_union_specifier:
} }
| struct_or_union identifier | struct_or_union identifier
{ {
$item{struct_or_union} =~ s/^(a|an)//; $item{struct_or_union} =~ s/^(an|a)\s+//;
$return = $item{identifier} =~ m/^`[aeiou]/ ? 'an' : 'a'; $return = $item{identifier} =~ m/^`[aeiou]/ ? 'an' : 'a';
$return .= " $item{identifier} $item{struct_or_union}"; $return .= " $item{identifier} $item{struct_or_union}";
} }