Skip to content

Commit 9c7a3f8

Browse files
committed
Support declaring functions with name exit/die
For use in stubs. Fixes #1030.
1 parent 26573ea commit 9c7a3f8

File tree

4 files changed

+1863
-1768
lines changed

4 files changed

+1863
-1768
lines changed

grammar/php.y

+4-3
Original file line numberDiff line numberDiff line change
@@ -464,15 +464,16 @@ block_or_error:
464464
| error { $$ = []; }
465465
;
466466

467-
identifier_maybe_readonly:
467+
fn_identifier:
468468
identifier_not_reserved
469469
| T_READONLY { $$ = Node\Identifier[$1]; }
470+
| T_EXIT { $$ = Node\Identifier[$1]; }
470471
;
471472

472473
function_declaration_statement:
473-
T_FUNCTION optional_ref identifier_maybe_readonly '(' parameter_list ')' optional_return_type block_or_error
474+
T_FUNCTION optional_ref fn_identifier '(' parameter_list ')' optional_return_type block_or_error
474475
{ $$ = Stmt\Function_[$3, ['byRef' => $2, 'params' => $5, 'returnType' => $7, 'stmts' => $8, 'attrGroups' => []]]; }
475-
| attributes T_FUNCTION optional_ref identifier_maybe_readonly '(' parameter_list ')' optional_return_type block_or_error
476+
| attributes T_FUNCTION optional_ref fn_identifier '(' parameter_list ')' optional_return_type block_or_error
476477
{ $$ = Stmt\Function_[$4, ['byRef' => $3, 'params' => $6, 'returnType' => $8, 'stmts' => $9, 'attrGroups' => $1]]; }
477478
;
478479

0 commit comments

Comments
 (0)