mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-30 07:59:42 +01:00
CGrammar: Fix structure member access; add lower-case markers
This commit is contained in:
parent
95949153e0
commit
a8320f52f9
@ -13,8 +13,8 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 674,
|
||||
BUILD_DATE => "2014-06-23",
|
||||
BUILD_REVISION => 675,
|
||||
BUILD_DATE => "2014-06-24",
|
||||
};
|
||||
|
||||
1;
|
||||
|
@ -406,8 +406,8 @@ if(not $output) {
|
||||
|
||||
# beautification
|
||||
$output =~ s/the value the expression/the value of the expression/g;
|
||||
$output =~ s/the value the member/the value of the member/g;
|
||||
$output =~ s/the value the/the/g;
|
||||
$output =~ s/(is true is)+/is/g;
|
||||
|
||||
print "$output\n";
|
||||
|
||||
|
@ -906,16 +906,16 @@ postfix_productions:
|
||||
$expression .= 'th';
|
||||
}
|
||||
if($arg{context} eq 'function call') {
|
||||
$return = "the $expression element of";
|
||||
$return = "the $expression element of^L";
|
||||
} else {
|
||||
$return = "the $expression element of $arg{primary_expression}";
|
||||
$return = "the $expression element of ^L$arg{primary_expression}^L";
|
||||
}
|
||||
} elsif($expression =~ /^-\s*\d+$/) {
|
||||
$expression *= -1;
|
||||
my $plural = $expression == 1 ? '' : 's';
|
||||
$return = "the location $expression element$plural backwards from where $arg{primary_expression} points";
|
||||
$return = "the location $expression element$plural backwards from where ^L$arg{primary_expression} points^L";
|
||||
} else {
|
||||
$return = "the element of $arg{primary_expression} at location $expression";
|
||||
$return = "the element of ^L$arg{primary_expression} at location ^L$expression^L";
|
||||
}
|
||||
}
|
||||
|
||||
@ -923,26 +923,31 @@ postfix_productions:
|
||||
$return = "$postfix $return";
|
||||
}
|
||||
}
|
||||
| ('.' identifier)(s) postfix_productions[context => 'struct access'](?)
|
||||
| '.' identifier postfix_productions[context => 'struct access'](?)
|
||||
{
|
||||
my $identifier = join('',@{$item[-2]});
|
||||
my $identifier = $item[-2];
|
||||
my $postfix = $item[-1]->[0];
|
||||
|
||||
if ($identifier) {
|
||||
if($arg{context} eq 'array_address') {
|
||||
$return = "member $identifier of";
|
||||
$return = "the member $identifier of^L";
|
||||
} else {
|
||||
$return = "the member $identifier of $arg{primary_expression}";
|
||||
$return = "the member $identifier of^L";
|
||||
$return .= " $arg{primary_expression}" if $arg{primary_expression};
|
||||
}
|
||||
}
|
||||
|
||||
if($postfix) {
|
||||
$return = "$postfix->[0] $return $postfix->[1]";
|
||||
if(ref $postfix eq 'ARRAY') {
|
||||
$return = "$postfix->[0] $return $postfix->[1]";
|
||||
} else {
|
||||
$return = "$postfix $return";
|
||||
}
|
||||
}
|
||||
}
|
||||
| ('->' identifier)(s) postfix_productions[context => 'struct access'](?)
|
||||
| '->' identifier postfix_productions[context => 'struct access'](?)
|
||||
{
|
||||
my $identifier = join('',@{$item[-2]});
|
||||
my $identifier = $item[-2];
|
||||
my $postfix = $item[-1]->[0];
|
||||
|
||||
if ($identifier) {
|
||||
@ -950,7 +955,11 @@ postfix_productions:
|
||||
}
|
||||
|
||||
if($postfix) {
|
||||
$return = "$postfix->[0] $return $postfix->[1]";
|
||||
if(ref $postfix eq 'ARRAY') {
|
||||
$return = "$postfix->[0] $return $postfix->[1]";
|
||||
} else {
|
||||
$return = "$postfix $return";
|
||||
}
|
||||
}
|
||||
}
|
||||
| ('++')(s)
|
||||
|
Loading…
Reference in New Issue
Block a user