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