Add specialized constructor for binary operators

This commit is contained in:
nikic
2011-08-11 08:57:13 +02:00
parent 22b507e9f4
commit 284f32f475
28 changed files with 501 additions and 76 deletions

View File

@ -470,35 +470,35 @@ expr:
| T_INC variable { $$ = Expr_PreInc[var: $2]; }
| variable T_DEC { $$ = Expr_PostDec[var: $1]; }
| T_DEC variable { $$ = Expr_PreDec[var: $2]; }
| expr T_BOOLEAN_OR expr { $$ = Expr_BooleanOr[left: $1, right: $3]; }
| expr T_BOOLEAN_AND expr { $$ = Expr_BooleanAnd[left: $1, right: $3]; }
| expr T_LOGICAL_OR expr { $$ = Expr_LogicalOr[left: $1, right: $3]; }
| expr T_LOGICAL_AND expr { $$ = Expr_LogicalAnd[left: $1, right: $3]; }
| expr T_LOGICAL_XOR expr { $$ = Expr_LogicalXor[left: $1, right: $3]; }
| expr '|' expr { $$ = Expr_BitwiseOr[left: $1, right: $3]; }
| expr '&' expr { $$ = Expr_BitwiseAnd[left: $1, right: $3]; }
| expr '^' expr { $$ = Expr_BitwiseXor[left: $1, right: $3]; }
| expr '.' expr { $$ = Expr_Concat[left: $1, right: $3]; }
| expr '+' expr { $$ = Expr_Plus[left: $1, right: $3]; }
| expr '-' expr { $$ = Expr_Minus[left: $1, right: $3]; }
| expr '*' expr { $$ = Expr_Mul[left: $1, right: $3]; }
| expr '/' expr { $$ = Expr_Div[left: $1, right: $3]; }
| expr '%' expr { $$ = Expr_Mod[left: $1, right: $3]; }
| expr T_SL expr { $$ = Expr_ShiftLeft[left: $1, right: $3]; }
| expr T_SR expr { $$ = Expr_ShiftRight[left: $1, right: $3]; }
| expr T_BOOLEAN_OR expr { $$ = Expr_BooleanOr [$1, $3]; }
| expr T_BOOLEAN_AND expr { $$ = Expr_BooleanAnd[$1, $3]; }
| expr T_LOGICAL_OR expr { $$ = Expr_LogicalOr [$1, $3]; }
| expr T_LOGICAL_AND expr { $$ = Expr_LogicalAnd[$1, $3]; }
| expr T_LOGICAL_XOR expr { $$ = Expr_LogicalXor[$1, $3]; }
| expr '|' expr { $$ = Expr_BitwiseOr [$1, $3]; }
| expr '&' expr { $$ = Expr_BitwiseAnd[$1, $3]; }
| expr '^' expr { $$ = Expr_BitwiseXor[$1, $3]; }
| expr '.' expr { $$ = Expr_Concat [$1, $3]; }
| expr '+' expr { $$ = Expr_Plus [$1, $3]; }
| expr '-' expr { $$ = Expr_Minus [$1, $3]; }
| expr '*' expr { $$ = Expr_Mul [$1, $3]; }
| expr '/' expr { $$ = Expr_Div [$1, $3]; }
| expr '%' expr { $$ = Expr_Mod [$1, $3]; }
| expr T_SL expr { $$ = Expr_ShiftLeft [$1, $3]; }
| expr T_SR expr { $$ = Expr_ShiftRight[$1, $3]; }
| '+' expr %prec T_INC { $$ = Expr_UnaryPlus[expr: $2]; }
| '-' expr %prec T_INC { $$ = Expr_UnaryMinus[expr: $2]; }
| '!' expr { $$ = Expr_BooleanNot[expr: $2]; }
| '~' expr { $$ = Expr_BitwiseNot[expr: $2]; }
| expr T_IS_IDENTICAL expr { $$ = Expr_Identical[left: $1, right: $3]; }
| expr T_IS_NOT_IDENTICAL expr { $$ = Expr_NotIdentical[left: $1, right: $3]; }
| expr T_IS_EQUAL expr { $$ = Expr_Equal[left: $1, right: $3]; }
| expr T_IS_NOT_EQUAL expr { $$ = Expr_NotEqual[left: $1, right: $3]; }
| expr '<' expr { $$ = Expr_Smaller[left: $1, right: $3]; }
| expr T_IS_SMALLER_OR_EQUAL expr { $$ = Expr_SmallerOrEqual[left: $1, right: $3]; }
| expr '>' expr { $$ = Expr_Greater[left: $1, right: $3]; }
| expr T_IS_GREATER_OR_EQUAL expr { $$ = Expr_GreaterOrEqual[left: $1, right: $3]; }
| expr T_INSTANCEOF class_name_reference { $$ = Expr_Instanceof[expr: $1, class: $3]; }
| expr T_IS_IDENTICAL expr { $$ = Expr_Identical [$1, $3]; }
| expr T_IS_NOT_IDENTICAL expr { $$ = Expr_NotIdentical [$1, $3]; }
| expr T_IS_EQUAL expr { $$ = Expr_Equal [$1, $3]; }
| expr T_IS_NOT_EQUAL expr { $$ = Expr_NotEqual [$1, $3]; }
| expr '<' expr { $$ = Expr_Smaller [$1, $3]; }
| expr T_IS_SMALLER_OR_EQUAL expr { $$ = Expr_SmallerOrEqual[$1, $3]; }
| expr '>' expr { $$ = Expr_Greater [$1, $3]; }
| expr T_IS_GREATER_OR_EQUAL expr { $$ = Expr_GreaterOrEqual[$1, $3]; }
| expr T_INSTANCEOF class_name_reference { $$ = Expr_Instanceof [$1, $3]; }
| '(' expr ')' { $$ = $2; }
| expr '?' expr ':' expr { $$ = Expr_Ternary[cond: $1, if: $3, else: $5]; }
| expr '?' ':' expr { $$ = Expr_Ternary[cond: $1, if: null, else: $4]; }