PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - Zend - zend_language_parser.y (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 713 728 97.9 %
Date: 2016-09-18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : %{
       2             : /*
       3             :    +----------------------------------------------------------------------+
       4             :    | Zend Engine                                                          |
       5             :    +----------------------------------------------------------------------+
       6             :    | Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
       7             :    +----------------------------------------------------------------------+
       8             :    | This source file is subject to version 2.00 of the Zend license,     |
       9             :    | that is bundled with this package in the file LICENSE, and is        |
      10             :    | available through the world-wide-web at the following url:           |
      11             :    | http://www.zend.com/license/2_00.txt.                                |
      12             :    | If you did not receive a copy of the Zend license and are unable to  |
      13             :    | obtain it through the world-wide-web, please send a note to          |
      14             :    | license@zend.com so we can mail you a copy immediately.              |
      15             :    +----------------------------------------------------------------------+
      16             :    | Authors: Andi Gutmans <andi@zend.com>                                |
      17             :    |          Zeev Suraski <zeev@zend.com>                                |
      18             :    |          Nikita Popov <nikic@php.net>                                |
      19             :    +----------------------------------------------------------------------+
      20             : */
      21             : 
      22             : /* $Id$ */
      23             : 
      24             : #include "zend_compile.h"
      25             : #include "zend.h"
      26             : #include "zend_list.h"
      27             : #include "zend_globals.h"
      28             : #include "zend_API.h"
      29             : #include "zend_constants.h"
      30             : #include "zend_language_scanner.h"
      31             : 
      32             : #define YYSIZE_T size_t
      33             : #define yytnamerr zend_yytnamerr
      34             : static YYSIZE_T zend_yytnamerr(char*, const char*);
      35             : 
      36             : #define YYERROR_VERBOSE
      37             : #define YYSTYPE zend_parser_stack_elem
      38             : 
      39             : #ifdef _MSC_VER
      40             : #define YYMALLOC malloc
      41             : #define YYFREE free
      42             : #endif
      43             : 
      44             : %}
      45             : 
      46             : %pure-parser
      47             : %expect 0
      48             : 
      49             : %code requires {
      50             : }
      51             : 
      52         166 : %destructor { zend_ast_destroy($$); } <ast>
      53          13 : %destructor { if ($$) zend_string_release($$); } <str>
      54             : 
      55             : %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
      56             : %left ','
      57             : %left T_LOGICAL_OR
      58             : %left T_LOGICAL_XOR
      59             : %left T_LOGICAL_AND
      60             : %right T_PRINT
      61             : %right T_YIELD
      62             : %right T_DOUBLE_ARROW
      63             : %right T_YIELD_FROM
      64             : %left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL
      65             : %left '?' ':'
      66             : %right T_COALESCE
      67             : %left T_BOOLEAN_OR
      68             : %left T_BOOLEAN_AND
      69             : %left '|'
      70             : %left '^'
      71             : %left '&'
      72             : %nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP
      73             : %nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
      74             : %left T_SL T_SR
      75             : %left '+' '-' '.'
      76             : %left '*' '/' '%'
      77             : %right '!'
      78             : %nonassoc T_INSTANCEOF
      79             : %right '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
      80             : %right T_POW
      81             : %right '['
      82             : %nonassoc T_NEW T_CLONE
      83             : %left T_NOELSE
      84             : %left T_ELSEIF
      85             : %left T_ELSE
      86             : %left T_ENDIF
      87             : %right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
      88             : 
      89             : %token <ast> T_LNUMBER   "integer number (T_LNUMBER)"
      90             : %token <ast> T_DNUMBER   "floating-point number (T_DNUMBER)"
      91             : %token <ast> T_STRING    "identifier (T_STRING)"
      92             : %token <ast> T_VARIABLE  "variable (T_VARIABLE)"
      93             : %token <ast> T_INLINE_HTML
      94             : %token <ast> T_ENCAPSED_AND_WHITESPACE  "quoted-string and whitespace (T_ENCAPSED_AND_WHITESPACE)"
      95             : %token <ast> T_CONSTANT_ENCAPSED_STRING "quoted-string (T_CONSTANT_ENCAPSED_STRING)"
      96             : %token <ast> T_STRING_VARNAME "variable name (T_STRING_VARNAME)"
      97             : %token <ast> T_NUM_STRING "number (T_NUM_STRING)"
      98             : 
      99             : %token END 0 "end of file"
     100             : %token T_INCLUDE      "include (T_INCLUDE)"
     101             : %token T_INCLUDE_ONCE "include_once (T_INCLUDE_ONCE)"
     102             : %token T_EVAL         "eval (T_EVAL)"
     103             : %token T_REQUIRE      "require (T_REQUIRE)"
     104             : %token T_REQUIRE_ONCE "require_once (T_REQUIRE_ONCE)"
     105             : %token T_LOGICAL_OR   "or (T_LOGICAL_OR)"
     106             : %token T_LOGICAL_XOR  "xor (T_LOGICAL_XOR)"
     107             : %token T_LOGICAL_AND  "and (T_LOGICAL_AND)"
     108             : %token T_PRINT        "print (T_PRINT)"
     109             : %token T_YIELD        "yield (T_YIELD)"
     110             : %token T_YIELD_FROM   "yield from (T_YIELD_FROM)"
     111             : %token T_PLUS_EQUAL   "+= (T_PLUS_EQUAL)"
     112             : %token T_MINUS_EQUAL  "-= (T_MINUS_EQUAL)"
     113             : %token T_MUL_EQUAL    "*= (T_MUL_EQUAL)"
     114             : %token T_DIV_EQUAL    "/= (T_DIV_EQUAL)"
     115             : %token T_CONCAT_EQUAL ".= (T_CONCAT_EQUAL)"
     116             : %token T_MOD_EQUAL    "%= (T_MOD_EQUAL)"
     117             : %token T_AND_EQUAL    "&= (T_AND_EQUAL)"
     118             : %token T_OR_EQUAL     "|= (T_OR_EQUAL)"
     119             : %token T_XOR_EQUAL    "^= (T_XOR_EQUAL)"
     120             : %token T_SL_EQUAL     "<<= (T_SL_EQUAL)"
     121             : %token T_SR_EQUAL     ">>= (T_SR_EQUAL)"
     122             : %token T_BOOLEAN_OR   "|| (T_BOOLEAN_OR)"
     123             : %token T_BOOLEAN_AND  "&& (T_BOOLEAN_AND)"
     124             : %token T_IS_EQUAL     "== (T_IS_EQUAL)"
     125             : %token T_IS_NOT_EQUAL "!= (T_IS_NOT_EQUAL)"
     126             : %token T_IS_IDENTICAL "=== (T_IS_IDENTICAL)"
     127             : %token T_IS_NOT_IDENTICAL "!== (T_IS_NOT_IDENTICAL)"
     128             : %token T_IS_SMALLER_OR_EQUAL "<= (T_IS_SMALLER_OR_EQUAL)"
     129             : %token T_IS_GREATER_OR_EQUAL ">= (T_IS_GREATER_OR_EQUAL)"
     130             : %token T_SPACESHIP "<=> (T_SPACESHIP)"
     131             : %token T_SL "<< (T_SL)"
     132             : %token T_SR ">> (T_SR)"
     133             : %token T_INSTANCEOF  "instanceof (T_INSTANCEOF)"
     134             : %token T_INC "++ (T_INC)"
     135             : %token T_DEC "-- (T_DEC)"
     136             : %token T_INT_CAST    "(int) (T_INT_CAST)"
     137             : %token T_DOUBLE_CAST "(double) (T_DOUBLE_CAST)"
     138             : %token T_STRING_CAST "(string) (T_STRING_CAST)"
     139             : %token T_ARRAY_CAST  "(array) (T_ARRAY_CAST)"
     140             : %token T_OBJECT_CAST "(object) (T_OBJECT_CAST)"
     141             : %token T_BOOL_CAST   "(bool) (T_BOOL_CAST)"
     142             : %token T_UNSET_CAST  "(unset) (T_UNSET_CAST)"
     143             : %token T_NEW       "new (T_NEW)"
     144             : %token T_CLONE     "clone (T_CLONE)"
     145             : %token T_EXIT      "exit (T_EXIT)"
     146             : %token T_IF        "if (T_IF)"
     147             : %token T_ELSEIF    "elseif (T_ELSEIF)"
     148             : %token T_ELSE      "else (T_ELSE)"
     149             : %token T_ENDIF     "endif (T_ENDIF)"
     150             : %token T_ECHO       "echo (T_ECHO)"
     151             : %token T_DO         "do (T_DO)"
     152             : %token T_WHILE      "while (T_WHILE)"
     153             : %token T_ENDWHILE   "endwhile (T_ENDWHILE)"
     154             : %token T_FOR        "for (T_FOR)"
     155             : %token T_ENDFOR     "endfor (T_ENDFOR)"
     156             : %token T_FOREACH    "foreach (T_FOREACH)"
     157             : %token T_ENDFOREACH "endforeach (T_ENDFOREACH)"
     158             : %token T_DECLARE    "declare (T_DECLARE)"
     159             : %token T_ENDDECLARE "enddeclare (T_ENDDECLARE)"
     160             : %token T_AS         "as (T_AS)"
     161             : %token T_SWITCH     "switch (T_SWITCH)"
     162             : %token T_ENDSWITCH  "endswitch (T_ENDSWITCH)"
     163             : %token T_CASE       "case (T_CASE)"
     164             : %token T_DEFAULT    "default (T_DEFAULT)"
     165             : %token T_BREAK      "break (T_BREAK)"
     166             : %token T_CONTINUE   "continue (T_CONTINUE)"
     167             : %token T_GOTO       "goto (T_GOTO)"
     168             : %token T_FUNCTION   "function (T_FUNCTION)"
     169             : %token T_CONST      "const (T_CONST)"
     170             : %token T_RETURN     "return (T_RETURN)"
     171             : %token T_TRY        "try (T_TRY)"
     172             : %token T_CATCH      "catch (T_CATCH)"
     173             : %token T_FINALLY    "finally (T_FINALLY)"
     174             : %token T_THROW      "throw (T_THROW)"
     175             : %token T_USE        "use (T_USE)"
     176             : %token T_INSTEADOF  "insteadof (T_INSTEADOF)"
     177             : %token T_GLOBAL     "global (T_GLOBAL)"
     178             : %token T_STATIC     "static (T_STATIC)"
     179             : %token T_ABSTRACT   "abstract (T_ABSTRACT)"
     180             : %token T_FINAL      "final (T_FINAL)"
     181             : %token T_PRIVATE    "private (T_PRIVATE)"
     182             : %token T_PROTECTED  "protected (T_PROTECTED)"
     183             : %token T_PUBLIC     "public (T_PUBLIC)"
     184             : %token T_VAR        "var (T_VAR)"
     185             : %token T_UNSET      "unset (T_UNSET)"
     186             : %token T_ISSET      "isset (T_ISSET)"
     187             : %token T_EMPTY      "empty (T_EMPTY)"
     188             : %token T_HALT_COMPILER "__halt_compiler (T_HALT_COMPILER)"
     189             : %token T_CLASS      "class (T_CLASS)"
     190             : %token T_TRAIT      "trait (T_TRAIT)"
     191             : %token T_INTERFACE  "interface (T_INTERFACE)"
     192             : %token T_EXTENDS    "extends (T_EXTENDS)"
     193             : %token T_IMPLEMENTS "implements (T_IMPLEMENTS)"
     194             : %token T_OBJECT_OPERATOR "-> (T_OBJECT_OPERATOR)"
     195             : %token T_DOUBLE_ARROW    "=> (T_DOUBLE_ARROW)"
     196             : %token T_LIST            "list (T_LIST)"
     197             : %token T_ARRAY           "array (T_ARRAY)"
     198             : %token T_CALLABLE        "callable (T_CALLABLE)"
     199             : %token T_LINE            "__LINE__ (T_LINE)"
     200             : %token T_FILE            "__FILE__ (T_FILE)"
     201             : %token T_DIR             "__DIR__ (T_DIR)"
     202             : %token T_CLASS_C         "__CLASS__ (T_CLASS_C)"
     203             : %token T_TRAIT_C         "__TRAIT__ (T_TRAIT_C)"
     204             : %token T_METHOD_C        "__METHOD__ (T_METHOD_C)"
     205             : %token T_FUNC_C          "__FUNCTION__ (T_FUNC_C)"
     206             : %token T_COMMENT         "comment (T_COMMENT)"
     207             : %token T_DOC_COMMENT     "doc comment (T_DOC_COMMENT)"
     208             : %token T_OPEN_TAG        "open tag (T_OPEN_TAG)"
     209             : %token T_OPEN_TAG_WITH_ECHO "open tag with echo (T_OPEN_TAG_WITH_ECHO)"
     210             : %token T_CLOSE_TAG       "close tag (T_CLOSE_TAG)"
     211             : %token T_WHITESPACE      "whitespace (T_WHITESPACE)"
     212             : %token T_START_HEREDOC   "heredoc start (T_START_HEREDOC)"
     213             : %token T_END_HEREDOC     "heredoc end (T_END_HEREDOC)"
     214             : %token T_DOLLAR_OPEN_CURLY_BRACES "${ (T_DOLLAR_OPEN_CURLY_BRACES)"
     215             : %token T_CURLY_OPEN      "{$ (T_CURLY_OPEN)"
     216             : %token T_PAAMAYIM_NEKUDOTAYIM ":: (T_PAAMAYIM_NEKUDOTAYIM)"
     217             : %token T_NAMESPACE       "namespace (T_NAMESPACE)"
     218             : %token T_NS_C            "__NAMESPACE__ (T_NS_C)"
     219             : %token T_NS_SEPARATOR    "\\ (T_NS_SEPARATOR)"
     220             : %token T_ELLIPSIS        "... (T_ELLIPSIS)"
     221             : %token T_COALESCE        "?? (T_COALESCE)"
     222             : %token T_POW             "** (T_POW)"
     223             : %token T_POW_EQUAL       "**= (T_POW_EQUAL)"
     224             : 
     225             : /* Token used to force a parse error from the lexer */
     226             : %token T_ERROR
     227             : 
     228             : %type <ast> top_statement namespace_name name statement function_declaration_statement
     229             : %type <ast> class_declaration_statement trait_declaration_statement
     230             : %type <ast> interface_declaration_statement interface_extends_list
     231             : %type <ast> group_use_declaration inline_use_declarations inline_use_declaration
     232             : %type <ast> mixed_group_use_declaration use_declaration unprefixed_use_declaration
     233             : %type <ast> unprefixed_use_declarations const_decl inner_statement
     234             : %type <ast> expr optional_expr while_statement for_statement foreach_variable
     235             : %type <ast> foreach_statement declare_statement finally_statement unset_variable variable
     236             : %type <ast> extends_from parameter optional_type argument expr_without_variable global_var
     237             : %type <ast> static_var class_statement trait_adaptation trait_precedence trait_alias
     238             : %type <ast> absolute_trait_method_reference trait_method_reference property echo_expr
     239             : %type <ast> new_expr anonymous_class class_name class_name_reference simple_variable
     240             : %type <ast> internal_functions_in_yacc
     241             : %type <ast> exit_expr scalar backticks_expr lexical_var function_call member_name property_name
     242             : %type <ast> variable_class_name dereferencable_scalar constant dereferencable
     243             : %type <ast> callable_expr callable_variable static_member new_variable
     244             : %type <ast> encaps_var encaps_var_offset isset_variables
     245             : %type <ast> top_statement_list use_declarations const_list inner_statement_list if_stmt
     246             : %type <ast> alt_if_stmt for_exprs switch_case_list global_var_list static_var_list
     247             : %type <ast> echo_expr_list unset_variables catch_name_list catch_list parameter_list class_statement_list
     248             : %type <ast> implements_list case_list if_stmt_without_else
     249             : %type <ast> non_empty_parameter_list argument_list non_empty_argument_list property_list
     250             : %type <ast> class_const_list class_const_decl name_list trait_adaptations method_body non_empty_for_exprs
     251             : %type <ast> ctor_arguments alt_if_stmt_without_else trait_adaptation_list lexical_vars
     252             : %type <ast> lexical_var_list encaps_list
     253             : %type <ast> array_pair non_empty_array_pair_list array_pair_list possible_array_pair
     254             : %type <ast> isset_variable type return_type type_expr
     255             : %type <ast> identifier
     256             : 
     257             : %type <num> returns_ref function is_reference is_variadic variable_modifiers
     258             : %type <num> method_modifiers non_empty_member_modifiers member_modifier
     259             : %type <num> class_modifiers class_modifier use_type backup_fn_flags
     260             : 
     261             : %type <str> backup_doc_comment
     262             : 
     263             : %% /* Rules */
     264             : 
     265             : start:
     266       35129 :         top_statement_list      { CG(ast) = $1; }
     267       35129 : ;
     268             : 
     269             : reserved_non_modifiers:
     270             :           T_INCLUDE | T_INCLUDE_ONCE | T_EVAL | T_REQUIRE | T_REQUIRE_ONCE | T_LOGICAL_OR | T_LOGICAL_XOR | T_LOGICAL_AND
     271             :         | T_INSTANCEOF | T_NEW | T_CLONE | T_EXIT | T_IF | T_ELSEIF | T_ELSE | T_ENDIF | T_ECHO | T_DO | T_WHILE | T_ENDWHILE
     272             :         | T_FOR | T_ENDFOR | T_FOREACH | T_ENDFOREACH | T_DECLARE | T_ENDDECLARE | T_AS | T_TRY | T_CATCH | T_FINALLY
     273             :         | T_THROW | T_USE | T_INSTEADOF | T_GLOBAL | T_VAR | T_UNSET | T_ISSET | T_EMPTY | T_CONTINUE | T_GOTO
     274             :         | T_FUNCTION | T_CONST | T_RETURN | T_PRINT | T_YIELD | T_LIST | T_SWITCH | T_ENDSWITCH | T_CASE | T_DEFAULT | T_BREAK
     275             :         | T_ARRAY | T_CALLABLE | T_EXTENDS | T_IMPLEMENTS | T_NAMESPACE | T_TRAIT | T_INTERFACE | T_CLASS
     276             :         | T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C
     277             : ;
     278             : 
     279             : semi_reserved:
     280             :           reserved_non_modifiers
     281             :         | T_STATIC | T_ABSTRACT | T_FINAL | T_PRIVATE | T_PROTECTED | T_PUBLIC
     282             : ;
     283             : 
     284             : identifier:
     285       43047 :                 T_STRING { $$ = $1; }
     286       43047 :         |       semi_reserved  {
     287             :                         zval zv;
     288         506 :                         zend_lex_tstring(&zv);
     289         506 :                         $$ = zend_ast_create_zval(&zv);
     290             :                 }
     291         506 : ;
     292             : 
     293             : top_statement_list:
     294      247806 :                 top_statement_list top_statement { $$ = zend_ast_list_add($1, $2); }
     295      247806 :         |       /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
     296       35332 : ;
     297             : 
     298             : namespace_name:
     299      432477 :                 T_STRING                                                                { $$ = $1; }
     300      432477 :         |       namespace_name T_NS_SEPARATOR T_STRING  { $$ = zend_ast_append_str($1, $3); }
     301         460 : ;
     302             : 
     303             : name:
     304      431613 :                 namespace_name                                                          { $$ = $1; $$->attr = ZEND_NAME_NOT_FQ; }
     305      431613 :         |       T_NAMESPACE T_NS_SEPARATOR namespace_name       { $$ = $3; $$->attr = ZEND_NAME_RELATIVE; }
     306          58 :         |       T_NS_SEPARATOR namespace_name                           { $$ = $2; $$->attr = ZEND_NAME_FQ; }
     307         413 : ;
     308             : 
     309             : top_statement:
     310      223334 :                 statement                                                       { $$ = $1; }
     311      223334 :         |       function_declaration_statement          { $$ = $1; }
     312       16307 :         |       class_declaration_statement                     { $$ = $1; }
     313        6825 :         |       trait_declaration_statement                     { $$ = $1; }
     314         238 :         |       interface_declaration_statement         { $$ = $1; }
     315         222 :         |       T_HALT_COMPILER '(' ')' ';'
     316         554 :                         { $$ = zend_ast_create(ZEND_AST_HALT_COMPILER,
     317         277 :                               zend_ast_create_zval_from_long(zend_get_scanned_file_offset()));
     318         277 :                           zend_stop_lexing(); }
     319         277 :         |       T_NAMESPACE namespace_name ';'
     320         151 :                         { $$ = zend_ast_create(ZEND_AST_NAMESPACE, $2, NULL);
     321         151 :                           RESET_DOC_COMMENT(); }
     322         152 :         |       T_NAMESPACE namespace_name { RESET_DOC_COMMENT(); }
     323          76 :                 '{' top_statement_list '}'
     324          73 :                         { $$ = zend_ast_create(ZEND_AST_NAMESPACE, $2, $5); }
     325          73 :         |       T_NAMESPACE { RESET_DOC_COMMENT(); }
     326          46 :                 '{' top_statement_list '}'
     327          46 :                         { $$ = zend_ast_create(ZEND_AST_NAMESPACE, NULL, $4); }
     328          46 :         |       T_USE mixed_group_use_declaration ';'           { $$ = $2; }
     329          10 :         |       T_USE use_type group_use_declaration ';'        { $$ = $3; $$->attr = $2; }
     330           4 :         |       T_USE use_declarations ';'                                      { $$ = $2; $$->attr = T_CLASS; }
     331          64 :         |       T_USE use_type use_declarations ';'                     { $$ = $3; $$->attr = $2; }
     332          33 :         |       T_CONST const_list ';'                                          { $$ = $2; }
     333         222 : ;
     334             : 
     335             : use_type:
     336          24 :                 T_FUNCTION              { $$ = T_FUNCTION; }
     337          24 :         |       T_CONST                 { $$ = T_CONST; }
     338          23 : ;
     339             : 
     340             : group_use_declaration:
     341             :                 namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations '}'
     342           2 :                         { $$ = zend_ast_create(ZEND_AST_GROUP_USE, $1, $4); }
     343           2 :         |       T_NS_SEPARATOR namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations '}'
     344           2 :                         { $$ = zend_ast_create(ZEND_AST_GROUP_USE, $2, $5); }
     345           2 : ;
     346             : 
     347             : mixed_group_use_declaration:
     348             :                 namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}'
     349           9 :                         { $$ = zend_ast_create(ZEND_AST_GROUP_USE, $1, $4);}
     350           9 :         |       T_NS_SEPARATOR namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}'
     351           1 :                         { $$ = zend_ast_create(ZEND_AST_GROUP_USE, $2, $5); }
     352           1 : ;
     353             : 
     354             : inline_use_declarations:
     355             :                 inline_use_declarations ',' inline_use_declaration
     356          19 :                         { $$ = zend_ast_list_add($1, $3); }
     357          19 :         |       inline_use_declaration
     358          11 :                         { $$ = zend_ast_create_list(1, ZEND_AST_USE, $1); }
     359          11 : ;
     360             : 
     361             : unprefixed_use_declarations:
     362             :                 unprefixed_use_declarations ',' unprefixed_use_declaration
     363           9 :                         { $$ = zend_ast_list_add($1, $3); }
     364           9 :         |       unprefixed_use_declaration
     365           5 :                         { $$ = zend_ast_create_list(1, ZEND_AST_USE, $1); }
     366           5 : ;
     367             : 
     368             : use_declarations:
     369             :                 use_declarations ',' use_declaration
     370           8 :                         { $$ = zend_ast_list_add($1, $3); }
     371           8 :         |       use_declaration
     372          97 :                         { $$ = zend_ast_create_list(1, ZEND_AST_USE, $1); }
     373          97 : ;
     374             : 
     375             : inline_use_declaration:
     376          21 :                 unprefixed_use_declaration { $$ = $1; $$->attr = T_CLASS; }
     377          21 :         |       use_type unprefixed_use_declaration { $$ = $2; $$->attr = $1; }
     378           9 : ;
     379             : 
     380             : unprefixed_use_declaration:
     381             :                 namespace_name
     382          87 :                         { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $1, NULL); }
     383          87 :         |       namespace_name T_AS T_STRING
     384          62 :                         { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $1, $3); }
     385          62 : ;
     386             : 
     387             : use_declaration:
     388          90 :                 unprefixed_use_declaration                { $$ = $1; }
     389          90 :         |       T_NS_SEPARATOR unprefixed_use_declaration { $$ = $2; }
     390          15 : ;
     391             : 
     392             : const_list:
     393           2 :                 const_list ',' const_decl { $$ = zend_ast_list_add($1, $3); }
     394           2 :         |       const_decl { $$ = zend_ast_create_list(1, ZEND_AST_CONST_DECL, $1); }
     395         295 : ;
     396             : 
     397             : inner_statement_list:
     398             :                 inner_statement_list inner_statement
     399      285022 :                         { $$ = zend_ast_list_add($1, $2); }
     400      285022 :         |       /* empty */
     401      137079 :                         { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
     402      137079 : ;
     403             : 
     404             : 
     405             : inner_statement:
     406      279398 :                 statement { $$ = $1; }
     407      279398 :         |       function_declaration_statement          { $$ = $1; }
     408        4670 :         |       class_declaration_statement             { $$ = $1; }
     409         954 :         |       trait_declaration_statement                     { $$ = $1; }
     410           0 :         |       interface_declaration_statement         { $$ = $1; }
     411           0 :         |       T_HALT_COMPILER '(' ')' ';'
     412           1 :                         { $$ = NULL; zend_error_noreturn(E_COMPILE_ERROR,
     413             :                               "__HALT_COMPILER() can only be used from the outermost scope"); }
     414             : ;
     415             : 
     416             : 
     417             : statement:
     418       87819 :                 '{' inner_statement_list '}' { $$ = $2; }
     419       87819 :         |       if_stmt { $$ = $1; }
     420       81918 :         |       alt_if_stmt { $$ = $1; }
     421           4 :         |       T_WHILE '(' expr ')' while_statement
     422        2306 :                         { $$ = zend_ast_create(ZEND_AST_WHILE, $3, $5); }
     423        2306 :         |       T_DO statement T_WHILE '(' expr ')' ';'
     424         314 :                         { $$ = zend_ast_create(ZEND_AST_DO_WHILE, $2, $5); }
     425         314 :         |       T_FOR '(' for_exprs ';' for_exprs ';' for_exprs ')' for_statement
     426        2303 :                         { $$ = zend_ast_create(ZEND_AST_FOR, $3, $5, $7, $9); }
     427        2303 :         |       T_SWITCH '(' expr ')' switch_case_list
     428         517 :                         { $$ = zend_ast_create(ZEND_AST_SWITCH, $3, $5); }
     429         517 :         |       T_BREAK optional_expr ';'               { $$ = zend_ast_create(ZEND_AST_BREAK, $2); }
     430        2086 :         |       T_CONTINUE optional_expr ';'    { $$ = zend_ast_create(ZEND_AST_CONTINUE, $2); }
     431         306 :         |       T_RETURN optional_expr ';'              { $$ = zend_ast_create(ZEND_AST_RETURN, $2); }
     432       46992 :         |       T_GLOBAL global_var_list ';'    { $$ = $2; }
     433        4371 :         |       T_STATIC static_var_list ';'    { $$ = $2; }
     434        2210 :         |       T_ECHO echo_expr_list ';'               { $$ = $2; }
     435       35582 :         |       T_INLINE_HTML { $$ = zend_ast_create(ZEND_AST_ECHO, $1); }
     436        4065 :         |       expr ';' { $$ = $1; }
     437      304849 :         |       T_UNSET '(' unset_variables ')' ';' { $$ = $3; }
     438        1602 :         |       T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement
     439        6949 :                         { $$ = zend_ast_create(ZEND_AST_FOREACH, $3, $5, NULL, $7); }
     440        6949 :         |       T_FOREACH '(' expr T_AS foreach_variable T_DOUBLE_ARROW foreach_variable ')'
     441             :                 foreach_statement
     442        5402 :                         { $$ = zend_ast_create(ZEND_AST_FOREACH, $3, $7, $5, $9); }
     443        5402 :         |       T_DECLARE '(' const_list ')'
     444          73 :                         { zend_handle_encoding_declaration($3); }
     445          69 :                 declare_statement
     446          69 :                         { $$ = zend_ast_create(ZEND_AST_DECLARE, $3, $6); }
     447          69 :         |       ';'     /* empty statement */ { $$ = NULL; }
     448       32513 :         |       T_TRY '{' inner_statement_list '}' catch_list finally_statement
     449        3090 :                         { $$ = zend_ast_create(ZEND_AST_TRY, $3, $5, $6); }
     450        3090 :         |       T_THROW expr ';' { $$ = zend_ast_create(ZEND_AST_THROW, $2); }
     451         461 :         |       T_GOTO T_STRING ';' { $$ = zend_ast_create(ZEND_AST_GOTO, $2); }
     452          51 :         |       T_STRING ':' { $$ = zend_ast_create(ZEND_AST_LABEL, $1); }
     453          51 : ;
     454             : 
     455             : catch_list:
     456             :                 /* empty */
     457        3090 :                         { $$ = zend_ast_create_list(0, ZEND_AST_CATCH_LIST); }
     458        3090 :         |       catch_list T_CATCH '(' catch_name_list T_VARIABLE ')' '{' inner_statement_list '}'
     459        3007 :                         { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_CATCH, $4, $5, $8)); }
     460        3007 : ;
     461             : 
     462             : catch_name_list:
     463        3007 :                 name { $$ = zend_ast_create_list(1, ZEND_AST_NAME_LIST, $1); }
     464        3007 :         |       catch_name_list '|' name { $$ = zend_ast_list_add($1, $3); }
     465          13 : ;
     466             : 
     467             : finally_statement:
     468        2928 :                 /* empty */ { $$ = NULL; }
     469        2928 :         |       T_FINALLY '{' inner_statement_list '}' { $$ = $3; }
     470         162 : ;
     471             : 
     472             : unset_variables:
     473        1602 :                 unset_variable { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
     474        1602 :         |       unset_variables ',' unset_variable { $$ = zend_ast_list_add($1, $3); }
     475         123 : ;
     476             : 
     477             : unset_variable:
     478        1725 :                 variable { $$ = zend_ast_create(ZEND_AST_UNSET, $1); }
     479        1725 : ;
     480             : 
     481             : function_declaration_statement:
     482             :         function returns_ref T_STRING backup_doc_comment '(' parameter_list ')' return_type
     483             :         backup_fn_flags '{' inner_statement_list '}' backup_fn_flags
     484      104885 :                 { $$ = zend_ast_create_decl(ZEND_AST_FUNC_DECL, $2 | $13, $1, $4,
     485      104885 :                       zend_ast_get_str($3), $6, NULL, $11, $8); CG(extra_fn_flags) = $9; }
     486       20977 : ;
     487             : 
     488             : is_reference:
     489       88736 :                 /* empty */     { $$ = 0; }
     490       88736 :         |       '&'                 { $$ = ZEND_PARAM_REF; }
     491        1162 : ;
     492             : 
     493             : is_variadic:
     494       89855 :                 /* empty */ { $$ = 0; }
     495       89855 :         |       T_ELLIPSIS  { $$ = ZEND_PARAM_VARIADIC; }
     496          43 : ;
     497             : 
     498             : class_declaration_statement:
     499         118 :                 class_modifiers T_CLASS { $<num>$ = CG(zend_lineno); }
     500         118 :                 T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
     501         236 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLASS, $1, $<num>3, $7, zend_ast_get_str($4), $5, $6, $9, NULL); }
     502         118 :         |       T_CLASS { $<num>$ = CG(zend_lineno); }
     503        7679 :                 T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
     504       15322 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLASS, 0, $<num>2, $6, zend_ast_get_str($3), $4, $5, $8, NULL); }
     505        7661 : ;
     506             : 
     507             : class_modifiers:
     508         120 :                 class_modifier                                  { $$ = $1; }
     509         120 :         |       class_modifiers class_modifier  { $$ = zend_add_class_modifier($1, $2); }
     510           0 : ;
     511             : 
     512             : class_modifier:
     513         103 :                 T_ABSTRACT              { $$ = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
     514         103 :         |       T_FINAL                 { $$ = ZEND_ACC_FINAL; }
     515          19 : ;
     516             : 
     517             : trait_declaration_statement:
     518         240 :                 T_TRAIT { $<num>$ = CG(zend_lineno); }
     519         240 :                 T_STRING backup_doc_comment '{' class_statement_list '}'
     520         476 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLASS, ZEND_ACC_TRAIT, $<num>2, $4, zend_ast_get_str($3), NULL, NULL, $6, NULL); }
     521         238 : ;
     522             : 
     523             : interface_declaration_statement:
     524         223 :                 T_INTERFACE { $<num>$ = CG(zend_lineno); }
     525         223 :                 T_STRING interface_extends_list backup_doc_comment '{' class_statement_list '}'
     526         444 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLASS, ZEND_ACC_INTERFACE, $<num>2, $5, zend_ast_get_str($3), NULL, $4, $7, NULL); }
     527         222 : ;
     528             : 
     529             : extends_from:
     530        5316 :                 /* empty */             { $$ = NULL; }
     531        5316 :         |       T_EXTENDS name  { $$ = $2; }
     532        2520 : ;
     533             : 
     534             : interface_extends_list:
     535         182 :                 /* empty */                     { $$ = NULL; }
     536         182 :         |       T_EXTENDS name_list     { $$ = $2; }
     537          40 : ;
     538             : 
     539             : implements_list:
     540        7492 :                 /* empty */                             { $$ = NULL; }
     541        7492 :         |       T_IMPLEMENTS name_list  { $$ = $2; }
     542         343 : ;
     543             : 
     544             : foreach_variable:
     545       17624 :                 variable                        { $$ = $1; }
     546       17624 :         |       '&' variable                { $$ = zend_ast_create(ZEND_AST_REF, $2); }
     547         115 :         |       T_LIST '(' array_pair_list ')' { $$ = $3; $$->attr = ZEND_ARRAY_SYNTAX_LIST; }
     548          14 :         |       '[' array_pair_list ']' { $$ = $2; $$->attr = ZEND_ARRAY_SYNTAX_SHORT; }
     549           0 : ;
     550             : 
     551             : for_statement:
     552        2300 :                 statement { $$ = $1; }
     553        2300 :         |       ':' inner_statement_list T_ENDFOR ';' { $$ = $2; }
     554           3 : ;
     555             : 
     556             : foreach_statement:
     557       12351 :                 statement { $$ = $1; }
     558       12351 :         |       ':' inner_statement_list T_ENDFOREACH ';' { $$ = $2; }
     559           0 : ;
     560             : 
     561             : declare_statement:
     562          69 :                 statement { $$ = $1; }
     563          69 :         |       ':' inner_statement_list T_ENDDECLARE ';' { $$ = $2; }
     564           0 : ;
     565             : 
     566             : switch_case_list:
     567         516 :                 '{' case_list '}'                                       { $$ = $2; }
     568         516 :         |       '{' ';' case_list '}'                           { $$ = $3; }
     569           0 :         |       ':' case_list T_ENDSWITCH ';'           { $$ = $2; }
     570           1 :         |       ':' ';' case_list T_ENDSWITCH ';'       { $$ = $3; }
     571           0 : ;
     572             : 
     573             : case_list:
     574         517 :                 /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_SWITCH_LIST); }
     575         517 :         |       case_list T_CASE expr case_separator inner_statement_list
     576        1751 :                         { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_SWITCH_CASE, $3, $5)); }
     577        1751 :         |       case_list T_DEFAULT case_separator inner_statement_list
     578         307 :                         { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_SWITCH_CASE, NULL, $4)); }
     579         307 : ;
     580             : 
     581             : case_separator:
     582             :                 ':'
     583             :         |       ';'
     584             : ;
     585             : 
     586             : 
     587             : while_statement:
     588        2305 :                 statement { $$ = $1; }
     589        2305 :         |       ':' inner_statement_list T_ENDWHILE ';' { $$ = $2; }
     590           1 : ;
     591             : 
     592             : 
     593             : if_stmt_without_else:
     594             :                 T_IF '(' expr ')' statement
     595      163836 :                         { $$ = zend_ast_create_list(1, ZEND_AST_IF,
     596       81918 :                               zend_ast_create(ZEND_AST_IF_ELEM, $3, $5)); }
     597       81918 :         |       if_stmt_without_else T_ELSEIF '(' expr ')' statement
     598        4504 :                         { $$ = zend_ast_list_add($1,
     599        2252 :                               zend_ast_create(ZEND_AST_IF_ELEM, $4, $6)); }
     600        2252 : ;
     601             : 
     602             : if_stmt:
     603       60329 :                 if_stmt_without_else %prec T_NOELSE { $$ = $1; }
     604       60329 :         |       if_stmt_without_else T_ELSE statement
     605       21589 :                         { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_IF_ELEM, NULL, $3)); }
     606       21589 : ;
     607             : 
     608             : alt_if_stmt_without_else:
     609             :                 T_IF '(' expr ')' ':' inner_statement_list
     610           8 :                         { $$ = zend_ast_create_list(1, ZEND_AST_IF,
     611           4 :                               zend_ast_create(ZEND_AST_IF_ELEM, $3, $6)); }
     612           4 :         |       alt_if_stmt_without_else T_ELSEIF '(' expr ')' ':' inner_statement_list
     613           2 :                         { $$ = zend_ast_list_add($1,
     614           1 :                               zend_ast_create(ZEND_AST_IF_ELEM, $4, $7)); }
     615           1 : ;
     616             : 
     617             : alt_if_stmt:
     618           2 :                 alt_if_stmt_without_else T_ENDIF ';' { $$ = $1; }
     619           2 :         |       alt_if_stmt_without_else T_ELSE ':' inner_statement_list T_ENDIF ';'
     620           2 :                         { $$ = zend_ast_list_add($1,
     621           2 :                               zend_ast_create(ZEND_AST_IF_ELEM, NULL, $4)); }
     622           2 : ;
     623             : 
     624             : parameter_list:
     625       30274 :                 non_empty_parameter_list { $$ = $1; }
     626       30274 :         |       /* empty */     { $$ = zend_ast_create_list(0, ZEND_AST_PARAM_LIST); }
     627       10860 : ;
     628             : 
     629             : 
     630             : non_empty_parameter_list:
     631             :                 parameter
     632       30274 :                         { $$ = zend_ast_create_list(1, ZEND_AST_PARAM_LIST, $1); }
     633       30274 :         |       non_empty_parameter_list ',' parameter
     634       59624 :                         { $$ = zend_ast_list_add($1, $3); }
     635       59624 : ;
     636             : 
     637             : parameter:
     638             :                 optional_type is_reference is_variadic T_VARIABLE
     639       73314 :                         { $$ = zend_ast_create_ex(ZEND_AST_PARAM, $2 | $3, $1, $4, NULL); }
     640       73314 :         |       optional_type is_reference is_variadic T_VARIABLE '=' expr
     641       16584 :                         { $$ = zend_ast_create_ex(ZEND_AST_PARAM, $2 | $3, $1, $4, $6); }
     642       16584 : ;
     643             : 
     644             : 
     645             : optional_type:
     646       89271 :                 /* empty */     { $$ = NULL; }
     647       89271 :         |       type_expr       { $$ = $1; }
     648         627 : ;
     649             : 
     650             : type_expr:
     651         762 :                 type            { $$ = $1; }
     652         762 :         |       '?' type        { $$ = $2; $$->attr |= ZEND_TYPE_NULLABLE; }
     653          48 : ;
     654             : 
     655             : type:
     656         279 :                 T_ARRAY         { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); }
     657         279 :         |       T_CALLABLE      { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); }
     658          21 :         |       name            { $$ = $1; }
     659         510 : ;
     660             : 
     661             : return_type:
     662       40949 :                 /* empty */     { $$ = NULL; }
     663       40949 :         |       ':' type_expr   { $$ = $2; }
     664         183 : ;
     665             : 
     666             : argument_list:
     667       43701 :                 '(' ')' { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
     668       43701 :         |       '(' non_empty_argument_list ')' { $$ = $2; }
     669      318208 : ;
     670             : 
     671             : non_empty_argument_list:
     672             :                 argument
     673      318208 :                         { $$ = zend_ast_create_list(1, ZEND_AST_ARG_LIST, $1); }
     674      318208 :         |       non_empty_argument_list ',' argument
     675      290663 :                         { $$ = zend_ast_list_add($1, $3); }
     676      290663 : ;
     677             : 
     678             : argument:
     679      608797 :                 expr                    { $$ = $1; }
     680      608797 :         |       T_ELLIPSIS expr { $$ = zend_ast_create(ZEND_AST_UNPACK, $2); }
     681          74 : ;
     682             : 
     683             : global_var_list:
     684        1065 :                 global_var_list ',' global_var { $$ = zend_ast_list_add($1, $3); }
     685        1065 :         |       global_var { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
     686        4372 : ;
     687             : 
     688             : global_var:
     689             :         simple_variable
     690        5437 :                 { $$ = zend_ast_create(ZEND_AST_GLOBAL, zend_ast_create(ZEND_AST_VAR, $1)); }
     691        5437 : ;
     692             : 
     693             : 
     694             : static_var_list:
     695           9 :                 static_var_list ',' static_var { $$ = zend_ast_list_add($1, $3); }
     696           9 :         |       static_var { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
     697        2210 : ;
     698             : 
     699             : static_var:
     700          22 :                 T_VARIABLE                      { $$ = zend_ast_create(ZEND_AST_STATIC, $1, NULL); }
     701          22 :         |       T_VARIABLE '=' expr     { $$ = zend_ast_create(ZEND_AST_STATIC, $1, $3); }
     702        2197 : ;
     703             : 
     704             : 
     705             : class_statement_list:
     706             :                 class_statement_list class_statement
     707       22855 :                         { $$ = zend_ast_list_add($1, $2); }
     708       22855 :         |       /* empty */
     709        8293 :                         { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
     710        8293 : ;
     711             : 
     712             : 
     713             : class_statement:
     714             :                 variable_modifiers property_list ';'
     715        2703 :                         { $$ = $2; $$->attr = $1; }
     716        2703 :         |       method_modifiers T_CONST class_const_list ';'
     717         388 :                         { $$ = $3; $$->attr = $1; }
     718         388 :         |       T_USE name_list trait_adaptations
     719         225 :                         { $$ = zend_ast_create(ZEND_AST_USE_TRAIT, $2, $3); }
     720         225 :         |       method_modifiers function returns_ref identifier backup_doc_comment '(' parameter_list ')'
     721             :                 return_type backup_fn_flags method_body backup_fn_flags
     722       97695 :                         { $$ = zend_ast_create_decl(ZEND_AST_METHOD, $3 | $1 | $12, $2, $5,
     723       97695 :                                   zend_ast_get_str($4), $7, NULL, $11, $9); CG(extra_fn_flags) = $10; }
     724       19539 : ;
     725             : 
     726             : name_list:
     727         631 :                 name { $$ = zend_ast_create_list(1, ZEND_AST_NAME_LIST, $1); }
     728         631 :         |       name_list ',' name { $$ = zend_ast_list_add($1, $3); }
     729          86 : ;
     730             : 
     731             : trait_adaptations:
     732         158 :                 ';'                                                             { $$ = NULL; }
     733         158 :         |       '{' '}'                                                 { $$ = NULL; }
     734           0 :         |       '{' trait_adaptation_list '}'   { $$ = $2; }
     735          67 : ;
     736             : 
     737             : trait_adaptation_list:
     738             :                 trait_adaptation
     739          67 :                         { $$ = zend_ast_create_list(1, ZEND_AST_TRAIT_ADAPTATIONS, $1); }
     740          67 :         |       trait_adaptation_list trait_adaptation
     741          35 :                         { $$ = zend_ast_list_add($1, $2); }
     742          35 : ;
     743             : 
     744             : trait_adaptation:
     745          23 :                 trait_precedence ';'    { $$ = $1; }
     746          23 :         |       trait_alias ';'                 { $$ = $1; }
     747          79 : ;
     748             : 
     749             : trait_precedence:
     750             :         absolute_trait_method_reference T_INSTEADOF name_list
     751          23 :                 { $$ = zend_ast_create(ZEND_AST_TRAIT_PRECEDENCE, $1, $3); }
     752          23 : ;
     753             : 
     754             : trait_alias:
     755             :                 trait_method_reference T_AS T_STRING
     756          52 :                         { $$ = zend_ast_create_ex(ZEND_AST_TRAIT_ALIAS, 0, $1, $3); }
     757          52 :         |       trait_method_reference T_AS reserved_non_modifiers
     758           6 :                         { zval zv; zend_lex_tstring(&zv); $$ = zend_ast_create_ex(ZEND_AST_TRAIT_ALIAS, 0, $1, zend_ast_create_zval(&zv)); }
     759           3 :         |       trait_method_reference T_AS member_modifier identifier
     760           9 :                         { $$ = zend_ast_create_ex(ZEND_AST_TRAIT_ALIAS, $3, $1, $4); }
     761           9 :         |       trait_method_reference T_AS member_modifier
     762          15 :                         { $$ = zend_ast_create_ex(ZEND_AST_TRAIT_ALIAS, $3, $1, NULL); }
     763          15 : ;
     764             : 
     765             : trait_method_reference:
     766             :                 identifier
     767          45 :                         { $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, NULL, $1); }
     768          45 :         |       absolute_trait_method_reference { $$ = $1; }
     769          34 : ;
     770             : 
     771             : absolute_trait_method_reference:
     772             :         name T_PAAMAYIM_NEKUDOTAYIM identifier
     773          57 :                 { $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, $1, $3); }
     774          57 : ;
     775             : 
     776             : method_body:
     777         205 :                 ';' /* abstract method */               { $$ = NULL; }
     778         205 :         |       '{' inner_statement_list '}'    { $$ = $2; }
     779       19334 : ;
     780             : 
     781             : variable_modifiers:
     782        2504 :                 non_empty_member_modifiers              { $$ = $1; }
     783        2504 :         |       T_VAR                                                   { $$ = ZEND_ACC_PUBLIC; }
     784         199 : ;
     785             : 
     786             : method_modifiers:
     787        7547 :                 /* empty */                                             { $$ = ZEND_ACC_PUBLIC; }
     788        7547 :         |       non_empty_member_modifiers
     789       12382 :                         { $$ = $1; if (!($$ & ZEND_ACC_PPP_MASK)) { $$ |= ZEND_ACC_PUBLIC; } }
     790       12382 : ;
     791             : 
     792             : non_empty_member_modifiers:
     793       14897 :                 member_modifier                 { $$ = $1; }
     794       14897 :         |       non_empty_member_modifiers member_modifier
     795         836 :                         { $$ = zend_add_member_modifier($1, $2); }
     796         825 : ;
     797             : 
     798             : member_modifier:
     799        5134 :                 T_PUBLIC                                { $$ = ZEND_ACC_PUBLIC; }
     800        5134 :         |       T_PROTECTED                             { $$ = ZEND_ACC_PROTECTED; }
     801         628 :         |       T_PRIVATE                               { $$ = ZEND_ACC_PRIVATE; }
     802        1272 :         |       T_STATIC                                { $$ = ZEND_ACC_STATIC; }
     803        8612 :         |       T_ABSTRACT                              { $$ = ZEND_ACC_ABSTRACT; }
     804          81 :         |       T_FINAL                                 { $$ = ZEND_ACC_FINAL; }
     805          30 : ;
     806             : 
     807             : property_list:
     808          49 :                 property_list ',' property { $$ = zend_ast_list_add($1, $3); }
     809          49 :         |       property { $$ = zend_ast_create_list(1, ZEND_AST_PROP_DECL, $1); }
     810        2703 : ;
     811             : 
     812             : property:
     813             :                 T_VARIABLE backup_doc_comment
     814        1310 :                         { $$ = zend_ast_create(ZEND_AST_PROP_ELEM, $1, NULL, ($2 ? zend_ast_create_zval_from_str($2) : NULL)); }
     815        1267 :         |       T_VARIABLE '=' expr backup_doc_comment
     816        1497 :                         { $$ = zend_ast_create(ZEND_AST_PROP_ELEM, $1, $3, ($4 ? zend_ast_create_zval_from_str($4) : NULL)); }
     817        1485 : ;
     818             : 
     819             : class_const_list:
     820           7 :                 class_const_list ',' class_const_decl { $$ = zend_ast_list_add($1, $3); }
     821           7 :         |       class_const_decl { $$ = zend_ast_create_list(1, ZEND_AST_CLASS_CONST_DECL, $1); }
     822         388 : ;
     823             : 
     824             : class_const_decl:
     825         403 :         identifier '=' expr backup_doc_comment { $$ = zend_ast_create(ZEND_AST_CONST_ELEM, $1, $3, ($4 ? zend_ast_create_zval_from_str($4) : NULL)); }
     826         395 : ;
     827             : 
     828             : const_decl:
     829         297 :         T_STRING '=' expr backup_doc_comment { $$ = zend_ast_create(ZEND_AST_CONST_ELEM, $1, $3, ($4 ? zend_ast_create_zval_from_str($4) : NULL)); }
     830         297 : ;
     831             : 
     832             : echo_expr_list:
     833        2328 :                 echo_expr_list ',' echo_expr { $$ = zend_ast_list_add($1, $3); }
     834        2328 :         |       echo_expr { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
     835       35582 : ;
     836             : echo_expr:
     837       37910 :         expr { $$ = zend_ast_create(ZEND_AST_ECHO, $1); }
     838       37910 : ;
     839             : 
     840             : for_exprs:
     841           7 :                 /* empty */                     { $$ = NULL; }
     842           7 :         |       non_empty_for_exprs     { $$ = $1; }
     843        6902 : ;
     844             : 
     845             : non_empty_for_exprs:
     846          13 :                 non_empty_for_exprs ',' expr { $$ = zend_ast_list_add($1, $3); }
     847          13 :         |       expr { $$ = zend_ast_create_list(1, ZEND_AST_EXPR_LIST, $1); }
     848        6902 : ;
     849             : 
     850             : anonymous_class:
     851          41 :         T_CLASS { $<num>$ = CG(zend_lineno); } ctor_arguments
     852          41 :                 extends_from implements_list backup_doc_comment '{' class_statement_list '}' {
     853         205 :                         zend_ast *decl = zend_ast_create_decl(
     854          82 :                                 ZEND_AST_CLASS, ZEND_ACC_ANON_CLASS, $<num>2, $6, NULL,
     855         164 :                                 $4, $5, $8, NULL);
     856          41 :                         $$ = zend_ast_create(ZEND_AST_NEW, decl, $3);
     857             :                 }
     858          41 : ;
     859             : 
     860             : new_expr:
     861             :                 T_NEW class_name_reference ctor_arguments
     862       15656 :                         { $$ = zend_ast_create(ZEND_AST_NEW, $2, $3); }
     863       15656 :         |       T_NEW anonymous_class
     864          41 :                         { $$ = $2; }
     865          41 : ;
     866             : 
     867             : expr_without_variable:
     868             :                 T_LIST '(' array_pair_list ')' '=' expr
     869         197 :                         { $3->attr = ZEND_ARRAY_SYNTAX_LIST; $$ = zend_ast_create(ZEND_AST_ASSIGN, $3, $6); }
     870         197 :         |       '[' array_pair_list ']' '=' expr
     871           4 :                         { $2->attr = ZEND_ARRAY_SYNTAX_SHORT; $$ = zend_ast_create(ZEND_AST_ASSIGN, $2, $5); }
     872           4 :         |       variable '=' expr
     873      160825 :                         { $$ = zend_ast_create(ZEND_AST_ASSIGN, $1, $3); }
     874      160825 :         |       variable '=' '&' variable
     875         494 :                         { $$ = zend_ast_create(ZEND_AST_ASSIGN_REF, $1, $4); }
     876         494 :         |       T_CLONE expr { $$ = zend_ast_create(ZEND_AST_CLONE, $2); }
     877         124 :         |       variable T_PLUS_EQUAL expr
     878        1456 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_ADD, $1, $3); }
     879         728 :         |       variable T_MINUS_EQUAL expr
     880         288 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SUB, $1, $3); }
     881         144 :         |       variable T_MUL_EQUAL expr
     882          38 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_MUL, $1, $3); }
     883          19 :         |       variable T_POW_EQUAL expr
     884          12 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_POW, $1, $3); }
     885           6 :         |       variable T_DIV_EQUAL expr
     886          14 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_DIV, $1, $3); }
     887           7 :         |       variable T_CONCAT_EQUAL expr
     888        6808 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_CONCAT, $1, $3); }
     889        3404 :         |       variable T_MOD_EQUAL expr
     890          14 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_MOD, $1, $3); }
     891           7 :         |       variable T_AND_EQUAL expr
     892          18 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_AND, $1, $3); }
     893           9 :         |       variable T_OR_EQUAL expr
     894         204 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_OR, $1, $3); }
     895         102 :         |       variable T_XOR_EQUAL expr
     896          20 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_XOR, $1, $3); }
     897          10 :         |       variable T_SL_EQUAL expr
     898          18 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SL, $1, $3); }
     899           9 :         |       variable T_SR_EQUAL expr
     900          34 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SR, $1, $3); }
     901          17 :         |       variable T_INC { $$ = zend_ast_create(ZEND_AST_POST_INC, $1); }
     902        5951 :         |       T_INC variable { $$ = zend_ast_create(ZEND_AST_PRE_INC, $2); }
     903         574 :         |       variable T_DEC { $$ = zend_ast_create(ZEND_AST_POST_DEC, $1); }
     904         178 :         |       T_DEC variable { $$ = zend_ast_create(ZEND_AST_PRE_DEC, $2); }
     905          18 :         |       expr T_BOOLEAN_OR expr
     906        4838 :                         { $$ = zend_ast_create(ZEND_AST_OR, $1, $3); }
     907        4838 :         |       expr T_BOOLEAN_AND expr
     908        8258 :                         { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
     909        8258 :         |       expr T_LOGICAL_OR expr
     910         943 :                         { $$ = zend_ast_create(ZEND_AST_OR, $1, $3); }
     911         943 :         |       expr T_LOGICAL_AND expr
     912          14 :                         { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
     913          14 :         |       expr T_LOGICAL_XOR expr
     914           4 :                         { $$ = zend_ast_create_binary_op(ZEND_BOOL_XOR, $1, $3); }
     915        1715 :         |       expr '|' expr   { $$ = zend_ast_create_binary_op(ZEND_BW_OR, $1, $3); }
     916        2039 :         |       expr '&' expr       { $$ = zend_ast_create_binary_op(ZEND_BW_AND, $1, $3); }
     917         354 :         |       expr '^' expr   { $$ = zend_ast_create_binary_op(ZEND_BW_XOR, $1, $3); }
     918       49279 :         |       expr '.' expr   { $$ = zend_ast_create_binary_op(ZEND_CONCAT, $1, $3); }
     919       55419 :         |       expr '+' expr   { $$ = zend_ast_create_binary_op(ZEND_ADD, $1, $3); }
     920        7499 :         |       expr '-' expr   { $$ = zend_ast_create_binary_op(ZEND_SUB, $1, $3); }
     921        4295 :         |       expr '*' expr   { $$ = zend_ast_create_binary_op(ZEND_MUL, $1, $3); }
     922        2978 :         |       expr T_POW expr { $$ = zend_ast_create_binary_op(ZEND_POW, $1, $3); }
     923         567 :         |       expr '/' expr   { $$ = zend_ast_create_binary_op(ZEND_DIV, $1, $3); }
     924        1364 :         |       expr '%' expr   { $$ = zend_ast_create_binary_op(ZEND_MOD, $1, $3); }
     925         972 :         |       expr T_SL expr  { $$ = zend_ast_create_binary_op(ZEND_SL, $1, $3); }
     926         241 :         |       expr T_SR expr  { $$ = zend_ast_create_binary_op(ZEND_SR, $1, $3); }
     927          80 :         |       '+' expr %prec T_INC { $$ = zend_ast_create(ZEND_AST_UNARY_PLUS, $2); }
     928         256 :         |       '-' expr %prec T_INC { $$ = zend_ast_create(ZEND_AST_UNARY_MINUS, $2); }
     929        6795 :         |       '!' expr { $$ = zend_ast_create_ex(ZEND_AST_UNARY_OP, ZEND_BOOL_NOT, $2); }
     930       34306 :         |       '~' expr { $$ = zend_ast_create_ex(ZEND_AST_UNARY_OP, ZEND_BW_NOT, $2); }
     931          94 :         |       expr T_IS_IDENTICAL expr
     932       14696 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_IDENTICAL, $1, $3); }
     933        7348 :         |       expr T_IS_NOT_IDENTICAL expr
     934       17968 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_NOT_IDENTICAL, $1, $3); }
     935        8984 :         |       expr T_IS_EQUAL expr
     936       35608 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_EQUAL, $1, $3); }
     937       17804 :         |       expr T_IS_NOT_EQUAL expr
     938        7142 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_NOT_EQUAL, $1, $3); }
     939        3571 :         |       expr '<' expr
     940        4914 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_SMALLER, $1, $3); }
     941        2457 :         |       expr T_IS_SMALLER_OR_EQUAL expr
     942        3552 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_SMALLER_OR_EQUAL, $1, $3); }
     943        1776 :         |       expr '>' expr
     944         939 :                         { $$ = zend_ast_create(ZEND_AST_GREATER, $1, $3); }
     945         939 :         |       expr T_IS_GREATER_OR_EQUAL expr
     946         617 :                         { $$ = zend_ast_create(ZEND_AST_GREATER_EQUAL, $1, $3); }
     947         617 :         |       expr T_SPACESHIP expr
     948          38 :                         { $$ = zend_ast_create_binary_op(ZEND_SPACESHIP, $1, $3); }
     949          19 :         |       expr T_INSTANCEOF class_name_reference
     950          75 :                         { $$ = zend_ast_create(ZEND_AST_INSTANCEOF, $1, $3); }
     951          75 :         |       '(' expr ')' { $$ = $2; }
     952       27737 :         |       new_expr { $$ = $1; }
     953       15697 :         |       expr '?' expr ':' expr
     954       25735 :                         { $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1, $3, $5); }
     955       25735 :         |       expr '?' ':' expr
     956         225 :                         { $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1, NULL, $4); }
     957         225 :         |       expr T_COALESCE expr
     958          53 :                         { $$ = zend_ast_create(ZEND_AST_COALESCE, $1, $3); }
     959          53 :         |       internal_functions_in_yacc { $$ = $1; }
     960       32931 :         |       T_INT_CAST expr         { $$ = zend_ast_create_cast(IS_LONG, $2); }
     961        5011 :         |       T_DOUBLE_CAST expr      { $$ = zend_ast_create_cast(IS_DOUBLE, $2); }
     962        1442 :         |       T_STRING_CAST expr      { $$ = zend_ast_create_cast(IS_STRING, $2); }
     963        1392 :         |       T_ARRAY_CAST expr       { $$ = zend_ast_create_cast(IS_ARRAY, $2); }
     964         214 :         |       T_OBJECT_CAST expr      { $$ = zend_ast_create_cast(IS_OBJECT, $2); }
     965         256 :         |       T_BOOL_CAST expr        { $$ = zend_ast_create_cast(_IS_BOOL, $2); }
     966          76 :         |       T_UNSET_CAST expr       { $$ = zend_ast_create_cast(IS_NULL, $2); }
     967           0 :         |       T_EXIT exit_expr        { $$ = zend_ast_create(ZEND_AST_EXIT, $2); }
     968       18075 :         |       '@' expr                        { $$ = zend_ast_create(ZEND_AST_SILENCE, $2); }
     969        7301 :         |       scalar { $$ = $1; }
     970      749274 :         |       '`' backticks_expr '`' { $$ = zend_ast_create(ZEND_AST_SHELL_EXEC, $2); }
     971         125 :         |       T_PRINT expr { $$ = zend_ast_create(ZEND_AST_PRINT, $2); }
     972        3592 :         |       T_YIELD { $$ = zend_ast_create(ZEND_AST_YIELD, NULL, NULL); CG(extra_fn_flags) |= ZEND_ACC_GENERATOR; }
     973          89 :         |       T_YIELD expr { $$ = zend_ast_create(ZEND_AST_YIELD, $2, NULL); CG(extra_fn_flags) |= ZEND_ACC_GENERATOR; }
     974         142 :         |       T_YIELD expr T_DOUBLE_ARROW expr { $$ = zend_ast_create(ZEND_AST_YIELD, $4, $2); CG(extra_fn_flags) |= ZEND_ACC_GENERATOR; }
     975          33 :         |       T_YIELD_FROM expr { $$ = zend_ast_create(ZEND_AST_YIELD_FROM, $2); CG(extra_fn_flags) |= ZEND_ACC_GENERATOR; }
     976          42 :         |       function returns_ref backup_doc_comment '(' parameter_list ')' lexical_vars return_type
     977             :                 backup_fn_flags '{' inner_statement_list '}' backup_fn_flags
     978        3000 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $2 | $13, $1, $3,
     979             :                                   zend_string_init("{closure}", sizeof("{closure}") - 1, 0),
     980        3000 :                               $5, $7, $11, $8); CG(extra_fn_flags) = $9; }
     981         600 :         |       T_STATIC function returns_ref backup_doc_comment '(' parameter_list ')' lexical_vars
     982             :                 return_type backup_fn_flags '{' inner_statement_list '}' backup_fn_flags
     983          60 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $3 | $14 | ZEND_ACC_STATIC, $2, $4,
     984             :                               zend_string_init("{closure}", sizeof("{closure}") - 1, 0),
     985          60 :                               $6, $8, $12, $9); CG(extra_fn_flags) = $10; }
     986          12 : ;
     987             : 
     988             : function:
     989       41135 :         T_FUNCTION { $$ = CG(zend_lineno); }
     990       41135 : ;
     991             : 
     992             : backup_doc_comment:
     993       52876 :         /* empty */ { $$ = CG(doc_comment); CG(doc_comment) = NULL; }
     994       52876 : ;
     995             : 
     996             : backup_fn_flags:
     997       82260 :         /* empty */ { $$ = CG(extra_fn_flags); CG(extra_fn_flags) = 0; }
     998       82260 : ;
     999             : 
    1000             : returns_ref:
    1001       41033 :                 /* empty */     { $$ = 0; }
    1002       41033 :         |       '&'                 { $$ = ZEND_ACC_RETURN_REFERENCE; }
    1003         102 : ;
    1004             : 
    1005             : lexical_vars:
    1006         411 :                 /* empty */ { $$ = NULL; }
    1007         411 :         |       T_USE '(' lexical_var_list ')' { $$ = $3; }
    1008         201 : ;
    1009             : 
    1010             : lexical_var_list:
    1011          14 :                 lexical_var_list ',' lexical_var { $$ = zend_ast_list_add($1, $3); }
    1012          14 :         |       lexical_var { $$ = zend_ast_create_list(1, ZEND_AST_CLOSURE_USES, $1); }
    1013         201 : ;
    1014             : 
    1015             : lexical_var:
    1016         172 :                 T_VARIABLE              { $$ = $1; }
    1017         172 :         |       '&' T_VARIABLE      { $$ = $2; $$->attr = 1; }
    1018          43 : ;
    1019             : 
    1020             : function_call:
    1021             :                 name argument_list
    1022      295063 :                         { $$ = zend_ast_create(ZEND_AST_CALL, $1, $2); }
    1023      295063 :         |       class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
    1024       12071 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_CALL, $1, $3, $4); }
    1025       12071 :         |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
    1026          43 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_CALL, $1, $3, $4); }
    1027          43 :         |       callable_expr argument_list
    1028        2239 :                         { $$ = zend_ast_create(ZEND_AST_CALL, $1, $2); }
    1029        2239 : ;
    1030             : 
    1031             : class_name:
    1032             :                 T_STATIC
    1033          81 :                         { zval zv; ZVAL_INTERNED_STR(&zv, CG(known_strings)[ZEND_STR_STATIC]);
    1034          81 :                           $$ = zend_ast_create_zval_ex(&zv, ZEND_NAME_NOT_FQ); }
    1035          81 :         |       name { $$ = $1; }
    1036       38476 : ;
    1037             : 
    1038             : class_name_reference:
    1039       14266 :                 class_name              { $$ = $1; }
    1040       14266 :         |       new_variable    { $$ = $1; }
    1041        1465 : ;
    1042             : 
    1043             : exit_expr:
    1044         475 :                 /* empty */                             { $$ = NULL; }
    1045         475 :         |       '(' optional_expr ')'   { $$ = $2; }
    1046       17600 : ;
    1047             : 
    1048             : backticks_expr:
    1049             :                 /* empty */
    1050           0 :                         { $$ = zend_ast_create_zval_from_str(ZSTR_EMPTY_ALLOC()); }
    1051           0 :         |       T_ENCAPSED_AND_WHITESPACE { $$ = $1; }
    1052           8 :         |       encaps_list { $$ = $1; }
    1053         117 : ;
    1054             : 
    1055             : 
    1056             : ctor_arguments:
    1057        3066 :                 /* empty */     { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
    1058        3066 :         |       argument_list { $$ = $1; }
    1059       12631 : ;
    1060             : 
    1061             : 
    1062             : dereferencable_scalar:
    1063       28608 :                 T_ARRAY '(' array_pair_list ')' { $$ = $3; $$->attr = ZEND_ARRAY_SYNTAX_LONG; }
    1064       28608 :         |       '[' array_pair_list ']'                 { $$ = $2; $$->attr = ZEND_ARRAY_SYNTAX_SHORT; }
    1065        1412 :         |       T_CONSTANT_ENCAPSED_STRING              { $$ = $1; }
    1066      395383 : ;
    1067             : 
    1068             : scalar:
    1069      180351 :                 T_LNUMBER       { $$ = $1; }
    1070      180351 :         |       T_DNUMBER       { $$ = $1; }
    1071        6766 :         |       T_LINE          { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_LINE); }
    1072          25 :         |       T_FILE          { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_FILE); }
    1073       10054 :         |       T_DIR           { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_DIR); }
    1074         942 :         |       T_TRAIT_C       { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_TRAIT_C); }
    1075           5 :         |       T_METHOD_C      { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_METHOD_C); }
    1076         987 :         |       T_FUNC_C        { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_FUNC_C); }
    1077         133 :         |       T_NS_C          { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_NS_C); }
    1078          36 :         |       T_CLASS_C       { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_CLASS_C); }
    1079         101 :         |       T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
    1080        1396 :         |       T_START_HEREDOC T_END_HEREDOC
    1081         118 :                         { $$ = zend_ast_create_zval_from_str(ZSTR_EMPTY_ALLOC()); }
    1082          59 :         |       '"' encaps_list '"'   { $$ = $2; }
    1083       19789 :         |       T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
    1084         148 :         |       dereferencable_scalar   { $$ = $1; }
    1085      425364 :         |       constant                        { $$ = $1; }
    1086      103118 : ;
    1087             : 
    1088             : constant:
    1089       91706 :                 name { $$ = zend_ast_create(ZEND_AST_CONST, $1); }
    1090       91706 :         |       class_name T_PAAMAYIM_NEKUDOTAYIM identifier
    1091       11421 :                         { $$ = zend_ast_create(ZEND_AST_CLASS_CONST, $1, $3); }
    1092       11421 :         |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM identifier
    1093          16 :                         { $$ = zend_ast_create(ZEND_AST_CLASS_CONST, $1, $3); }
    1094          16 : ;
    1095             : 
    1096             : expr:
    1097      794493 :                 variable                                        { $$ = $1; }
    1098      794493 :         |       expr_without_variable           { $$ = $1; }
    1099     1218718 : ;
    1100             : 
    1101             : optional_expr:
    1102        3764 :                 /* empty */     { $$ = NULL; }
    1103        3764 :         |       expr            { $$ = $1; }
    1104      193596 : ;
    1105             : 
    1106             : variable_class_name:
    1107          78 :         dereferencable { $$ = $1; }
    1108          78 : ;
    1109             : 
    1110             : dereferencable:
    1111      181253 :                 variable                                { $$ = $1; }
    1112      181253 :         |       '(' expr ')'                    { $$ = $2; }
    1113         100 :         |       dereferencable_scalar   { $$ = $1; }
    1114          33 : ;
    1115             : 
    1116             : callable_expr:
    1117        2190 :                 callable_variable               { $$ = $1; }
    1118        2190 :         |       '(' expr ')'                    { $$ = $2; }
    1119          43 :         |       dereferencable_scalar   { $$ = $1; }
    1120           6 : ;
    1121             : 
    1122             : callable_variable:
    1123             :                 simple_variable
    1124      680793 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1125      680793 :         |       dereferencable '[' optional_expr ']'
    1126      130336 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1127      130336 :         |       constant '[' optional_expr ']'
    1128          24 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1129          24 :         |       dereferencable '{' expr '}'
    1130          36 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1131          36 :         |       dereferencable T_OBJECT_OPERATOR property_name argument_list
    1132       39862 :                         { $$ = zend_ast_create(ZEND_AST_METHOD_CALL, $1, $3, $4); }
    1133       39862 :         |       function_call { $$ = $1; }
    1134      309416 : ;
    1135             : 
    1136             : variable:
    1137             :                 callable_variable
    1138     1158277 :                         { $$ = $1; }
    1139     1158277 :         |       static_member
    1140         816 :                         { $$ = $1; }
    1141         816 :         |       dereferencable T_OBJECT_OPERATOR property_name
    1142       11074 :                         { $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
    1143       11074 : ;
    1144             : 
    1145             : simple_variable:
    1146      688668 :                 T_VARIABLE                      { $$ = $1; }
    1147      688668 :         |       '$' '{' expr '}'        { $$ = $3; }
    1148          57 :         |       '$' simple_variable     { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
    1149         173 : ;
    1150             : 
    1151             : static_member:
    1152             :                 class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
    1153         798 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
    1154         798 :         |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
    1155          18 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
    1156          18 : ;
    1157             : 
    1158             : new_variable:
    1159             :                 simple_variable
    1160        1464 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1161        1464 :         |       new_variable '[' optional_expr ']'
    1162          11 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1163          11 :         |       new_variable '{' expr '}'
    1164           1 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1165           1 :         |       new_variable T_OBJECT_OPERATOR property_name
    1166           4 :                         { $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
    1167           4 :         |       class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
    1168           1 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
    1169           1 :         |       new_variable T_PAAMAYIM_NEKUDOTAYIM simple_variable
    1170           2 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
    1171           2 : ;
    1172             : 
    1173             : member_name:
    1174       12070 :                 identifier { $$ = $1; }
    1175       12070 :         |       '{' expr '}'    { $$ = $2; }
    1176           9 :         |       simple_variable { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1177          35 : ;
    1178             : 
    1179             : property_name:
    1180       50693 :                 T_STRING { $$ = $1; }
    1181       50693 :         |       '{' expr '}'    { $$ = $2; }
    1182          70 :         |       simple_variable { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1183         177 : ;
    1184             : 
    1185             : array_pair_list:
    1186             :                 non_empty_array_pair_list
    1187       60536 :                         { /* allow single trailing comma */ $$ = zend_ast_list_rtrim($1); }
    1188       30268 : ;
    1189             : 
    1190             : possible_array_pair:
    1191        6167 :                 /* empty */ { $$ = NULL; }
    1192        6167 :         |       array_pair  { $$ = $1; }
    1193      108580 : ;
    1194             : 
    1195             : non_empty_array_pair_list:
    1196             :                 non_empty_array_pair_list ',' possible_array_pair
    1197       84479 :                         { $$ = zend_ast_list_add($1, $3); }
    1198       84479 :         |       possible_array_pair
    1199       30268 :                         { $$ = zend_ast_create_list(1, ZEND_AST_ARRAY, $1); }
    1200       30268 : ;
    1201             : 
    1202             : array_pair:
    1203             :                 expr T_DOUBLE_ARROW expr
    1204       29025 :                         { $$ = zend_ast_create(ZEND_AST_ARRAY_ELEM, $3, $1); }
    1205       29025 :         |       expr
    1206       79359 :                         { $$ = zend_ast_create(ZEND_AST_ARRAY_ELEM, $1, NULL); }
    1207       79359 :         |       expr T_DOUBLE_ARROW '&' variable
    1208          65 :                         { $$ = zend_ast_create_ex(ZEND_AST_ARRAY_ELEM, 1, $4, $1); }
    1209          65 :         |       '&' variable
    1210         100 :                         { $$ = zend_ast_create_ex(ZEND_AST_ARRAY_ELEM, 1, $2, NULL); }
    1211         100 :         |       expr T_DOUBLE_ARROW T_LIST '(' array_pair_list ')'
    1212           7 :                         { $5->attr = ZEND_ARRAY_SYNTAX_LIST;
    1213           7 :                           $$ = zend_ast_create(ZEND_AST_ARRAY_ELEM, $5, $1); }
    1214           7 :         |       T_LIST '(' array_pair_list ')'
    1215          24 :                         { $3->attr = ZEND_ARRAY_SYNTAX_LIST;
    1216          24 :                           $$ = zend_ast_create(ZEND_AST_ARRAY_ELEM, $3, NULL); }
    1217          24 : ;
    1218             : 
    1219             : encaps_list:
    1220             :                 encaps_list encaps_var
    1221        8358 :                         { $$ = zend_ast_list_add($1, $2); }
    1222        8358 :         |       encaps_list T_ENCAPSED_AND_WHITESPACE
    1223       19954 :                         { $$ = zend_ast_list_add($1, $2); }
    1224       19954 :         |       encaps_var
    1225        5567 :                         { $$ = zend_ast_create_list(1, ZEND_AST_ENCAPS_LIST, $1); }
    1226        5567 :         |       T_ENCAPSED_AND_WHITESPACE encaps_var
    1227       14488 :                         { $$ = zend_ast_create_list(2, ZEND_AST_ENCAPS_LIST, $1, $2); }
    1228       14488 : ;
    1229             : 
    1230             : encaps_var:
    1231             :                 T_VARIABLE
    1232       25083 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1233       25083 :         |       T_VARIABLE '[' encaps_var_offset ']'
    1234        2036 :                         { $$ = zend_ast_create(ZEND_AST_DIM,
    1235        2036 :                               zend_ast_create(ZEND_AST_VAR, $1), $3); }
    1236        1018 :         |       T_VARIABLE T_OBJECT_OPERATOR T_STRING
    1237         230 :                         { $$ = zend_ast_create(ZEND_AST_PROP,
    1238         115 :                               zend_ast_create(ZEND_AST_VAR, $1), $3); }
    1239         115 :         |       T_DOLLAR_OPEN_CURLY_BRACES expr '}'
    1240           4 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
    1241           4 :         |       T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}'
    1242         400 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
    1243         400 :         |       T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
    1244           0 :                         { $$ = zend_ast_create(ZEND_AST_DIM,
    1245           0 :                               zend_ast_create(ZEND_AST_VAR, $2), $4); }
    1246           0 :         |       T_CURLY_OPEN variable '}' { $$ = $2; }
    1247        1793 : ;
    1248             : 
    1249             : encaps_var_offset:
    1250           5 :                 T_STRING                { $$ = $1; }
    1251           5 :         |       T_NUM_STRING    { $$ = $1; }
    1252         419 :         |       T_VARIABLE              { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1253         594 : ;
    1254             : 
    1255             : 
    1256             : internal_functions_in_yacc:
    1257        5835 :                 T_ISSET '(' isset_variables ')' { $$ = $3; }
    1258        5835 :         |       T_EMPTY '(' expr ')' { $$ = zend_ast_create(ZEND_AST_EMPTY, $3); }
    1259        8114 :         |       T_INCLUDE expr
    1260        2778 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_INCLUDE, $2); }
    1261        2778 :         |       T_INCLUDE_ONCE expr
    1262         548 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_INCLUDE_ONCE, $2); }
    1263         548 :         |       T_EVAL '(' expr ')'
    1264        2579 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_EVAL, $3); }
    1265        2579 :         |       T_REQUIRE expr
    1266        2359 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_REQUIRE, $2); }
    1267        2359 :         |       T_REQUIRE_ONCE expr
    1268        5791 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_REQUIRE_ONCE, $2); }
    1269        5791 : ;
    1270             : 
    1271             : isset_variables:
    1272        5835 :                 isset_variable { $$ = $1; }
    1273        5835 :         |       isset_variables ',' isset_variable
    1274          45 :                         { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
    1275          45 : ;
    1276             : 
    1277             : isset_variable:
    1278        5880 :                 expr { $$ = zend_ast_create(ZEND_AST_ISSET, $1); }
    1279             : ;
    1280             : 
    1281             : %%
    1282             : 
    1283             : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
    1284             :    quotes and backslashes, so that it's suitable for yyerror.  The
    1285             :    heuristic is that double-quoting is unnecessary unless the string
    1286             :    contains an apostrophe, a comma, or backslash (other than
    1287             :    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
    1288             :    null, do not copy; instead, return the length of what the result
    1289             :    would have been.  */
    1290         585 : static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
    1291             : {
    1292             :         /* CG(parse_error) states:
    1293             :          * 0 => yyres = NULL, yystr is the unexpected token
    1294             :          * 1 => yyres = NULL, yystr is one of the expected tokens
    1295             :          * 2 => yyres != NULL, yystr is the unexpected token
    1296             :          * 3 => yyres != NULL, yystr is one of the expected tokens
    1297             :          */
    1298         585 :         if (yyres && CG(parse_error) < 2) {
    1299          54 :                 CG(parse_error) = 2;
    1300             :         }
    1301             : 
    1302         585 :         if (CG(parse_error) % 2 == 0) {
    1303             :                 /* The unexpected token */
    1304             :                 char buffer[120];
    1305         108 :                 const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
    1306         108 :                 unsigned int len = 0, toklen = 0, yystr_len;
    1307             : 
    1308         108 :                 CG(parse_error)++;
    1309             : 
    1310         128 :                 if (LANG_SCNG(yy_text)[0] == 0 &&
    1311          10 :                         LANG_SCNG(yy_leng) == 1 &&
    1312          10 :                         memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) {
    1313          10 :                         if (yyres) {
    1314           5 :                                 yystpcpy(yyres, "end of file");
    1315             :                         }
    1316          10 :                         return sizeof("end of file")-1;
    1317             :                 }
    1318             : 
    1319          98 :                 str = LANG_SCNG(yy_text);
    1320          98 :                 end = memchr(str, '\n', LANG_SCNG(yy_leng));
    1321          98 :                 yystr_len = (unsigned int)yystrlen(yystr);
    1322             : 
    1323         210 :                 if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
    1324          56 :                         && (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
    1325          56 :                         toklen = (tok2 - tok1) + 1;
    1326             :                 } else {
    1327          42 :                         tok1 = tok2 = NULL;
    1328          42 :                         toklen = 0;
    1329             :                 }
    1330             : 
    1331          98 :                 if (end == NULL) {
    1332          96 :                         len = LANG_SCNG(yy_leng) > 30 ? 30 : LANG_SCNG(yy_leng);
    1333             :                 } else {
    1334           2 :                         len = (end - str) > 30 ? 30 : (end - str);
    1335             :                 }
    1336          98 :                 if (yyres) {
    1337          49 :                         if (toklen) {
    1338          28 :                                 snprintf(buffer, sizeof(buffer), "'%.*s' %.*s", len, str, toklen, tok1);
    1339             :                         } else {
    1340          21 :                                 snprintf(buffer, sizeof(buffer), "'%.*s'", len, str);
    1341             :                         }
    1342          49 :                         yystpcpy(yyres, buffer);
    1343             :                 }
    1344          98 :                 return len + (toklen ? toklen + 1 : 0) + 2;
    1345             :         }
    1346             : 
    1347             :         /* One of the expected tokens */
    1348         477 :         if (!yyres) {
    1349         416 :                 return yystrlen(yystr) - (*yystr == '"' ? 2 : 0);
    1350             :         }
    1351             : 
    1352          61 :         if (*yystr == '"') {
    1353          30 :                 YYSIZE_T yyn = 0;
    1354          30 :                 const char *yyp = yystr;
    1355             : 
    1356         602 :                 for (; *++yyp != '"'; ++yyn) {
    1357         572 :                         yyres[yyn] = *yyp;
    1358             :                 }
    1359          30 :                 yyres[yyn] = '\0';
    1360          30 :                 return yyn;
    1361             :         }
    1362          31 :         yystpcpy(yyres, yystr);
    1363          31 :         return strlen(yystr);
    1364             : }
    1365             : 
    1366             : /*
    1367             :  * Local variables:
    1368             :  * tab-width: 4
    1369             :  * c-basic-offset: 4
    1370             :  * indent-tabs-mode: t
    1371             :  * End:
    1372             :  */

Generated by: LCOV version 1.10

Generated at Sun, 18 Sep 2016 08:20:03 +0000 (6 days ago)

Copyright © 2005-2016 The PHP Group
All rights reserved.