@@ -285,10 +285,10 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
285
285
%type <ast> enum_declaration_statement enum_backing_type enum_case enum_case_expr
286
286
%type <ast> function_name non_empty_member_modifiers
287
287
%type <ast> property_hook property_hook_list optional_property_hook_list hooked_property property_hook_body
288
- %type <ast> optional_parameter_list
288
+ %type <ast> optional_parameter_list inner_class_statement
289
289
290
290
%type <num> returns_ref function fn is_reference is_variadic property_modifiers property_hook_modifiers
291
- %type <num> method_modifiers class_const_modifiers member_modifier optional_cpp_modifiers
291
+ %type <num> method_modifiers class_const_modifiers member_modifier optional_cpp_modifiers inner_class_modifiers
292
292
%type <num> class_modifiers class_modifier anonymous_class_modifiers anonymous_class_modifiers_optional use_type backup_fn_flags
293
293
294
294
%type <ptr> backup_lex_pos
@@ -628,6 +628,14 @@ class_modifier:
628
628
| T_READONLY { $$ = ZEND_ACC_READONLY_CLASS|ZEND_ACC_NO_DYNAMIC_PROPERTIES; }
629
629
;
630
630
631
+ inner_class_modifiers :
632
+ non_empty_member_modifiers
633
+ { $$ = zend_modifier_list_to_flags(ZEND_MODIFIER_TARGET_INNER_CLASS, $1 );
634
+ if (!$$ ) { YYERROR ; } }
635
+ | %empty
636
+ { $$ = ZEND_ACC_PUBLIC; }
637
+ ;
638
+
631
639
trait_declaration_statement :
632
640
T_TRAIT { $<num>$ = CG(zend_lineno); }
633
641
T_STRING backup_doc_comment ' {' class_statement_list ' }'
@@ -943,6 +951,10 @@ class_statement_list:
943
951
{ $$ = zend_ast_create_list(0 , ZEND_AST_STMT_LIST); }
944
952
;
945
953
954
+ inner_class_statement :
955
+ T_CLASS T_STRING { $<num>$ = CG(zend_lineno); } extends_from implements_list backup_doc_comment ' {' class_statement_list ' }'
956
+ { $$ = zend_ast_create_decl(ZEND_AST_CLASS, 0 , $<num>3 , $6 , zend_ast_get_str($2 ), $4 , $5 , $8 , NULL , NULL ); }
957
+ ;
946
958
947
959
attributed_class_statement :
948
960
property_modifiers optional_type_without_static property_list ' ;'
@@ -962,6 +974,7 @@ attributed_class_statement:
962
974
{ $$ = zend_ast_create_decl(ZEND_AST_METHOD, $3 | $1 | $12 , $2 , $5 ,
963
975
zend_ast_get_str ($4 ), $7, NULL, $11, $9, NULL); CG(extra_fn_flags) = $10 ; }
964
976
| enum_case { $$ = $1 ; }
977
+ | inner_class_modifiers inner_class_statement { $$ = $2 ; $$ ->attr = $1 ; }
965
978
;
966
979
967
980
class_statement :
0 commit comments