}
/* }}} */
-void zend_compile_batch_use(zend_ast *ast) /* {{{ */
-{
- zend_string *ns = zend_ast_get_str(ast->child[0]);
- zend_ast_list *list = zend_ast_get_list(ast->child[1]);
- uint32_t i;
-
- for (i = 0; i < list->children; i++) {
- zend_ast *use = list->child[i];
- zval *name_zval = zend_ast_get_zval(use->child[0]);
- zend_string *name = Z_STR_P(name_zval);
- zend_string *compound_ns = zend_concat_names(ns->val, ns->len, name->val, name->len);
- zend_string_release(name);
- ZVAL_STR(name_zval, compound_ns);
- zend_ast_list *inline_use = zend_ast_create_list(1, ZEND_AST_USE, use);
- inline_use->attr = ast->attr ? ast->attr : use->attr;
- zend_compile_use(inline_use);
- }
-}
-/* }}} */
-
void zend_compile_use(zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
}
/* }}} */
+void zend_compile_group_use(zend_ast *ast) /* {{{ */
+{
+ zend_string *ns = zend_ast_get_str(ast->child[0]);
+ zend_ast_list *list = zend_ast_get_list(ast->child[1]);
+ uint32_t i;
+
+ for (i = 0; i < list->children; i++) {
+ zend_ast *use = list->child[i];
+ zval *name_zval = zend_ast_get_zval(use->child[0]);
+ zend_string *name = Z_STR_P(name_zval);
+ zend_string *compound_ns = zend_concat_names(ns->val, ns->len, name->val, name->len);
+ zend_string_release(name);
+ ZVAL_STR(name_zval, compound_ns);
+ zend_ast *inline_use = zend_ast_create_list(1, ZEND_AST_USE, use);
+ inline_use->attr = ast->attr ? ast->attr : use->attr;
+ zend_compile_use(inline_use);
+ }
+}
+/* }}} */
+
+
void zend_compile_const_decl(zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
case ZEND_AST_CLASS:
zend_compile_class_decl(ast);
break;
- case ZEND_AST_BATCH_USE:
- zend_compile_batch_use(ast);
+ case ZEND_AST_GROUP_USE:
+ zend_compile_group_use(ast);
break;
case ZEND_AST_USE:
zend_compile_use(ast);
%type <ast> top_statement namespace_name name statement function_declaration_statement
%type <ast> class_declaration_statement trait_declaration_statement
%type <ast> interface_declaration_statement interface_extends_list
-%type <ast> batch_use_declarations inline_use_declarations inline_use_declaration
-%type <ast> mixed_batch_use_declarations use_declaration const_decl inner_statement
+%type <ast> group_use_declaration inline_use_declarations inline_use_declaration
+%type <ast> mixed_group_use_declaration use_declaration const_decl inner_statement
%type <ast> expr optional_expr while_statement for_statement foreach_variable
%type <ast> foreach_statement declare_statement finally_statement unset_variable variable
%type <ast> extends_from parameter optional_type argument expr_without_variable global_var
%type <num> returns_ref function is_reference is_variadic variable_modifiers
%type <num> method_modifiers trait_modifiers non_empty_member_modifiers member_modifier
-%type <num> class_modifiers class_modifier
+%type <num> class_modifiers class_modifier use_type
%type <str> backup_doc_comment
| T_NAMESPACE { RESET_DOC_COMMENT(); }
'{' top_statement_list '}'
{ $$ = zend_ast_create(ZEND_AST_NAMESPACE, NULL, $4); }
- | T_USE mixed_batch_use_declarations ';' { $$ = $2; }
- | T_USE T_FUNCTION batch_use_declarations ';' { $$ = $3; $3->attr = T_FUNCTION; }
- | T_USE T_CONST batch_use_declarations ';' { $$ = $3; $3->attr = T_CONST; }
+ | T_USE mixed_group_use_declaration ';' { $$ = $2; }
+ | T_USE T_FUNCTION group_use_declaration ';' { $$ = $3; $$->attr = T_FUNCTION; }
+ | T_USE T_CONST group_use_declaration ';' { $$ = $3; $$->attr = T_CONST; }
| T_USE use_declarations ';' { $$ = $2; $$->attr = T_CLASS; }
| T_USE T_FUNCTION use_declarations ';' { $$ = $3; $$->attr = T_FUNCTION; }
| T_USE T_CONST use_declarations ';' { $$ = $3; $$->attr = T_CONST; }
| T_CONST const_list ';' { $$ = $2; }
;
-batch_use_declarations:
+use_type:
+ /* empty */ { $$ = T_CLASS; }
+ | T_FUNCTION { $$ = T_FUNCTION; }
+ | T_CONST { $$ = T_CONST; }
+;
+
+group_use_declaration:
namespace_name T_NS_SEPARATOR '{' use_declarations '}'
- {$$ = zend_ast_create(ZEND_AST_BATCH_USE, $1, $4); }
+ {$$ = zend_ast_create(ZEND_AST_GROUP_USE, $1, $4); }
;
-mixed_batch_use_declarations:
+mixed_group_use_declaration:
namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}'
- {$$ = zend_ast_create(ZEND_AST_BATCH_USE, $1, $4);}
+ {$$ = zend_ast_create(ZEND_AST_GROUP_USE, $1, $4);}
;
inline_use_declarations:
;
inline_use_declaration:
- use_declaration
- { $$ = $1; $$->attr = T_CLASS; }
- | T_FUNCTION use_declaration
- { $$ = $2; $$->attr = T_FUNCTION; }
- | T_CONST use_declaration
- { $$ = $2; $$->attr = T_CONST; }
+ use_type use_declaration { $$ = $2; $$->attr = $1; }
;
use_declarations: