@@ -3355,7 +3355,28 @@ ObjectItem // {{{
33553355// }}}
33563356
33573357Operand // {{{
3358- : UnaryExpression
3358+ : PrefixUnaryOperator Operand
3359+ {
3360+ if ($1 .kind === UnaryOperator .Negative && $2 .kind === Kind .NumericExpression ) {
3361+ $2 .value = - $2 .value ;
3362+ $$ = location ($2 , @1 , @2 );
3363+ }
3364+ else {
3365+ $$ = location ({
3366+ kind: Kind .UnaryExpression ,
3367+ operator: $1 ,
3368+ argument: $2
3369+ }, @1 , @2 );
3370+ }
3371+ }
3372+ | Operand PostfixUnaryOperator
3373+ {
3374+ $$ = location ({
3375+ kind: Kind .UnaryExpression ,
3376+ operator: $2 ,
3377+ argument: $1
3378+ }, @1 , @2 );
3379+ }
33593380 | OperandSX
33603381 ;
33613382// }}}
@@ -3508,7 +3529,28 @@ OperandOrType // {{{
35083529// }}}
35093530
35103531OperandNAF // {{{
3511- : UnaryExpression
3532+ : PrefixUnaryOperator OperandNAF
3533+ {
3534+ if ($1 .kind === UnaryOperator .Negative && $2 .kind === Kind .NumericExpression ) {
3535+ $2 .value = - $2 .value ;
3536+ $$ = location ($2 , @1 , @2 );
3537+ }
3538+ else {
3539+ $$ = location ({
3540+ kind: Kind .UnaryExpression ,
3541+ operator: $1 ,
3542+ argument: $2
3543+ }, @1 , @2 );
3544+ }
3545+ }
3546+ | OperandNAF PostfixUnaryOperator
3547+ {
3548+ $$ = location ({
3549+ kind: Kind .UnaryExpression ,
3550+ operator: $2 ,
3551+ argument: $1
3552+ }, @1 , @2 );
3553+ }
35123554 | OperandSXNAF
35133555 ;
35143556// }}}
@@ -3661,7 +3703,28 @@ OperandOrTypeNAF // {{{
36613703// }}}
36623704
36633705OperandNO // {{{
3664- : UnaryExpression
3706+ : PrefixUnaryOperator OperandNO
3707+ {
3708+ if ($1 .kind === UnaryOperator .Negative && $2 .kind === Kind .NumericExpression ) {
3709+ $2 .value = - $2 .value ;
3710+ $$ = location ($2 , @1 , @2 );
3711+ }
3712+ else {
3713+ $$ = location ({
3714+ kind: Kind .UnaryExpression ,
3715+ operator: $1 ,
3716+ argument: $2
3717+ }, @1 , @2 );
3718+ }
3719+ }
3720+ | OperandNO PostfixUnaryOperator
3721+ {
3722+ $$ = location ({
3723+ kind: Kind .UnaryExpression ,
3724+ operator: $2 ,
3725+ argument: $1
3726+ }, @1 , @2 );
3727+ }
36653728 | OperandSXNO
36663729 ;
36673730// }}}
@@ -3896,6 +3959,22 @@ ParenthesisNAF // {{{
38963959 ;
38973960// }}}
38983961
3962+ PostfixUnaryOperator // {{{
3963+ : '--'
3964+ {
3965+ $$ = location ({
3966+ kind: UnaryOperator .DecrementPostfix
3967+ }, @1 );
3968+ }
3969+ | '++'
3970+ {
3971+ $$ = location ({
3972+ kind: UnaryOperator .IncrementPostfix
3973+ }, @1 );
3974+ }
3975+ ;
3976+ // }}}
3977+
38993978PrefixUnaryOperator // {{{
39003979 : '--'
39013980 {
@@ -5022,24 +5101,6 @@ TypeVarList // {{{
50225101 ;
50235102// }}}
50245103
5025- UnaryExpression // {{{
5026- : PrefixUnaryOperator Operand
5027- {
5028- if ($1 .kind === UnaryOperator .Negative && $2 .kind === Kind .NumericExpression ) {
5029- $2 .value = - $2 .value ;
5030- $$ = location ($2 , @1 , @2 );
5031- }
5032- else {
5033- $$ = location ({
5034- kind: Kind .UnaryExpression ,
5035- operator: $1 ,
5036- argument: $2
5037- }, @1 , @2 );
5038- }
5039- }
5040- ;
5041- // }}}
5042-
50435104UnlessStatement // {{{
50445105 : 'UNLESS' Expression Block
50455106 {
0 commit comments