Skip to content

Commit 8bbac00

Browse files
zend_language_parser.y: simplify class_declaration_statement grammar
Allow `class_modifiers` to be empty (resulting in a `0`) and unify the rules for class declarations with and without modifiers.
1 parent f46bc8e commit 8bbac00

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Zend/zend_language_parser.y

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,10 @@ class_declaration_statement:
605605
class_modifiers T_CLASS { $<num>$ = CG(zend_lineno); }
606606
T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
607607
{ $$ = zend_ast_create_decl(ZEND_AST_CLASS, $1, $<num>3, $7, zend_ast_get_str($4), $5, $6, $9, NULL, NULL); }
608-
| T_CLASS { $<num>$ = CG(zend_lineno); }
609-
T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
610-
{ $$ = zend_ast_create_decl(ZEND_AST_CLASS, 0, $<num>2, $6, zend_ast_get_str($3), $4, $5, $8, NULL, NULL); }
611608
;
612609

613610
class_modifiers:
614-
class_modifier { $$ = $1; }
611+
%empty { $$ = 0; }
615612
| class_modifiers class_modifier
616613
{ $$ = zend_add_class_modifier($1, $2); if (!$$) { YYERROR; } }
617614
;

0 commit comments

Comments
 (0)