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: 682 696 98.0 %
Date: 2015-05-21 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-2015 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             : /*
      25             :  * LALR shift/reduce conflicts and how they are resolved:
      26             :  *
      27             :  * - 2 shift/reduce conflicts due to the dangling elseif/else ambiguity. Solved by shift.
      28             :  *
      29             :  */
      30             : 
      31             : 
      32             : #include "zend_compile.h"
      33             : #include "zend.h"
      34             : #include "zend_list.h"
      35             : #include "zend_globals.h"
      36             : #include "zend_API.h"
      37             : #include "zend_constants.h"
      38             : 
      39             : #define YYSIZE_T size_t
      40             : #define yytnamerr zend_yytnamerr
      41             : static YYSIZE_T zend_yytnamerr(char*, const char*);
      42             : 
      43             : #define YYERROR_VERBOSE
      44             : #define YYSTYPE zend_parser_stack_elem
      45             : 
      46             : #ifdef _MSC_VER
      47             : #define YYMALLOC malloc
      48             : #define YYFREE free
      49             : #endif
      50             : 
      51             : %}
      52             : 
      53             : %pure_parser
      54             : %expect 2
      55             : 
      56             : %code requires {
      57             : }
      58             : 
      59         146 : %destructor { zend_ast_destroy($$); } <ast>
      60          11 : %destructor { if ($$) zend_string_release($$); } <str>
      61             : 
      62             : %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
      63             : %left ','
      64             : %left T_LOGICAL_OR
      65             : %left T_LOGICAL_XOR
      66             : %left T_LOGICAL_AND
      67             : %right T_PRINT
      68             : %right T_YIELD
      69             : %right T_DOUBLE_ARROW
      70             : %right T_YIELD_FROM
      71             : %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
      72             : %left '?' ':'
      73             : %right T_COALESCE
      74             : %left T_BOOLEAN_OR
      75             : %left T_BOOLEAN_AND
      76             : %left '|'
      77             : %left '^'
      78             : %left '&'
      79             : %nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP
      80             : %nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
      81             : %left T_SL T_SR
      82             : %left '+' '-' '.'
      83             : %left '*' '/' '%'
      84             : %right '!'
      85             : %nonassoc T_INSTANCEOF
      86             : %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 '@'
      87             : %right T_POW
      88             : %right '['
      89             : %nonassoc T_NEW T_CLONE
      90             : %left T_ELSEIF
      91             : %left T_ELSE
      92             : %left T_ENDIF
      93             : %right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
      94             : 
      95             : %token <ast> T_LNUMBER   "integer number (T_LNUMBER)"
      96             : %token <ast> T_DNUMBER   "floating-point number (T_DNUMBER)"
      97             : %token <ast> T_STRING    "identifier (T_STRING)"
      98             : %token <ast> T_VARIABLE  "variable (T_VARIABLE)"
      99             : %token <ast> T_INLINE_HTML
     100             : %token <ast> T_ENCAPSED_AND_WHITESPACE  "quoted-string and whitespace (T_ENCAPSED_AND_WHITESPACE)"
     101             : %token <ast> T_CONSTANT_ENCAPSED_STRING "quoted-string (T_CONSTANT_ENCAPSED_STRING)"
     102             : %token <ast> T_STRING_VARNAME "variable name (T_STRING_VARNAME)"
     103             : %token <ast> T_NUM_STRING "number (T_NUM_STRING)"
     104             : 
     105             : %token END 0 "end of file"
     106             : %token T_INCLUDE      "include (T_INCLUDE)"
     107             : %token T_INCLUDE_ONCE "include_once (T_INCLUDE_ONCE)"
     108             : %token T_EVAL         "eval (T_EVAL)"
     109             : %token T_REQUIRE      "require (T_REQUIRE)"
     110             : %token T_REQUIRE_ONCE "require_once (T_REQUIRE_ONCE)"
     111             : %token T_LOGICAL_OR   "or (T_LOGICAL_OR)"
     112             : %token T_LOGICAL_XOR  "xor (T_LOGICAL_XOR)"
     113             : %token T_LOGICAL_AND  "and (T_LOGICAL_AND)"
     114             : %token T_PRINT        "print (T_PRINT)"
     115             : %token T_YIELD        "yield (T_YIELD)"
     116             : %token T_YIELD_FROM   "yield from (T_YIELD_FROM)"
     117             : %token T_PLUS_EQUAL   "+= (T_PLUS_EQUAL)"
     118             : %token T_MINUS_EQUAL  "-= (T_MINUS_EQUAL)"
     119             : %token T_MUL_EQUAL    "*= (T_MUL_EQUAL)"
     120             : %token T_DIV_EQUAL    "/= (T_DIV_EQUAL)"
     121             : %token T_CONCAT_EQUAL ".= (T_CONCAT_EQUAL)"
     122             : %token T_MOD_EQUAL    "%= (T_MOD_EQUAL)"
     123             : %token T_AND_EQUAL    "&= (T_AND_EQUAL)"
     124             : %token T_OR_EQUAL     "|= (T_OR_EQUAL)"
     125             : %token T_XOR_EQUAL    "^= (T_XOR_EQUAL)"
     126             : %token T_SL_EQUAL     "<<= (T_SL_EQUAL)"
     127             : %token T_SR_EQUAL     ">>= (T_SR_EQUAL)"
     128             : %token T_BOOLEAN_OR   "|| (T_BOOLEAN_OR)"
     129             : %token T_BOOLEAN_AND  "&& (T_BOOLEAN_AND)"
     130             : %token T_IS_EQUAL     "== (T_IS_EQUAL)"
     131             : %token T_IS_NOT_EQUAL "!= (T_IS_NOT_EQUAL)"
     132             : %token T_IS_IDENTICAL "=== (T_IS_IDENTICAL)"
     133             : %token T_IS_NOT_IDENTICAL "!== (T_IS_NOT_IDENTICAL)"
     134             : %token T_IS_SMALLER_OR_EQUAL "<= (T_IS_SMALLER_OR_EQUAL)"
     135             : %token T_IS_GREATER_OR_EQUAL ">= (T_IS_GREATER_OR_EQUAL)"
     136             : %token T_SPACESHIP "<=> (T_SPACESHIP)"
     137             : %token T_SL "<< (T_SL)"
     138             : %token T_SR ">> (T_SR)"
     139             : %token T_INSTANCEOF  "instanceof (T_INSTANCEOF)"
     140             : %token T_INC "++ (T_INC)"
     141             : %token T_DEC "-- (T_DEC)"
     142             : %token T_INT_CAST    "(int) (T_INT_CAST)"
     143             : %token T_DOUBLE_CAST "(double) (T_DOUBLE_CAST)"
     144             : %token T_STRING_CAST "(string) (T_STRING_CAST)"
     145             : %token T_ARRAY_CAST  "(array) (T_ARRAY_CAST)"
     146             : %token T_OBJECT_CAST "(object) (T_OBJECT_CAST)"
     147             : %token T_BOOL_CAST   "(bool) (T_BOOL_CAST)"
     148             : %token T_UNSET_CAST  "(unset) (T_UNSET_CAST)"
     149             : %token T_NEW       "new (T_NEW)"
     150             : %token T_CLONE     "clone (T_CLONE)"
     151             : %token T_EXIT      "exit (T_EXIT)"
     152             : %token T_IF        "if (T_IF)"
     153             : %token T_ELSEIF    "elseif (T_ELSEIF)"
     154             : %token T_ELSE      "else (T_ELSE)"
     155             : %token T_ENDIF     "endif (T_ENDIF)"
     156             : %token T_ECHO       "echo (T_ECHO)"
     157             : %token T_DO         "do (T_DO)"
     158             : %token T_WHILE      "while (T_WHILE)"
     159             : %token T_ENDWHILE   "endwhile (T_ENDWHILE)"
     160             : %token T_FOR        "for (T_FOR)"
     161             : %token T_ENDFOR     "endfor (T_ENDFOR)"
     162             : %token T_FOREACH    "foreach (T_FOREACH)"
     163             : %token T_ENDFOREACH "endforeach (T_ENDFOREACH)"
     164             : %token T_DECLARE    "declare (T_DECLARE)"
     165             : %token T_ENDDECLARE "enddeclare (T_ENDDECLARE)"
     166             : %token T_AS         "as (T_AS)"
     167             : %token T_SWITCH     "switch (T_SWITCH)"
     168             : %token T_ENDSWITCH  "endswitch (T_ENDSWITCH)"
     169             : %token T_CASE       "case (T_CASE)"
     170             : %token T_DEFAULT    "default (T_DEFAULT)"
     171             : %token T_BREAK      "break (T_BREAK)"
     172             : %token T_CONTINUE   "continue (T_CONTINUE)"
     173             : %token T_GOTO       "goto (T_GOTO)"
     174             : %token T_FUNCTION   "function (T_FUNCTION)"
     175             : %token T_CONST      "const (T_CONST)"
     176             : %token T_RETURN     "return (T_RETURN)"
     177             : %token T_TRY        "try (T_TRY)"
     178             : %token T_CATCH      "catch (T_CATCH)"
     179             : %token T_FINALLY    "finally (T_FINALLY)"
     180             : %token T_THROW      "throw (T_THROW)"
     181             : %token T_USE        "use (T_USE)"
     182             : %token T_INSTEADOF  "insteadof (T_INSTEADOF)"
     183             : %token T_GLOBAL     "global (T_GLOBAL)"
     184             : %token T_STATIC     "static (T_STATIC)"
     185             : %token T_ABSTRACT   "abstract (T_ABSTRACT)"
     186             : %token T_FINAL      "final (T_FINAL)"
     187             : %token T_PRIVATE    "private (T_PRIVATE)"
     188             : %token T_PROTECTED  "protected (T_PROTECTED)"
     189             : %token T_PUBLIC     "public (T_PUBLIC)"
     190             : %token T_VAR        "var (T_VAR)"
     191             : %token T_UNSET      "unset (T_UNSET)"
     192             : %token T_ISSET      "isset (T_ISSET)"
     193             : %token T_EMPTY      "empty (T_EMPTY)"
     194             : %token T_HALT_COMPILER "__halt_compiler (T_HALT_COMPILER)"
     195             : %token T_CLASS      "class (T_CLASS)"
     196             : %token T_TRAIT      "trait (T_TRAIT)"
     197             : %token T_INTERFACE  "interface (T_INTERFACE)"
     198             : %token T_EXTENDS    "extends (T_EXTENDS)"
     199             : %token T_IMPLEMENTS "implements (T_IMPLEMENTS)"
     200             : %token T_OBJECT_OPERATOR "-> (T_OBJECT_OPERATOR)"
     201             : %token T_DOUBLE_ARROW    "=> (T_DOUBLE_ARROW)"
     202             : %token T_LIST            "list (T_LIST)"
     203             : %token T_ARRAY           "array (T_ARRAY)"
     204             : %token T_CALLABLE        "callable (T_CALLABLE)"
     205             : %token T_LINE            "__LINE__ (T_LINE)"
     206             : %token T_FILE            "__FILE__ (T_FILE)"
     207             : %token T_DIR             "__DIR__ (T_DIR)"
     208             : %token T_CLASS_C         "__CLASS__ (T_CLASS_C)"
     209             : %token T_TRAIT_C         "__TRAIT__ (T_TRAIT_C)"
     210             : %token T_METHOD_C        "__METHOD__ (T_METHOD_C)"
     211             : %token T_FUNC_C          "__FUNCTION__ (T_FUNC_C)"
     212             : %token T_COMMENT         "comment (T_COMMENT)"
     213             : %token T_DOC_COMMENT     "doc comment (T_DOC_COMMENT)"
     214             : %token T_OPEN_TAG        "open tag (T_OPEN_TAG)"
     215             : %token T_OPEN_TAG_WITH_ECHO "open tag with echo (T_OPEN_TAG_WITH_ECHO)"
     216             : %token T_CLOSE_TAG       "close tag (T_CLOSE_TAG)"
     217             : %token T_WHITESPACE      "whitespace (T_WHITESPACE)"
     218             : %token T_START_HEREDOC   "heredoc start (T_START_HEREDOC)"
     219             : %token T_END_HEREDOC     "heredoc end (T_END_HEREDOC)"
     220             : %token T_DOLLAR_OPEN_CURLY_BRACES "${ (T_DOLLAR_OPEN_CURLY_BRACES)"
     221             : %token T_CURLY_OPEN      "{$ (T_CURLY_OPEN)"
     222             : %token T_PAAMAYIM_NEKUDOTAYIM ":: (T_PAAMAYIM_NEKUDOTAYIM)"
     223             : %token T_NAMESPACE       "namespace (T_NAMESPACE)"
     224             : %token T_NS_C            "__NAMESPACE__ (T_NS_C)"
     225             : %token T_NS_SEPARATOR    "\\ (T_NS_SEPARATOR)"
     226             : %token T_ELLIPSIS        "... (T_ELLIPSIS)"
     227             : %token T_COALESCE        "?? (T_COALESCE)"
     228             : %token T_POW             "** (T_POW)"
     229             : %token T_POW_EQUAL       "**= (T_POW_EQUAL)"
     230             : 
     231             : /* Token used to force a parse error from the lexer */
     232             : %token T_ERROR
     233             : 
     234             : %type <ast> top_statement namespace_name name statement function_declaration_statement
     235             : %type <ast> class_declaration_statement trait_declaration_statement
     236             : %type <ast> interface_declaration_statement interface_extends_list
     237             : %type <ast> group_use_declaration inline_use_declarations inline_use_declaration
     238             : %type <ast> mixed_group_use_declaration use_declaration const_decl inner_statement
     239             : %type <ast> expr optional_expr while_statement for_statement foreach_variable
     240             : %type <ast> foreach_statement declare_statement finally_statement unset_variable variable
     241             : %type <ast> extends_from parameter optional_type argument expr_without_variable global_var
     242             : %type <ast> static_var class_statement trait_adaptation trait_precedence trait_alias
     243             : %type <ast> absolute_trait_method_reference trait_method_reference property echo_expr
     244             : %type <ast> new_expr anonymous_class class_name class_name_reference simple_variable
     245             : %type <ast> internal_functions_in_yacc
     246             : %type <ast> exit_expr scalar backticks_expr lexical_var function_call member_name
     247             : %type <ast> variable_class_name dereferencable_scalar class_name_scalar constant dereferencable
     248             : %type <ast> callable_expr callable_variable static_member new_variable
     249             : %type <ast> assignment_list_element array_pair encaps_var encaps_var_offset isset_variables
     250             : %type <ast> top_statement_list use_declarations const_list inner_statement_list if_stmt
     251             : %type <ast> alt_if_stmt for_exprs switch_case_list global_var_list static_var_list
     252             : %type <ast> echo_expr_list unset_variables catch_list parameter_list class_statement_list
     253             : %type <ast> implements_list case_list if_stmt_without_else
     254             : %type <ast> non_empty_parameter_list argument_list non_empty_argument_list property_list
     255             : %type <ast> class_const_list name_list trait_adaptations method_body non_empty_for_exprs
     256             : %type <ast> ctor_arguments alt_if_stmt_without_else trait_adaptation_list lexical_vars
     257             : %type <ast> lexical_var_list encaps_list array_pair_list non_empty_array_pair_list
     258             : %type <ast> assignment_list isset_variable type return_type
     259             : 
     260             : %type <num> returns_ref function is_reference is_variadic variable_modifiers
     261             : %type <num> method_modifiers trait_modifiers non_empty_member_modifiers member_modifier
     262             : %type <num> class_modifiers class_modifier use_type
     263             : 
     264             : %type <str> backup_doc_comment
     265             : 
     266             : %% /* Rules */
     267             : 
     268             : start:
     269       29786 :         top_statement_list      { CG(ast) = $1; }
     270       29786 : ;
     271             : 
     272             : top_statement_list:
     273      214616 :                 top_statement_list top_statement { $$ = zend_ast_list_add($1, $2); }
     274      214616 :         |       /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
     275       29950 : ;
     276             : 
     277             : namespace_name:
     278      362496 :                 T_STRING                                                                { $$ = $1; }
     279      362496 :         |       namespace_name T_NS_SEPARATOR T_STRING  { $$ = zend_ast_append_str($1, $3); }
     280         431 : ;
     281             : 
     282             : name:
     283      361861 :                 namespace_name                                                          { $$ = $1; $$->attr = ZEND_NAME_NOT_FQ; }
     284      361861 :         |       T_NAMESPACE T_NS_SEPARATOR namespace_name       { $$ = $3; $$->attr = ZEND_NAME_RELATIVE; }
     285          52 :         |       T_NS_SEPARATOR namespace_name                           { $$ = $2; $$->attr = ZEND_NAME_FQ; }
     286         234 : ;
     287             : 
     288             : top_statement:
     289      193471 :                 statement                                                       { $$ = $1; }
     290      193471 :         |       function_declaration_statement          { $$ = $1; }
     291       13827 :         |       class_declaration_statement                     { $$ = $1; }
     292        6090 :         |       trait_declaration_statement                     { $$ = $1; }
     293         221 :         |       interface_declaration_statement         { $$ = $1; }
     294         202 :         |       T_HALT_COMPILER '(' ')' ';'
     295         552 :                         { $$ = zend_ast_create(ZEND_AST_HALT_COMPILER,
     296         276 :                               zend_ast_create_zval_from_long(zend_get_scanned_file_offset()));
     297         276 :                           zend_stop_lexing(); }
     298         276 :         |       T_NAMESPACE namespace_name ';'
     299         144 :                         { $$ = zend_ast_create(ZEND_AST_NAMESPACE, $2, NULL);
     300         144 :                           RESET_DOC_COMMENT(); }
     301         145 :         |       T_NAMESPACE namespace_name { RESET_DOC_COMMENT(); }
     302          57 :                 '{' top_statement_list '}'
     303          54 :                         { $$ = zend_ast_create(ZEND_AST_NAMESPACE, $2, $5); }
     304          54 :         |       T_NAMESPACE { RESET_DOC_COMMENT(); }
     305          37 :                 '{' top_statement_list '}'
     306          37 :                         { $$ = zend_ast_create(ZEND_AST_NAMESPACE, NULL, $4); }
     307          37 :         |       T_USE mixed_group_use_declaration ';'           { $$ = $2; }
     308           9 :         |       T_USE use_type group_use_declaration ';'        { $$ = $3; $$->attr = $2; }
     309           2 :         |       T_USE use_declarations ';'                                      { $$ = $2; $$->attr = T_CLASS; }
     310          61 :         |       T_USE use_type use_declarations ';'                     { $$ = $3; $$->attr = $2; }
     311          31 :         |       T_CONST const_list ';'                                          { $$ = $2; }
     312         191 : ;
     313             : 
     314             : use_type:
     315          22 :                 T_FUNCTION              { $$ = T_FUNCTION; }
     316          22 :         |       T_CONST                 { $$ = T_CONST; }
     317          21 : ;
     318             : 
     319             : group_use_declaration:
     320             :         namespace_name T_NS_SEPARATOR '{' use_declarations '}'
     321           2 :                 {$$ = zend_ast_create(ZEND_AST_GROUP_USE, $1, $4); }
     322           2 : ;
     323             : 
     324             : mixed_group_use_declaration:
     325             :         namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}'
     326           9 :                 {$$ = zend_ast_create(ZEND_AST_GROUP_USE, $1, $4);}
     327           9 : ;
     328             : 
     329             : inline_use_declarations:
     330             :                 inline_use_declarations ',' inline_use_declaration
     331          17 :                         { $$ = zend_ast_list_add($1, $3); }
     332          17 :         |       inline_use_declaration
     333          10 :                         { $$ = zend_ast_create_list(1, ZEND_AST_USE, $1); }
     334          10 : ;
     335             : 
     336             : inline_use_declaration:
     337          18 :                 use_declaration { $$ = $1; $$->attr = T_CLASS; }
     338          18 :         |       use_type use_declaration { $$ = $2; $$->attr = $1; }
     339           9 : ;
     340             : 
     341             : use_declarations:
     342             :                 use_declarations ',' use_declaration
     343          13 :                         { $$ = zend_ast_list_add($1, $3); }
     344          13 :         |       use_declaration
     345          95 :                         { $$ = zend_ast_create_list(1, ZEND_AST_USE, $1); }
     346          95 : ;
     347             : 
     348             : use_declaration:
     349             :                 namespace_name
     350          63 :                         { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $1, NULL); }
     351          63 :         |       namespace_name T_AS T_STRING
     352          57 :                         { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $1, $3); }
     353          57 :         |       T_NS_SEPARATOR namespace_name
     354          11 :                         { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $2, NULL); }
     355          11 :         |       T_NS_SEPARATOR namespace_name T_AS T_STRING
     356           4 :                         { $$ = zend_ast_create(ZEND_AST_USE_ELEM, $2, $4); }
     357           4 : ;
     358             : 
     359             : const_list:
     360           2 :                 const_list ',' const_decl { $$ = zend_ast_list_add($1, $3); }
     361           2 :         |       const_decl { $$ = zend_ast_create_list(1, ZEND_AST_CONST_DECL, $1); }
     362         257 : ;
     363             : 
     364             : inner_statement_list:
     365             :                 inner_statement_list inner_statement
     366      233269 :                         { $$ = zend_ast_list_add($1, $2); }
     367      233269 :         |       /* empty */
     368      111761 :                         { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
     369      111761 : ;
     370             : 
     371             : 
     372             : inner_statement:
     373      228281 :                 statement { $$ = $1; }
     374      228281 :         |       function_declaration_statement          { $$ = $1; }
     375        4050 :         |       class_declaration_statement             { $$ = $1; }
     376         938 :         |       trait_declaration_statement                     { $$ = $1; }
     377           0 :         |       interface_declaration_statement         { $$ = $1; }
     378           0 :         |       T_HALT_COMPILER '(' ')' ';'
     379           1 :                         { $$ = NULL; zend_error_noreturn(E_COMPILE_ERROR,
     380             :                               "__HALT_COMPILER() can only be used from the outermost scope"); }
     381             : ;
     382             : 
     383             : 
     384             : statement:
     385       69443 :                 '{' inner_statement_list '}' { $$ = $2; }
     386       69443 :         |       if_stmt { $$ = $1; }
     387       67065 :         |       alt_if_stmt { $$ = $1; }
     388           4 :         |       T_WHILE '(' expr ')' while_statement
     389        1855 :                         { $$ = zend_ast_create(ZEND_AST_WHILE, $3, $5); }
     390        1855 :         |       T_DO statement T_WHILE '(' expr ')' ';'
     391         296 :                         { $$ = zend_ast_create(ZEND_AST_DO_WHILE, $2, $5); }
     392         296 :         |       T_FOR '(' for_exprs ';' for_exprs ';' for_exprs ')' for_statement
     393        2060 :                         { $$ = zend_ast_create(ZEND_AST_FOR, $3, $5, $7, $9); }
     394        2060 :         |       T_SWITCH '(' expr ')' switch_case_list
     395         452 :                         { $$ = zend_ast_create(ZEND_AST_SWITCH, $3, $5); }
     396         452 :         |       T_BREAK optional_expr ';'               { $$ = zend_ast_create(ZEND_AST_BREAK, $2); }
     397        1886 :         |       T_CONTINUE optional_expr ';'    { $$ = zend_ast_create(ZEND_AST_CONTINUE, $2); }
     398         273 :         |       T_RETURN optional_expr ';'              { $$ = zend_ast_create(ZEND_AST_RETURN, $2); }
     399       43564 :         |       T_GLOBAL global_var_list ';'    { $$ = $2; }
     400        4185 :         |       T_STATIC static_var_list ';'    { $$ = $2; }
     401        1884 :         |       T_ECHO echo_expr_list ';'               { $$ = $2; }
     402       30061 :         |       T_INLINE_HTML { $$ = zend_ast_create(ZEND_AST_ECHO, $1); }
     403        3573 :         |       expr ';' { $$ = $1; }
     404      253061 :         |       T_UNSET '(' unset_variables ')' ';' { $$ = $3; }
     405        1431 :         |       T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement
     406        5378 :                         { $$ = zend_ast_create(ZEND_AST_FOREACH, $3, $5, NULL, $7); }
     407        5378 :         |       T_FOREACH '(' expr T_AS foreach_variable T_DOUBLE_ARROW foreach_variable ')'
     408             :                 foreach_statement
     409        4700 :                         { $$ = zend_ast_create(ZEND_AST_FOREACH, $3, $7, $5, $9); }
     410        4700 :         |       T_DECLARE '(' const_list ')'
     411          66 :                         { zend_handle_encoding_declaration($3); }
     412          62 :                 declare_statement
     413          62 :                         { $$ = zend_ast_create(ZEND_AST_DECLARE, $3, $6); }
     414          62 :         |       ';'     /* empty statement */ { $$ = NULL; }
     415       27646 :         |       T_TRY '{' inner_statement_list '}' catch_list finally_statement
     416        2380 :                         { $$ = zend_ast_create(ZEND_AST_TRY, $3, $5, $6); }
     417        2380 :         |       T_THROW expr ';' { $$ = zend_ast_create(ZEND_AST_THROW, $2); }
     418         337 :         |       T_GOTO T_STRING ';' { $$ = zend_ast_create(ZEND_AST_GOTO, $2); }
     419          37 :         |       T_STRING ':' { $$ = zend_ast_create(ZEND_AST_LABEL, $1); }
     420          38 : ;
     421             : 
     422             : catch_list:
     423             :                 /* empty */
     424        2380 :                         { $$ = zend_ast_create_list(0, ZEND_AST_CATCH_LIST); }
     425        2380 :         |       catch_list T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}'
     426        2346 :                         { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_CATCH, $4, $5, $8)); }
     427        2346 : ;
     428             : 
     429             : finally_statement:
     430        2307 :                 /* empty */ { $$ = NULL; }
     431        2307 :         |       T_FINALLY '{' inner_statement_list '}' { $$ = $3; }
     432          73 : ;
     433             : 
     434             : unset_variables:
     435        1431 :                 unset_variable { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
     436        1431 :         |       unset_variables ',' unset_variable { $$ = zend_ast_list_add($1, $3); }
     437         117 : ;
     438             : 
     439             : unset_variable:
     440        1548 :                 variable { $$ = zend_ast_create(ZEND_AST_UNSET, $1); }
     441        1548 : ;
     442             : 
     443             : function_declaration_statement:
     444             :         function returns_ref T_STRING '(' parameter_list ')' return_type
     445             :         backup_doc_comment '{' inner_statement_list '}'
     446       89385 :                 { $$ = zend_ast_create_decl(ZEND_AST_FUNC_DECL, $2, $1, $8,
     447       71508 :                       zend_ast_get_str($3), $5, NULL, $10, $7); }
     448       17877 : ;
     449             : 
     450             : is_reference:
     451       81730 :                 /* empty */     { $$ = 0; }
     452       81730 :         |       '&'                 { $$ = ZEND_PARAM_REF; }
     453        1075 : ;
     454             : 
     455             : is_variadic:
     456       82766 :                 /* empty */ { $$ = 0; }
     457       82766 :         |       T_ELLIPSIS  { $$ = ZEND_PARAM_VARIADIC; }
     458          39 : ;
     459             : 
     460             : class_declaration_statement:
     461         112 :                 class_modifiers T_CLASS { $<num>$ = CG(zend_lineno); }
     462         112 :                 T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
     463         224 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLASS, $1, $<num>3, $7, zend_ast_get_str($4), $5, $6, $9, NULL); }
     464         112 :         |       T_CLASS { $<num>$ = CG(zend_lineno); }
     465        6935 :                 T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
     466       13832 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLASS, 0, $<num>2, $6, zend_ast_get_str($3), $4, $5, $8, NULL); }
     467        6916 : ;
     468             : 
     469             : class_modifiers:
     470         114 :                 class_modifier                                  { $$ = $1; }
     471         114 :         |       class_modifiers class_modifier  { $$ = zend_add_class_modifier($1, $2); }
     472           0 : ;
     473             : 
     474             : class_modifier:
     475          97 :                 T_ABSTRACT              { $$ = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
     476          97 :         |       T_FINAL                 { $$ = ZEND_ACC_FINAL; }
     477          19 : ;
     478             : 
     479             : trait_declaration_statement:
     480         223 :                 T_TRAIT { $<num>$ = CG(zend_lineno); }
     481         223 :                 T_STRING backup_doc_comment '{' class_statement_list '}'
     482         442 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLASS, ZEND_ACC_TRAIT, $<num>2, $4, zend_ast_get_str($3), NULL, NULL, $6, NULL); }
     483         221 : ;
     484             : 
     485             : interface_declaration_statement:
     486         203 :                 T_INTERFACE { $<num>$ = CG(zend_lineno); }
     487         203 :                 T_STRING interface_extends_list backup_doc_comment '{' class_statement_list '}'
     488         404 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLASS, ZEND_ACC_INTERFACE, $<num>2, $5, zend_ast_get_str($3), NULL, $4, $7, NULL); }
     489         202 : ;
     490             : 
     491             : extends_from:
     492        4690 :                 /* empty */             { $$ = NULL; }
     493        4690 :         |       T_EXTENDS name  { $$ = $2; }
     494        2367 : ;
     495             : 
     496             : interface_extends_list:
     497         164 :                 /* empty */                     { $$ = NULL; }
     498         164 :         |       T_EXTENDS name_list     { $$ = $2; }
     499          38 : ;
     500             : 
     501             : implements_list:
     502        6749 :                 /* empty */                             { $$ = NULL; }
     503        6749 :         |       T_IMPLEMENTS name_list  { $$ = $2; }
     504         307 : ;
     505             : 
     506             : foreach_variable:
     507       14665 :                 variable                        { $$ = $1; }
     508       14665 :         |       '&' variable                { $$ = zend_ast_create(ZEND_AST_REF, $2); }
     509         104 :         |       T_LIST '(' assignment_list ')' { $$ = $3; }
     510           9 : ;
     511             : 
     512             : for_statement:
     513        2057 :                 statement { $$ = $1; }
     514        2057 :         |       ':' inner_statement_list T_ENDFOR ';' { $$ = $2; }
     515           3 : ;
     516             : 
     517             : foreach_statement:
     518       10078 :                 statement { $$ = $1; }
     519       10078 :         |       ':' inner_statement_list T_ENDFOREACH ';' { $$ = $2; }
     520           0 : ;
     521             : 
     522             : declare_statement:
     523          62 :                 statement { $$ = $1; }
     524          62 :         |       ':' inner_statement_list T_ENDDECLARE ';' { $$ = $2; }
     525           0 : ;
     526             : 
     527             : switch_case_list:
     528         451 :                 '{' case_list '}'                                       { $$ = $2; }
     529         451 :         |       '{' ';' case_list '}'                           { $$ = $3; }
     530           0 :         |       ':' case_list T_ENDSWITCH ';'           { $$ = $2; }
     531           1 :         |       ':' ';' case_list T_ENDSWITCH ';'       { $$ = $3; }
     532           0 : ;
     533             : 
     534             : case_list:
     535         452 :                 /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_SWITCH_LIST); }
     536         452 :         |       case_list T_CASE expr case_separator inner_statement_list
     537        1599 :                         { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_SWITCH_CASE, $3, $5)); }
     538        1599 :         |       case_list T_DEFAULT case_separator inner_statement_list
     539         268 :                         { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_SWITCH_CASE, NULL, $4)); }
     540         268 : ;
     541             : 
     542             : case_separator:
     543             :                 ':'
     544             :         |       ';'
     545             : ;
     546             : 
     547             : 
     548             : while_statement:
     549        1854 :                 statement { $$ = $1; }
     550        1854 :         |       ':' inner_statement_list T_ENDWHILE ';' { $$ = $2; }
     551           1 : ;
     552             : 
     553             : 
     554             : if_stmt_without_else:
     555             :                 T_IF '(' expr ')' statement
     556      134130 :                         { $$ = zend_ast_create_list(1, ZEND_AST_IF,
     557       67065 :                               zend_ast_create(ZEND_AST_IF_ELEM, $3, $5)); }
     558       67065 :         |       if_stmt_without_else T_ELSEIF '(' expr ')' statement
     559        3482 :                         { $$ = zend_ast_list_add($1,
     560        1741 :                               zend_ast_create(ZEND_AST_IF_ELEM, $4, $6)); }
     561        1741 : ;
     562             : 
     563             : if_stmt:
     564       50299 :                 if_stmt_without_else { $$ = $1; }
     565       50299 :         |       if_stmt_without_else T_ELSE statement
     566       16766 :                         { $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_IF_ELEM, NULL, $3)); }
     567       16766 : ;
     568             : 
     569             : alt_if_stmt_without_else:
     570             :                 T_IF '(' expr ')' ':' inner_statement_list
     571           8 :                         { $$ = zend_ast_create_list(1, ZEND_AST_IF,
     572           4 :                               zend_ast_create(ZEND_AST_IF_ELEM, $3, $6)); }
     573           4 :         |       alt_if_stmt_without_else T_ELSEIF '(' expr ')' ':' inner_statement_list
     574           2 :                         { $$ = zend_ast_list_add($1,
     575           1 :                               zend_ast_create(ZEND_AST_IF_ELEM, $4, $7)); }
     576           1 : ;
     577             : 
     578             : alt_if_stmt:
     579           2 :                 alt_if_stmt_without_else T_ENDIF ';' { $$ = $1; }
     580           2 :         |       alt_if_stmt_without_else T_ELSE ':' inner_statement_list T_ENDIF ';'
     581           2 :                         { $$ = zend_ast_list_add($1,
     582           2 :                               zend_ast_create(ZEND_AST_IF_ELEM, NULL, $4)); }
     583           2 : ;
     584             : 
     585             : parameter_list:
     586       26721 :                 non_empty_parameter_list { $$ = $1; }
     587       26721 :         |       /* empty */     { $$ = zend_ast_create_list(0, ZEND_AST_PARAM_LIST); }
     588        9106 : ;
     589             : 
     590             : 
     591             : non_empty_parameter_list:
     592             :                 parameter
     593       26721 :                         { $$ = zend_ast_create_list(1, ZEND_AST_PARAM_LIST, $1); }
     594       26721 :         |       non_empty_parameter_list ',' parameter
     595       56084 :                         { $$ = zend_ast_list_add($1, $3); }
     596       56084 : ;
     597             : 
     598             : parameter:
     599             :                 optional_type is_reference is_variadic T_VARIABLE
     600       68428 :                         { $$ = zend_ast_create_ex(ZEND_AST_PARAM, $2 | $3, $1, $4, NULL); }
     601       68428 :         |       optional_type is_reference is_variadic T_VARIABLE '=' expr
     602       14377 :                         { $$ = zend_ast_create_ex(ZEND_AST_PARAM, $2 | $3, $1, $4, $6); }
     603       14377 : ;
     604             : 
     605             : 
     606             : optional_type:
     607       82292 :                 /* empty */     { $$ = NULL; }
     608       82292 :         |       type            { $$ = $1; }
     609         513 : ;
     610             : 
     611             : type:
     612         248 :                 T_ARRAY         { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_ARRAY); }
     613         248 :         |       T_CALLABLE      { $$ = zend_ast_create_ex(ZEND_AST_TYPE, IS_CALLABLE); }
     614          14 :         |       name            { $$ = $1; }
     615         343 : ;
     616             : 
     617             : return_type:
     618       35733 :                 /* empty */     { $$ = NULL; }
     619       35733 :         |       ':' type        { $$ = $2; }
     620          92 : ;
     621             : 
     622             : argument_list:
     623       37376 :                 '(' ')' { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
     624       37376 :         |       '(' non_empty_argument_list ')' { $$ = $2; }
     625      268175 : ;
     626             : 
     627             : non_empty_argument_list:
     628             :                 argument
     629      268176 :                         { $$ = zend_ast_create_list(1, ZEND_AST_ARG_LIST, $1); }
     630      268176 :         |       non_empty_argument_list ',' argument
     631      261418 :                         { $$ = zend_ast_list_add($1, $3); }
     632      261418 : ;
     633             : 
     634             : argument:
     635      529527 :                 expr                    { $$ = $1; }
     636      529527 :         |       T_ELLIPSIS expr { $$ = zend_ast_create(ZEND_AST_UNPACK, $2); }
     637          67 : ;
     638             : 
     639             : global_var_list:
     640         935 :                 global_var_list ',' global_var { $$ = zend_ast_list_add($1, $3); }
     641         935 :         |       global_var { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
     642        4186 : ;
     643             : 
     644             : global_var:
     645             :         simple_variable
     646        5121 :                 { $$ = zend_ast_create(ZEND_AST_GLOBAL, zend_ast_create(ZEND_AST_VAR, $1)); }
     647        5121 : ;
     648             : 
     649             : 
     650             : static_var_list:
     651           9 :                 static_var_list ',' static_var { $$ = zend_ast_list_add($1, $3); }
     652           9 :         |       static_var { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
     653        1884 : ;
     654             : 
     655             : static_var:
     656          21 :                 T_VARIABLE                      { $$ = zend_ast_create(ZEND_AST_STATIC, $1, NULL); }
     657          21 :         |       T_VARIABLE '=' expr     { $$ = zend_ast_create(ZEND_AST_STATIC, $1, $3); }
     658        1872 : ;
     659             : 
     660             : 
     661             : class_statement_list:
     662             :                 class_statement_list class_statement
     663       20353 :                         { $$ = zend_ast_list_add($1, $2); }
     664       20353 :         |       /* empty */
     665        7477 :                         { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
     666        7477 : ;
     667             : 
     668             : 
     669             : class_statement:
     670             :                 variable_modifiers property_list ';'
     671        2385 :                         { $$ = zend_ast_append_doc_comment($2); $$->attr = $1; }
     672        2385 :         |       T_CONST class_const_list ';'
     673         252 :                         { $$ = $2; RESET_DOC_COMMENT(); }
     674         250 :         |       T_USE name_list trait_adaptations
     675         210 :                         { $$ = zend_ast_create(ZEND_AST_USE_TRAIT, $2, $3); }
     676         210 :         |       method_modifiers function returns_ref T_STRING '(' parameter_list ')'
     677             :                 return_type backup_doc_comment method_body
     678       70032 :                         { $$ = zend_ast_create_decl(ZEND_AST_METHOD, $3 | $1, $2, $9,
     679       52524 :                                   zend_ast_get_str($4), $6, NULL, $10, $8); }
     680       17508 : ;
     681             : 
     682             : name_list:
     683         575 :                 name { $$ = zend_ast_create_list(1, ZEND_AST_NAME_LIST, $1); }
     684         575 :         |       name_list ',' name { $$ = zend_ast_list_add($1, $3); }
     685          84 : ;
     686             : 
     687             : trait_adaptations:
     688         151 :                 ';'                                                             { $$ = NULL; }
     689         151 :         |       '{' '}'                                                 { $$ = NULL; }
     690           0 :         |       '{' trait_adaptation_list '}'   { $$ = $2; }
     691          59 : ;
     692             : 
     693             : trait_adaptation_list:
     694             :                 trait_adaptation
     695          59 :                         { $$ = zend_ast_create_list(1, ZEND_AST_TRAIT_ADAPTATIONS, $1); }
     696          59 :         |       trait_adaptation_list trait_adaptation
     697          23 :                         { $$ = zend_ast_list_add($1, $2); }
     698          23 : ;
     699             : 
     700             : trait_adaptation:
     701          20 :                 trait_precedence ';'    { $$ = $1; }
     702          20 :         |       trait_alias ';'                 { $$ = $1; }
     703          62 : ;
     704             : 
     705             : trait_precedence:
     706             :         absolute_trait_method_reference T_INSTEADOF name_list
     707          20 :                 { $$ = zend_ast_create(ZEND_AST_TRAIT_PRECEDENCE, $1, $3); }
     708          20 : ;
     709             : 
     710             : trait_alias:
     711             :                 trait_method_reference T_AS trait_modifiers T_STRING
     712          50 :                         { $$ = zend_ast_create_ex(ZEND_AST_TRAIT_ALIAS, $3, $1, $4); }
     713          50 :         |       trait_method_reference T_AS member_modifier
     714          12 :                         { $$ = zend_ast_create_ex(ZEND_AST_TRAIT_ALIAS, $3, $1, NULL); }
     715          12 : ;
     716             : 
     717             : trait_method_reference:
     718             :                 T_STRING
     719          38 :                         { $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, NULL, $1); }
     720          38 :         |       absolute_trait_method_reference { $$ = $1; }
     721          24 : ;
     722             : 
     723             : absolute_trait_method_reference:
     724             :         name T_PAAMAYIM_NEKUDOTAYIM T_STRING
     725          44 :                 { $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, $1, $3); }
     726          44 : ;
     727             : 
     728             : trait_modifiers:
     729          45 :                 /* empty */             { $$ = 0; }
     730          45 :         |       member_modifier { $$ = $1; }
     731           5 : ;
     732             : 
     733             : method_body:
     734         189 :                 ';' /* abstract method */               { $$ = NULL; }
     735         189 :         |       '{' inner_statement_list '}'    { $$ = $2; }
     736       17319 : ;
     737             : 
     738             : variable_modifiers:
     739        2274 :                 non_empty_member_modifiers              { $$ = $1; }
     740        2274 :         |       T_VAR                                                   { $$ = ZEND_ACC_PUBLIC; }
     741         111 : ;
     742             : 
     743             : method_modifiers:
     744        6945 :                 /* empty */                                             { $$ = ZEND_ACC_PUBLIC; }
     745        6945 :         |       non_empty_member_modifiers
     746       10566 :                         { $$ = $1; if (!($$ & ZEND_ACC_PPP_MASK)) { $$ |= ZEND_ACC_PUBLIC; } }
     747       10566 : ;
     748             : 
     749             : non_empty_member_modifiers:
     750       12851 :                 member_modifier                 { $$ = $1; }
     751       12851 :         |       non_empty_member_modifiers member_modifier
     752         761 :                         { $$ = zend_add_member_modifier($1, $2); }
     753         750 : ;
     754             : 
     755             : member_modifier:
     756        4695 :                 T_PUBLIC                                { $$ = ZEND_ACC_PUBLIC; }
     757        4695 :         |       T_PROTECTED                             { $$ = ZEND_ACC_PROTECTED; }
     758         582 :         |       T_PRIVATE                               { $$ = ZEND_ACC_PRIVATE; }
     759        1169 :         |       T_STATIC                                { $$ = ZEND_ACC_STATIC; }
     760        7078 :         |       T_ABSTRACT                              { $$ = ZEND_ACC_ABSTRACT; }
     761          78 :         |       T_FINAL                                 { $$ = ZEND_ACC_FINAL; }
     762          27 : ;
     763             : 
     764             : property_list:
     765          42 :                 property_list ',' property { $$ = zend_ast_list_add($1, $3); }
     766          42 :         |       property { $$ = zend_ast_create_list(1, ZEND_AST_PROP_DECL, $1); }
     767        2385 : ;
     768             : 
     769             : property:
     770        1179 :                 T_VARIABLE { $$ = zend_ast_create(ZEND_AST_PROP_ELEM, $1, NULL); }
     771        1179 :         |       T_VARIABLE '=' expr
     772        1248 :                         { $$ = zend_ast_create(ZEND_AST_PROP_ELEM, $1, $3); }
     773        1248 : ;
     774             : 
     775             : class_const_list:
     776           4 :                 class_const_list ',' const_decl { $$ = zend_ast_list_add($1, $3); }
     777           4 :         |       const_decl { $$ = zend_ast_create_list(1, ZEND_AST_CLASS_CONST_DECL, $1); }
     778         250 : ;
     779             : 
     780             : const_decl:
     781         513 :         T_STRING '=' expr { $$ = zend_ast_create(ZEND_AST_CONST_ELEM, $1, $3); }
     782         513 : ;
     783             : 
     784             : echo_expr_list:
     785        1505 :                 echo_expr_list ',' echo_expr { $$ = zend_ast_list_add($1, $3); }
     786        1505 :         |       echo_expr { $$ = zend_ast_create_list(1, ZEND_AST_STMT_LIST, $1); }
     787       30061 : ;
     788             : echo_expr:
     789       31566 :         expr { $$ = zend_ast_create(ZEND_AST_ECHO, $1); }
     790       31566 : ;
     791             : 
     792             : for_exprs:
     793           7 :                 /* empty */                     { $$ = NULL; }
     794           7 :         |       non_empty_for_exprs     { $$ = $1; }
     795        6173 : ;
     796             : 
     797             : non_empty_for_exprs:
     798           9 :                 non_empty_for_exprs ',' expr { $$ = zend_ast_list_add($1, $3); }
     799           9 :         |       expr { $$ = zend_ast_create_list(1, ZEND_AST_EXPR_LIST, $1); }
     800        6173 : ;
     801             : 
     802             : anonymous_class:
     803          12 :         T_CLASS { $<num>$ = CG(zend_lineno); } ctor_arguments
     804          12 :                 extends_from implements_list backup_doc_comment '{' class_statement_list '}' {
     805          60 :                         zend_ast *decl = zend_ast_create_decl(
     806          24 :                                 ZEND_AST_CLASS, ZEND_ACC_ANON_CLASS, $<num>2, $6, NULL,
     807          48 :                                 $4, $5, $8, NULL);
     808          12 :                         $$ = zend_ast_create(ZEND_AST_NEW, decl, $3);
     809             :                 }
     810          12 : ;
     811             : 
     812             : new_expr:
     813             :                 T_NEW class_name_reference ctor_arguments
     814       14412 :                         { $$ = zend_ast_create(ZEND_AST_NEW, $2, $3); }
     815       14412 :         |       T_NEW anonymous_class
     816          12 :                         { $$ = $2; }
     817          12 : ;
     818             : 
     819             : expr_without_variable:
     820             :                 T_LIST '(' assignment_list ')' '=' expr
     821         151 :                         { $$ = zend_ast_create(ZEND_AST_ASSIGN, $3, $6); }
     822         151 :         |       variable '=' expr
     823      130290 :                         { $$ = zend_ast_create(ZEND_AST_ASSIGN, $1, $3); }
     824      130290 :         |       variable '=' '&' variable
     825         424 :                         { $$ = zend_ast_create(ZEND_AST_ASSIGN_REF, $1, $4); }
     826         424 :         |       T_CLONE expr { $$ = zend_ast_create(ZEND_AST_CLONE, $2); }
     827         117 :         |       variable T_PLUS_EQUAL expr
     828        1396 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_ADD, $1, $3); }
     829         698 :         |       variable T_MINUS_EQUAL expr
     830         278 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SUB, $1, $3); }
     831         139 :         |       variable T_MUL_EQUAL expr
     832          32 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_MUL, $1, $3); }
     833          16 :         |       variable T_POW_EQUAL expr
     834           4 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_POW, $1, $3); }
     835           2 :         |       variable T_DIV_EQUAL expr
     836          10 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_DIV, $1, $3); }
     837           5 :         |       variable T_CONCAT_EQUAL expr
     838        5502 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_CONCAT, $1, $3); }
     839        2751 :         |       variable T_MOD_EQUAL expr
     840          10 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_MOD, $1, $3); }
     841           5 :         |       variable T_AND_EQUAL expr
     842          10 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_AND, $1, $3); }
     843           5 :         |       variable T_OR_EQUAL expr
     844         196 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_OR, $1, $3); }
     845          98 :         |       variable T_XOR_EQUAL expr
     846           8 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_BW_XOR, $1, $3); }
     847           4 :         |       variable T_SL_EQUAL expr
     848          14 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SL, $1, $3); }
     849           7 :         |       variable T_SR_EQUAL expr
     850          10 :                         { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_SR, $1, $3); }
     851           5 :         |       variable T_INC { $$ = zend_ast_create(ZEND_AST_POST_INC, $1); }
     852        5574 :         |       T_INC variable { $$ = zend_ast_create(ZEND_AST_PRE_INC, $2); }
     853         528 :         |       variable T_DEC { $$ = zend_ast_create(ZEND_AST_POST_DEC, $1); }
     854          78 :         |       T_DEC variable { $$ = zend_ast_create(ZEND_AST_PRE_DEC, $2); }
     855          16 :         |       expr T_BOOLEAN_OR expr
     856        4299 :                         { $$ = zend_ast_create(ZEND_AST_OR, $1, $3); }
     857        4299 :         |       expr T_BOOLEAN_AND expr
     858        6727 :                         { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
     859        6727 :         |       expr T_LOGICAL_OR expr
     860         914 :                         { $$ = zend_ast_create(ZEND_AST_OR, $1, $3); }
     861         914 :         |       expr T_LOGICAL_AND expr
     862          14 :                         { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
     863          14 :         |       expr T_LOGICAL_XOR expr
     864           4 :                         { $$ = zend_ast_create_binary_op(ZEND_BOOL_XOR, $1, $3); }
     865         688 :         |       expr '|' expr   { $$ = zend_ast_create_binary_op(ZEND_BW_OR, $1, $3); }
     866        1887 :         |       expr '&' expr       { $$ = zend_ast_create_binary_op(ZEND_BW_AND, $1, $3); }
     867        1225 :         |       expr '^' expr   { $$ = zend_ast_create_binary_op(ZEND_BW_XOR, $1, $3); }
     868       33433 :         |       expr '.' expr   { $$ = zend_ast_create_binary_op(ZEND_CONCAT, $1, $3); }
     869       37034 :         |       expr '+' expr   { $$ = zend_ast_create_binary_op(ZEND_ADD, $1, $3); }
     870        4757 :         |       expr '-' expr   { $$ = zend_ast_create_binary_op(ZEND_SUB, $1, $3); }
     871        3974 :         |       expr '*' expr   { $$ = zend_ast_create_binary_op(ZEND_MUL, $1, $3); }
     872        2853 :         |       expr T_POW expr { $$ = zend_ast_create_binary_op(ZEND_POW, $1, $3); }
     873         537 :         |       expr '/' expr   { $$ = zend_ast_create_binary_op(ZEND_DIV, $1, $3); }
     874         652 :         |       expr '%' expr   { $$ = zend_ast_create_binary_op(ZEND_MOD, $1, $3); }
     875         267 :         |       expr T_SL expr  { $$ = zend_ast_create_binary_op(ZEND_SL, $1, $3); }
     876         212 :         |       expr T_SR expr  { $$ = zend_ast_create_binary_op(ZEND_SR, $1, $3); }
     877          71 :         |       '+' expr %prec T_INC { $$ = zend_ast_create(ZEND_AST_UNARY_PLUS, $2); }
     878         251 :         |       '-' expr %prec T_INC { $$ = zend_ast_create(ZEND_AST_UNARY_MINUS, $2); }
     879        6228 :         |       '!' expr { $$ = zend_ast_create_ex(ZEND_AST_UNARY_OP, ZEND_BOOL_NOT, $2); }
     880       27521 :         |       '~' expr { $$ = zend_ast_create_ex(ZEND_AST_UNARY_OP, ZEND_BW_NOT, $2); }
     881          91 :         |       expr T_IS_IDENTICAL expr
     882       11438 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_IDENTICAL, $1, $3); }
     883        5719 :         |       expr T_IS_NOT_IDENTICAL expr
     884       13414 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_NOT_IDENTICAL, $1, $3); }
     885        6707 :         |       expr T_IS_EQUAL expr
     886       32104 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_EQUAL, $1, $3); }
     887       16052 :         |       expr T_IS_NOT_EQUAL expr
     888        5680 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_NOT_EQUAL, $1, $3); }
     889        2840 :         |       expr '<' expr
     890        3810 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_SMALLER, $1, $3); }
     891        1905 :         |       expr T_IS_SMALLER_OR_EQUAL expr
     892        3496 :                         { $$ = zend_ast_create_binary_op(ZEND_IS_SMALLER_OR_EQUAL, $1, $3); }
     893        1748 :         |       expr '>' expr
     894         895 :                         { $$ = zend_ast_create(ZEND_AST_GREATER, $1, $3); }
     895         895 :         |       expr T_IS_GREATER_OR_EQUAL expr
     896         468 :                         { $$ = zend_ast_create(ZEND_AST_GREATER_EQUAL, $1, $3); }
     897         468 :         |       expr T_SPACESHIP expr
     898          14 :                         { $$ = zend_ast_create_binary_op(ZEND_SPACESHIP, $1, $3); }
     899           7 :         |       expr T_INSTANCEOF class_name_reference
     900          68 :                         { $$ = zend_ast_create(ZEND_AST_INSTANCEOF, $1, $3); }
     901          68 :         |       '(' expr ')' { $$ = $2; }
     902       25455 :         |       new_expr { $$ = $1; }
     903       14424 :         |       expr '?' expr ':' expr
     904       24932 :                         { $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1, $3, $5); }
     905       24932 :         |       expr '?' ':' expr
     906         191 :                         { $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1, NULL, $4); }
     907         191 :         |       expr T_COALESCE expr
     908          17 :                         { $$ = zend_ast_create(ZEND_AST_COALESCE, $1, $3); }
     909          17 :         |       internal_functions_in_yacc { $$ = $1; }
     910       28113 :         |       T_INT_CAST expr         { $$ = zend_ast_create_cast(IS_LONG, $2); }
     911        4818 :         |       T_DOUBLE_CAST expr      { $$ = zend_ast_create_cast(IS_DOUBLE, $2); }
     912        1337 :         |       T_STRING_CAST expr      { $$ = zend_ast_create_cast(IS_STRING, $2); }
     913        1331 :         |       T_ARRAY_CAST expr       { $$ = zend_ast_create_cast(IS_ARRAY, $2); }
     914         192 :         |       T_OBJECT_CAST expr      { $$ = zend_ast_create_cast(IS_OBJECT, $2); }
     915         244 :         |       T_BOOL_CAST expr        { $$ = zend_ast_create_cast(_IS_BOOL, $2); }
     916          72 :         |       T_UNSET_CAST expr       { $$ = zend_ast_create_cast(IS_NULL, $2); }
     917           0 :         |       T_EXIT exit_expr        { $$ = zend_ast_create(ZEND_AST_EXIT, $2); }
     918       14515 :         |       '@' expr                        { $$ = zend_ast_create(ZEND_AST_SILENCE, $2); }
     919        5264 :         |       scalar { $$ = $1; }
     920      646470 :         |       '`' backticks_expr '`' { $$ = zend_ast_create(ZEND_AST_SHELL_EXEC, $2); }
     921         114 :         |       T_PRINT expr { $$ = zend_ast_create(ZEND_AST_PRINT, $2); }
     922        3336 :         |       T_YIELD { $$ = zend_ast_create(ZEND_AST_YIELD, NULL, NULL); }
     923          55 :         |       T_YIELD expr { $$ = zend_ast_create(ZEND_AST_YIELD, $2, NULL); }
     924         115 :         |       T_YIELD expr T_DOUBLE_ARROW expr { $$ = zend_ast_create(ZEND_AST_YIELD, $4, $2); }
     925          33 :         |       T_YIELD_FROM expr { $$ = zend_ast_create(ZEND_AST_YIELD_FROM, $2); }
     926          22 :         |       function returns_ref '(' parameter_list ')' lexical_vars return_type
     927             :                 backup_doc_comment '{' inner_statement_list '}'
     928        2125 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $2, $1, $8,
     929             :                                   zend_string_init("{closure}", sizeof("{closure}") - 1, 0),
     930        1700 :                               $4, $6, $10, $7); }
     931         425 :         |       T_STATIC function returns_ref '(' parameter_list ')' lexical_vars
     932             :                 return_type backup_doc_comment '{' inner_statement_list '}'
     933          55 :                         { $$ = zend_ast_create_decl(ZEND_AST_CLOSURE, $3 | ZEND_ACC_STATIC, $2, $9,
     934             :                               zend_string_init("{closure}", sizeof("{closure}") - 1, 0),
     935          44 :                               $5, $7, $11, $8); }
     936          11 : ;
     937             : 
     938             : function:
     939       35829 :         T_FUNCTION { $$ = CG(zend_lineno); }
     940       35829 : ;
     941             : 
     942             : backup_doc_comment:
     943       43306 :         /* empty */ { $$ = CG(doc_comment); CG(doc_comment) = NULL; }
     944       43306 : ;
     945             : 
     946             : returns_ref:
     947       35747 :                 /* empty */     { $$ = 0; }
     948       35747 :         |       '&'                 { $$ = ZEND_ACC_RETURN_REFERENCE; }
     949          82 : ;
     950             : 
     951             : lexical_vars:
     952         268 :                 /* empty */ { $$ = NULL; }
     953         268 :         |       T_USE '(' lexical_var_list ')' { $$ = $3; }
     954         168 : ;
     955             : 
     956             : lexical_var_list:
     957          10 :                 lexical_var_list ',' lexical_var { $$ = zend_ast_list_add($1, $3); }
     958          10 :         |       lexical_var { $$ = zend_ast_create_list(1, ZEND_AST_CLOSURE_USES, $1); }
     959         168 : ;
     960             : 
     961             : lexical_var:
     962         147 :                 T_VARIABLE              { $$ = $1; }
     963         147 :         |       '&' T_VARIABLE      { $$ = $2; $$->attr = 1; }
     964          31 : ;
     965             : 
     966             : function_call:
     967             :                 name argument_list
     968      245838 :                         { $$ = zend_ast_create(ZEND_AST_CALL, $1, $2); }
     969      245838 :         |       class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
     970       10372 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_CALL, $1, $3, $4); }
     971       10372 :         |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM member_name argument_list
     972          40 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_CALL, $1, $3, $4); }
     973          40 :         |       callable_expr argument_list
     974        2113 :                         { $$ = zend_ast_create(ZEND_AST_CALL, $1, $2); }
     975        2113 : ;
     976             : 
     977             : class_name:
     978             :                 T_STATIC
     979         132 :                         { zval zv; ZVAL_STRINGL(&zv, "static", sizeof("static")-1);
     980          66 :                           $$ = zend_ast_create_zval_ex(&zv, ZEND_NAME_NOT_FQ); }
     981          66 :         |       name { $$ = $1; }
     982       33551 : ;
     983             : 
     984             : class_name_reference:
     985       13330 :                 class_name              { $$ = $1; }
     986       13330 :         |       new_variable    { $$ = $1; }
     987        1150 : ;
     988             : 
     989             : exit_expr:
     990         407 :                 /* empty */                             { $$ = NULL; }
     991         407 :         |       '(' optional_expr ')'   { $$ = $2; }
     992       14108 : ;
     993             : 
     994             : backticks_expr:
     995             :                 /* empty */
     996           0 :                         { $$ = zend_ast_create_zval_from_str(STR_EMPTY_ALLOC()); }
     997           0 :         |       T_ENCAPSED_AND_WHITESPACE { $$ = $1; }
     998           7 :         |       encaps_list { $$ = $1; }
     999         107 : ;
    1000             : 
    1001             : 
    1002             : ctor_arguments:
    1003        2749 :                 /* empty */     { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
    1004        2749 :         |       argument_list { $$ = $1; }
    1005       11675 : ;
    1006             : 
    1007             : 
    1008             : dereferencable_scalar:
    1009       24696 :                 T_ARRAY '(' array_pair_list ')' { $$ = $3; }
    1010       24696 :         |       '[' array_pair_list ']'                 { $$ = $2; }
    1011         818 :         |       T_CONSTANT_ENCAPSED_STRING              { $$ = $1; }
    1012      343637 : ;
    1013             : 
    1014             : scalar:
    1015      160647 :                 T_LNUMBER       { $$ = $1; }
    1016      160647 :         |       T_DNUMBER       { $$ = $1; }
    1017        6654 :         |       T_LINE          { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_LINE); }
    1018          18 :         |       T_FILE          { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_FILE); }
    1019        7402 :         |       T_DIR           { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_DIR); }
    1020         485 :         |       T_TRAIT_C       { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_TRAIT_C); }
    1021           5 :         |       T_METHOD_C      { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_METHOD_C); }
    1022         766 :         |       T_FUNC_C        { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_FUNC_C); }
    1023         124 :         |       T_NS_C          { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_NS_C); }
    1024          36 :         |       T_CLASS_C       { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_CLASS_C); }
    1025          84 :         |       T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
    1026        1365 :         |       T_START_HEREDOC T_END_HEREDOC
    1027         118 :                         { $$ = zend_ast_create_zval_from_str(STR_EMPTY_ALLOC()); }
    1028          59 :         |       '"' encaps_list '"'   { $$ = $2; }
    1029       13341 :         |       T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
    1030         142 :         |       dereferencable_scalar   { $$ = $1; }
    1031      369121 :         |       class_name_scalar       { $$ = $1; }
    1032          39 :         |       constant                        { $$ = $1; }
    1033       86182 : ;
    1034             : 
    1035             : constant:
    1036       76988 :                 name { $$ = zend_ast_create(ZEND_AST_CONST, $1); }
    1037       76988 :         |       class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
    1038        9201 :                         { $$ = zend_ast_create(ZEND_AST_CLASS_CONST, $1, $3); }
    1039        9201 :         |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING
    1040           6 :                         { $$ = zend_ast_create(ZEND_AST_CLASS_CONST, $1, $3); }
    1041           6 : ;
    1042             : 
    1043             : possible_comma:
    1044             :                 /* empty */
    1045             :         |       ','
    1046             : ;
    1047             : 
    1048             : expr:
    1049      685324 :                 variable                                        { $$ = $1; }
    1050      685324 :         |       expr_without_variable           { $$ = $1; }
    1051     1032256 : ;
    1052             : 
    1053             : optional_expr:
    1054        2907 :                 /* empty */     { $$ = NULL; }
    1055        2907 :         |       expr            { $$ = $1; }
    1056      179884 : ;
    1057             : 
    1058             : variable_class_name:
    1059          60 :         dereferencable { $$ = $1; }
    1060          60 : ;
    1061             : 
    1062             : dereferencable:
    1063      168925 :                 variable                                { $$ = $1; }
    1064      168925 :         |       '(' expr ')'                    { $$ = $2; }
    1065          47 :         |       dereferencable_scalar   { $$ = $1; }
    1066          26 : ;
    1067             : 
    1068             : callable_expr:
    1069        2101 :                 callable_variable               { $$ = $1; }
    1070        2101 :         |       '(' expr ')'                    { $$ = $2; }
    1071           8 :         |       dereferencable_scalar   { $$ = $1; }
    1072           4 : ;
    1073             : 
    1074             : callable_variable:
    1075             :                 simple_variable
    1076      587586 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1077      587586 :         |       dereferencable '[' optional_expr ']'
    1078      122932 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1079      122932 :         |       constant '[' optional_expr ']'
    1080          12 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1081          12 :         |       dereferencable '{' expr '}'
    1082          21 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1083          21 :         |       dereferencable T_OBJECT_OPERATOR member_name argument_list
    1084       35513 :                         { $$ = zend_ast_create(ZEND_AST_METHOD_CALL, $1, $3, $4); }
    1085       35513 :         |       function_call { $$ = $1; }
    1086      258363 : ;
    1087             : 
    1088             : variable:
    1089             :                 callable_variable
    1090     1002326 :                         { $$ = $1; }
    1091     1002326 :         |       static_member
    1092         688 :                         { $$ = $1; }
    1093         688 :         |       dereferencable T_OBJECT_OPERATOR member_name
    1094       10472 :                         { $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
    1095       10472 : ;
    1096             : 
    1097             : simple_variable:
    1098      594711 :                 T_VARIABLE                      { $$ = $1; }
    1099      594711 :         |       '$' '{' expr '}'        { $$ = $3; }
    1100          44 :         |       '$' simple_variable     { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
    1101         160 : ;
    1102             : 
    1103             : static_member:
    1104             :                 class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
    1105         674 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
    1106         674 :         |       variable_class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
    1107          14 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
    1108          14 : ;
    1109             : 
    1110             : new_variable:
    1111             :                 simple_variable
    1112        1149 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1113        1149 :         |       new_variable '[' optional_expr ']'
    1114          11 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1115          11 :         |       new_variable '{' expr '}'
    1116           1 :                         { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
    1117           1 :         |       new_variable T_OBJECT_OPERATOR member_name
    1118           4 :                         { $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
    1119           4 :         |       class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
    1120           1 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
    1121           1 :         |       new_variable T_PAAMAYIM_NEKUDOTAYIM simple_variable
    1122           2 :                         { $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
    1123           2 : ;
    1124             : 
    1125             : member_name:
    1126       56120 :                 T_STRING                { $$ = $1; }
    1127       56120 :         |       '{' expr '}'    { $$ = $2; }
    1128          73 :         |       simple_variable { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1129         208 : ;
    1130             : 
    1131             : assignment_list:
    1132             :                 assignment_list ',' assignment_list_element
    1133         243 :                         { $$ = zend_ast_list_add($1, $3); }
    1134         243 :         |       assignment_list_element
    1135         181 :                         { $$ = zend_ast_create_list(1, ZEND_AST_LIST, $1); }
    1136         181 : ;
    1137             : 
    1138             : assignment_list_element:
    1139         371 :                 variable                                                { $$ = $1; }
    1140         371 :         |       T_LIST '(' assignment_list ')'  { $$ = $3; }
    1141          21 :         |       /* empty */                                             { $$ = NULL; }
    1142          32 : ;
    1143             : 
    1144             : 
    1145             : array_pair_list:
    1146        3360 :                 /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_ARRAY); }
    1147        3360 :         |       non_empty_array_pair_list possible_comma { $$ = $1; }
    1148       22154 : ;
    1149             : 
    1150             : non_empty_array_pair_list:
    1151             :                 non_empty_array_pair_list ',' array_pair
    1152       74481 :                         { $$ = zend_ast_list_add($1, $3); }
    1153       74481 :         |       array_pair
    1154       22154 :                         { $$ = zend_ast_create_list(1, ZEND_AST_ARRAY, $1); }
    1155       22154 : ;
    1156             : 
    1157             : array_pair:
    1158             :                 expr T_DOUBLE_ARROW expr
    1159       27248 :                         { $$ = zend_ast_create(ZEND_AST_ARRAY_ELEM, $3, $1); }
    1160       27248 :         |       expr { $$ = zend_ast_create(ZEND_AST_ARRAY_ELEM, $1, NULL); }
    1161       69233 :         |       expr T_DOUBLE_ARROW '&' variable
    1162          61 :                         { $$ = zend_ast_create_ex(ZEND_AST_ARRAY_ELEM, 1, $4, $1); }
    1163          61 :         |       '&' variable
    1164          93 :                         { $$ = zend_ast_create_ex(ZEND_AST_ARRAY_ELEM, 1, $2, NULL); }
    1165          93 : ;
    1166             : 
    1167             : encaps_list:
    1168             :                 encaps_list encaps_var
    1169        6428 :                         { $$ = zend_ast_list_add($1, $2); }
    1170        6428 :         |       encaps_list T_ENCAPSED_AND_WHITESPACE
    1171       15330 :                         { $$ = zend_ast_list_add($1, $2); }
    1172       15330 :         |       encaps_var
    1173        4389 :                         { $$ = zend_ast_create_list(1, ZEND_AST_ENCAPS_LIST, $1); }
    1174        4389 :         |       T_ENCAPSED_AND_WHITESPACE encaps_var
    1175        9202 :                         { $$ = zend_ast_create_list(2, ZEND_AST_ENCAPS_LIST, $1, $2); }
    1176        9202 : ;
    1177             : 
    1178             : encaps_var:
    1179             :                 T_VARIABLE
    1180       17258 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1181       17258 :         |       T_VARIABLE '[' encaps_var_offset ']'
    1182        1962 :                         { $$ = zend_ast_create(ZEND_AST_DIM,
    1183        1962 :                               zend_ast_create(ZEND_AST_VAR, $1), $3); }
    1184         981 :         |       T_VARIABLE T_OBJECT_OPERATOR T_STRING
    1185         164 :                         { $$ = zend_ast_create(ZEND_AST_PROP,
    1186          82 :                               zend_ast_create(ZEND_AST_VAR, $1), $3); }
    1187          82 :         |       T_DOLLAR_OPEN_CURLY_BRACES expr '}'
    1188           3 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
    1189           3 :         |       T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}'
    1190         372 :                         { $$ = zend_ast_create(ZEND_AST_VAR, $2); }
    1191         372 :         |       T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
    1192           0 :                         { $$ = zend_ast_create(ZEND_AST_DIM,
    1193           0 :                               zend_ast_create(ZEND_AST_VAR, $2), $4); }
    1194           0 :         |       T_CURLY_OPEN variable '}' { $$ = $2; }
    1195        1323 : ;
    1196             : 
    1197             : encaps_var_offset:
    1198           4 :                 T_STRING                { $$ = $1; }
    1199           4 :         |       T_NUM_STRING    { $$ = $1; }
    1200         383 :         |       T_VARIABLE              { $$ = zend_ast_create(ZEND_AST_VAR, $1); }
    1201         594 : ;
    1202             : 
    1203             : 
    1204             : internal_functions_in_yacc:
    1205        5520 :                 T_ISSET '(' isset_variables ')' { $$ = $3; }
    1206        5520 :         |       T_EMPTY '(' expr ')' { $$ = zend_ast_create(ZEND_AST_EMPTY, $3); }
    1207        7271 :         |       T_INCLUDE expr
    1208        1920 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_INCLUDE, $2); }
    1209        1920 :         |       T_INCLUDE_ONCE expr
    1210         508 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_INCLUDE_ONCE, $2); }
    1211         508 :         |       T_EVAL '(' expr ')'
    1212        1945 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_EVAL, $3); }
    1213        1945 :         |       T_REQUIRE expr
    1214         774 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_REQUIRE, $2); }
    1215         774 :         |       T_REQUIRE_ONCE expr
    1216        5383 :                         { $$ = zend_ast_create_ex(ZEND_AST_INCLUDE_OR_EVAL, ZEND_REQUIRE_ONCE, $2); }
    1217        5383 : ;
    1218             : 
    1219             : isset_variables:
    1220        5520 :                 isset_variable { $$ = $1; }
    1221        5520 :         |       isset_variables ',' isset_variable
    1222          44 :                         { $$ = zend_ast_create(ZEND_AST_AND, $1, $3); }
    1223          44 : ;
    1224             : 
    1225             : isset_variable:
    1226        5564 :                 expr { $$ = zend_ast_create(ZEND_AST_ISSET, $1); }
    1227        5564 : ;
    1228             : 
    1229             : class_name_scalar:
    1230             :         class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS
    1231          39 :                 { $$ = zend_ast_create(ZEND_AST_RESOLVE_CLASS_NAME, $1); }
    1232             : ;
    1233             : 
    1234             : %%
    1235             : 
    1236             : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
    1237             :    quotes and backslashes, so that it's suitable for yyerror.  The
    1238             :    heuristic is that double-quoting is unnecessary unless the string
    1239             :    contains an apostrophe, a comma, or backslash (other than
    1240             :    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
    1241             :    null, do not copy; instead, return the length of what the result
    1242             :    would have been.  */
    1243         469 : static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
    1244             : {
    1245         469 :         if (!yyres) {
    1246         374 :                 return yystrlen(yystr);
    1247             :         }
    1248             :         {
    1249          95 :                 if (CG(parse_error) == 0) {
    1250             :                         char buffer[120];
    1251          46 :                         const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
    1252          46 :                         unsigned int len = 0, toklen = 0, yystr_len;
    1253             : 
    1254          46 :                         CG(parse_error) = 1;
    1255             : 
    1256          56 :                         if (LANG_SCNG(yy_text)[0] == 0 &&
    1257           5 :                                 LANG_SCNG(yy_leng) == 1 &&
    1258           5 :                                 memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) {
    1259           5 :                                 yystpcpy(yyres, "end of file");
    1260           5 :                                 return sizeof("end of file")-1;
    1261             :                         }
    1262             : 
    1263          41 :                         str = LANG_SCNG(yy_text);
    1264          41 :                         end = memchr(str, '\n', LANG_SCNG(yy_leng));
    1265          41 :                         yystr_len = (unsigned int)yystrlen(yystr);
    1266             : 
    1267          89 :                         if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
    1268          24 :                                 && (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
    1269          24 :                                 toklen = (tok2 - tok1) + 1;
    1270             :                         } else {
    1271          17 :                                 tok1 = tok2 = NULL;
    1272          17 :                                 toklen = 0;
    1273             :                         }
    1274             : 
    1275          41 :                         if (end == NULL) {
    1276          40 :                                 len = LANG_SCNG(yy_leng) > 30 ? 30 : LANG_SCNG(yy_leng);
    1277             :                         } else {
    1278           1 :                                 len = (end - str) > 30 ? 30 : (end - str);
    1279             :                         }
    1280          41 :                         if (toklen) {
    1281          24 :                                 snprintf(buffer, sizeof(buffer), "'%.*s' %.*s", len, str, toklen, tok1);
    1282             :                         } else {
    1283          17 :                                 snprintf(buffer, sizeof(buffer), "'%.*s'", len, str);
    1284             :                         }
    1285          41 :                         yystpcpy(yyres, buffer);
    1286          41 :                         return len + (toklen ? toklen + 1 : 0) + 2;
    1287             :                 }
    1288             :         }
    1289          49 :         if (*yystr == '"') {
    1290          25 :                 YYSIZE_T yyn = 0;
    1291          25 :                 const char *yyp = yystr;
    1292             : 
    1293         506 :                 for (; *++yyp != '"'; ++yyn) {
    1294         481 :                         yyres[yyn] = *yyp;
    1295             :                 }
    1296          25 :                 yyres[yyn] = '\0';
    1297          25 :                 return yyn;
    1298             :         }
    1299          24 :         yystpcpy(yyres, yystr);
    1300          24 :         return strlen(yystr);
    1301             : }
    1302             : 
    1303             : /*
    1304             :  * Local variables:
    1305             :  * tab-width: 4
    1306             :  * c-basic-offset: 4
    1307             :  * indent-tabs-mode: t
    1308             :  * End:
    1309             :  */

Generated by: LCOV version 1.10

Generated at Thu, 21 May 2015 19:58:53 +0000 (4 days ago)

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