mirror of
https://github.com/pragma-/pbot.git
synced 2025-02-02 15:34:05 +01:00
CGrammar: Improve enumeration translation
This commit is contained in:
parent
ffab2c6f3b
commit
9992119b11
@ -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 => 622,
|
BUILD_REVISION => 623,
|
||||||
BUILD_DATE => "2014-06-09",
|
BUILD_DATE => "2014-06-09",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1137,7 +1137,7 @@ typedef_name:
|
|||||||
foreach (@defined_types) {
|
foreach (@defined_types) {
|
||||||
if ($item{identifier} eq $_) {
|
if ($item{identifier} eq $_) {
|
||||||
$answer = 1;
|
$answer = 1;
|
||||||
$return = ($item{identifier} =~ m/^[aeiouy]/ ? 'an ' : 'a ') . $item{identifier};
|
$return = ($item{identifier} =~ m/^`[aeiouy]/ ? 'an ' : 'a ') . $item{identifier};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$answer) { undef $answer; }
|
if (!$answer) { undef $answer; }
|
||||||
@ -1218,21 +1218,22 @@ enum_specifier:
|
|||||||
{
|
{
|
||||||
$return .= 'an enumeration';
|
$return .= 'an enumeration';
|
||||||
|
|
||||||
|
if (@{$item{'identifier(?)'}}){
|
||||||
|
$return .= ' of ' . join('',@{$item{'identifier(?)'}});
|
||||||
|
}
|
||||||
|
|
||||||
my @enumerator_list = @{$item{enumerator_list}};
|
my @enumerator_list = @{$item{enumerator_list}};
|
||||||
|
|
||||||
if(@enumerator_list == 1) {
|
if(@enumerator_list == 1) {
|
||||||
$return .= " of $enumerator_list[0]";
|
$return .= " comprising $enumerator_list[0]";
|
||||||
} else {
|
} else {
|
||||||
my $last = pop @enumerator_list;
|
my $last = pop @enumerator_list;
|
||||||
$return .= ' of ' . join(', ', @enumerator_list) . " and $last";
|
$return .= ' comprising ' . join(', ', @enumerator_list) . " and $last";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@{$item{'identifier(?)'}}){
|
|
||||||
$return .= ' identified as ' . join('',@{$item{'identifier(?)'}});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
| 'enum' identifier
|
| 'enum' identifier
|
||||||
{ $return = ($item{identifer} =~ m/^[aieouy]/ ? 'an ' : 'a ') . "$item{identifier} enumeration"; }
|
{ $return = "an enumeration of type $item{identifier}"; }
|
||||||
|
|
||||||
|
|
||||||
enumerator_list:
|
enumerator_list:
|
||||||
|
Loading…
Reference in New Issue
Block a user