xref: /PHP-5.6/Zend/zend_language_parser.y (revision 3537e95d)
1 %{
2 /*
3    +----------------------------------------------------------------------+
4    | Zend Engine                                                          |
5    +----------------------------------------------------------------------+
6    | Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
7    +----------------------------------------------------------------------+
8    | This source file is subject to version 2.00 of the Zend license,     |
9    | that is bundled with this package in the file LICENSE, and is        |
10    | available through the world-wide-web at the following url:           |
11    | http://www.zend.com/license/2_00.txt.                                |
12    | If you did not receive a copy of the Zend license and are unable to  |
13    | obtain it through the world-wide-web, please send a note to          |
14    | license@zend.com so we can mail you a copy immediately.              |
15    +----------------------------------------------------------------------+
16    | Authors: Andi Gutmans <andi@zend.com>                                |
17    |          Zeev Suraski <zeev@zend.com>                                |
18    +----------------------------------------------------------------------+
19 */
20 
21 /* $Id$ */
22 
23 /*
24  * LALR shift/reduce conflicts and how they are resolved:
25  *
26  * - 2 shift/reduce conflicts due to the dangling elseif/else ambiguity. Solved by shift.
27  *
28  */
29 
30 
31 #include "zend_compile.h"
32 #include "zend.h"
33 #include "zend_list.h"
34 #include "zend_globals.h"
35 #include "zend_API.h"
36 #include "zend_constants.h"
37 
38 #define YYSIZE_T size_t
39 #define yytnamerr zend_yytnamerr
40 static YYSIZE_T zend_yytnamerr(char*, const char*);
41 
42 #define YYERROR_VERBOSE
43 #define YYSTYPE znode
44 
45 %}
46 
47 %pure_parser
48 %expect 3
49 
50 %code requires {
51 #ifdef ZTS
52 # define YYPARSE_PARAM tsrm_ls
53 # define YYLEX_PARAM tsrm_ls
54 #endif
55 }
56 
57 %token END 0 "end of file"
58 %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
59 %token T_INCLUDE      "include (T_INCLUDE)"
60 %token T_INCLUDE_ONCE "include_once (T_INCLUDE_ONCE)"
61 %token T_EVAL         "eval (T_EVAL)"
62 %token T_REQUIRE      "require (T_REQUIRE)"
63 %token T_REQUIRE_ONCE "require_once (T_REQUIRE_ONCE)"
64 %left ','
65 %left T_LOGICAL_OR
66 %token T_LOGICAL_OR   "or (T_LOGICAL_OR)"
67 %left T_LOGICAL_XOR
68 %token T_LOGICAL_XOR  "xor (T_LOGICAL_XOR)"
69 %left T_LOGICAL_AND
70 %token T_LOGICAL_AND  "and (T_LOGICAL_AND)"
71 %right T_PRINT
72 %token T_PRINT        "print (T_PRINT)"
73 %right T_YIELD
74 %token T_YIELD        "yield (T_YIELD)"
75 %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
76 %token T_PLUS_EQUAL   "+= (T_PLUS_EQUAL)"
77 %token T_MINUS_EQUAL  "-= (T_MINUS_EQUAL)"
78 %token T_MUL_EQUAL    "*= (T_MUL_EQUAL)"
79 %token T_DIV_EQUAL    "/= (T_DIV_EQUAL)"
80 %token T_CONCAT_EQUAL ".= (T_CONCAT_EQUAL)"
81 %token T_MOD_EQUAL    "%= (T_MOD_EQUAL)"
82 %token T_AND_EQUAL    "&= (T_AND_EQUAL)"
83 %token T_OR_EQUAL     "|= (T_OR_EQUAL)"
84 %token T_XOR_EQUAL    "^= (T_XOR_EQUAL)"
85 %token T_SL_EQUAL     "<<= (T_SL_EQUAL)"
86 %token T_SR_EQUAL     ">>= (T_SR_EQUAL)"
87 %left '?' ':'
88 %left T_BOOLEAN_OR
89 %token T_BOOLEAN_OR   "|| (T_BOOLEAN_OR)"
90 %left T_BOOLEAN_AND
91 %token T_BOOLEAN_AND  "&& (T_BOOLEAN_AND)"
92 %left '|'
93 %left '^'
94 %left '&'
95 %nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
96 %token T_IS_EQUAL     "== (T_IS_EQUAL)"
97 %token T_IS_NOT_EQUAL "!= (T_IS_NOT_EQUAL)"
98 %token T_IS_IDENTICAL "=== (T_IS_IDENTICAL)"
99 %token T_IS_NOT_IDENTICAL "!== (T_IS_NOT_IDENTICAL)"
100 %nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
101 %token T_IS_SMALLER_OR_EQUAL "<= (T_IS_SMALLER_OR_EQUAL)"
102 %token T_IS_GREATER_OR_EQUAL ">= (T_IS_GREATER_OR_EQUAL)"
103 %left T_SL T_SR
104 %token T_SL "<< (T_SL)"
105 %token T_SR ">> (T_SR)"
106 %left '+' '-' '.'
107 %left '*' '/' '%'
108 %right '!'
109 %nonassoc T_INSTANCEOF
110 %token T_INSTANCEOF  "instanceof (T_INSTANCEOF)"
111 %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 '@'
112 %right T_POW
113 %token T_INC "++ (T_INC)"
114 %token T_DEC "-- (T_DEC)"
115 %token T_INT_CAST    "(int) (T_INT_CAST)"
116 %token T_DOUBLE_CAST "(double) (T_DOUBLE_CAST)"
117 %token T_STRING_CAST "(string) (T_STRING_CAST)"
118 %token T_ARRAY_CAST  "(array) (T_ARRAY_CAST)"
119 %token T_OBJECT_CAST "(object) (T_OBJECT_CAST)"
120 %token T_BOOL_CAST   "(bool) (T_BOOL_CAST)"
121 %token T_UNSET_CAST  "(unset) (T_UNSET_CAST)"
122 %right '['
123 %nonassoc T_NEW T_CLONE
124 %token T_NEW       "new (T_NEW)"
125 %token T_CLONE     "clone (T_CLONE)"
126 %token T_EXIT      "exit (T_EXIT)"
127 %token T_IF        "if (T_IF)"
128 %left T_ELSEIF
129 %token T_ELSEIF    "elseif (T_ELSEIF)"
130 %left T_ELSE
131 %token T_ELSE      "else (T_ELSE)"
132 %left T_ENDIF
133 %token T_ENDIF     "endif (T_ENDIF)"
134 %token T_LNUMBER   "integer number (T_LNUMBER)"
135 %token T_DNUMBER   "floating-point number (T_DNUMBER)"
136 %token T_STRING    "identifier (T_STRING)"
137 %token T_STRING_VARNAME "variable name (T_STRING_VARNAME)"
138 %token T_VARIABLE  "variable (T_VARIABLE)"
139 %token T_NUM_STRING "number (T_NUM_STRING)"
140 %token T_INLINE_HTML
141 %token T_CHARACTER
142 %token T_BAD_CHARACTER
143 %token T_ENCAPSED_AND_WHITESPACE  "quoted-string and whitespace (T_ENCAPSED_AND_WHITESPACE)"
144 %token T_CONSTANT_ENCAPSED_STRING "quoted-string (T_CONSTANT_ENCAPSED_STRING)"
145 %token T_ECHO       "echo (T_ECHO)"
146 %token T_DO         "do (T_DO)"
147 %token T_WHILE      "while (T_WHILE)"
148 %token T_ENDWHILE   "endwhile (T_ENDWHILE)"
149 %token T_FOR        "for (T_FOR)"
150 %token T_ENDFOR     "endfor (T_ENDFOR)"
151 %token T_FOREACH    "foreach (T_FOREACH)"
152 %token T_ENDFOREACH "endforeach (T_ENDFOREACH)"
153 %token T_DECLARE    "declare (T_DECLARE)"
154 %token T_ENDDECLARE "enddeclare (T_ENDDECLARE)"
155 %token T_AS         "as (T_AS)"
156 %token T_SWITCH     "switch (T_SWITCH)"
157 %token T_ENDSWITCH  "endswitch (T_ENDSWITCH)"
158 %token T_CASE       "case (T_CASE)"
159 %token T_DEFAULT    "default (T_DEFAULT)"
160 %token T_BREAK      "break (T_BREAK)"
161 %token T_CONTINUE   "continue (T_CONTINUE)"
162 %token T_GOTO       "goto (T_GOTO)"
163 %token T_FUNCTION   "function (T_FUNCTION)"
164 %token T_CONST      "const (T_CONST)"
165 %token T_RETURN     "return (T_RETURN)"
166 %token T_TRY        "try (T_TRY)"
167 %token T_CATCH      "catch (T_CATCH)"
168 %token T_FINALLY    "finally (T_FINALLY)"
169 %token T_THROW      "throw (T_THROW)"
170 %token T_USE        "use (T_USE)"
171 %token T_INSTEADOF  "insteadof (T_INSTEADOF)"
172 %token T_GLOBAL     "global (T_GLOBAL)"
173 %right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
174 %token T_STATIC     "static (T_STATIC)"
175 %token T_ABSTRACT   "abstract (T_ABSTRACT)"
176 %token T_FINAL      "final (T_FINAL)"
177 %token T_PRIVATE    "private (T_PRIVATE)"
178 %token T_PROTECTED  "protected (T_PROTECTED)"
179 %token T_PUBLIC     "public (T_PUBLIC)"
180 %token T_VAR        "var (T_VAR)"
181 %token T_UNSET      "unset (T_UNSET)"
182 %token T_ISSET      "isset (T_ISSET)"
183 %token T_EMPTY      "empty (T_EMPTY)"
184 %token T_HALT_COMPILER "__halt_compiler (T_HALT_COMPILER)"
185 %token T_CLASS      "class (T_CLASS)"
186 %token T_TRAIT      "trait (T_TRAIT)"
187 %token T_INTERFACE  "interface (T_INTERFACE)"
188 %token T_EXTENDS    "extends (T_EXTENDS)"
189 %token T_IMPLEMENTS "implements (T_IMPLEMENTS)"
190 %token T_OBJECT_OPERATOR "-> (T_OBJECT_OPERATOR)"
191 %token T_DOUBLE_ARROW    "=> (T_DOUBLE_ARROW)"
192 %token T_LIST            "list (T_LIST)"
193 %token T_ARRAY           "array (T_ARRAY)"
194 %token T_CALLABLE        "callable (T_CALLABLE)"
195 %token T_CLASS_C         "__CLASS__ (T_CLASS_C)"
196 %token T_TRAIT_C         "__TRAIT__ (T_TRAIT_C)"
197 %token T_METHOD_C        "__METHOD__ (T_METHOD_C)"
198 %token T_FUNC_C          "__FUNCTION__ (T_FUNC_C)"
199 %token T_LINE            "__LINE__ (T_LINE)"
200 %token T_FILE            "__FILE__ (T_FILE)"
201 %token T_COMMENT         "comment (T_COMMENT)"
202 %token T_DOC_COMMENT     "doc comment (T_DOC_COMMENT)"
203 %token T_OPEN_TAG        "open tag (T_OPEN_TAG)"
204 %token T_OPEN_TAG_WITH_ECHO "open tag with echo (T_OPEN_TAG_WITH_ECHO)"
205 %token T_CLOSE_TAG       "close tag (T_CLOSE_TAG)"
206 %token T_WHITESPACE      "whitespace (T_WHITESPACE)"
207 %token T_START_HEREDOC   "heredoc start (T_START_HEREDOC)"
208 %token T_END_HEREDOC     "heredoc end (T_END_HEREDOC)"
209 %token T_DOLLAR_OPEN_CURLY_BRACES "${ (T_DOLLAR_OPEN_CURLY_BRACES)"
210 %token T_CURLY_OPEN      "{$ (T_CURLY_OPEN)"
211 %token T_PAAMAYIM_NEKUDOTAYIM ":: (T_PAAMAYIM_NEKUDOTAYIM)"
212 %token T_NAMESPACE       "namespace (T_NAMESPACE)"
213 %token T_NS_C            "__NAMESPACE__ (T_NS_C)"
214 %token T_DIR             "__DIR__ (T_DIR)"
215 %token T_NS_SEPARATOR    "\\ (T_NS_SEPARATOR)"
216 %token T_ELLIPSIS        "... (T_ELLIPSIS)"
217 %token T_POW             "** (T_POW)"
218 %token T_POW_EQUAL       "**= (T_POW_EQUAL)"
219 
220 %% /* Rules */
221 
222 start:
223 	top_statement_list	{ zend_do_end_compilation(TSRMLS_C); }
224 ;
225 
226 top_statement_list:
227 		top_statement_list  { zend_do_extended_info(TSRMLS_C); } top_statement { HANDLE_INTERACTIVE(); }
228 	|	/* empty */
229 ;
230 
231 namespace_name:
232 		T_STRING { $$ = $1; }
233 	|	namespace_name T_NS_SEPARATOR T_STRING { zend_do_build_namespace_name(&$$, &$1, &$3 TSRMLS_CC); }
234 ;
235 
236 top_statement:
237 		statement						{ zend_verify_namespace(TSRMLS_C); }
238 	|	function_declaration_statement	{ zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); }
239 	|	class_declaration_statement		{ zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); }
240 	|	T_HALT_COMPILER '(' ')' ';'		{ zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; }
241 	|	T_NAMESPACE namespace_name ';'	{ zend_do_begin_namespace(&$2, 0 TSRMLS_CC); }
242 	|	T_NAMESPACE namespace_name '{'	{ zend_do_begin_namespace(&$2, 1 TSRMLS_CC); }
243 		top_statement_list '}'		    { zend_do_end_namespace(TSRMLS_C); }
244 	|	T_NAMESPACE '{'					{ zend_do_begin_namespace(NULL, 1 TSRMLS_CC); }
245 		top_statement_list '}'			{ zend_do_end_namespace(TSRMLS_C); }
246 	|	T_USE use_declarations ';'      { zend_verify_namespace(TSRMLS_C); }
247 	|	T_USE T_FUNCTION use_function_declarations ';' { zend_verify_namespace(TSRMLS_C); }
248 	|	T_USE T_CONST use_const_declarations ';'       { zend_verify_namespace(TSRMLS_C); }
249 	|	constant_declaration ';'		{ zend_verify_namespace(TSRMLS_C); }
250 ;
251 
252 use_declarations:
253 		use_declarations ',' use_declaration
254 	|	use_declaration
255 ;
256 
257 use_declaration:
258 		namespace_name 			{ zend_do_use(&$1, NULL TSRMLS_CC); }
259 	|	namespace_name T_AS T_STRING	{ zend_do_use(&$1, &$3 TSRMLS_CC); }
260 	|	T_NS_SEPARATOR namespace_name { zend_do_use(&$2, NULL TSRMLS_CC); }
261 	|	T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use(&$2, &$4 TSRMLS_CC); }
262 ;
263 
264 use_function_declarations:
265 		use_function_declarations ',' use_function_declaration
266 	|	use_function_declaration
267 ;
268 
269 use_function_declaration:
270 		namespace_name 			{ zend_do_use_function(&$1, NULL TSRMLS_CC); }
271 	|	namespace_name T_AS T_STRING	{ zend_do_use_function(&$1, &$3 TSRMLS_CC); }
272 	|	T_NS_SEPARATOR namespace_name { zend_do_use_function(&$2, NULL TSRMLS_CC); }
273 	|	T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_function(&$2, &$4 TSRMLS_CC); }
274 ;
275 
276 use_const_declarations:
277 		use_const_declarations ',' use_const_declaration
278 	|	use_const_declaration
279 ;
280 
281 use_const_declaration:
282 		namespace_name 			{ zend_do_use_const(&$1, NULL TSRMLS_CC); }
283 	|	namespace_name T_AS T_STRING	{ zend_do_use_const(&$1, &$3 TSRMLS_CC); }
284 	|	T_NS_SEPARATOR namespace_name { zend_do_use_const(&$2, NULL TSRMLS_CC); }
285 	|	T_NS_SEPARATOR namespace_name T_AS T_STRING { zend_do_use_const(&$2, &$4 TSRMLS_CC); }
286 ;
287 
288 constant_declaration:
289 		constant_declaration ',' T_STRING '=' static_scalar	{ zend_do_declare_constant(&$3, &$5 TSRMLS_CC); }
290 	|	T_CONST T_STRING '=' static_scalar { zend_do_declare_constant(&$2, &$4 TSRMLS_CC); }
291 ;
292 
293 inner_statement_list:
294 		inner_statement_list  { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); }
295 	|	/* empty */
296 ;
297 
298 
299 inner_statement:
300 		statement
301 	|	function_declaration_statement
302 	|	class_declaration_statement
303 	|	T_HALT_COMPILER '(' ')' ';'   { zend_error_noreturn(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); }
304 ;
305 
306 
307 statement:
308 		unticked_statement { DO_TICKS(); }
309 	|	T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); }
310 ;
311 
312 unticked_statement:
313 		'{' inner_statement_list '}'
314 	|	T_IF parenthesis_expr { zend_do_if_cond(&$2, &$1 TSRMLS_CC); } statement { zend_do_if_after_statement(&$1, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); }
315 	|	T_IF parenthesis_expr ':' { zend_do_if_cond(&$2, &$1 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$1, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); }
316 	|	T_WHILE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); } parenthesis_expr { zend_do_while_cond(&$3, &$$ TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$4 TSRMLS_CC); }
317 	|	T_DO { $1.u.op.opline_num = get_next_op_number(CG(active_op_array));  zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE { $4.u.op.opline_num = get_next_op_number(CG(active_op_array)); } parenthesis_expr ';' { zend_do_do_while_end(&$1, &$4, &$6 TSRMLS_CC); }
318 	|	T_FOR
319 			'('
320 				for_expr
321 			';' { zend_do_free(&$3 TSRMLS_CC); $4.u.op.opline_num = get_next_op_number(CG(active_op_array)); }
322 				for_expr
323 			';' { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&$6, &$7 TSRMLS_CC); }
324 				for_expr
325 			')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); }
326 			for_statement { zend_do_for_end(&$7 TSRMLS_CC); }
327 	|	T_SWITCH parenthesis_expr	{ zend_do_switch_cond(&$2 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$4 TSRMLS_CC); }
328 	|	T_BREAK ';'				{ zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); }
329 	|	T_BREAK expr ';'		{ zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); }
330 	|	T_CONTINUE ';'			{ zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); }
331 	|	T_CONTINUE expr ';'		{ zend_do_brk_cont(ZEND_CONT, &$2 TSRMLS_CC); }
332 	|	T_RETURN ';'						{ zend_do_return(NULL, 0 TSRMLS_CC); }
333 	|	T_RETURN expr_without_variable ';'	{ zend_do_return(&$2, 0 TSRMLS_CC); }
334 	|	T_RETURN variable ';'				{ zend_do_return(&$2, 1 TSRMLS_CC); }
335 	|	yield_expr ';' { zend_do_free(&$1 TSRMLS_CC); }
336 	|	T_GLOBAL global_var_list ';'
337 	|	T_STATIC static_var_list ';'
338 	|	T_ECHO echo_expr_list ';'
339 	|	T_INLINE_HTML			{ zend_do_echo(&$1 TSRMLS_CC); }
340 	|	expr ';'				{ zend_do_free(&$1 TSRMLS_CC); }
341 	|	T_UNSET '(' unset_variables ')' ';'
342 	|	T_FOREACH '(' variable T_AS
343 		{ zend_do_foreach_begin(&$1, &$2, &$3, &$4, 1 TSRMLS_CC); }
344 		foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); }
345 		foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); }
346 	|	T_FOREACH '(' expr_without_variable T_AS
347 		{ zend_do_foreach_begin(&$1, &$2, &$3, &$4, 0 TSRMLS_CC); }
348 		foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); }
349 		foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); }
350 	|	T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
351 	|	';'		/* empty statement */
352 	|	T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
353 		catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); }
354 		finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); }
355 	|	T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
356 	|	T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); }
357 ;
358 
359 catch_statement:
360 				/* empty */ { $$.op_type = IS_UNUSED; }
361 	|	T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
362 		fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); }
363 		T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); }
364 		'{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
365 		additional_catches { zend_do_mark_last_catch(&$2, &$13 TSRMLS_CC); $$ = $1;}
366 
367 finally_statement:
368 					/* empty */ { $$.op_type = IS_UNUSED; }
369 	|	T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; }
370 ;
371 
372 additional_catches:
373 		non_empty_additional_catches { $$ = $1; }
374 	|	/* empty */ { $$.u.op.opline_num = -1; }
375 ;
376 
377 non_empty_additional_catches:
378 		additional_catch { $$ = $1; }
379 	|	non_empty_additional_catches additional_catch { $$ = $2; }
380 ;
381 
382 additional_catch:
383 	T_CATCH '(' fully_qualified_class_name { $$.u.op.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, NULL TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
384 ;
385 
386 unset_variables:
387 		unset_variable
388 	|	unset_variables ',' unset_variable
389 ;
390 
391 unset_variable:
392 		variable	{ zend_do_end_variable_parse(&$1, BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); }
393 ;
394 
395 function_declaration_statement:
396 		unticked_function_declaration_statement	{ DO_TICKS(); }
397 ;
398 
399 class_declaration_statement:
400 		unticked_class_declaration_statement	{ DO_TICKS(); }
401 ;
402 
403 is_reference:
404 		/* empty */	{ $$.op_type = 0; }
405 	|	'&'			{ $$.op_type = 1; }
406 ;
407 
408 is_variadic:
409 		/* empty */ { $$.op_type = 0; }
410 	|	T_ELLIPSIS  { $$.op_type = 1; }
411 ;
412 
413 unticked_function_declaration_statement:
414 		function is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$3, 0, $2.op_type, NULL TSRMLS_CC); }
415 		'(' parameter_list ')'
416 		'{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
417 ;
418 
419 unticked_class_declaration_statement:
420 		class_entry_type T_STRING extends_from
421 			{ zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); }
422 			implements_list
423 			'{'
424 				class_statement_list
425 			'}' { zend_do_end_class_declaration(&$1, &$3 TSRMLS_CC); }
426 	|	interface_entry T_STRING
427 			{ zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); }
428 			interface_extends_list
429 			'{'
430 				class_statement_list
431 			'}' { zend_do_end_class_declaration(&$1, NULL TSRMLS_CC); }
432 ;
433 
434 
435 class_entry_type:
436 		T_CLASS			{ $$.u.op.opline_num = CG(zend_lineno); $$.EA = 0; }
437 	|	T_ABSTRACT T_CLASS { $$.u.op.opline_num = CG(zend_lineno); $$.EA = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
438 	|	T_TRAIT { $$.u.op.opline_num = CG(zend_lineno); $$.EA = ZEND_ACC_TRAIT; }
439 	|	T_FINAL T_CLASS { $$.u.op.opline_num = CG(zend_lineno); $$.EA = ZEND_ACC_FINAL_CLASS; }
440 ;
441 
442 extends_from:
443 		/* empty */					{ $$.op_type = IS_UNUSED; }
444 	|	T_EXTENDS fully_qualified_class_name	{ zend_do_fetch_class(&$$, &$2 TSRMLS_CC); }
445 ;
446 
447 interface_entry:
448 	T_INTERFACE		{ $$.u.op.opline_num = CG(zend_lineno); $$.EA = ZEND_ACC_INTERFACE; }
449 ;
450 
451 interface_extends_list:
452 		/* empty */
453 	|	T_EXTENDS interface_list
454 ;
455 
456 implements_list:
457 		/* empty */
458 	|	T_IMPLEMENTS interface_list
459 ;
460 
461 interface_list:
462 		fully_qualified_class_name			{ zend_do_implements_interface(&$1 TSRMLS_CC); }
463 	|	interface_list ',' fully_qualified_class_name { zend_do_implements_interface(&$3 TSRMLS_CC); }
464 ;
465 
466 foreach_optional_arg:
467 		/* empty */						{ $$.op_type = IS_UNUSED; }
468 	|	T_DOUBLE_ARROW foreach_variable	{ $$ = $2; }
469 ;
470 
471 foreach_variable:
472 		variable			{ zend_check_writable_variable(&$1); $$ = $1; }
473 	|	'&' variable		{ zend_check_writable_variable(&$2); $$ = $2;  $$.EA |= ZEND_PARSED_REFERENCE_VARIABLE; }
474 	|	T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' { $$ = $1; $$.EA = ZEND_PARSED_LIST_EXPR; }
475 ;
476 
477 for_statement:
478 		statement
479 	|	':' inner_statement_list T_ENDFOR ';'
480 ;
481 
482 
483 foreach_statement:
484 		statement
485 	|	':' inner_statement_list T_ENDFOREACH ';'
486 ;
487 
488 
489 declare_statement:
490 		statement
491 	|	':' inner_statement_list T_ENDDECLARE ';'
492 ;
493 
494 
495 declare_list:
496 		T_STRING '=' static_scalar					{ zend_do_declare_stmt(&$1, &$3 TSRMLS_CC); }
497 	|	declare_list ',' T_STRING '=' static_scalar	{ zend_do_declare_stmt(&$3, &$5 TSRMLS_CC); }
498 ;
499 
500 
501 switch_case_list:
502 		'{' case_list '}'					{ $$ = $2; }
503 	|	'{' ';' case_list '}'				{ $$ = $3; }
504 	|	':' case_list T_ENDSWITCH ';'		{ $$ = $2; }
505 	|	':' ';' case_list T_ENDSWITCH ';'	{ $$ = $3; }
506 ;
507 
508 
509 case_list:
510 		/* empty */	{ $$.op_type = IS_UNUSED; }
511 	|	case_list T_CASE expr case_separator { zend_do_extended_info(TSRMLS_C);  zend_do_case_before_statement(&$1, &$2, &$3 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
512 	|	case_list T_DEFAULT case_separator { zend_do_extended_info(TSRMLS_C);  zend_do_default_before_statement(&$1, &$2 TSRMLS_CC); } inner_statement_list { zend_do_case_after_statement(&$$, &$2 TSRMLS_CC); $$.op_type = IS_CONST; }
513 ;
514 
515 
516 case_separator:
517 		':'
518 	|	';'
519 ;
520 
521 
522 while_statement:
523 		statement
524 	|	':' inner_statement_list T_ENDWHILE ';'
525 ;
526 
527 
528 
529 elseif_list:
530 		/* empty */
531 	|	elseif_list T_ELSEIF parenthesis_expr { zend_do_if_cond(&$3, &$2 TSRMLS_CC); } statement { zend_do_if_after_statement(&$2, 0 TSRMLS_CC); }
532 ;
533 
534 
535 new_elseif_list:
536 		/* empty */
537 	|	new_elseif_list T_ELSEIF parenthesis_expr ':' { zend_do_if_cond(&$3, &$2 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$2, 0 TSRMLS_CC); }
538 ;
539 
540 
541 else_single:
542 		/* empty */
543 	|	T_ELSE statement
544 ;
545 
546 
547 new_else_single:
548 		/* empty */
549 	|	T_ELSE ':' inner_statement_list
550 ;
551 
552 
553 parameter_list:
554 		non_empty_parameter_list
555 	|	/* empty */
556 ;
557 
558 
559 non_empty_parameter_list:
560 		parameter
561 	|	non_empty_parameter_list ',' parameter
562 ;
563 
564 parameter:
565 		optional_class_type is_reference is_variadic T_VARIABLE
566 			{ zend_do_receive_param(ZEND_RECV, &$4, NULL, &$1, $2.op_type, $3.op_type TSRMLS_CC); }
567 	|	optional_class_type is_reference is_variadic T_VARIABLE '=' static_scalar
568 			{ zend_do_receive_param(ZEND_RECV_INIT, &$4, &$6, &$1, $2.op_type, $3.op_type TSRMLS_CC); }
569 ;
570 
571 
572 optional_class_type:
573 		/* empty */					{ $$.op_type = IS_UNUSED; }
574 	|	T_ARRAY						{ $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_ARRAY; }
575 	|	T_CALLABLE					{ $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_CALLABLE; }
576 	|	fully_qualified_class_name			{ $$ = $1; }
577 ;
578 
579 
580 function_call_parameter_list:
581 		'(' ')'	{ Z_LVAL($$.u.constant) = 0; }
582 	|	'(' non_empty_function_call_parameter_list ')'	{ $$ = $2; }
583 	|	'(' yield_expr ')'	{ zend_do_pass_param(&$2, ZEND_SEND_VAL TSRMLS_CC); }
584 ;
585 
586 
587 non_empty_function_call_parameter_list:
588 		function_call_parameter
589 	|	non_empty_function_call_parameter_list ',' function_call_parameter
590 ;
591 
592 function_call_parameter:
593 		expr_without_variable	{ zend_do_pass_param(&$1, ZEND_SEND_VAL TSRMLS_CC); }
594 	|	variable				{ zend_do_pass_param(&$1, ZEND_SEND_VAR TSRMLS_CC); }
595 	|	'&' w_variable 			{ zend_do_pass_param(&$2, ZEND_SEND_REF TSRMLS_CC); }
596 	|	T_ELLIPSIS expr			{ zend_do_unpack_params(&$2 TSRMLS_CC); }
597 ;
598 
599 global_var_list:
600 		global_var_list ',' global_var	{ zend_do_fetch_global_variable(&$3, NULL, ZEND_FETCH_GLOBAL_LOCK TSRMLS_CC); }
601 	|	global_var						{ zend_do_fetch_global_variable(&$1, NULL, ZEND_FETCH_GLOBAL_LOCK TSRMLS_CC); }
602 ;
603 
604 
605 global_var:
606 		T_VARIABLE			{ $$ = $1; }
607 	|	'$' r_variable		{ $$ = $2; }
608 	|	'$' '{' expr '}'	{ $$ = $3; }
609 ;
610 
611 
612 static_var_list:
613 		static_var_list ',' T_VARIABLE { zend_do_fetch_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
614 	|	static_var_list ',' T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); }
615 	|	T_VARIABLE  { zend_do_fetch_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
616 	|	T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); }
617 
618 ;
619 
620 
621 class_statement_list:
622 		class_statement_list class_statement
623 	|	/* empty */
624 ;
625 
626 
627 class_statement:
628 		variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';'
629 	|	class_constant_declaration ';'
630 	|	trait_use_statement
631 	|	method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); }
632 		'(' parameter_list ')'
633 		method_body { zend_do_abstract_method(&$4, &$1, &$9 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); }
634 ;
635 
636 trait_use_statement:
637 		T_USE trait_list trait_adaptations
638 ;
639 
640 trait_list:
641 		fully_qualified_class_name						{ zend_do_use_trait(&$1 TSRMLS_CC); }
642 	|	trait_list ',' fully_qualified_class_name		{ zend_do_use_trait(&$3 TSRMLS_CC); }
643 ;
644 
645 trait_adaptations:
646 		';'
647 	|	'{' trait_adaptation_list '}'
648 ;
649 
650 trait_adaptation_list:
651 		/* empty */
652 	|	non_empty_trait_adaptation_list
653 ;
654 
655 non_empty_trait_adaptation_list:
656 		trait_adaptation_statement
657 	|	non_empty_trait_adaptation_list trait_adaptation_statement
658 ;
659 
660 trait_adaptation_statement:
661 		trait_precedence ';'
662 	|	trait_alias ';'
663 ;
664 
665 trait_precedence:
666 	trait_method_reference_fully_qualified T_INSTEADOF trait_reference_list	{ zend_add_trait_precedence(&$1, &$3 TSRMLS_CC); }
667 ;
668 
669 trait_reference_list:
670 		fully_qualified_class_name									{ zend_resolve_class_name(&$1 TSRMLS_CC); zend_init_list(&$$.u.op.ptr, Z_STRVAL($1.u.constant) TSRMLS_CC); }
671 	|	trait_reference_list ',' fully_qualified_class_name			{ zend_resolve_class_name(&$3 TSRMLS_CC); zend_add_to_list(&$1.u.op.ptr, Z_STRVAL($3.u.constant) TSRMLS_CC); $$ = $1; }
672 ;
673 
674 trait_method_reference:
675 		T_STRING													{ zend_prepare_reference(&$$, NULL, &$1 TSRMLS_CC); }
676 	|	trait_method_reference_fully_qualified						{ $$ = $1; }
677 ;
678 
679 trait_method_reference_fully_qualified:
680 	fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING		{ zend_prepare_reference(&$$, &$1, &$3 TSRMLS_CC); }
681 ;
682 
683 trait_alias:
684 		trait_method_reference T_AS trait_modifiers T_STRING		{ zend_add_trait_alias(&$1, &$3, &$4 TSRMLS_CC); }
685 	|	trait_method_reference T_AS member_modifier					{ zend_add_trait_alias(&$1, &$3, NULL TSRMLS_CC); }
686 ;
687 
688 trait_modifiers:
689 		/* empty */					{ Z_LVAL($$.u.constant) = 0x0; } /* No change of methods visibility */
690 	|	member_modifier	{ $$ = $1; } /* REM: Keep in mind, there are not only visibility modifiers */
691 ;
692 
693 method_body:
694 		';' /* abstract method */		{ Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
695 	|	'{' inner_statement_list '}'	{ Z_LVAL($$.u.constant) = 0;	}
696 ;
697 
698 variable_modifiers:
699 		non_empty_member_modifiers		{ $$ = $1; }
700 	|	T_VAR							{ Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
701 ;
702 
703 method_modifiers:
704 		/* empty */							{ Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
705 	|	non_empty_member_modifiers			{ $$ = $1;  if (!(Z_LVAL($$.u.constant) & ZEND_ACC_PPP_MASK)) { Z_LVAL($$.u.constant) |= ZEND_ACC_PUBLIC; } }
706 ;
707 
708 non_empty_member_modifiers:
709 		member_modifier						{ $$ = $1; }
710 	|	non_empty_member_modifiers member_modifier	{ Z_LVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); }
711 ;
712 
713 member_modifier:
714 		T_PUBLIC				{ Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
715 	|	T_PROTECTED				{ Z_LVAL($$.u.constant) = ZEND_ACC_PROTECTED; }
716 	|	T_PRIVATE				{ Z_LVAL($$.u.constant) = ZEND_ACC_PRIVATE; }
717 	|	T_STATIC				{ Z_LVAL($$.u.constant) = ZEND_ACC_STATIC; }
718 	|	T_ABSTRACT				{ Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
719 	|	T_FINAL					{ Z_LVAL($$.u.constant) = ZEND_ACC_FINAL; }
720 ;
721 
722 class_variable_declaration:
723 		class_variable_declaration ',' T_VARIABLE					{ zend_do_declare_property(&$3, NULL, CG(access_type) TSRMLS_CC); }
724 	|	class_variable_declaration ',' T_VARIABLE '=' static_scalar	{ zend_do_declare_property(&$3, &$5, CG(access_type) TSRMLS_CC); }
725 	|	T_VARIABLE						{ zend_do_declare_property(&$1, NULL, CG(access_type) TSRMLS_CC); }
726 	|	T_VARIABLE '=' static_scalar	{ zend_do_declare_property(&$1, &$3, CG(access_type) TSRMLS_CC); }
727 ;
728 
729 class_constant_declaration:
730 		class_constant_declaration ',' T_STRING '=' static_scalar	{ zend_do_declare_class_constant(&$3, &$5 TSRMLS_CC); }
731 	|	T_CONST T_STRING '=' static_scalar	{ zend_do_declare_class_constant(&$2, &$4 TSRMLS_CC); }
732 ;
733 
734 echo_expr_list:
735 		echo_expr_list ',' expr { zend_do_echo(&$3 TSRMLS_CC); }
736 	|	expr					{ zend_do_echo(&$1 TSRMLS_CC); }
737 ;
738 
739 
740 for_expr:
741 		/* empty */			{ $$.op_type = IS_CONST;  Z_TYPE($$.u.constant) = IS_BOOL;  Z_LVAL($$.u.constant) = 1; }
742 	|	non_empty_for_expr	{ $$ = $1; }
743 ;
744 
745 non_empty_for_expr:
746 		non_empty_for_expr ','	{ zend_do_free(&$1 TSRMLS_CC); } expr { $$ = $4; }
747 	|	expr					{ $$ = $1; }
748 ;
749 
750 chaining_method_or_property:
751 		chaining_method_or_property variable_property 	{ $$.EA = $2.EA; }
752 	|	variable_property 								{ $$.EA = $1.EA; }
753 ;
754 
755 chaining_dereference:
756 		chaining_dereference '[' dim_offset ']'	{ fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
757 	|	'[' dim_offset ']'		{ zend_do_pop_object(&$1 TSRMLS_CC); fetch_array_dim(&$$, &$1, &$2 TSRMLS_CC); }
758 ;
759 
760 chaining_instance_call:
761 		chaining_dereference 		{ zend_do_push_object(&$1 TSRMLS_CC); } chaining_method_or_property { $$ = $3; }
762 	|	chaining_dereference 		{ zend_do_push_object(&$1 TSRMLS_CC); $$ = $1; }
763 	|	chaining_method_or_property { $$ = $1; }
764 ;
765 
766 instance_call:
767 		/* empty */ 		{ $$ = $0; }
768 	|	{ zend_do_push_object(&$0 TSRMLS_CC); zend_do_begin_variable_parse(TSRMLS_C); }
769 		chaining_instance_call	{ zend_do_pop_object(&$$ TSRMLS_CC); zend_do_end_variable_parse(&$2, BP_VAR_R, 0 TSRMLS_CC); }
770 ;
771 
772 new_expr:
773 		T_NEW class_name_reference { zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$1, &$2 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$$, &$1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
774 ;
775 
776 expr_without_variable:
777 		T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
778 	|	variable '=' expr		{ zend_check_writable_variable(&$1); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
779 	|	variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$4, BP_VAR_W, 1 TSRMLS_CC); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
780 	|	variable '=' '&' T_NEW class_name_reference { zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated");  zend_check_writable_variable(&$1); zend_do_extended_fcall_begin(TSRMLS_C); zend_do_begin_new_object(&$4, &$5 TSRMLS_CC); } ctor_arguments { zend_do_end_new_object(&$3, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); $3.EA = ZEND_PARSED_NEW; zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
781 	|	T_CLONE expr { zend_do_clone(&$$, &$2 TSRMLS_CC); }
782 	|	variable T_PLUS_EQUAL expr 	{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
783 	|	variable T_MINUS_EQUAL expr	{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); }
784 	|	variable T_MUL_EQUAL expr		{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); }
785 	|	variable T_POW_EQUAL expr		{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_POW, &$$, &$1, &$3 TSRMLS_CC); }
786 	|	variable T_DIV_EQUAL expr		{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); }
787 	|	variable T_CONCAT_EQUAL expr	{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
788 	|	variable T_MOD_EQUAL expr		{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); }
789 	|	variable T_AND_EQUAL expr		{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
790 	|	variable T_OR_EQUAL expr 		{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
791 	|	variable T_XOR_EQUAL expr 		{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
792 	|	variable T_SL_EQUAL expr	{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); }
793 	|	variable T_SR_EQUAL expr	{ zend_check_writable_variable(&$1); zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); }
794 	|	rw_variable T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); }
795 	|	T_INC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); }
796 	|	rw_variable T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); }
797 	|	T_DEC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_DEC TSRMLS_CC); }
798 	|	expr T_BOOLEAN_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
799 	|	expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
800 	|	expr T_LOGICAL_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
801 	|	expr T_LOGICAL_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
802 	|	expr T_LOGICAL_XOR expr { zend_do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); }
803 	|	expr '|' expr	{ zend_do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
804 	|	expr '&' expr	{ zend_do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
805 	|	expr '^' expr	{ zend_do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
806 	|	expr '.' expr 	{ zend_do_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
807 	|	expr '+' expr 	{ zend_do_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); }
808 	|	expr '-' expr 	{ zend_do_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); }
809 	|	expr '*' expr	{ zend_do_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); }
810 	|	expr T_POW expr	{ zend_do_binary_op(ZEND_POW, &$$, &$1, &$3 TSRMLS_CC); }
811 	|	expr '/' expr	{ zend_do_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); }
812 	|	expr '%' expr 	{ zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
813 	| 	expr T_SL expr	{ zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
814 	|	expr T_SR expr	{ zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
815 	|	'+' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); } }
816 	|	'-' expr %prec T_INC { ZVAL_LONG(&$1.u.constant, 0); if ($2.op_type == IS_CONST) { sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } else { $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); } }
817 	|	'!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
818 	|	'~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); }
819 	|	expr T_IS_IDENTICAL expr		{ zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
820 	|	expr T_IS_NOT_IDENTICAL expr	{ zend_do_binary_op(ZEND_IS_NOT_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
821 	|	expr T_IS_EQUAL expr			{ zend_do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
822 	|	expr T_IS_NOT_EQUAL expr 		{ zend_do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
823 	|	expr '<' expr 					{ zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 TSRMLS_CC); }
824 	|	expr T_IS_SMALLER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
825 	|	expr '>' expr 					{ zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); }
826 	|	expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); }
827 	|	expr T_INSTANCEOF class_name_reference { zend_do_instanceof(&$$, &$1, &$3, 0 TSRMLS_CC); }
828 	|	parenthesis_expr 	{ $$ = $1; }
829 	|	new_expr		{ $$ = $1; }
830 	|	'(' new_expr ')' { $$ = $2; } instance_call { $$ = $5; }
831 	|	expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
832 		expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); }
833 		expr	 { zend_do_qm_false(&$$, &$7, &$2, &$5 TSRMLS_CC); }
834 	|	expr '?' ':' { zend_do_jmp_set(&$1, &$2, &$3 TSRMLS_CC); }
835 		expr     { zend_do_jmp_set_else(&$$, &$5, &$2, &$3 TSRMLS_CC); }
836 	|	internal_functions_in_yacc { $$ = $1; }
837 	|	T_INT_CAST expr 	{ zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); }
838 	|	T_DOUBLE_CAST expr 	{ zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); }
839 	|	T_STRING_CAST expr	{ zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); }
840 	|	T_ARRAY_CAST expr 	{ zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
841 	|	T_OBJECT_CAST expr 	{ zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); }
842 	|	T_BOOL_CAST expr	{ zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); }
843 	|	T_UNSET_CAST expr	{ zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); }
844 	|	T_EXIT exit_expr	{ zend_do_exit(&$$, &$2 TSRMLS_CC); }
845 	|	'@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
846 	|	scalar				{ $$ = $1; }
847 	|	combined_scalar_offset { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); }
848 	|	combined_scalar { $$ = $1; }
849 	|	'`' backticks_expr '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); }
850 	|	T_PRINT expr  { zend_do_print(&$$, &$2 TSRMLS_CC); }
851 	|	T_YIELD { zend_do_yield(&$$, NULL, NULL, 0 TSRMLS_CC); }
852 	|	function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$1, $2.op_type, 0 TSRMLS_CC); }
853 		'(' parameter_list ')' lexical_vars
854 		'{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); $$ = $3; }
855 	|	T_STATIC function is_reference { zend_do_begin_lambda_function_declaration(&$$, &$2, $3.op_type, 1 TSRMLS_CC); }
856 		'(' parameter_list ')' lexical_vars
857 		'{' inner_statement_list '}' { zend_do_end_function_declaration(&$2 TSRMLS_CC); $$ = $4; }
858 ;
859 
860 yield_expr:
861 		T_YIELD expr_without_variable { zend_do_yield(&$$, &$2, NULL, 0 TSRMLS_CC); }
862 	|	T_YIELD variable { zend_do_yield(&$$, &$2, NULL, 1 TSRMLS_CC); }
863 	|	T_YIELD expr T_DOUBLE_ARROW expr_without_variable { zend_do_yield(&$$, &$4, &$2, 0 TSRMLS_CC); }
864 	|	T_YIELD expr T_DOUBLE_ARROW variable { zend_do_yield(&$$, &$4, &$2, 1 TSRMLS_CC); }
865 ;
866 
867 combined_scalar_offset:
868 		combined_scalar '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
869 	|	combined_scalar_offset '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
870 	|	T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { $1.EA = 0; zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
871 	|	general_constant '[' dim_offset ']' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
872 ;
873 
874 combined_scalar:
875 		T_ARRAY '(' array_pair_list ')' { $$ = $3; }
876 	|	'[' array_pair_list ']' { $$ = $2; }
877 ;
878 
879 function:
880 	T_FUNCTION { $$.u.op.opline_num = CG(zend_lineno); }
881 ;
882 
883 lexical_vars:
884 		/* empty */
885 	|	T_USE '(' lexical_var_list ')'
886 ;
887 
888 lexical_var_list:
889 		lexical_var_list ',' T_VARIABLE			{ zend_do_fetch_lexical_variable(&$3, 0 TSRMLS_CC); }
890 	|	lexical_var_list ',' '&' T_VARIABLE		{ zend_do_fetch_lexical_variable(&$4, 1 TSRMLS_CC); }
891 	|	T_VARIABLE								{ zend_do_fetch_lexical_variable(&$1, 0 TSRMLS_CC); }
892 	|	'&' T_VARIABLE							{ zend_do_fetch_lexical_variable(&$2, 1 TSRMLS_CC); }
893 ;
894 
895 function_call:
896 		namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$1, 1 TSRMLS_CC); }
897 		function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, $2.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
898 	|	T_NAMESPACE T_NS_SEPARATOR namespace_name { $1.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$1.u.constant);  zend_do_build_namespace_name(&$1, &$1, &$3 TSRMLS_CC); $$.u.op.opline_num = zend_do_begin_function_call(&$1, 0 TSRMLS_CC); }
899 		function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
900 	|	T_NS_SEPARATOR namespace_name { $$.u.op.opline_num = zend_do_begin_function_call(&$2, 0 TSRMLS_CC); }
901 		function_call_parameter_list { zend_do_end_function_call(&$2, &$$, 0, $3.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
902 	|	class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { $$.u.op.opline_num = zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
903 		function_call_parameter_list { zend_do_end_function_call($4.u.op.opline_num?NULL:&$3, &$$, $4.u.op.opline_num, $4.u.op.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
904 	|	class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
905 		function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
906 	|	variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
907 		function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
908 	|	variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { zend_do_end_variable_parse(&$3, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
909 		function_call_parameter_list { zend_do_end_function_call(NULL, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
910 	|	variable_without_objects { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1, 0 TSRMLS_CC); }
911 		function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
912 ;
913 
914 class_name:
915 		T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1, 1);}
916 	|	namespace_name { $$ = $1; }
917 	|	T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant);  zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
918 	|	T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; }
919 ;
920 
921 fully_qualified_class_name:
922 		namespace_name { $$ = $1; }
923 	|	T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant);  zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); }
924 	|	T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; }
925 ;
926 
927 
928 
929 class_name_reference:
930 		class_name						{ zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
931 	|	dynamic_class_name_reference	{ zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
932 ;
933 
934 
935 dynamic_class_name_reference:
936 		base_variable T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); }
937 			object_property { zend_do_push_object(&$4 TSRMLS_CC); } dynamic_class_name_variable_properties
938 			{ zend_do_pop_object(&$$ TSRMLS_CC); $$.EA = ZEND_PARSED_MEMBER; }
939 	|	base_variable { $$ = $1; }
940 ;
941 
942 
943 dynamic_class_name_variable_properties:
944 		dynamic_class_name_variable_properties dynamic_class_name_variable_property
945 	|	/* empty */
946 ;
947 
948 
949 dynamic_class_name_variable_property:
950 		T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); }
951 ;
952 
953 exit_expr:
954 		/* empty */	{ memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
955 	|	'(' ')'		{ memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
956 	|	parenthesis_expr	{ $$ = $1; }
957 ;
958 
959 backticks_expr:
960 		/* empty */	{ ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; }
961 	|	T_ENCAPSED_AND_WHITESPACE	{ $$ = $1; }
962 	|	encaps_list	{ $$ = $1; }
963 ;
964 
965 
966 ctor_arguments:
967 		/* empty */	{ Z_LVAL($$.u.constant) = 0; }
968 	|	function_call_parameter_list 	{ $$ = $1; }
969 ;
970 
971 
972 common_scalar:
973 		T_LNUMBER 					{ $$ = $1; }
974 	|	T_DNUMBER 					{ $$ = $1; }
975 	|	T_CONSTANT_ENCAPSED_STRING	{ $$ = $1; }
976 	|	T_LINE 						{ $$ = $1; }
977 	|	T_FILE 						{ $$ = $1; }
978 	|	T_DIR   					{ $$ = $1; }
979 	|	T_TRAIT_C					{ $$ = $1; }
980 	|	T_METHOD_C					{ $$ = $1; }
981 	|	T_FUNC_C					{ $$ = $1; }
982 	|	T_NS_C						{ $$ = $1; }
983 	|	T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
984 	|	T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; }
985 ;
986 
987 static_class_constant:
988 		class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT, 0 TSRMLS_CC); }
989 ;
990 
991 static_scalar: /* compile-time evaluated scalars */
992 	static_scalar_value { zend_do_constant_expression(&$$, $1.u.ast TSRMLS_CC); }
993 ;
994 
995 static_scalar_value:
996 		common_scalar	{ $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
997 	|	static_class_name_scalar	{ $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
998 	|	namespace_name 		{ zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
999 	|	T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant);  zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
1000 	|	T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
1001 	|	T_ARRAY '(' static_array_pair_list ')' { $$ = $3; }
1002 	|	'[' static_array_pair_list ']' { $$ = $2; }
1003 	|	static_class_constant { $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
1004 	|	T_CLASS_C			{ $$.u.ast = zend_ast_create_constant(&$1.u.constant); }
1005 	|	static_operation { $$ = $1; }
1006 ;
1007 
1008 static_operation:
1009 		static_scalar_value '[' static_scalar_value ']' { $$.u.ast = zend_ast_create_binary(ZEND_FETCH_DIM_R, $1.u.ast, $3.u.ast); }
1010 	|	static_scalar_value '+' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_ADD, $1.u.ast, $3.u.ast); }
1011 	|	static_scalar_value '-' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_SUB, $1.u.ast, $3.u.ast); }
1012 	|	static_scalar_value '*' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_MUL, $1.u.ast, $3.u.ast); }
1013 	|	static_scalar_value T_POW static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_POW, $1.u.ast, $3.u.ast); }
1014 	|	static_scalar_value '/' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_DIV, $1.u.ast, $3.u.ast); }
1015 	|	static_scalar_value '%' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_MOD, $1.u.ast, $3.u.ast); }
1016 	|	'!' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_BOOL_NOT, $2.u.ast); }
1017 	|	'~' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_BW_NOT, $2.u.ast); }
1018 	|	static_scalar_value '|' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BW_OR, $1.u.ast, $3.u.ast); }
1019 	|	static_scalar_value '&' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BW_AND, $1.u.ast, $3.u.ast); }
1020 	|	static_scalar_value '^' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BW_XOR, $1.u.ast, $3.u.ast); }
1021 	|	static_scalar_value T_SL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_SL, $1.u.ast, $3.u.ast); }
1022 	|	static_scalar_value T_SR static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_SR, $1.u.ast, $3.u.ast); }
1023 	|	static_scalar_value '.' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_CONCAT, $1.u.ast, $3.u.ast); }
1024 	|	static_scalar_value T_LOGICAL_XOR static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_XOR, $1.u.ast, $3.u.ast); }
1025 	|	static_scalar_value T_LOGICAL_AND static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_AND, $1.u.ast, $3.u.ast); }
1026 	|	static_scalar_value T_LOGICAL_OR static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_OR, $1.u.ast, $3.u.ast); }
1027 	|	static_scalar_value T_BOOLEAN_AND static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_AND, $1.u.ast, $3.u.ast); }
1028 	|	static_scalar_value T_BOOLEAN_OR static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_OR, $1.u.ast, $3.u.ast); }
1029 	|	static_scalar_value T_IS_IDENTICAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_IDENTICAL, $1.u.ast, $3.u.ast); }
1030 	|	static_scalar_value T_IS_NOT_IDENTICAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_NOT_IDENTICAL, $1.u.ast, $3.u.ast); }
1031 	|	static_scalar_value T_IS_EQUAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_EQUAL, $1.u.ast, $3.u.ast); }
1032 	|	static_scalar_value T_IS_NOT_EQUAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_NOT_EQUAL, $1.u.ast, $3.u.ast); }
1033 	|	static_scalar_value '<' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_SMALLER, $1.u.ast, $3.u.ast); }
1034 	|	static_scalar_value '>' static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_SMALLER, $3.u.ast, $1.u.ast); }
1035 	|	static_scalar_value T_IS_SMALLER_OR_EQUAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_SMALLER_OR_EQUAL, $1.u.ast, $3.u.ast); }
1036 	|	static_scalar_value T_IS_GREATER_OR_EQUAL static_scalar_value { $$.u.ast = zend_ast_create_binary(ZEND_IS_SMALLER_OR_EQUAL, $3.u.ast, $1.u.ast); }
1037 	|	static_scalar_value '?' ':' static_scalar_value { $$.u.ast = zend_ast_create_ternary(ZEND_SELECT, $1.u.ast, NULL, $4.u.ast); }
1038 	|	static_scalar_value '?' static_scalar_value ':' static_scalar_value { $$.u.ast = zend_ast_create_ternary(ZEND_SELECT, $1.u.ast, $3.u.ast, $5.u.ast); }
1039 	|	'+' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_UNARY_PLUS, $2.u.ast); }
1040 	|	'-' static_scalar_value { $$.u.ast = zend_ast_create_unary(ZEND_UNARY_MINUS, $2.u.ast); }
1041 	|	'(' static_scalar_value ')' { $$ = $2; }
1042 ;
1043 
1044 general_constant:
1045 		class_constant { $$ = $1; }
1046 	|	namespace_name	{ zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); }
1047 	|	T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant);  zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); }
1048 	|	T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
1049 ;
1050 
1051 scalar:
1052 		T_STRING_VARNAME { $$ = $1; }
1053 	|	general_constant { $$ = $1; }
1054 	|	class_name_scalar { $$ = $1; }
1055 	|	common_scalar { $$ = $1; }
1056 	|	'"' encaps_list '"' { $$ = $2; }
1057 	|	T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
1058 	|	T_CLASS_C { if (Z_TYPE($1.u.constant) == IS_CONSTANT) {zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC);} else {$$ = $1;} }
1059 ;
1060 
1061 static_array_pair_list:
1062 		/* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); $$.u.ast = zend_ast_create_constant(&$$.u.constant); }
1063 	|	non_empty_static_array_pair_list possible_comma	{ zend_ast_dynamic_shrink(&$1.u.ast); $$ = $1; }
1064 ;
1065 
1066 possible_comma:
1067 		/* empty */
1068 	|	','
1069 ;
1070 
1071 non_empty_static_array_pair_list:
1072 		non_empty_static_array_pair_list ',' static_scalar_value T_DOUBLE_ARROW static_scalar_value { zend_ast_dynamic_add(&$$.u.ast, $3.u.ast); zend_ast_dynamic_add(&$$.u.ast, $5.u.ast); }
1073 	|	non_empty_static_array_pair_list ',' static_scalar_value { zend_ast_dynamic_add(&$$.u.ast, NULL); zend_ast_dynamic_add(&$$.u.ast, $3.u.ast); }
1074 	|	static_scalar_value T_DOUBLE_ARROW static_scalar_value { $$.u.ast = zend_ast_create_dynamic(ZEND_INIT_ARRAY); zend_ast_dynamic_add(&$$.u.ast, $1.u.ast); zend_ast_dynamic_add(&$$.u.ast, $3.u.ast); }
1075 	|	static_scalar_value { $$.u.ast = zend_ast_create_dynamic(ZEND_INIT_ARRAY); zend_ast_dynamic_add(&$$.u.ast, NULL); zend_ast_dynamic_add(&$$.u.ast, $1.u.ast); }
1076 ;
1077 
1078 expr:
1079 		r_variable					{ $$ = $1; }
1080 	|	expr_without_variable		{ $$ = $1; }
1081 ;
1082 
1083 parenthesis_expr:
1084 		'(' expr ')'		{ $$ = $2; }
1085 	|	'(' yield_expr ')'	{ $$ = $2; }
1086 ;
1087 
1088 
1089 r_variable:
1090 	variable { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
1091 ;
1092 
1093 
1094 w_variable:
1095 	variable	{ zend_do_end_variable_parse(&$1, BP_VAR_W, 0 TSRMLS_CC); $$ = $1;
1096 				  zend_check_writable_variable(&$1); }
1097 ;
1098 
1099 rw_variable:
1100 	variable	{ zend_do_end_variable_parse(&$1, BP_VAR_RW, 0 TSRMLS_CC); $$ = $1;
1101 				  zend_check_writable_variable(&$1); }
1102 ;
1103 
1104 variable:
1105 		base_variable_with_function_calls T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); }
1106 			object_property { zend_do_push_object(&$4 TSRMLS_CC); } method_or_not variable_properties
1107 			{ zend_do_pop_object(&$$ TSRMLS_CC); $$.EA = $1.EA | ($7.EA ? $7.EA : $6.EA); }
1108 	|	base_variable_with_function_calls { $$ = $1; }
1109 ;
1110 
1111 variable_properties:
1112 		variable_properties variable_property { $$.EA = $2.EA; }
1113 	|	/* empty */ { $$.EA = 0; }
1114 ;
1115 
1116 
1117 variable_property:
1118 		T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); } method_or_not { $$.EA = $4.EA; }
1119 ;
1120 
1121 array_method_dereference:
1122 		array_method_dereference '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
1123 	|	method '[' dim_offset ']' { $1.EA = ZEND_PARSED_METHOD_CALL; fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
1124 ;
1125 
1126 method:
1127 		{ zend_do_pop_object(&$$ TSRMLS_CC); zend_do_begin_method_call(&$$ TSRMLS_CC); }
1128 		function_call_parameter_list { zend_do_end_function_call(&$1, &$$, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
1129 ;
1130 
1131 method_or_not:
1132 		method						{ $$ = $1; $$.EA = ZEND_PARSED_METHOD_CALL; zend_do_push_object(&$$ TSRMLS_CC); }
1133 	|	array_method_dereference	{ $$ = $1; zend_do_push_object(&$$ TSRMLS_CC); }
1134 	|	/* empty */ { $$.EA = ZEND_PARSED_MEMBER; }
1135 ;
1136 
1137 variable_without_objects:
1138 		reference_variable { $$ = $1; }
1139 	|	simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); }
1140 ;
1141 
1142 static_member:
1143 		class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
1144 	|	variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
1145 
1146 ;
1147 
1148 variable_class_name:
1149 		reference_variable { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); $$=$1;; }
1150 ;
1151 
1152 array_function_dereference:
1153 		array_function_dereference '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
1154 	|	function_call { zend_do_begin_variable_parse(TSRMLS_C); $1.EA = ZEND_PARSED_FUNCTION_CALL; }
1155 		'[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$4 TSRMLS_CC); }
1156 ;
1157 
1158 base_variable_with_function_calls:
1159 		base_variable				{ $$ = $1; }
1160 	|	array_function_dereference	{ $$ = $1; }
1161 	|	function_call { zend_do_begin_variable_parse(TSRMLS_C); $$ = $1; $$.EA = ZEND_PARSED_FUNCTION_CALL; }
1162 ;
1163 
1164 
1165 base_variable:
1166 		reference_variable { $$ = $1; $$.EA = ZEND_PARSED_VARIABLE; }
1167 	|	simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); $$.EA = ZEND_PARSED_VARIABLE; }
1168 	|	static_member { $$ = $1; $$.EA = ZEND_PARSED_STATIC_MEMBER; }
1169 ;
1170 
1171 reference_variable:
1172 		reference_variable '[' dim_offset ']'	{ fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
1173 	|	reference_variable '{' expr '}'		{ fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
1174 	|	compound_variable			{ zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
1175 ;
1176 
1177 
1178 compound_variable:
1179 		T_VARIABLE			{ $$ = $1; }
1180 	|	'$' '{' expr '}'	{ $$ = $3; }
1181 ;
1182 
1183 dim_offset:
1184 		/* empty */		{ $$.op_type = IS_UNUSED; }
1185 	|	expr			{ $$ = $1; }
1186 ;
1187 
1188 
1189 object_property:
1190 		object_dim_list { $$ = $1; }
1191 	|	variable_without_objects { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); } { znode tmp_znode;  zend_do_pop_object(&tmp_znode TSRMLS_CC);  zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
1192 ;
1193 
1194 object_dim_list:
1195 		object_dim_list '[' dim_offset ']'	{ fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
1196 	|	object_dim_list '{' expr '}'		{ fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
1197 	|	variable_name { znode tmp_znode;  zend_do_pop_object(&tmp_znode TSRMLS_CC);  zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
1198 ;
1199 
1200 variable_name:
1201 		T_STRING		{ $$ = $1; }
1202 	|	'{' expr '}'	{ $$ = $2; }
1203 ;
1204 
1205 simple_indirect_reference:
1206 		'$' { Z_LVAL($$.u.constant) = 1; }
1207 	|	simple_indirect_reference '$' { Z_LVAL($$.u.constant)++; }
1208 ;
1209 
1210 assignment_list:
1211 		assignment_list ',' assignment_list_element
1212 	|	assignment_list_element
1213 ;
1214 
1215 
1216 assignment_list_element:
1217 		variable								{ zend_do_add_list_element(&$1 TSRMLS_CC); }
1218 	|	T_LIST '(' { zend_do_new_list_begin(TSRMLS_C); } assignment_list ')'	{ zend_do_new_list_end(TSRMLS_C); }
1219 	|	/* empty */							{ zend_do_add_list_element(NULL TSRMLS_CC); }
1220 ;
1221 
1222 
1223 array_pair_list:
1224 		/* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); }
1225 	|	non_empty_array_pair_list possible_comma	{ $$ = $1; }
1226 ;
1227 
1228 non_empty_array_pair_list:
1229 		non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr	{ zend_do_add_array_element(&$$, &$5, &$3, 0 TSRMLS_CC); }
1230 	|	non_empty_array_pair_list ',' expr			{ zend_do_add_array_element(&$$, &$3, NULL, 0 TSRMLS_CC); }
1231 	|	expr T_DOUBLE_ARROW expr	{ zend_do_init_array(&$$, &$3, &$1, 0 TSRMLS_CC); }
1232 	|	expr 				{ zend_do_init_array(&$$, &$1, NULL, 0 TSRMLS_CC); }
1233 	|	non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable { zend_do_add_array_element(&$$, &$6, &$3, 1 TSRMLS_CC); }
1234 	|	non_empty_array_pair_list ',' '&' w_variable { zend_do_add_array_element(&$$, &$4, NULL, 1 TSRMLS_CC); }
1235 	|	expr T_DOUBLE_ARROW '&' w_variable	{ zend_do_init_array(&$$, &$4, &$1, 1 TSRMLS_CC); }
1236 	|	'&' w_variable 			{ zend_do_init_array(&$$, &$2, NULL, 1 TSRMLS_CC); }
1237 ;
1238 
1239 encaps_list:
1240 		encaps_list encaps_var { zend_do_end_variable_parse(&$2, BP_VAR_R, 0 TSRMLS_CC);  zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); }
1241 	|	encaps_list T_ENCAPSED_AND_WHITESPACE	{ zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
1242 	|	encaps_var { zend_do_end_variable_parse(&$1, BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, NULL, &$1 TSRMLS_CC); }
1243 	|	T_ENCAPSED_AND_WHITESPACE encaps_var	{ zend_do_add_string(&$$, NULL, &$1 TSRMLS_CC); zend_do_end_variable_parse(&$2, BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$$, &$2 TSRMLS_CC); }
1244 ;
1245 
1246 
1247 
1248 encaps_var:
1249 		T_VARIABLE { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
1250 	|	T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']'	{ fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); }
1251 	|	T_VARIABLE T_OBJECT_OPERATOR T_STRING { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$2, &$1, 1 TSRMLS_CC); zend_do_fetch_property(&$$, &$2, &$3 TSRMLS_CC); }
1252 	|	T_DOLLAR_OPEN_CURLY_BRACES expr '}' { zend_do_begin_variable_parse(TSRMLS_C);  fetch_simple_variable(&$$, &$2, 1 TSRMLS_CC); }
1253 	|	T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { zend_do_begin_variable_parse(TSRMLS_C);  fetch_array_begin(&$$, &$2, &$4 TSRMLS_CC); }
1254 	|	T_CURLY_OPEN variable '}' { $$ = $2; }
1255 ;
1256 
1257 
1258 encaps_var_offset:
1259 		T_STRING		{ $$ = $1; }
1260 	|	T_NUM_STRING	{ $$ = $1; }
1261 	|	T_VARIABLE		{ fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
1262 ;
1263 
1264 
1265 internal_functions_in_yacc:
1266 		T_ISSET '(' isset_variables ')' { $$ = $3; }
1267 	|	T_EMPTY '(' variable ')'	{ zend_do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 TSRMLS_CC); }
1268 	|	T_EMPTY '(' expr_without_variable ')' { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$3 TSRMLS_CC); }
1269 	|	T_INCLUDE expr 			{ zend_do_include_or_eval(ZEND_INCLUDE, &$$, &$2 TSRMLS_CC); }
1270 	|	T_INCLUDE_ONCE expr 	{ zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 TSRMLS_CC); }
1271 	|	T_EVAL '(' expr ')' 	{ zend_do_include_or_eval(ZEND_EVAL, &$$, &$3 TSRMLS_CC); }
1272 	|	T_REQUIRE expr			{ zend_do_include_or_eval(ZEND_REQUIRE, &$$, &$2 TSRMLS_CC); }
1273 	|	T_REQUIRE_ONCE expr		{ zend_do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 TSRMLS_CC); }
1274 ;
1275 
1276 isset_variables:
1277 		isset_variable			{ $$ = $1; }
1278 	|	isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } isset_variable { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
1279 ;
1280 
1281 isset_variable:
1282 		variable				{ zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); }
1283 	|	expr_without_variable	{ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use isset() on the result of an expression (you can use \"null !== expression\" instead)"); }
1284 ;
1285 
1286 class_constant:
1287 		class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }
1288 	|	variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }
1289 ;
1290 
1291 static_class_name_scalar:
1292 	class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS { zend_do_resolve_class_name(&$$, &$1, 1 TSRMLS_CC); }
1293 ;
1294 
1295 class_name_scalar:
1296 	class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS { zend_do_resolve_class_name(&$$, &$1, 0 TSRMLS_CC); }
1297 ;
1298 
1299 %%
1300 
1301 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1302    quotes and backslashes, so that it's suitable for yyerror.  The
1303    heuristic is that double-quoting is unnecessary unless the string
1304    contains an apostrophe, a comma, or backslash (other than
1305    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1306    null, do not copy; instead, return the length of what the result
1307    would have been.  */
1308 static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
1309 {
1310 	if (!yyres) {
1311 		return yystrlen(yystr);
1312 	}
1313 	{
1314 		TSRMLS_FETCH();
1315 		if (CG(parse_error) == 0) {
1316 			char buffer[120];
1317 			const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
1318 			unsigned int len = 0, toklen = 0, yystr_len;
1319 
1320 			CG(parse_error) = 1;
1321 
1322 			if (LANG_SCNG(yy_text)[0] == 0 &&
1323 				LANG_SCNG(yy_leng) == 1 &&
1324 				memcmp(yystr, "\"end of file\"", sizeof("\"end of file\"") - 1) == 0) {
1325 				yystpcpy(yyres, "end of file");
1326 				return sizeof("end of file")-1;
1327 			}
1328 
1329 			str = LANG_SCNG(yy_text);
1330 			end = memchr(str, '\n', LANG_SCNG(yy_leng));
1331 			yystr_len = yystrlen(yystr);
1332 
1333 			if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
1334 				&& (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
1335 				toklen = (tok2 - tok1) + 1;
1336 			} else {
1337 				tok1 = tok2 = NULL;
1338 				toklen = 0;
1339 			}
1340 
1341 			if (end == NULL) {
1342 				len = LANG_SCNG(yy_leng) > 30 ? 30 : LANG_SCNG(yy_leng);
1343 			} else {
1344 				len = (end - str) > 30 ? 30 : (end - str);
1345 			}
1346 			if (toklen) {
1347 				snprintf(buffer, sizeof(buffer), "'%.*s' %.*s", len, str, toklen, tok1);
1348 			} else {
1349 				snprintf(buffer, sizeof(buffer), "'%.*s'", len, str);
1350 			}
1351 			yystpcpy(yyres, buffer);
1352 			return len + (toklen ? toklen + 1 : 0) + 2;
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  */
1376