mirror of
https://github.com/pragma-/pbot.git
synced 2025-05-03 13:17:33 +02:00
CGrammar: Improve translation of initializer expressions such as int i = 'a' > 'b';
This commit is contained in:
parent
de3493f1ca
commit
4520be1a2c
@ -13,8 +13,8 @@ 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 => 721,
|
BUILD_REVISION => 722,
|
||||||
BUILD_DATE => "2014-07-07",
|
BUILD_DATE => "2014-07-09",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -622,7 +622,12 @@ rel_add_mul_shift_expression:
|
|||||||
cast_expression ...';'
|
cast_expression ...';'
|
||||||
{ $return = $item{cast_expression}; }
|
{ $return = $item{cast_expression}; }
|
||||||
| <leftop: cast_expression rel_mul_add_ex_op 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:
|
closure:
|
||||||
',' | ';' | ')'
|
',' | ';' | ')'
|
||||||
@ -853,7 +858,7 @@ init_declarator:
|
|||||||
initializer:
|
initializer:
|
||||||
designation initializer
|
designation initializer
|
||||||
{ $return = "$item[1] $item[2]"; }
|
{ $return = "$item[1] $item[2]"; }
|
||||||
| comment(?) assignment_expression comment(?)
|
| comment(?) assignment_expression[context => "$arg{context}|initializer expression"] comment(?)
|
||||||
{
|
{
|
||||||
$return = $item[2];
|
$return = $item[2];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user