3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01:00

CGrammar: Improve translation of initializer expressions such as int i = 'a' > 'b';

This commit is contained in:
Pragmatic Software 2014-07-09 09:19:49 +00:00
parent de3493f1ca
commit 4520be1a2c
2 changed files with 9 additions and 4 deletions

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 721,
BUILD_DATE => "2014-07-07",
BUILD_REVISION => 722,
BUILD_DATE => "2014-07-09",
};
1;

View File

@ -622,7 +622,12 @@ rel_add_mul_shift_expression:
cast_expression ...';'
{ $return = $item{cast_expression}; }
| <leftop: cast_expression rel_mul_add_ex_op cast_expression>
{ $return = join('' , @{$item[1]}); }
{
if($arg{context} =~ /expression/) {
$return = 'the result of the expression ';
}
$return .= join('' , @{$item[1]});
}
closure:
',' | ';' | ')'
@ -853,7 +858,7 @@ init_declarator:
initializer:
designation initializer
{ $return = "$item[1] $item[2]"; }
| comment(?) assignment_expression comment(?)
| comment(?) assignment_expression[context => "$arg{context}|initializer expression"] comment(?)
{
$return = $item[2];