@@ -229,8 +229,8 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
229229%type <ast> top_statement namespace_name name statement function_declaration_statement
230230%type <ast> class_declaration_statement trait_declaration_statement
231231%type <ast> interface_declaration_statement interface_extends_list
232- %type <ast> batch_use_declarations inline_use_declarations inline_use_declaration
233- %type <ast> mixed_batch_use_declarations use_declaration const_decl inner_statement
232+ %type <ast> group_use_declaration inline_use_declarations inline_use_declaration
233+ %type <ast> mixed_group_use_declaration use_declaration const_decl inner_statement
234234%type <ast> expr optional_expr while_statement for_statement foreach_variable
235235%type <ast> foreach_statement declare_statement finally_statement unset_variable variable
236236%type <ast> extends_from parameter optional_type argument expr_without_variable global_var
@@ -253,7 +253,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
253253
254254%type <num> returns_ref function is_reference is_variadic variable_modifiers
255255%type <num> method_modifiers trait_modifiers non_empty_member_modifiers member_modifier
256- %type <num> class_modifiers class_modifier
256+ %type <num> class_modifiers class_modifier use_type
257257
258258%type <str> backup_doc_comment
259259
@@ -298,23 +298,29 @@ top_statement:
298298 | T_NAMESPACE { RESET_DOC_COMMENT(); }
299299 ' {' top_statement_list ' }'
300300 { $$ = zend_ast_create(ZEND_AST_NAMESPACE, NULL , $4 ); }
301- | T_USE mixed_batch_use_declarations ' ;' { $$ = $2 ; }
302- | T_USE T_FUNCTION batch_use_declarations ' ;' { $$ = $3 ; $3 ->attr = T_FUNCTION; }
303- | T_USE T_CONST batch_use_declarations ' ;' { $$ = $3 ; $3 ->attr = T_CONST; }
301+ | T_USE mixed_group_use_declaration ' ;' { $$ = $2 ; }
302+ | T_USE T_FUNCTION group_use_declaration ' ;' { $$ = $3 ; $$ ->attr = T_FUNCTION; }
303+ | T_USE T_CONST group_use_declaration ' ;' { $$ = $3 ; $$ ->attr = T_CONST; }
304304 | T_USE use_declarations ' ;' { $$ = $2 ; $$ ->attr = T_CLASS; }
305305 | T_USE T_FUNCTION use_declarations ' ;' { $$ = $3 ; $$ ->attr = T_FUNCTION; }
306306 | T_USE T_CONST use_declarations ' ;' { $$ = $3 ; $$ ->attr = T_CONST; }
307307 | T_CONST const_list ' ;' { $$ = $2 ; }
308308;
309309
310- batch_use_declarations :
310+ use_type :
311+ /* empty */ { $$ = T_CLASS; }
312+ | T_FUNCTION { $$ = T_FUNCTION; }
313+ | T_CONST { $$ = T_CONST; }
314+ ;
315+
316+ group_use_declaration :
311317 namespace_name T_NS_SEPARATOR ' {' use_declarations ' }'
312- {$$ = zend_ast_create(ZEND_AST_BATCH_USE , $1 , $4 ); }
318+ {$$ = zend_ast_create(ZEND_AST_GROUP_USE , $1 , $4 ); }
313319;
314320
315- mixed_batch_use_declarations :
321+ mixed_group_use_declaration :
316322 namespace_name T_NS_SEPARATOR ' {' inline_use_declarations ' }'
317- {$$ = zend_ast_create(ZEND_AST_BATCH_USE , $1 , $4 );}
323+ {$$ = zend_ast_create(ZEND_AST_GROUP_USE , $1 , $4 );}
318324;
319325
320326inline_use_declarations :
@@ -325,12 +331,7 @@ inline_use_declarations:
325331;
326332
327333inline_use_declaration :
328- use_declaration
329- { $$ = $1 ; $$ ->attr = T_CLASS; }
330- | T_FUNCTION use_declaration
331- { $$ = $2 ; $$ ->attr = T_FUNCTION; }
332- | T_CONST use_declaration
333- { $$ = $2 ; $$ ->attr = T_CONST; }
334+ use_type use_declaration { $$ = $2 ; $$ ->attr = $1 ; }
334335;
335336
336337use_declarations :
0 commit comments