@@ -268,11 +268,11 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
268268%type <ast> callable_expr callable_variable static_member new_variable
269269%type <ast> encaps_var encaps_var_offset isset_variables
270270%type <ast> top_statement_list use_declarations const_list inner_statement_list if_stmt
271- %type <ast> alt_if_stmt for_exprs for_expr_statements switch_case_list global_var_list static_var_list
271+ %type <ast> alt_if_stmt for_cond_exprs for_exprs switch_case_list global_var_list static_var_list
272272%type <ast> echo_expr_list unset_variables catch_name_list catch_list optional_variable parameter_list class_statement_list
273273%type <ast> implements_list case_list if_stmt_without_else
274274%type <ast> non_empty_parameter_list argument_list non_empty_argument_list property_list
275- %type <ast> class_const_list class_const_decl class_name_list trait_adaptations method_body non_empty_for_exprs non_empty_for_expr_statements
275+ %type <ast> class_const_list class_const_decl class_name_list trait_adaptations method_body non_empty_for_exprs
276276%type <ast> ctor_arguments alt_if_stmt_without_else trait_adaptation_list lexical_vars
277277%type <ast> lexical_var_list encaps_list
278278%type <ast> array_pair non_empty_array_pair_list array_pair_list possible_array_pair
@@ -508,7 +508,7 @@ statement:
508508 { $$ = zend_ast_create(ZEND_AST_WHILE, $3 , $5 ); }
509509 | T_DO statement T_WHILE ' (' expr ' )' ' ;'
510510 { $$ = zend_ast_create(ZEND_AST_DO_WHILE, $2 , $5 ); }
511- | T_FOR ' (' for_expr_statements ' ;' for_exprs ' ;' for_expr_statements ' )' for_statement
511+ | T_FOR ' (' for_exprs ' ;' for_cond_exprs ' ;' for_exprs ' )' for_statement
512512 { $$ = zend_ast_create(ZEND_AST_FOR, $3 , $5 , $7 , $9 ); }
513513 | T_SWITCH ' (' expr ' )' switch_case_list
514514 { $$ = zend_ast_create(ZEND_AST_SWITCH, $3 , $5 ); }
@@ -1169,24 +1169,20 @@ echo_expr:
11691169 expr { $$ = zend_ast_create(ZEND_AST_ECHO, $1 ); }
11701170;
11711171
1172- for_exprs :
1172+ for_cond_exprs :
11731173 %empty { $$ = NULL ; }
1174- | non_empty_for_exprs { $$ = $1 ; }
1175- ;
1176-
1177- non_empty_for_exprs :
1178- non_empty_for_expr_statements ' ,' expr { $$ = zend_ast_list_add($1 , $3 ); }
1174+ | non_empty_for_exprs ' ,' expr { $$ = zend_ast_list_add($1 , $3 ); }
11791175 | expr { $$ = zend_ast_create_list(1 , ZEND_AST_EXPR_LIST, $1 ); }
11801176;
11811177
1182- for_expr_statements :
1178+ for_exprs :
11831179 %empty { $$ = NULL ; }
1184- | non_empty_for_expr_statements { $$ = $1 ; }
1180+ | non_empty_for_exprs { $$ = $1 ; }
11851181;
11861182
1187- non_empty_for_expr_statements :
1188- non_empty_for_expr_statements ' ,' expr { $$ = zend_ast_list_add($1 , $3 ); }
1189- | non_empty_for_expr_statements ' ,' T_VOID_CAST expr { $$ = zend_ast_list_add($1 , zend_ast_create(ZEND_AST_CAST_VOID, $4 )); }
1183+ non_empty_for_exprs :
1184+ non_empty_for_exprs ' ,' expr { $$ = zend_ast_list_add($1 , $3 ); }
1185+ | non_empty_for_exprs ' ,' T_VOID_CAST expr { $$ = zend_ast_list_add($1 , zend_ast_create(ZEND_AST_CAST_VOID, $4 )); }
11901186 | T_VOID_CAST expr { $$ = zend_ast_create_list(1 , ZEND_AST_EXPR_LIST, zend_ast_create(ZEND_AST_CAST_VOID, $2 )); }
11911187 | expr { $$ = zend_ast_create_list(1 , ZEND_AST_EXPR_LIST, $1 ); }
11921188;
0 commit comments