From 2529d49aace18d18935023d057cc06644071f038 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 9 Sep 2014 07:20:42 +0000 Subject: [PATCH] CGrammar: Remove excessive "result of the expression" for parenthesized expressions --- PBot/VERSION.pm | 2 +- modules/c2english/CGrammar.pm | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index f991004f..da537f11 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 784, + BUILD_REVISION => 785, BUILD_DATE => "2014-09-09", }; diff --git a/modules/c2english/CGrammar.pm b/modules/c2english/CGrammar.pm index ef1ff807..1de61ce3 100644 --- a/modules/c2english/CGrammar.pm +++ b/modules/c2english/CGrammar.pm @@ -629,6 +629,7 @@ logical_OR_AND_expression: and $expression !~ /^the .*? number \S+$/i and $expression !~ /the size of/i and $expression !~ /the offset/i + and $expression !~ /the address of/i and $expression !~ /^the result of the/) { $return = 'the result of the expression ^L'; } @@ -961,7 +962,7 @@ designator: } $expression = "the $expression element"; } else { - $expression = "the element at location $expression"; + $expression = "the element at location ^L$expression^L"; } $return = $expression; @@ -1112,7 +1113,7 @@ postfix_productions: my $plural = $expression == 1 ? '' : 's'; $return = "the location $expression element$plural backwards from where ^L$arg{primary_expression} points^L"; } else { - $return = "the element at location ^L$expression^L of"; + $return = "the element at location ^L$expression of^L"; $return .= " $arg{primary_expression}" if $arg{primary_expression}; } } @@ -1288,7 +1289,7 @@ primary_expression: if ($arg{context} =~ /statement$/) { $return = "Evaluate the expression "; } else { - $return = "The result of the expression "; + #$return = "The result of the expression "; } $return .= '(' x $repeats; $return .= "^L$expression";