From b20267c5adae9082e8ebce1b50183f8279a14543 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 9 Jul 2023 18:50:02 +0200 Subject: [PATCH] Make use of default actions For the default action $$ = $1, save the closure invocation. --- grammar/parser.template | 4 +- grammar/php.y | 158 ++++---- lib/PhpParser/Parser/Php7.php | 652 ++++++++----------------------- lib/PhpParser/Parser/Php8.php | 652 ++++++++----------------------- lib/PhpParser/ParserAbstract.php | 9 +- 5 files changed, 413 insertions(+), 1062 deletions(-) diff --git a/grammar/parser.template b/grammar/parser.template index 5d7da49f..41972f0e 100644 --- a/grammar/parser.template +++ b/grammar/parser.template @@ -101,9 +101,7 @@ class #(-p) extends \PhpParser\ParserAbstract %b }, #noact - %n => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + %n => null, #endreduce ]; } diff --git a/grammar/php.y b/grammar/php.y index e5d6914b..d021c737 100644 --- a/grammar/php.y +++ b/grammar/php.y @@ -185,7 +185,7 @@ namespace_name: ; legacy_namespace_name: - namespace_name { $$ = $1; } + namespace_name | T_NAME_FULLY_QUALIFIED { $$ = Name[substr($1, 1)]; } ; @@ -229,13 +229,13 @@ attributes: optional_attributes: /* empty */ { $$ = []; } - | attributes { $$ = $1; } + | attributes ; top_statement: - statement { $$ = $1; } - | function_declaration_statement { $$ = $1; } - | class_declaration_statement { $$ = $1; } + statement + | function_declaration_statement + | class_declaration_statement | T_HALT_COMPILER '(' ')' ';' { $$ = Stmt\HaltCompiler[$this->lexer->handleHaltCompiler()]; } | T_NAMESPACE namespace_declaration_name semi @@ -252,7 +252,7 @@ top_statement: $this->checkNamespace($$); } | T_USE use_declarations semi { $$ = Stmt\Use_[$2, Stmt\Use_::TYPE_NORMAL]; } | T_USE use_type use_declarations semi { $$ = Stmt\Use_[$3, $2]; } - | group_use_declaration semi { $$ = $1; } + | group_use_declaration semi | T_CONST constant_declaration_list semi { $$ = Stmt\Const_[$2]; } ; @@ -269,7 +269,7 @@ group_use_declaration: ; unprefixed_use_declarations: - non_empty_unprefixed_use_declarations optional_comma { $$ = $1; } + non_empty_unprefixed_use_declarations optional_comma ; non_empty_unprefixed_use_declarations: @@ -279,7 +279,7 @@ non_empty_unprefixed_use_declarations: ; use_declarations: - non_empty_use_declarations no_comma { $$ = $1; } + non_empty_use_declarations no_comma ; non_empty_use_declarations: @@ -288,7 +288,7 @@ non_empty_use_declarations: ; inline_use_declarations: - non_empty_inline_use_declarations optional_comma { $$ = $1; } + non_empty_inline_use_declarations optional_comma ; non_empty_inline_use_declarations: @@ -317,7 +317,7 @@ inline_use_declaration: ; constant_declaration_list: - non_empty_constant_declaration_list no_comma { $$ = $1; } + non_empty_constant_declaration_list no_comma ; non_empty_constant_declaration_list: @@ -331,7 +331,7 @@ constant_declaration: ; class_const_list: - non_empty_class_const_list no_comma { $$ = $1; } + non_empty_class_const_list no_comma ; non_empty_class_const_list: @@ -358,9 +358,9 @@ inner_statement_list: ; inner_statement: - statement { $$ = $1; } - | function_declaration_statement { $$ = $1; } - | class_declaration_statement { $$ = $1; } + statement + | function_declaration_statement + | class_declaration_statement | T_HALT_COMPILER { throw new Error('__HALT_COMPILER() can only be used from the outermost scope', attributes()); } ; @@ -417,7 +417,7 @@ non_empty_statement: ; statement: - non_empty_statement { $$ = $1; } + non_empty_statement | ';' { makeNop($$, $this->startAttributeStack[#1], $this->endAttributes); if ($$ === null) $$ = array(); /* means: no statement */ } @@ -444,7 +444,7 @@ optional_finally: ; variables_list: - non_empty_variables_list optional_comma { $$ = $1; } + non_empty_variables_list optional_comma ; non_empty_variables_list: @@ -473,7 +473,7 @@ block_or_error: ; identifier_maybe_readonly: - identifier_not_reserved { $$ = $1; } + identifier_not_reserved | T_READONLY { $$ = Node\Identifier[$1]; } ; @@ -512,11 +512,11 @@ enum_case_expr: class_entry_type: T_CLASS { $$ = 0; } - | class_modifiers T_CLASS { $$ = $1; } + | class_modifiers T_CLASS ; class_modifiers: - class_modifier { $$ = $1; } + class_modifier | class_modifiers class_modifier { $this->checkClassModifier($1, $2, #2); $$ = $1 | $2; } ; @@ -542,7 +542,7 @@ implements_list: ; class_name_list: - non_empty_class_name_list no_comma { $$ = $1; } + non_empty_class_name_list no_comma ; non_empty_class_name_list: @@ -567,7 +567,7 @@ declare_statement: ; declare_list: - non_empty_declare_list no_comma { $$ = $1; } + non_empty_declare_list no_comma ; non_empty_declare_list: @@ -607,7 +607,7 @@ match: match_arm_list: /* empty */ { $$ = []; } - | non_empty_match_arm_list optional_comma { $$ = $1; } + | non_empty_match_arm_list optional_comma ; non_empty_match_arm_list: @@ -664,7 +664,7 @@ foreach_variable: ; parameter_list: - non_empty_parameter_list optional_comma { $$ = $1; } + non_empty_parameter_list optional_comma | /* empty */ { $$ = array(); } ; @@ -701,14 +701,14 @@ parameter: ; type_expr: - type { $$ = $1; } + type | '?' type { $$ = Node\NullableType[$2]; } | union_type { $$ = Node\UnionType[$1]; } - | intersection_type { $$ = $1; } + | intersection_type ; type: - type_without_static { $$ = $1; } + type_without_static | T_STATIC { $$ = Node\Name['static']; } ; @@ -719,8 +719,8 @@ type_without_static: ; union_type_element: - type { $$ = $1; } - | '(' intersection_type ')' { $$ = $2; } + type + | '(' intersection_type ')' { $$ = $2; } ; union_type: @@ -729,7 +729,7 @@ union_type: ; union_type_without_static_element: - type_without_static { $$ = $1; } + type_without_static | '(' intersection_type_without_static ')' { $$ = $2; } ; @@ -760,15 +760,15 @@ intersection_type_without_static: ; type_expr_without_static: - type_without_static { $$ = $1; } + type_without_static | '?' type_without_static { $$ = Node\NullableType[$2]; } | union_type_without_static { $$ = Node\UnionType[$1]; } - | intersection_type_without_static { $$ = $1; } + | intersection_type_without_static ; optional_type_without_static: /* empty */ { $$ = null; } - | type_expr_without_static { $$ = $1; } + | type_expr_without_static ; optional_return_type: @@ -801,7 +801,7 @@ argument: ; global_var_list: - non_empty_global_var_list no_comma { $$ = $1; } + non_empty_global_var_list no_comma ; non_empty_global_var_list: @@ -810,11 +810,11 @@ non_empty_global_var_list: ; global_var: - simple_variable { $$ = $1; } + simple_variable ; static_var_list: - non_empty_static_var_list no_comma { $$ = $1; } + non_empty_static_var_list no_comma ; non_empty_static_var_list: @@ -885,27 +885,27 @@ trait_method_reference_fully_qualified: name T_PAAMAYIM_NEKUDOTAYIM identifier_maybe_reserved { $$ = array($1, $3); } ; trait_method_reference: - trait_method_reference_fully_qualified { $$ = $1; } + trait_method_reference_fully_qualified | identifier_maybe_reserved { $$ = array(null, $1); } ; method_body: ';' /* abstract method */ { $$ = null; } - | block_or_error { $$ = $1; } + | block_or_error ; variable_modifiers: - non_empty_member_modifiers { $$ = $1; } + non_empty_member_modifiers | T_VAR { $$ = 0; } ; method_modifiers: /* empty */ { $$ = 0; } - | non_empty_member_modifiers { $$ = $1; } + | non_empty_member_modifiers ; non_empty_member_modifiers: - member_modifier { $$ = $1; } + member_modifier | non_empty_member_modifiers member_modifier { $this->checkModifier($1, $2, #2); $$ = $1 | $2; } ; @@ -920,7 +920,7 @@ member_modifier: ; property_declaration_list: - non_empty_property_declaration_list no_comma { $$ = $1; } + non_empty_property_declaration_list no_comma ; non_empty_property_declaration_list: @@ -939,11 +939,11 @@ property_declaration: ; expr_list_forbid_comma: - non_empty_expr_list no_comma { $$ = $1; } + non_empty_expr_list no_comma ; expr_list_allow_comma: - non_empty_expr_list optional_comma { $$ = $1; } + non_empty_expr_list optional_comma ; non_empty_expr_list: @@ -953,11 +953,11 @@ non_empty_expr_list: for_expr: /* empty */ { $$ = array(); } - | expr_list_forbid_comma { $$ = $1; } + | expr_list_forbid_comma ; expr: - variable { $$ = $1; } + variable | list_expr '=' expr { $$ = Expr\Assign[$1, $3]; } | array_short_syntax '=' expr { $$ = Expr\Assign[$this->fixupArrayDestructuring($1), $3]; } @@ -969,8 +969,8 @@ expr: $this->emitError(new Error('Cannot assign new by reference', attributes())); } } - | new_expr { $$ = $1; } - | match { $$ = $1; } + | new_expr + | match | T_CLONE expr { $$ = Expr\Clone_[$2]; } | variable T_PLUS_EQUAL expr { $$ = Expr\AssignOp\Plus [$1, $3]; } | variable T_MINUS_EQUAL expr { $$ = Expr\AssignOp\Minus [$1, $3]; } @@ -1047,7 +1047,7 @@ expr: $attrs['kind'] = strtolower($1) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; $$ = new Expr\Exit_($2, $attrs); } | '@' expr { $$ = Expr\ErrorSuppress[$2]; } - | scalar { $$ = $1; } + | scalar | '`' backticks_expr '`' { $$ = Expr\ShellExec[$2]; } | T_PRINT expr { $$ = Expr\Print_[$2]; } | T_YIELD { $$ = Expr\Yield_[null, null]; } @@ -1093,7 +1093,7 @@ lexical_vars: ; lexical_var_list: - non_empty_lexical_var_list optional_comma { $$ = $1; } + non_empty_lexical_var_list optional_comma ; non_empty_lexical_var_list: @@ -1119,7 +1119,7 @@ function_call: class_name: T_STATIC { $$ = Name[$1]; } - | name { $$ = $1; } + | name ; name: @@ -1130,15 +1130,15 @@ name: ; class_name_reference: - class_name { $$ = $1; } - | new_variable { $$ = $1; } + class_name + | new_variable | '(' expr ')' { $$ = $2; } | error { $$ = Expr\Error[]; $this->errorState = 2; } ; class_name_or_var: - class_name { $$ = $1; } - | fully_dereferencable { $$ = $1; } + class_name + | fully_dereferencable ; exit_expr: @@ -1155,7 +1155,7 @@ backticks_expr: ctor_arguments: /* empty */ { $$ = array(); } - | argument_list { $$ = $1; } + | argument_list ; constant: @@ -1203,9 +1203,9 @@ scalar: T_LNUMBER { $$ = $this->parseLNumber($1, attributes(), $this->phpVersion->allowsInvalidOctals()); } | T_DNUMBER { $$ = Scalar\Float_::fromString($1, attributes()); } - | dereferencable_scalar { $$ = $1; } - | constant { $$ = $1; } - | class_constant { $$ = $1; } + | dereferencable_scalar + | constant + | class_constant | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), true); } | T_START_HEREDOC T_END_HEREDOC @@ -1216,32 +1216,32 @@ scalar: optional_expr: /* empty */ { $$ = null; } - | expr { $$ = $1; } + | expr ; fully_dereferencable: - variable { $$ = $1; } + variable | '(' expr ')' { $$ = $2; } - | dereferencable_scalar { $$ = $1; } - | class_constant { $$ = $1; } + | dereferencable_scalar + | class_constant ; array_object_dereferencable: - fully_dereferencable { $$ = $1; } - | constant { $$ = $1; } + fully_dereferencable + | constant ; callable_expr: - callable_variable { $$ = $1; } + callable_variable | '(' expr ')' { $$ = $2; } - | dereferencable_scalar { $$ = $1; } + | dereferencable_scalar ; callable_variable: - simple_variable { $$ = $1; } + simple_variable | array_object_dereferencable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } | array_object_dereferencable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | function_call { $$ = $1; } + | function_call | array_object_dereferencable T_OBJECT_OPERATOR property_name argument_list { $$ = Expr\MethodCall[$1, $3, $4]; } | array_object_dereferencable T_NULLSAFE_OBJECT_OPERATOR property_name argument_list @@ -1250,12 +1250,12 @@ callable_variable: optional_plain_variable: /* empty */ { $$ = null; } - | plain_variable { $$ = $1; } + | plain_variable ; variable: - callable_variable { $$ = $1; } - | static_member { $$ = $1; } + callable_variable + | static_member | array_object_dereferencable T_OBJECT_OPERATOR property_name { $$ = Expr\PropertyFetch[$1, $3]; } | array_object_dereferencable T_NULLSAFE_OBJECT_OPERATOR property_name @@ -1263,7 +1263,7 @@ variable: ; simple_variable: - plain_variable { $$ = $1; } + plain_variable | '$' '{' expr '}' { $$ = Expr\Variable[$3]; } | '$' simple_variable { $$ = Expr\Variable[$2]; } | '$' error { $$ = Expr\Variable[Expr\Error[]]; $this->errorState = 2; } @@ -1280,7 +1280,7 @@ static_member: ; new_variable: - simple_variable { $$ = $1; } + simple_variable | new_variable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } | new_variable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } | new_variable T_OBJECT_OPERATOR property_name { $$ = Expr\PropertyFetch[$1, $3]; } @@ -1292,15 +1292,15 @@ new_variable: ; member_name: - identifier_maybe_reserved { $$ = $1; } + identifier_maybe_reserved | '{' expr '}' { $$ = $2; } - | simple_variable { $$ = $1; } + | simple_variable ; property_name: - identifier_not_reserved { $$ = $1; } + identifier_not_reserved | '{' expr '}' { $$ = $2; } - | simple_variable { $$ = $1; } + | simple_variable | error { $$ = Expr\Error[]; $this->errorState = 2; } ; @@ -1357,7 +1357,7 @@ encaps_str_varname: ; encaps_var: - plain_variable { $$ = $1; } + plain_variable | plain_variable '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } | plain_variable T_OBJECT_OPERATOR identifier_not_reserved { $$ = Expr\PropertyFetch[$1, $3]; } @@ -1374,7 +1374,7 @@ encaps_var_offset: T_STRING { $$ = Scalar\String_[$1]; } | T_NUM_STRING { $$ = $this->parseNumString($1, attributes()); } | '-' T_NUM_STRING { $$ = $this->parseNumString('-' . $2, attributes()); } - | plain_variable { $$ = $1; } + | plain_variable ; %% diff --git a/lib/PhpParser/Parser/Php7.php b/lib/PhpParser/Parser/Php7.php index 7cb04710..4c279b2a 100644 --- a/lib/PhpParser/Parser/Php7.php +++ b/lib/PhpParser/Parser/Php7.php @@ -1147,9 +1147,7 @@ class Php7 extends \PhpParser\ParserAbstract protected function initReduceCallbacks(): void { $this->reduceCallbacks = [ - 0 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 0 => null, 1 => function ($stackPos) { $this->semValue = $this->handleNamespaces($this->semStack[$stackPos-(1-1)]); }, @@ -1163,246 +1161,88 @@ class Php7 extends \PhpParser\ParserAbstract $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 5 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 6 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 7 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 8 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 9 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 10 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 11 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 12 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 13 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 14 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 15 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 16 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 17 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 18 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 19 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 20 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 21 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 22 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 23 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 24 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 25 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 26 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 27 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 28 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 29 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 30 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 31 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 32 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 33 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 34 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 35 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 36 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 37 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 38 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 39 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 40 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 41 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 42 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 43 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 44 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 45 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 46 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 47 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 48 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 49 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 50 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 51 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 52 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 53 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 54 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 55 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 56 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 57 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 58 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 59 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 60 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 61 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 62 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 63 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 64 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 65 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 66 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 67 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 68 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 69 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 70 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 71 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 72 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 73 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 74 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 75 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 5 => null, + 6 => null, + 7 => null, + 8 => null, + 9 => null, + 10 => null, + 11 => null, + 12 => null, + 13 => null, + 14 => null, + 15 => null, + 16 => null, + 17 => null, + 18 => null, + 19 => null, + 20 => null, + 21 => null, + 22 => null, + 23 => null, + 24 => null, + 25 => null, + 26 => null, + 27 => null, + 28 => null, + 29 => null, + 30 => null, + 31 => null, + 32 => null, + 33 => null, + 34 => null, + 35 => null, + 36 => null, + 37 => null, + 38 => null, + 39 => null, + 40 => null, + 41 => null, + 42 => null, + 43 => null, + 44 => null, + 45 => null, + 46 => null, + 47 => null, + 48 => null, + 49 => null, + 50 => null, + 51 => null, + 52 => null, + 53 => null, + 54 => null, + 55 => null, + 56 => null, + 57 => null, + 58 => null, + 59 => null, + 60 => null, + 61 => null, + 62 => null, + 63 => null, + 64 => null, + 65 => null, + 66 => null, + 67 => null, + 68 => null, + 69 => null, + 70 => null, + 71 => null, + 72 => null, + 73 => null, + 74 => null, + 75 => null, 76 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; if ($this->semValue === "emitError(new Error('Cannot use "startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); }, - 77 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 78 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 79 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 80 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 81 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 82 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 83 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 84 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 77 => null, + 78 => null, + 79 => null, + 80 => null, + 81 => null, + 82 => null, + 83 => null, + 84 => null, 85 => function ($stackPos) { $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1430,9 +1270,7 @@ class Php7 extends \PhpParser\ParserAbstract 93 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 94 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 94 => null, 95 => function ($stackPos) { $this->semValue = new Name(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1451,12 +1289,8 @@ class Php7 extends \PhpParser\ParserAbstract 100 => function ($stackPos) { $this->emitError(new Error('A trailing comma is not allowed here', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); }, - 101 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 102 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 101 => null, + 102 => null, 103 => function ($stackPos) { $this->semValue = new Node\Attribute($this->semStack[$stackPos-(1-1)], [], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1481,18 +1315,10 @@ class Php7 extends \PhpParser\ParserAbstract 110 => function ($stackPos) { $this->semValue = []; }, - 111 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 112 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 113 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 114 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 111 => null, + 112 => null, + 113 => null, + 114 => null, 115 => function ($stackPos) { $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -1517,9 +1343,7 @@ class Php7 extends \PhpParser\ParserAbstract 120 => function ($stackPos) { $this->semValue = new Stmt\Use_($this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 121 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 121 => null, 122 => function ($stackPos) { $this->semValue = new Stmt\Const_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, @@ -1535,27 +1359,21 @@ class Php7 extends \PhpParser\ParserAbstract 126 => function ($stackPos) { $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); }, - 127 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 127 => null, 128 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 129 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, - 130 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 130 => null, 131 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 132 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, - 133 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 133 => null, 134 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -1580,9 +1398,7 @@ class Php7 extends \PhpParser\ParserAbstract 141 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(2-2)]; $this->semValue->type = $this->semStack[$stackPos-(2-1)]; }, - 142 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 142 => null, 143 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -1592,9 +1408,7 @@ class Php7 extends \PhpParser\ParserAbstract 145 => function ($stackPos) { $this->semValue = new Node\Const_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 146 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 146 => null, 147 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -1617,15 +1431,9 @@ class Php7 extends \PhpParser\ParserAbstract $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 154 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 155 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 156 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 154 => null, + 155 => null, + 156 => null, 157 => function ($stackPos) { throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1717,9 +1525,7 @@ class Php7 extends \PhpParser\ParserAbstract 181 => function ($stackPos) { $this->semValue = array(); /* means: no statement */ }, - 182 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 182 => null, 183 => function ($stackPos) { $startAttributes = $this->startAttributeStack[$stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); } else { $this->semValue = null; }; if ($this->semValue === null) $this->semValue = array(); /* means: no statement */ @@ -1745,9 +1551,7 @@ class Php7 extends \PhpParser\ParserAbstract 190 => function ($stackPos) { $this->semValue = new Stmt\Finally_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 191 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 191 => null, 192 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -1778,9 +1582,7 @@ class Php7 extends \PhpParser\ParserAbstract 201 => function ($stackPos) { $this->semValue = []; }, - 202 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 202 => null, 203 => function ($stackPos) { $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1824,12 +1626,8 @@ class Php7 extends \PhpParser\ParserAbstract 215 => function ($stackPos) { $this->semValue = 0; }, - 216 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 217 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 216 => null, + 217 => null, 218 => function ($stackPos) { $this->checkClassModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; }, @@ -1860,9 +1658,7 @@ class Php7 extends \PhpParser\ParserAbstract 227 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(2-2)]; }, - 228 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 228 => null, 229 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -1890,9 +1686,7 @@ class Php7 extends \PhpParser\ParserAbstract 237 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(4-2)]; }, - 238 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 238 => null, 239 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -1926,21 +1720,15 @@ class Php7 extends \PhpParser\ParserAbstract 249 => function ($stackPos) { $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 250 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 251 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 250 => null, + 251 => null, 252 => function ($stackPos) { $this->semValue = new Expr\Match_($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-6)], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); }, 253 => function ($stackPos) { $this->semValue = []; }, - 254 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 254 => null, 255 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -2001,9 +1789,7 @@ class Php7 extends \PhpParser\ParserAbstract 274 => function ($stackPos) { $this->semValue = array($this->fixupArrayDestructuring($this->semStack[$stackPos-(1-1)]), false); }, - 275 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 275 => null, 276 => function ($stackPos) { $this->semValue = array(); }, @@ -2042,21 +1828,15 @@ class Php7 extends \PhpParser\ParserAbstract 287 => function ($stackPos) { $this->semValue = new Node\Param(new Expr\Error($this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes), null, $this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes, $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-1)]); }, - 288 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 288 => null, 289 => function ($stackPos) { $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 290 => function ($stackPos) { $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 291 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 292 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 291 => null, + 292 => null, 293 => function ($stackPos) { $this->semValue = new Node\Name('static', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -2069,9 +1849,7 @@ class Php7 extends \PhpParser\ParserAbstract 296 => function ($stackPos) { $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 297 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 297 => null, 298 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, @@ -2081,9 +1859,7 @@ class Php7 extends \PhpParser\ParserAbstract 300 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, - 301 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 301 => null, 302 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, @@ -2111,24 +1887,18 @@ class Php7 extends \PhpParser\ParserAbstract 310 => function ($stackPos) { $this->semValue = new Node\IntersectionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 311 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 311 => null, 312 => function ($stackPos) { $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 313 => function ($stackPos) { $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 314 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 314 => null, 315 => function ($stackPos) { $this->semValue = null; }, - 316 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 316 => null, 317 => function ($stackPos) { $this->semValue = null; }, @@ -2168,21 +1938,15 @@ class Php7 extends \PhpParser\ParserAbstract 329 => function ($stackPos) { $this->semValue = new Node\Arg($this->semStack[$stackPos-(3-3)], false, false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->semStack[$stackPos-(3-1)]); }, - 330 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 330 => null, 331 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 332 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, - 333 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 334 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 333 => null, + 334 => null, 335 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -2260,33 +2024,23 @@ class Php7 extends \PhpParser\ParserAbstract 358 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); }, - 359 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 359 => null, 360 => function ($stackPos) { $this->semValue = array(null, $this->semStack[$stackPos-(1-1)]); }, 361 => function ($stackPos) { $this->semValue = null; }, - 362 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 363 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 362 => null, + 363 => null, 364 => function ($stackPos) { $this->semValue = 0; }, 365 => function ($stackPos) { $this->semValue = 0; }, - 366 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 367 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 366 => null, + 367 => null, 368 => function ($stackPos) { $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; }, @@ -2311,9 +2065,7 @@ class Php7 extends \PhpParser\ParserAbstract 375 => function ($stackPos) { $this->semValue = Modifiers::READONLY; }, - 376 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 376 => null, 377 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -2329,12 +2081,8 @@ class Php7 extends \PhpParser\ParserAbstract 381 => function ($stackPos) { $this->semValue = new Node\PropertyItem($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 382 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 383 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 382 => null, + 383 => null, 384 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -2344,12 +2092,8 @@ class Php7 extends \PhpParser\ParserAbstract 386 => function ($stackPos) { $this->semValue = array(); }, - 387 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 388 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 387 => null, + 388 => null, 389 => function ($stackPos) { $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, @@ -2369,12 +2113,8 @@ class Php7 extends \PhpParser\ParserAbstract } }, - 394 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 395 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 394 => null, + 395 => null, 396 => function ($stackPos) { $this->semValue = new Expr\Clone_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, @@ -2589,9 +2329,7 @@ class Php7 extends \PhpParser\ParserAbstract 465 => function ($stackPos) { $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 466 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 466 => null, 467 => function ($stackPos) { $this->semValue = new Expr\ShellExec($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, @@ -2653,9 +2391,7 @@ class Php7 extends \PhpParser\ParserAbstract 486 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(4-3)]; }, - 487 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 487 => null, 488 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -2683,9 +2419,7 @@ class Php7 extends \PhpParser\ParserAbstract 496 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 497 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 497 => null, 498 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -2698,24 +2432,16 @@ class Php7 extends \PhpParser\ParserAbstract 501 => function ($stackPos) { $this->semValue = new Name\Relative(substr($this->semStack[$stackPos-(1-1)], 10), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 502 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 503 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 502 => null, + 503 => null, 504 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 505 => function ($stackPos) { $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; }, - 506 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 507 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 506 => null, + 507 => null, 508 => function ($stackPos) { $this->semValue = null; }, @@ -2734,9 +2460,7 @@ class Php7 extends \PhpParser\ParserAbstract 513 => function ($stackPos) { $this->semValue = array(); }, - 514 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 514 => null, 515 => function ($stackPos) { $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -2798,15 +2522,9 @@ class Php7 extends \PhpParser\ParserAbstract 533 => function ($stackPos) { $this->semValue = Scalar\Float_::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 534 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 535 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 536 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 534 => null, + 535 => null, + 536 => null, 537 => function ($stackPos) { $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); }, @@ -2819,48 +2537,28 @@ class Php7 extends \PhpParser\ParserAbstract 540 => function ($stackPos) { $this->semValue = null; }, - 541 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 542 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 541 => null, + 542 => null, 543 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 544 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 545 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 546 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 547 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 548 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 544 => null, + 545 => null, + 546 => null, + 547 => null, + 548 => null, 549 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 550 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 551 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 550 => null, + 551 => null, 552 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 553 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 554 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 554 => null, 555 => function ($stackPos) { $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -2870,24 +2568,16 @@ class Php7 extends \PhpParser\ParserAbstract 557 => function ($stackPos) { $this->semValue = null; }, - 558 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 559 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 560 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 558 => null, + 559 => null, + 560 => null, 561 => function ($stackPos) { $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 562 => function ($stackPos) { $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 563 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 563 => null, 564 => function ($stackPos) { $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -2903,9 +2593,7 @@ class Php7 extends \PhpParser\ParserAbstract 568 => function ($stackPos) { $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 569 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 569 => null, 570 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -2924,24 +2612,16 @@ class Php7 extends \PhpParser\ParserAbstract 575 => function ($stackPos) { $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 576 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 576 => null, 577 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 578 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 579 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 578 => null, + 579 => null, 580 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 581 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 581 => null, 582 => function ($stackPos) { $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; }, @@ -2952,9 +2632,7 @@ class Php7 extends \PhpParser\ParserAbstract 584 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end]->value instanceof Expr\Error) array_pop($this->semValue); }, - 585 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 585 => null, 586 => function ($stackPos) { /* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */ }, @@ -3009,9 +2687,7 @@ class Php7 extends \PhpParser\ParserAbstract 602 => function ($stackPos) { $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 603 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 603 => null, 604 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -3042,9 +2718,7 @@ class Php7 extends \PhpParser\ParserAbstract 613 => function ($stackPos) { $this->semValue = $this->parseNumString('-' . $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 614 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 614 => null, ]; } } diff --git a/lib/PhpParser/Parser/Php8.php b/lib/PhpParser/Parser/Php8.php index 009a8b6a..2588f07b 100644 --- a/lib/PhpParser/Parser/Php8.php +++ b/lib/PhpParser/Parser/Php8.php @@ -1155,9 +1155,7 @@ class Php8 extends \PhpParser\ParserAbstract protected function initReduceCallbacks(): void { $this->reduceCallbacks = [ - 0 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 0 => null, 1 => function ($stackPos) { $this->semValue = $this->handleNamespaces($this->semStack[$stackPos-(1-1)]); }, @@ -1171,246 +1169,88 @@ class Php8 extends \PhpParser\ParserAbstract $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 5 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 6 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 7 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 8 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 9 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 10 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 11 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 12 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 13 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 14 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 15 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 16 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 17 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 18 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 19 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 20 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 21 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 22 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 23 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 24 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 25 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 26 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 27 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 28 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 29 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 30 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 31 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 32 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 33 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 34 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 35 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 36 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 37 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 38 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 39 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 40 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 41 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 42 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 43 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 44 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 45 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 46 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 47 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 48 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 49 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 50 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 51 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 52 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 53 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 54 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 55 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 56 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 57 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 58 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 59 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 60 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 61 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 62 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 63 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 64 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 65 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 66 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 67 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 68 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 69 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 70 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 71 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 72 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 73 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 74 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 75 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 5 => null, + 6 => null, + 7 => null, + 8 => null, + 9 => null, + 10 => null, + 11 => null, + 12 => null, + 13 => null, + 14 => null, + 15 => null, + 16 => null, + 17 => null, + 18 => null, + 19 => null, + 20 => null, + 21 => null, + 22 => null, + 23 => null, + 24 => null, + 25 => null, + 26 => null, + 27 => null, + 28 => null, + 29 => null, + 30 => null, + 31 => null, + 32 => null, + 33 => null, + 34 => null, + 35 => null, + 36 => null, + 37 => null, + 38 => null, + 39 => null, + 40 => null, + 41 => null, + 42 => null, + 43 => null, + 44 => null, + 45 => null, + 46 => null, + 47 => null, + 48 => null, + 49 => null, + 50 => null, + 51 => null, + 52 => null, + 53 => null, + 54 => null, + 55 => null, + 56 => null, + 57 => null, + 58 => null, + 59 => null, + 60 => null, + 61 => null, + 62 => null, + 63 => null, + 64 => null, + 65 => null, + 66 => null, + 67 => null, + 68 => null, + 69 => null, + 70 => null, + 71 => null, + 72 => null, + 73 => null, + 74 => null, + 75 => null, 76 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; if ($this->semValue === "emitError(new Error('Cannot use "startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); }, - 77 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 78 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 79 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 80 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 81 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 82 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 83 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 84 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 77 => null, + 78 => null, + 79 => null, + 80 => null, + 81 => null, + 82 => null, + 83 => null, + 84 => null, 85 => function ($stackPos) { $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1438,9 +1278,7 @@ class Php8 extends \PhpParser\ParserAbstract 93 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 94 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 94 => null, 95 => function ($stackPos) { $this->semValue = new Name(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1459,12 +1297,8 @@ class Php8 extends \PhpParser\ParserAbstract 100 => function ($stackPos) { $this->emitError(new Error('A trailing comma is not allowed here', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); }, - 101 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 102 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 101 => null, + 102 => null, 103 => function ($stackPos) { $this->semValue = new Node\Attribute($this->semStack[$stackPos-(1-1)], [], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1489,18 +1323,10 @@ class Php8 extends \PhpParser\ParserAbstract 110 => function ($stackPos) { $this->semValue = []; }, - 111 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 112 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 113 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 114 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 111 => null, + 112 => null, + 113 => null, + 114 => null, 115 => function ($stackPos) { $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -1525,9 +1351,7 @@ class Php8 extends \PhpParser\ParserAbstract 120 => function ($stackPos) { $this->semValue = new Stmt\Use_($this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 121 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 121 => null, 122 => function ($stackPos) { $this->semValue = new Stmt\Const_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, @@ -1543,27 +1367,21 @@ class Php8 extends \PhpParser\ParserAbstract 126 => function ($stackPos) { $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); }, - 127 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 127 => null, 128 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 129 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, - 130 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 130 => null, 131 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 132 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, - 133 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 133 => null, 134 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -1588,9 +1406,7 @@ class Php8 extends \PhpParser\ParserAbstract 141 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(2-2)]; $this->semValue->type = $this->semStack[$stackPos-(2-1)]; }, - 142 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 142 => null, 143 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -1600,9 +1416,7 @@ class Php8 extends \PhpParser\ParserAbstract 145 => function ($stackPos) { $this->semValue = new Node\Const_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 146 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 146 => null, 147 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -1625,15 +1439,9 @@ class Php8 extends \PhpParser\ParserAbstract $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 154 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 155 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 156 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 154 => null, + 155 => null, + 156 => null, 157 => function ($stackPos) { throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1725,9 +1533,7 @@ class Php8 extends \PhpParser\ParserAbstract 181 => function ($stackPos) { $this->semValue = array(); /* means: no statement */ }, - 182 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 182 => null, 183 => function ($stackPos) { $startAttributes = $this->startAttributeStack[$stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); } else { $this->semValue = null; }; if ($this->semValue === null) $this->semValue = array(); /* means: no statement */ @@ -1753,9 +1559,7 @@ class Php8 extends \PhpParser\ParserAbstract 190 => function ($stackPos) { $this->semValue = new Stmt\Finally_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 191 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 191 => null, 192 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -1786,9 +1590,7 @@ class Php8 extends \PhpParser\ParserAbstract 201 => function ($stackPos) { $this->semValue = []; }, - 202 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 202 => null, 203 => function ($stackPos) { $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -1832,12 +1634,8 @@ class Php8 extends \PhpParser\ParserAbstract 215 => function ($stackPos) { $this->semValue = 0; }, - 216 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 217 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 216 => null, + 217 => null, 218 => function ($stackPos) { $this->checkClassModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; }, @@ -1868,9 +1666,7 @@ class Php8 extends \PhpParser\ParserAbstract 227 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(2-2)]; }, - 228 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 228 => null, 229 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -1898,9 +1694,7 @@ class Php8 extends \PhpParser\ParserAbstract 237 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(4-2)]; }, - 238 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 238 => null, 239 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -1934,21 +1728,15 @@ class Php8 extends \PhpParser\ParserAbstract 249 => function ($stackPos) { $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 250 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, - 251 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 250 => null, + 251 => null, 252 => function ($stackPos) { $this->semValue = new Expr\Match_($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-6)], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); }, 253 => function ($stackPos) { $this->semValue = []; }, - 254 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 254 => null, 255 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -2009,9 +1797,7 @@ class Php8 extends \PhpParser\ParserAbstract 274 => function ($stackPos) { $this->semValue = array($this->fixupArrayDestructuring($this->semStack[$stackPos-(1-1)]), false); }, - 275 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 275 => null, 276 => function ($stackPos) { $this->semValue = array(); }, @@ -2050,21 +1836,15 @@ class Php8 extends \PhpParser\ParserAbstract 287 => function ($stackPos) { $this->semValue = new Node\Param(new Expr\Error($this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes), null, $this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes, $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-1)]); }, - 288 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 288 => null, 289 => function ($stackPos) { $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 290 => function ($stackPos) { $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 291 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 292 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 291 => null, + 292 => null, 293 => function ($stackPos) { $this->semValue = new Node\Name('static', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -2077,9 +1857,7 @@ class Php8 extends \PhpParser\ParserAbstract 296 => function ($stackPos) { $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 297 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 297 => null, 298 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, @@ -2089,9 +1867,7 @@ class Php8 extends \PhpParser\ParserAbstract 300 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, - 301 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 301 => null, 302 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, @@ -2119,24 +1895,18 @@ class Php8 extends \PhpParser\ParserAbstract 310 => function ($stackPos) { $this->semValue = new Node\IntersectionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 311 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 311 => null, 312 => function ($stackPos) { $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 313 => function ($stackPos) { $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 314 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 314 => null, 315 => function ($stackPos) { $this->semValue = null; }, - 316 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 316 => null, 317 => function ($stackPos) { $this->semValue = null; }, @@ -2176,21 +1946,15 @@ class Php8 extends \PhpParser\ParserAbstract 329 => function ($stackPos) { $this->semValue = new Node\Arg($this->semStack[$stackPos-(3-3)], false, false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->semStack[$stackPos-(3-1)]); }, - 330 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 330 => null, 331 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 332 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, - 333 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 334 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 333 => null, + 334 => null, 335 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -2268,33 +2032,23 @@ class Php8 extends \PhpParser\ParserAbstract 358 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); }, - 359 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 359 => null, 360 => function ($stackPos) { $this->semValue = array(null, $this->semStack[$stackPos-(1-1)]); }, 361 => function ($stackPos) { $this->semValue = null; }, - 362 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 363 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 362 => null, + 363 => null, 364 => function ($stackPos) { $this->semValue = 0; }, 365 => function ($stackPos) { $this->semValue = 0; }, - 366 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 367 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 366 => null, + 367 => null, 368 => function ($stackPos) { $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; }, @@ -2319,9 +2073,7 @@ class Php8 extends \PhpParser\ParserAbstract 375 => function ($stackPos) { $this->semValue = Modifiers::READONLY; }, - 376 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 376 => null, 377 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -2337,12 +2089,8 @@ class Php8 extends \PhpParser\ParserAbstract 381 => function ($stackPos) { $this->semValue = new Node\PropertyItem($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 382 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, - 383 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 382 => null, + 383 => null, 384 => function ($stackPos) { $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, @@ -2352,12 +2100,8 @@ class Php8 extends \PhpParser\ParserAbstract 386 => function ($stackPos) { $this->semValue = array(); }, - 387 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 388 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 387 => null, + 388 => null, 389 => function ($stackPos) { $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, @@ -2377,12 +2121,8 @@ class Php8 extends \PhpParser\ParserAbstract } }, - 394 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 395 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 394 => null, + 395 => null, 396 => function ($stackPos) { $this->semValue = new Expr\Clone_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, @@ -2597,9 +2337,7 @@ class Php8 extends \PhpParser\ParserAbstract 465 => function ($stackPos) { $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 466 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 466 => null, 467 => function ($stackPos) { $this->semValue = new Expr\ShellExec($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, @@ -2661,9 +2399,7 @@ class Php8 extends \PhpParser\ParserAbstract 486 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(4-3)]; }, - 487 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(2-1)]; - }, + 487 => null, 488 => function ($stackPos) { $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, @@ -2691,9 +2427,7 @@ class Php8 extends \PhpParser\ParserAbstract 496 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 497 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 497 => null, 498 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -2706,24 +2440,16 @@ class Php8 extends \PhpParser\ParserAbstract 501 => function ($stackPos) { $this->semValue = new Name\Relative(substr($this->semStack[$stackPos-(1-1)], 10), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 502 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 503 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 502 => null, + 503 => null, 504 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 505 => function ($stackPos) { $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; }, - 506 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 507 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 506 => null, + 507 => null, 508 => function ($stackPos) { $this->semValue = null; }, @@ -2742,9 +2468,7 @@ class Php8 extends \PhpParser\ParserAbstract 513 => function ($stackPos) { $this->semValue = array(); }, - 514 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 514 => null, 515 => function ($stackPos) { $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, @@ -2806,15 +2530,9 @@ class Php8 extends \PhpParser\ParserAbstract 533 => function ($stackPos) { $this->semValue = Scalar\Float_::fromString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 534 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 535 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 536 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 534 => null, + 535 => null, + 536 => null, 537 => function ($stackPos) { $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); }, @@ -2827,48 +2545,28 @@ class Php8 extends \PhpParser\ParserAbstract 540 => function ($stackPos) { $this->semValue = null; }, - 541 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 542 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 541 => null, + 542 => null, 543 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 544 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 545 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 546 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 547 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 548 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 544 => null, + 545 => null, + 546 => null, + 547 => null, + 548 => null, 549 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 550 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 551 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 550 => null, + 551 => null, 552 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 553 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, - 554 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 554 => null, 555 => function ($stackPos) { $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -2878,24 +2576,16 @@ class Php8 extends \PhpParser\ParserAbstract 557 => function ($stackPos) { $this->semValue = null; }, - 558 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 559 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 560 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 558 => null, + 559 => null, + 560 => null, 561 => function ($stackPos) { $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 562 => function ($stackPos) { $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 563 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 563 => null, 564 => function ($stackPos) { $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -2911,9 +2601,7 @@ class Php8 extends \PhpParser\ParserAbstract 568 => function ($stackPos) { $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 569 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 569 => null, 570 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -2932,24 +2620,16 @@ class Php8 extends \PhpParser\ParserAbstract 575 => function ($stackPos) { $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 576 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 576 => null, 577 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 578 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, - 579 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 578 => null, + 579 => null, 580 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 581 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 581 => null, 582 => function ($stackPos) { $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; }, @@ -2960,9 +2640,7 @@ class Php8 extends \PhpParser\ParserAbstract 584 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end]->value instanceof Expr\Error) array_pop($this->semValue); }, - 585 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, + 585 => null, 586 => function ($stackPos) { /* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */ }, @@ -3017,9 +2695,7 @@ class Php8 extends \PhpParser\ParserAbstract 602 => function ($stackPos) { $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, - 603 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 603 => null, 604 => function ($stackPos) { $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, @@ -3050,9 +2726,7 @@ class Php8 extends \PhpParser\ParserAbstract 613 => function ($stackPos) { $this->semValue = $this->parseNumString('-' . $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, - 614 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; - }, + 614 => null, ]; } } diff --git a/lib/PhpParser/ParserAbstract.php b/lib/PhpParser/ParserAbstract.php index f3e5eb2f..8d2c56f7 100644 --- a/lib/PhpParser/ParserAbstract.php +++ b/lib/PhpParser/ParserAbstract.php @@ -312,8 +312,14 @@ abstract class ParserAbstract implements Parser { /* reduce */ //$this->traceReduce($rule); + $ruleLength = $this->ruleToLength[$rule]; try { - $this->reduceCallbacks[$rule]($stackPos); + $callback = $this->reduceCallbacks[$rule]; + if ($callback !== null) { + $callback($stackPos); + } elseif ($ruleLength > 0) { + $this->semValue = $this->semStack[$stackPos - $ruleLength + 1]; + } } catch (Error $e) { if (-1 === $e->getStartLine() && isset($startAttributes['startLine'])) { $e->setStartLine($startAttributes['startLine']); @@ -326,7 +332,6 @@ abstract class ParserAbstract implements Parser { /* Goto - shift nonterminal */ $lastEndAttributes = $this->endAttributeStack[$stackPos]; - $ruleLength = $this->ruleToLength[$rule]; $stackPos -= $ruleLength; $nonTerminal = $this->ruleToNonTerminal[$rule]; $idx = $this->gotoBase[$nonTerminal] + $stateStack[$stackPos];