@@ -227,7 +227,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
227
227
228
228
%type <ast> top_statement namespace_name name statement function_declaration_statement
229
229
%type <ast> class_declaration_statement use_declaration const_decl inner_statement
230
- %type <ast> parenthesis_expr expr while_statement for_statement foreach_variable
230
+ %type <ast> expr while_statement for_statement foreach_variable
231
231
%type <ast> foreach_statement declare_statement finally_statement unset_variable variable
232
232
%type <ast> extends_from parameter optional_type argument expr_without_variable global_var
233
233
%type <ast> static_var class_statement trait_adaptation trait_precedence trait_alias
@@ -351,14 +351,14 @@ statement:
351
351
' {' inner_statement_list ' }' { $$ = $<ast>2 ; }
352
352
| if_stmt { $$ = $<ast>1 ; }
353
353
| alt_if_stmt { $$ = $<ast>1 ; }
354
- | T_WHILE parenthesis_expr while_statement
355
- { $$ = zend_ast_create(ZEND_AST_WHILE, $2 , $3 ); }
356
- | T_DO statement T_WHILE parenthesis_expr ' ;'
357
- { $$ = zend_ast_create(ZEND_AST_DO_WHILE, $2 , $4 ); }
354
+ | T_WHILE ' ( ' expr ' ) ' while_statement
355
+ { $$ = zend_ast_create(ZEND_AST_WHILE, $3 , $5 ); }
356
+ | T_DO statement T_WHILE ' ( ' expr ' ) ' ' ;'
357
+ { $$ = zend_ast_create(ZEND_AST_DO_WHILE, $2 , $5 ); }
358
358
| T_FOR ' (' for_exprs ' ;' for_exprs ' ;' for_exprs ' )' for_statement
359
359
{ $$ = zend_ast_create(ZEND_AST_FOR, $<ast>3 , $<ast>5 , $<ast>7 , $9 ); }
360
- | T_SWITCH parenthesis_expr switch_case_list
361
- { $$ = zend_ast_create(ZEND_AST_SWITCH, $2 , $<ast>3 ); }
360
+ | T_SWITCH ' ( ' expr ' ) ' switch_case_list
361
+ { $$ = zend_ast_create(ZEND_AST_SWITCH, $3 , $<ast>5 ); }
362
362
| T_BREAK ' ;' { $$ = zend_ast_create(ZEND_AST_BREAK, NULL ); }
363
363
| T_BREAK expr ' ;' { $$ = zend_ast_create(ZEND_AST_BREAK, $2 ); }
364
364
| T_CONTINUE ' ;' { $$ = zend_ast_create(ZEND_AST_CONTINUE, NULL ); }
@@ -508,12 +508,12 @@ while_statement:
508
508
509
509
510
510
if_stmt_without_else :
511
- T_IF parenthesis_expr statement
511
+ T_IF ' ( ' expr ' ) ' statement
512
512
{ $$ = zend_ast_create_list(1 , ZEND_AST_IF,
513
- zend_ast_create (ZEND_AST_IF_ELEM, $2 , $3 )); }
514
- | if_stmt_without_else T_ELSEIF parenthesis_expr statement
513
+ zend_ast_create (ZEND_AST_IF_ELEM, $3 , $5 )); }
514
+ | if_stmt_without_else T_ELSEIF ' ( ' expr ' ) ' statement
515
515
{ $$ = zend_ast_list_add($1 ,
516
- zend_ast_create (ZEND_AST_IF_ELEM, $3 , $4 )); }
516
+ zend_ast_create (ZEND_AST_IF_ELEM, $4 , $6 )); }
517
517
;
518
518
519
519
if_stmt :
@@ -523,12 +523,12 @@ if_stmt:
523
523
;
524
524
525
525
alt_if_stmt_without_else :
526
- T_IF parenthesis_expr ' :' inner_statement_list
526
+ T_IF ' ( ' expr ' ) ' ' :' inner_statement_list
527
527
{ $$ = zend_ast_create_list(1 , ZEND_AST_IF,
528
- zend_ast_create (ZEND_AST_IF_ELEM, $2 , $<ast>4 )); }
529
- | alt_if_stmt_without_else T_ELSEIF parenthesis_expr ' :' inner_statement_list
528
+ zend_ast_create (ZEND_AST_IF_ELEM, $3 , $<ast>6 )); }
529
+ | alt_if_stmt_without_else T_ELSEIF ' ( ' expr ' ) ' ' :' inner_statement_list
530
530
{ $$ = zend_ast_list_add($1 ,
531
- zend_ast_create (ZEND_AST_IF_ELEM, $3 , $<ast>5 )); }
531
+ zend_ast_create (ZEND_AST_IF_ELEM, $4 , $<ast>7 )); }
532
532
;
533
533
534
534
alt_if_stmt :
@@ -833,7 +833,7 @@ expr_without_variable:
833
833
{ $$ = zend_ast_create(ZEND_AST_GREATER_EQUAL, $1 , $3 ); }
834
834
| expr T_INSTANCEOF class_name_reference
835
835
{ $$ = zend_ast_create(ZEND_AST_INSTANCEOF, $1 , $3 ); }
836
- | parenthesis_expr { $$ = $1 ; }
836
+ | ' ( ' expr ' ) ' { $$ = $2 ; }
837
837
| new_expr { $$ = $1 ; }
838
838
| expr ' ?' expr ' :' expr
839
839
{ $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1 , $3 , $5 ); }
@@ -929,9 +929,9 @@ class_name_reference:
929
929
;
930
930
931
931
exit_expr :
932
- /* empty */ { $$ = NULL ; }
933
- | ' (' ' )' { $$ = NULL ; }
934
- | parenthesis_expr { $$ = $1 ; }
932
+ /* empty */ { $$ = NULL ; }
933
+ | ' (' ' )' { $$ = NULL ; }
934
+ | ' ( ' expr ' ) ' { $$ = $2 ; }
935
935
;
936
936
937
937
backticks_expr :
@@ -993,10 +993,6 @@ expr:
993
993
| expr_without_variable { $$ = $1 ; }
994
994
;
995
995
996
- parenthesis_expr :
997
- ' (' expr ' )' { $$ = $2 ; }
998
- ;
999
-
1000
996
variable_class_name :
1001
997
dereferencable { $$ = $1 ; }
1002
998
;
0 commit comments