Skip to content

Commit f775bd9

Browse files
committed
Separate new and instanceof class name productions
1 parent de99571 commit f775bd9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Zend/zend_language_parser.y

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
238238
%type <ast> extends_from parameter optional_type argument global_var
239239
%type <ast> static_var class_statement trait_adaptation trait_precedence trait_alias
240240
%type <ast> absolute_trait_method_reference trait_method_reference property echo_expr
241-
%type <ast> new_expr anonymous_class class_name class_name_reference simple_variable
241+
%type <ast> new_expr anonymous_class class_name new_class_name instanceof_class_name simple_variable
242242
%type <ast> internal_functions_in_yacc
243243
%type <ast> exit_expr scalar backticks_expr lexical_var function_call member_name property_name
244244
%type <ast> variable_class_name dereferencable_scalar constant class_constant
@@ -876,7 +876,7 @@ anonymous_class:
876876
;
877877

878878
new_expr:
879-
T_NEW class_name_reference ctor_arguments
879+
T_NEW new_class_name ctor_arguments
880880
{ $$ = zend_ast_create(ZEND_AST_NEW, $2, $3); }
881881
| T_NEW anonymous_class
882882
{ $$ = $2; }
@@ -968,7 +968,7 @@ expr:
968968
{ $$ = zend_ast_create(ZEND_AST_GREATER_EQUAL, $1, $3); }
969969
| expr T_SPACESHIP expr
970970
{ $$ = zend_ast_create_binary_op(ZEND_SPACESHIP, $1, $3); }
971-
| expr T_INSTANCEOF class_name_reference
971+
| expr T_INSTANCEOF instanceof_class_name
972972
{ $$ = zend_ast_create(ZEND_AST_INSTANCEOF, $1, $3); }
973973
| '(' expr ')' {
974974
$$ = $2;
@@ -1075,7 +1075,13 @@ class_name:
10751075
| name { $$ = $1; }
10761076
;
10771077

1078-
class_name_reference:
1078+
instanceof_class_name:
1079+
class_name { $$ = $1; }
1080+
| new_variable { $$ = $1; }
1081+
| '{' expr '}' { $$ = $2; }
1082+
;
1083+
1084+
new_class_name:
10791085
class_name { $$ = $1; }
10801086
| new_variable { $$ = $1; }
10811087
| '{' expr '}' { $$ = $2; }

0 commit comments

Comments
 (0)