1 : %{
2 : /*
3 : +----------------------------------------------------------------------+
4 : | Zend Engine |
5 : +----------------------------------------------------------------------+
6 : | Copyright (c) 1998-2006 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: zend_language_parser.y,v 1.160.2.4.2.4 2007/04/04 00:42:42 iliaa Exp $ */
22 :
23 : /*
24 : * LALR shift/reduce conflicts and how they are resolved:
25 : *
26 : * - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift.
27 : * - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift.
28 : * - 1 shift/reduce conflict due to objects within encapsulated strings. Solved by shift.
29 : *
30 : */
31 :
32 :
33 : #include "zend_compile.h"
34 : #include "zend.h"
35 : #include "zend_list.h"
36 : #include "zend_globals.h"
37 : #include "zend_API.h"
38 : #include "zend_constants.h"
39 :
40 :
41 : #define YYERROR_VERBOSE
42 : #define YYSTYPE znode
43 : #ifdef ZTS
44 : # define YYPARSE_PARAM tsrm_ls
45 : # define YYLEX_PARAM tsrm_ls
46 : #endif
47 :
48 :
49 : %}
50 :
51 : %pure_parser
52 : %expect 4
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 : %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
61 : %left '?' ':'
62 : %left T_BOOLEAN_OR
63 : %left T_BOOLEAN_AND
64 : %left '|'
65 : %left '^'
66 : %left '&'
67 : %nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL
68 : %nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
69 : %left T_SL T_SR
70 : %left '+' '-' '.'
71 : %left '*' '/' '%'
72 : %right '!'
73 : %nonassoc T_INSTANCEOF
74 : %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 '@'
75 : %right '['
76 : %nonassoc T_NEW T_CLONE
77 : %token T_EXIT
78 : %token T_IF
79 : %left T_ELSEIF
80 : %left T_ELSE
81 : %left T_ENDIF
82 : %token T_LNUMBER
83 : %token T_DNUMBER
84 : %token T_STRING
85 : %token T_STRING_VARNAME
86 : %token T_VARIABLE
87 : %token T_NUM_STRING
88 : %token T_INLINE_HTML
89 : %token T_CHARACTER
90 : %token T_BAD_CHARACTER
91 : %token T_ENCAPSED_AND_WHITESPACE
92 : %token T_CONSTANT_ENCAPSED_STRING
93 : %token T_ECHO
94 : %token T_DO
95 : %token T_WHILE
96 : %token T_ENDWHILE
97 : %token T_FOR
98 : %token T_ENDFOR
99 : %token T_FOREACH
100 : %token T_ENDFOREACH
101 : %token T_DECLARE
102 : %token T_ENDDECLARE
103 : %token T_AS
104 : %token T_SWITCH
105 : %token T_ENDSWITCH
106 : %token T_CASE
107 : %token T_DEFAULT
108 : %token T_BREAK
109 : %token T_CONTINUE
110 : %token T_FUNCTION
111 : %token T_CONST
112 : %token T_RETURN
113 : %token T_TRY
114 : %token T_CATCH
115 : %token T_THROW
116 : %token T_USE
117 : %token T_GLOBAL
118 : %right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC
119 : %token T_VAR
120 : %token T_UNSET
121 : %token T_ISSET
122 : %token T_EMPTY
123 : %token T_HALT_COMPILER
124 : %token T_CLASS
125 : %token T_INTERFACE
126 : %token T_EXTENDS
127 : %token T_IMPLEMENTS
128 : %token T_OBJECT_OPERATOR
129 : %token T_DOUBLE_ARROW
130 : %token T_LIST
131 : %token T_ARRAY
132 : %token T_CLASS_C
133 : %token T_METHOD_C
134 : %token T_FUNC_C
135 : %token T_LINE
136 : %token T_FILE
137 : %token T_COMMENT
138 : %token T_DOC_COMMENT
139 : %token T_OPEN_TAG
140 : %token T_OPEN_TAG_WITH_ECHO
141 : %token T_CLOSE_TAG
142 : %token T_WHITESPACE
143 : %token T_START_HEREDOC
144 : %token T_END_HEREDOC
145 : %token T_DOLLAR_OPEN_CURLY_BRACES
146 : %token T_CURLY_OPEN
147 : %token T_PAAMAYIM_NEKUDOTAYIM
148 :
149 : %% /* Rules */
150 :
151 : start:
152 : top_statement_list
153 : ;
154 :
155 : top_statement_list:
156 4994 : top_statement_list { zend_do_extended_info(TSRMLS_C); } top_statement { HANDLE_INTERACTIVE(); }
157 4994 : | /* empty */
158 : ;
159 :
160 :
161 : top_statement:
162 : statement
163 906 : | function_declaration_statement { zend_do_early_binding(TSRMLS_C); }
164 906 : | class_declaration_statement { zend_do_early_binding(TSRMLS_C); }
165 5 : | T_HALT_COMPILER '(' ')' ';' { zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; }
166 : ;
167 :
168 :
169 : inner_statement_list:
170 4368 : inner_statement_list { zend_do_extended_info(TSRMLS_C); } inner_statement { HANDLE_INTERACTIVE(); }
171 4368 : | /* empty */
172 : ;
173 :
174 :
175 : inner_statement:
176 : statement
177 : | function_declaration_statement
178 : | class_declaration_statement
179 0 : | T_HALT_COMPILER '(' ')' ';' { zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); }
180 0 : ;
181 :
182 :
183 : statement:
184 4213 : unticked_statement { zend_do_ticks(TSRMLS_C); }
185 4213 : ;
186 :
187 : unticked_statement:
188 : '{' inner_statement_list '}'
189 990 : | T_IF '(' expr ')' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } statement { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } elseif_list else_single { zend_do_if_end(TSRMLS_C); }
190 990 : | T_IF '(' expr ')' ':' { zend_do_if_cond(&$3, &$4 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$4, 1 TSRMLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { zend_do_if_end(TSRMLS_C); }
191 26 : | T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { zend_do_while_cond(&$4, &$5 TSRMLS_CC); } while_statement { zend_do_while_end(&$1, &$5 TSRMLS_CC); }
192 41 : | T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement T_WHILE '(' { $5.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' ';' { zend_do_do_while_end(&$1, &$5, &$7 TSRMLS_CC); }
193 3 : | T_FOR
194 : '('
195 : for_expr
196 9 : ';' { zend_do_free(&$3 TSRMLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); }
197 9 : for_expr
198 9 : ';' { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(&$6, &$7 TSRMLS_CC); }
199 9 : for_expr
200 9 : ')' { zend_do_free(&$9 TSRMLS_CC); zend_do_for_before_statement(&$4, &$7 TSRMLS_CC); }
201 9 : for_statement { zend_do_for_end(&$7 TSRMLS_CC); }
202 19 : | T_SWITCH '(' expr ')' { zend_do_switch_cond(&$3 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$6 TSRMLS_CC); }
203 20 : | T_BREAK ';' { zend_do_brk_cont(ZEND_BRK, NULL TSRMLS_CC); }
204 62 : | T_BREAK expr ';' { zend_do_brk_cont(ZEND_BRK, &$2 TSRMLS_CC); }
205 0 : | T_CONTINUE ';' { zend_do_brk_cont(ZEND_CONT, NULL TSRMLS_CC); }
206 4 : | T_CONTINUE expr ';' { zend_do_brk_cont(ZEND_CONT, &$2 TSRMLS_CC); }
207 0 : | T_RETURN ';' { zend_do_return(NULL, 0 TSRMLS_CC); }
208 1 : | T_RETURN expr_without_variable ';' { zend_do_return(&$2, 0 TSRMLS_CC); }
209 15 : | T_RETURN variable ';' { zend_do_return(&$2, 1 TSRMLS_CC); }
210 11 : | T_GLOBAL global_var_list ';'
211 : | T_STATIC static_var_list ';'
212 : | T_ECHO echo_expr_list ';'
213 1 : | T_INLINE_HTML { zend_do_echo(&$1 TSRMLS_CC); }
214 1 : | expr ';' { zend_do_free(&$1 TSRMLS_CC); }
215 2705 : | T_USE use_filename ';' { zend_error(E_COMPILE_ERROR,"use: Not yet supported. Please use include_once() or require_once()"); zval_dtor(&$2.u.constant); }
216 0 : | T_UNSET '(' unset_variables ')' ';'
217 : | T_FOREACH '(' variable T_AS
218 41 : { zend_do_foreach_begin(&$1, &$2, &$3, &$4, 1 TSRMLS_CC); }
219 41 : foreach_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); }
220 41 : foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); }
221 41 : | T_FOREACH '(' expr_without_variable T_AS
222 1 : { zend_do_foreach_begin(&$1, &$2, &$3, &$4, 0 TSRMLS_CC); }
223 1 : variable foreach_optional_arg ')' { zend_check_writable_variable(&$6); zend_do_foreach_cont(&$1, &$2, &$4, &$6, &$7 TSRMLS_CC); }
224 1 : foreach_statement { zend_do_foreach_end(&$1, &$4 TSRMLS_CC); }
225 1 : | T_DECLARE { $1.u.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); }
226 0 : | ';' /* empty statement */
227 8 : | T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
228 8 : T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
229 8 : fully_qualified_class_name { zend_do_first_catch(&$7 TSRMLS_CC); }
230 8 : T_VARIABLE ')' { zend_do_begin_catch(&$1, &$9, &$11, 1 TSRMLS_CC); }
231 8 : '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
232 8 : additional_catches { zend_do_mark_last_catch(&$7, &$18 TSRMLS_CC); }
233 8 : | T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
234 3 : ;
235 :
236 :
237 : additional_catches:
238 0 : non_empty_additional_catches { $$ = $1; }
239 0 : | /* empty */ { $$.u.opline_num = -1; }
240 8 : ;
241 :
242 : non_empty_additional_catches:
243 0 : additional_catch { $$ = $1; }
244 0 : | non_empty_additional_catches additional_catch { $$ = $2; }
245 0 : ;
246 :
247 :
248 : additional_catch:
249 0 : T_CATCH '(' fully_qualified_class_name { $$.u.opline_num = get_next_op_number(CG(active_op_array)); } T_VARIABLE ')' { zend_do_begin_catch(&$1, &$3, &$5, 0 TSRMLS_CC); } '{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
250 0 : ;
251 :
252 :
253 : unset_variables:
254 : unset_variable
255 : | unset_variables ',' unset_variable
256 : ;
257 :
258 : unset_variable:
259 2 : variable { zend_do_end_variable_parse(BP_VAR_UNSET, 0 TSRMLS_CC); zend_do_unset(&$1 TSRMLS_CC); }
260 2 : ;
261 :
262 : use_filename:
263 0 : T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
264 0 : | '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; }
265 0 : ;
266 :
267 :
268 : function_declaration_statement:
269 906 : unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); }
270 906 : ;
271 :
272 : class_declaration_statement:
273 5 : unticked_class_declaration_statement { zend_do_ticks(TSRMLS_C); }
274 5 : ;
275 :
276 :
277 : is_reference:
278 916 : /* empty */ { $$.op_type = ZEND_RETURN_VAL; }
279 916 : | '&' { $$.op_type = ZEND_RETURN_REF; }
280 0 : ;
281 :
282 :
283 : unticked_function_declaration_statement:
284 1812 : T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$1, &$4, 0, $3.op_type, NULL TSRMLS_CC); }
285 1812 : '(' parameter_list ')' '{' inner_statement_list '}' { zend_do_end_function_declaration(&$1 TSRMLS_CC); }
286 906 : ;
287 :
288 : unticked_class_declaration_statement:
289 : class_entry_type T_STRING extends_from
290 5 : { zend_do_begin_class_declaration(&$1, &$2, &$3 TSRMLS_CC); }
291 5 : implements_list
292 : '{'
293 : class_statement_list
294 5 : '}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); }
295 5 : | interface_entry T_STRING
296 0 : { zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); }
297 0 : interface_extends_list
298 : '{'
299 : class_statement_list
300 0 : '}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); }
301 0 : ;
302 :
303 :
304 : class_entry_type:
305 5 : T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = 0; }
306 5 : | T_ABSTRACT T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
307 0 : | T_FINAL T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_FINAL_CLASS; }
308 0 : ;
309 :
310 : extends_from:
311 0 : /* empty */ { $$.op_type = IS_UNUSED; }
312 0 : | T_EXTENDS fully_qualified_class_name { $$ = $2; }
313 5 : ;
314 :
315 : interface_entry:
316 0 : T_INTERFACE { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_INTERFACE; }
317 0 : ;
318 :
319 : interface_extends_list:
320 : /* empty */
321 : | T_EXTENDS interface_list
322 : ;
323 :
324 : implements_list:
325 : /* empty */
326 : | T_IMPLEMENTS interface_list
327 : ;
328 :
329 : interface_list:
330 0 : fully_qualified_class_name { zend_do_implements_interface(&$1 TSRMLS_CC); }
331 0 : | interface_list ',' fully_qualified_class_name { zend_do_implements_interface(&$3 TSRMLS_CC); }
332 0 : ;
333 :
334 : foreach_optional_arg:
335 34 : /* empty */ { $$.op_type = IS_UNUSED; }
336 34 : | T_DOUBLE_ARROW foreach_variable { $$ = $2; }
337 8 : ;
338 :
339 :
340 : foreach_variable:
341 49 : variable { zend_check_writable_variable(&$1); $$ = $1; }
342 49 : | '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
343 0 : ;
344 :
345 : for_statement:
346 : statement
347 : | ':' inner_statement_list T_ENDFOR ';'
348 : ;
349 :
350 :
351 : foreach_statement:
352 : statement
353 : | ':' inner_statement_list T_ENDFOREACH ';'
354 : ;
355 :
356 :
357 : declare_statement:
358 : statement
359 : | ':' inner_statement_list T_ENDDECLARE ';'
360 : ;
361 :
362 :
363 : declare_list:
364 0 : T_STRING '=' static_scalar { zend_do_declare_stmt(&$1, &$3 TSRMLS_CC); }
365 0 : | declare_list ',' T_STRING '=' static_scalar { zend_do_declare_stmt(&$3, &$5 TSRMLS_CC); }
366 0 : ;
367 :
368 :
369 : switch_case_list:
370 10 : '{' case_list '}' { $$ = $2; }
371 10 : | '{' ';' case_list '}' { $$ = $3; }
372 0 : | ':' case_list T_ENDSWITCH ';' { $$ = $2; }
373 0 : | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; }
374 0 : ;
375 :
376 :
377 : case_list:
378 10 : /* empty */ { $$.op_type = IS_UNUSED; }
379 75 : | 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; }
380 131 : | 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; }
381 2 : ;
382 :
383 :
384 : case_separator:
385 : ':'
386 : | ';'
387 : ;
388 :
389 :
390 : while_statement:
391 : statement
392 : | ':' inner_statement_list T_ENDWHILE ';'
393 : ;
394 :
395 :
396 :
397 : elseif_list:
398 : /* empty */
399 6 : | elseif_list T_ELSEIF '(' expr ')' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } statement { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
400 6 : ;
401 :
402 :
403 : new_elseif_list:
404 : /* empty */
405 0 : | new_elseif_list T_ELSEIF '(' expr ')' ':' { zend_do_if_cond(&$4, &$5 TSRMLS_CC); } inner_statement_list { zend_do_if_after_statement(&$5, 0 TSRMLS_CC); }
406 0 : ;
407 :
408 :
409 : else_single:
410 : /* empty */
411 : | T_ELSE statement
412 : ;
413 :
414 :
415 : new_else_single:
416 : /* empty */
417 : | T_ELSE ':' inner_statement_list
418 : ;
419 :
420 :
421 : parameter_list:
422 : non_empty_parameter_list
423 : | /* empty */
424 : ;
425 :
426 :
427 : non_empty_parameter_list:
428 796 : optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; Z_LVAL($$.u.constant)=1; Z_TYPE($$.u.constant)=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, &$2, 0 TSRMLS_CC); }
429 796 : | optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; Z_LVAL($$.u.constant)=1; Z_TYPE($$.u.constant)=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$1, &$3, 1 TSRMLS_CC); }
430 1 : | optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 TSRMLS_CC); $$.op_type = IS_CONST; Z_LVAL($$.u.constant)=1; Z_TYPE($$.u.constant)=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, &$1, &$3, 1 TSRMLS_CC); }
431 0 : | optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$2, 0 TSRMLS_CC); $$.op_type = IS_CONST; Z_LVAL($$.u.constant)=1; Z_TYPE($$.u.constant)=IS_LONG; INIT_PZVAL(&$$.u.constant); zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$4, &$1, &$2, 0 TSRMLS_CC); }
432 1 : | non_empty_parameter_list ',' optional_class_type T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; Z_LVAL($$.u.constant)++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, &$4, 0 TSRMLS_CC); }
433 139 : | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; Z_LVAL($$.u.constant)++; zend_do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, &$3, &$5, 1 TSRMLS_CC); }
434 1 : | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$5, 0 TSRMLS_CC); $$=$1; Z_LVAL($$.u.constant)++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$7, &$3, &$5, 1 TSRMLS_CC); }
435 0 : | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$4, 0 TSRMLS_CC); $$=$1; Z_LVAL($$.u.constant)++; zend_do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$6, &$3, &$4, 0 TSRMLS_CC); }
436 10 : ;
437 :
438 :
439 : optional_class_type:
440 948 : /* empty */ { $$.op_type = IS_UNUSED; }
441 948 : | T_STRING { $$ = $1; }
442 0 : | T_ARRAY { $$.op_type = IS_CONST; Z_TYPE($$.u.constant)=IS_NULL;}
443 0 : ;
444 :
445 :
446 : function_call_parameter_list:
447 3741 : non_empty_function_call_parameter_list { $$ = $1; }
448 3741 : | /* empty */ { Z_LVAL($$.u.constant) = 0; }
449 220 : ;
450 :
451 :
452 : non_empty_function_call_parameter_list:
453 2460 : expr_without_variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$1, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); }
454 2460 : | variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$1, ZEND_SEND_VAR, Z_LVAL($$.u.constant) TSRMLS_CC); }
455 1281 : | '&' w_variable { Z_LVAL($$.u.constant) = 1; zend_do_pass_param(&$2, ZEND_SEND_REF, Z_LVAL($$.u.constant) TSRMLS_CC); }
456 0 : | non_empty_function_call_parameter_list ',' expr_without_variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$3, ZEND_SEND_VAL, Z_LVAL($$.u.constant) TSRMLS_CC); }
457 1791 : | non_empty_function_call_parameter_list ',' variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$3, ZEND_SEND_VAR, Z_LVAL($$.u.constant) TSRMLS_CC); }
458 815 : | non_empty_function_call_parameter_list ',' '&' w_variable { Z_LVAL($$.u.constant)=Z_LVAL($1.u.constant)+1; zend_do_pass_param(&$4, ZEND_SEND_REF, Z_LVAL($$.u.constant) TSRMLS_CC); }
459 0 : ;
460 :
461 : global_var_list:
462 47 : global_var_list ',' global_var { zend_do_fetch_global_variable(&$3, NULL, ZEND_FETCH_GLOBAL_LOCK TSRMLS_CC); }
463 47 : | global_var { zend_do_fetch_global_variable(&$1, NULL, ZEND_FETCH_GLOBAL_LOCK TSRMLS_CC); }
464 19 : ;
465 :
466 :
467 : global_var:
468 66 : T_VARIABLE { $$ = $1; }
469 66 : | '$' r_variable { $$ = $2; }
470 0 : | '$' '{' expr '}' { $$ = $3; }
471 0 : ;
472 :
473 :
474 : static_var_list:
475 0 : static_var_list ',' T_VARIABLE { zend_do_fetch_static_variable(&$3, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
476 0 : | static_var_list ',' T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$3, &$5, ZEND_FETCH_STATIC TSRMLS_CC); }
477 0 : | T_VARIABLE { zend_do_fetch_static_variable(&$1, NULL, ZEND_FETCH_STATIC TSRMLS_CC); }
478 0 : | T_VARIABLE '=' static_scalar { zend_do_fetch_static_variable(&$1, &$3, ZEND_FETCH_STATIC TSRMLS_CC); }
479 1 :
480 : ;
481 :
482 :
483 : class_statement_list:
484 : class_statement_list class_statement
485 : | /* empty */
486 : ;
487 :
488 :
489 : class_statement:
490 3 : variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';'
491 3 : | class_constant_declaration ';'
492 20 : | method_modifiers T_FUNCTION { $2.u.opline_num = CG(zend_lineno); } is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$5, 1, $4.op_type, &$1 TSRMLS_CC); } '('
493 20 : parameter_list ')' method_body { zend_do_abstract_method(&$5, &$1, &$10 TSRMLS_CC); zend_do_end_function_declaration(&$2 TSRMLS_CC); }
494 10 : ;
495 :
496 :
497 : method_body:
498 0 : ';' /* abstract method */ { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
499 0 : | '{' inner_statement_list '}' { Z_LVAL($$.u.constant) = 0; }
500 10 : ;
501 :
502 : variable_modifiers:
503 3 : non_empty_member_modifiers { $$ = $1; }
504 3 : | T_VAR { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
505 0 : ;
506 :
507 : method_modifiers:
508 4 : /* empty */ { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
509 4 : | non_empty_member_modifiers { $$ = $1; if (!(Z_LVAL($$.u.constant) & ZEND_ACC_PPP_MASK)) { Z_LVAL($$.u.constant) |= ZEND_ACC_PUBLIC; } }
510 6 : ;
511 :
512 : non_empty_member_modifiers:
513 9 : member_modifier { $$ = $1; }
514 9 : | non_empty_member_modifiers member_modifier { Z_LVAL($$.u.constant) = zend_do_verify_access_types(&$1, &$2); }
515 4 : ;
516 :
517 : member_modifier:
518 4 : T_PUBLIC { Z_LVAL($$.u.constant) = ZEND_ACC_PUBLIC; }
519 4 : | T_PROTECTED { Z_LVAL($$.u.constant) = ZEND_ACC_PROTECTED; }
520 2 : | T_PRIVATE { Z_LVAL($$.u.constant) = ZEND_ACC_PRIVATE; }
521 3 : | T_STATIC { Z_LVAL($$.u.constant) = ZEND_ACC_STATIC; }
522 0 : | T_ABSTRACT { Z_LVAL($$.u.constant) = ZEND_ACC_ABSTRACT; }
523 0 : | T_FINAL { Z_LVAL($$.u.constant) = ZEND_ACC_FINAL; }
524 4 : ;
525 :
526 : class_variable_declaration:
527 0 : class_variable_declaration ',' T_VARIABLE { zend_do_declare_property(&$3, NULL, CG(access_type) TSRMLS_CC); }
528 0 : | class_variable_declaration ',' T_VARIABLE '=' static_scalar { zend_do_declare_property(&$3, &$5, CG(access_type) TSRMLS_CC); }
529 0 : | T_VARIABLE { zend_do_declare_property(&$1, NULL, CG(access_type) TSRMLS_CC); }
530 3 : | T_VARIABLE '=' static_scalar { zend_do_declare_property(&$1, &$3, CG(access_type) TSRMLS_CC); }
531 0 : ;
532 :
533 : class_constant_declaration:
534 0 : class_constant_declaration ',' T_STRING '=' static_scalar { zend_do_declare_class_constant(&$3, &$5 TSRMLS_CC); }
535 0 : | T_CONST T_STRING '=' static_scalar { zend_do_declare_class_constant(&$2, &$4 TSRMLS_CC); }
536 0 : ;
537 :
538 : echo_expr_list:
539 25 : echo_expr_list ',' expr { zend_do_echo(&$3 TSRMLS_CC); }
540 25 : | expr { zend_do_echo(&$1 TSRMLS_CC); }
541 227 : ;
542 :
543 :
544 : for_expr:
545 0 : /* empty */ { $$.op_type = IS_CONST; Z_TYPE($$.u.constant) = IS_BOOL; Z_LVAL($$.u.constant) = 1; }
546 0 : | non_empty_for_expr { $$ = $1; }
547 27 : ;
548 :
549 : non_empty_for_expr:
550 4 : non_empty_for_expr ',' { zend_do_free(&$1 TSRMLS_CC); } expr { $$ = $4; }
551 4 : | expr { $$ = $1; }
552 27 : ;
553 :
554 : expr_without_variable:
555 4 : T_LIST '(' { zend_do_list_init(TSRMLS_C); } assignment_list ')' '=' expr { zend_do_list_end(&$$, &$7 TSRMLS_CC); }
556 4 : | variable '=' expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign(&$$, &$1, &$3 TSRMLS_CC); }
557 565 : | variable '=' '&' variable { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$4 TSRMLS_CC); }
558 0 : | variable '=' '&' T_NEW class_name_reference { zend_error(E_STRICT, "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, &$7 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); zend_do_assign_ref(&$$, &$1, &$3 TSRMLS_CC); }
559 58 : | 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, &$4 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
560 116 : | T_CLONE expr { zend_do_clone(&$$, &$2 TSRMLS_CC); }
561 1 : | variable T_PLUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC); }
562 5 : | variable T_MINUS_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 TSRMLS_CC); }
563 0 : | variable T_MUL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 TSRMLS_CC); }
564 0 : | variable T_DIV_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 TSRMLS_CC); }
565 0 : | variable T_CONCAT_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
566 52 : | variable T_MOD_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 TSRMLS_CC); }
567 0 : | variable T_AND_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
568 0 : | variable T_OR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
569 0 : | variable T_XOR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
570 0 : | variable T_SL_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 TSRMLS_CC); }
571 0 : | variable T_SR_EQUAL expr { zend_check_writable_variable(&$1); zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); zend_do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 TSRMLS_CC); }
572 0 : | rw_variable T_INC { zend_do_post_incdec(&$$, &$1, ZEND_POST_INC TSRMLS_CC); }
573 18 : | T_INC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_INC TSRMLS_CC); }
574 16 : | rw_variable T_DEC { zend_do_post_incdec(&$$, &$1, ZEND_POST_DEC TSRMLS_CC); }
575 5 : | T_DEC rw_variable { zend_do_pre_incdec(&$$, &$2, ZEND_PRE_DEC TSRMLS_CC); }
576 26 : | expr T_BOOLEAN_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
577 87 : | expr T_BOOLEAN_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
578 191 : | expr T_LOGICAL_OR { zend_do_boolean_or_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_or_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
579 244 : | expr T_LOGICAL_AND { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } expr { zend_do_boolean_and_end(&$$, &$1, &$4, &$2 TSRMLS_CC); }
580 20 : | expr T_LOGICAL_XOR expr { zend_do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 TSRMLS_CC); }
581 0 : | expr '|' expr { zend_do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 TSRMLS_CC); }
582 7 : | expr '&' expr { zend_do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 TSRMLS_CC); }
583 0 : | expr '^' expr { zend_do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 TSRMLS_CC); }
584 0 : | expr '.' expr { zend_do_binary_op(ZEND_CONCAT, &$$, &$1, &$3 TSRMLS_CC); }
585 288 : | expr '+' expr { zend_do_binary_op(ZEND_ADD, &$$, &$1, &$3 TSRMLS_CC); }
586 20 : | expr '-' expr { zend_do_binary_op(ZEND_SUB, &$$, &$1, &$3 TSRMLS_CC); }
587 6 : | expr '*' expr { zend_do_binary_op(ZEND_MUL, &$$, &$1, &$3 TSRMLS_CC); }
588 6 : | expr '/' expr { zend_do_binary_op(ZEND_DIV, &$$, &$1, &$3 TSRMLS_CC); }
589 6 : | expr '%' expr { zend_do_binary_op(ZEND_MOD, &$$, &$1, &$3 TSRMLS_CC); }
590 0 : | expr T_SL expr { zend_do_binary_op(ZEND_SL, &$$, &$1, &$3 TSRMLS_CC); }
591 0 : | expr T_SR expr { zend_do_binary_op(ZEND_SR, &$$, &$1, &$3 TSRMLS_CC); }
592 0 : | '+' expr { Z_LVAL($1.u.constant)=0; Z_TYPE($1.u.constant)=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_ADD, &$$, &$1, &$2 TSRMLS_CC); }
593 0 : | '-' expr { Z_LVAL($1.u.constant)=0; Z_TYPE($1.u.constant)=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); zend_do_binary_op(ZEND_SUB, &$$, &$1, &$2 TSRMLS_CC); }
594 5 : | '!' expr { zend_do_unary_op(ZEND_BOOL_NOT, &$$, &$2 TSRMLS_CC); }
595 511 : | '~' expr { zend_do_unary_op(ZEND_BW_NOT, &$$, &$2 TSRMLS_CC); }
596 0 : | expr T_IS_IDENTICAL expr { zend_do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
597 17 : | expr T_IS_NOT_IDENTICAL expr { zend_do_binary_op(ZEND_IS_NOT_IDENTICAL, &$$, &$1, &$3 TSRMLS_CC); }
598 15 : | expr T_IS_EQUAL expr { zend_do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
599 51 : | expr T_IS_NOT_EQUAL expr { zend_do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
600 12 : | expr '<' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 TSRMLS_CC); }
601 122 : | expr T_IS_SMALLER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 TSRMLS_CC); }
602 1 : | expr '>' expr { zend_do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 TSRMLS_CC); }
603 123 : | expr T_IS_GREATER_OR_EQUAL expr { zend_do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 TSRMLS_CC); }
604 0 : | expr T_INSTANCEOF class_name_reference { zend_do_instanceof(&$$, &$1, &$3, 0 TSRMLS_CC); }
605 0 : | '(' expr ')' { $$ = $2; }
606 30 : | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
607 24 : expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); }
608 24 : expr { zend_do_qm_false(&$$, &$7, &$2, &$5 TSRMLS_CC); }
609 24 : | internal_functions_in_yacc { $$ = $1; }
610 163 : | T_INT_CAST expr { zend_do_cast(&$$, &$2, IS_LONG TSRMLS_CC); }
611 0 : | T_DOUBLE_CAST expr { zend_do_cast(&$$, &$2, IS_DOUBLE TSRMLS_CC); }
612 216 : | T_STRING_CAST expr { zend_do_cast(&$$, &$2, IS_STRING TSRMLS_CC); }
613 0 : | T_ARRAY_CAST expr { zend_do_cast(&$$, &$2, IS_ARRAY TSRMLS_CC); }
614 1 : | T_OBJECT_CAST expr { zend_do_cast(&$$, &$2, IS_OBJECT TSRMLS_CC); }
615 2 : | T_BOOL_CAST expr { zend_do_cast(&$$, &$2, IS_BOOL TSRMLS_CC); }
616 0 : | T_UNSET_CAST expr { zend_do_cast(&$$, &$2, IS_NULL TSRMLS_CC); }
617 0 : | T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
618 291 : | '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
619 346 : | scalar { $$ = $1; }
620 5046 : | T_ARRAY '(' array_pair_list ')' { $$ = $3; }
621 108 : | '`' encaps_list '`' { zend_do_shell_exec(&$$, &$2 TSRMLS_CC); }
622 3 : | T_PRINT expr { zend_do_print(&$$, &$2 TSRMLS_CC); }
623 9 : ;
624 :
625 : function_call:
626 3654 : T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); }
627 3654 : function_call_parameter_list
628 3654 : ')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
629 3654 : | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
630 47 : function_call_parameter_list
631 47 : ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
632 47 : | fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
633 0 : function_call_parameter_list
634 0 : ')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
635 0 : | variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); }
636 0 : function_call_parameter_list ')'
637 0 : { zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
638 0 : ;
639 :
640 : fully_qualified_class_name:
641 75 : T_STRING { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
642 75 : ;
643 :
644 : class_name_reference:
645 57 : T_STRING { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
646 57 : | dynamic_class_name_reference { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
647 1 : ;
648 :
649 :
650 : dynamic_class_name_reference:
651 0 : base_variable T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); }
652 0 : object_property { zend_do_push_object(&$4 TSRMLS_CC); zend_do_declare_implicit_property(TSRMLS_C); } dynamic_class_name_variable_properties
653 0 : { zend_do_pop_object(&$$ TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_MEMBER; }
654 0 : | base_variable { $$ = $1; }
655 1 : ;
656 :
657 :
658 : dynamic_class_name_variable_properties:
659 : dynamic_class_name_variable_properties dynamic_class_name_variable_property
660 : | /* empty */
661 : ;
662 :
663 :
664 : dynamic_class_name_variable_property:
665 0 : T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); zend_do_declare_implicit_property(TSRMLS_C); }
666 0 : ;
667 :
668 : exit_expr:
669 2 : /* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
670 2 : | '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
671 108 : | '(' expr ')' { $$ = $2; }
672 8 : ;
673 :
674 :
675 : ctor_arguments:
676 10 : /* empty */ { Z_LVAL($$.u.constant)=0; }
677 10 : | '(' function_call_parameter_list ')' { $$ = $2; }
678 48 : ;
679 :
680 :
681 : common_scalar:
682 945 : T_LNUMBER { $$ = $1; }
683 945 : | T_DNUMBER { $$ = $1; }
684 34 : | T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
685 2748 : | T_LINE { $$ = $1; }
686 0 : | T_FILE { $$ = $1; }
687 16 : | T_CLASS_C { $$ = $1; }
688 0 : | T_METHOD_C { $$ = $1; }
689 0 : | T_FUNC_C { $$ = $1; }
690 0 : ;
691 :
692 :
693 : static_scalar: /* compile-time evaluated scalars */
694 3 : common_scalar { $$ = $1; }
695 3 : | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT TSRMLS_CC); }
696 8 : | '+' static_scalar { $$ = $2; }
697 0 : | '-' static_scalar { zval minus_one; Z_TYPE(minus_one) = IS_LONG; Z_LVAL(minus_one) = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one TSRMLS_CC); $$ = $2; }
698 0 : | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; }
699 1 : | static_class_constant { $$ = $1; }
700 0 : ;
701 :
702 : static_class_constant:
703 0 : T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT TSRMLS_CC); }
704 0 : ;
705 :
706 : scalar:
707 768 : T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT TSRMLS_CC); }
708 768 : | T_STRING_VARNAME { $$ = $1; }
709 0 : | class_constant { $$ = $1; }
710 15 : | common_scalar { $$ = $1; }
711 3740 : | '"' encaps_list '"' { $$ = $2; }
712 518 : | '\'' encaps_list '\'' { $$ = $2; }
713 0 : | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; zend_do_end_heredoc(TSRMLS_C); }
714 5 : ;
715 :
716 :
717 : static_array_pair_list:
718 1 : /* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); }
719 1 : | non_empty_static_array_pair_list possible_comma { $$ = $1; }
720 0 : ;
721 :
722 : possible_comma:
723 : /* empty */
724 : | ','
725 : ;
726 :
727 : non_empty_static_array_pair_list:
728 0 : non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { zend_do_add_static_array_element(&$$, &$3, &$5); }
729 0 : | non_empty_static_array_pair_list ',' static_scalar { zend_do_add_static_array_element(&$$, NULL, &$3); }
730 0 : | static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, &$1, &$3); }
731 0 : | static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); zend_do_add_static_array_element(&$$, NULL, &$1); }
732 0 : ;
733 :
734 : expr:
735 3892 : r_variable { $$ = $1; }
736 3892 : | expr_without_variable { $$ = $1; }
737 3728 : ;
738 :
739 :
740 : r_variable:
741 3892 : variable { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); $$ = $1; }
742 3892 : ;
743 :
744 :
745 : w_variable:
746 0 : variable { zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC); $$ = $1; }
747 0 : { zend_check_writable_variable(&$1); }
748 0 : ;
749 :
750 : rw_variable:
751 40 : variable { zend_do_end_variable_parse(BP_VAR_RW, 0 TSRMLS_CC); $$ = $1; }
752 40 : { zend_check_writable_variable(&$1); }
753 40 : ;
754 :
755 : variable:
756 263 : base_variable_with_function_calls T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); }
757 263 : object_property { zend_do_push_object(&$4 TSRMLS_CC); } method_or_not variable_properties
758 263 : { zend_do_pop_object(&$$ TSRMLS_CC); $$.u.EA.type = $1.u.EA.type | ($7.u.EA.type ? $7.u.EA.type : $6.u.EA.type); }
759 263 : | base_variable_with_function_calls { $$ = $1; }
760 6558 : ;
761 :
762 : variable_properties:
763 15 : variable_properties variable_property { $$.u.EA.type = $2.u.EA.type; }
764 15 : | /* empty */ { $$.u.EA.type = 0; }
765 263 : ;
766 :
767 :
768 : variable_property:
769 30 : T_OBJECT_OPERATOR object_property { zend_do_push_object(&$2 TSRMLS_CC); } method_or_not { $$.u.EA.type = $4.u.EA.type; }
770 30 : ;
771 :
772 : method_or_not:
773 212 : '(' { zend_do_pop_object(&$1 TSRMLS_CC); zend_do_begin_method_call(&$1 TSRMLS_CC); }
774 212 : function_call_parameter_list ')'
775 212 : { zend_do_end_function_call(&$1, &$$, &$3, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);
776 212 : zend_do_push_object(&$$ TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_METHOD_CALL; }
777 212 : | /* empty */ { zend_do_declare_implicit_property(TSRMLS_C); $$.u.EA.type = ZEND_PARSED_MEMBER; }
778 66 : ;
779 :
780 : variable_without_objects:
781 1 : reference_variable { $$ = $1; }
782 1 : | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); }
783 0 : ;
784 :
785 : static_member:
786 0 : fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = $3; zend_do_fetch_static_member(&$$, &$1 TSRMLS_CC); }
787 0 : ;
788 :
789 :
790 : base_variable_with_function_calls:
791 3120 : base_variable { $$ = $1; }
792 3120 : | function_call { zend_do_begin_variable_parse(TSRMLS_C); $$ = $1; $$.u.EA.type = ZEND_PARSED_FUNCTION_CALL; }
793 3701 : ;
794 :
795 :
796 : base_variable:
797 3121 : reference_variable { $$ = $1; $$.u.EA.type = ZEND_PARSED_VARIABLE; }
798 3121 : | simple_indirect_reference reference_variable { zend_do_indirect_references(&$$, &$1, &$2 TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_VARIABLE; }
799 0 : | static_member { $$ = $1; $$.u.EA.type = ZEND_PARSED_STATIC_MEMBER; }
800 0 : ;
801 :
802 : reference_variable:
803 357 : reference_variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
804 357 : | reference_variable '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
805 0 : | compound_variable { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
806 3122 : ;
807 :
808 :
809 : compound_variable:
810 3122 : T_VARIABLE { $$ = $1; }
811 3122 : | '$' '{' expr '}' { $$ = $3; }
812 0 : ;
813 :
814 : dim_offset:
815 26 : /* empty */ { $$.op_type = IS_UNUSED; }
816 26 : | expr { $$ = $1; }
817 374 : ;
818 :
819 :
820 : object_property:
821 277 : object_dim_list { $$ = $1; }
822 278 : | variable_without_objects { zend_do_end_variable_parse(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);}
823 2 : ;
824 :
825 : object_dim_list:
826 43 : object_dim_list '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); }
827 43 : | object_dim_list '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 TSRMLS_CC); }
828 0 : | variable_name { znode tmp_znode; zend_do_pop_object(&tmp_znode TSRMLS_CC); zend_do_fetch_property(&$$, &tmp_znode, &$1 TSRMLS_CC);}
829 277 : ;
830 :
831 : variable_name:
832 277 : T_STRING { $$ = $1; }
833 277 : | '{' expr '}' { $$ = $2; }
834 0 : ;
835 :
836 : simple_indirect_reference:
837 0 : '$' { Z_LVAL($$.u.constant) = 1; }
838 0 : | simple_indirect_reference '$' { Z_LVAL($$.u.constant)++; }
839 0 : ;
840 :
841 : assignment_list:
842 : assignment_list ',' assignment_list_element
843 : | assignment_list_element
844 : ;
845 :
846 :
847 : assignment_list_element:
848 4 : variable { zend_do_add_list_element(&$1 TSRMLS_CC); }
849 4 : | T_LIST '(' { zend_do_new_list_begin(TSRMLS_C); } assignment_list ')' { zend_do_new_list_end(TSRMLS_C); }
850 0 : | /* empty */ { zend_do_add_list_element(NULL TSRMLS_CC); }
851 0 : ;
852 :
853 :
854 : array_pair_list:
855 31 : /* empty */ { zend_do_init_array(&$$, NULL, NULL, 0 TSRMLS_CC); }
856 31 : | non_empty_array_pair_list possible_comma { $$ = $1; }
857 77 : ;
858 :
859 : non_empty_array_pair_list:
860 84 : non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { zend_do_add_array_element(&$$, &$5, &$3, 0 TSRMLS_CC); }
861 84 : | non_empty_array_pair_list ',' expr { zend_do_add_array_element(&$$, &$3, NULL, 0 TSRMLS_CC); }
862 47 : | expr T_DOUBLE_ARROW expr { zend_do_init_array(&$$, &$3, &$1, 0 TSRMLS_CC); }
863 48 : | expr { zend_do_init_array(&$$, &$1, NULL, 0 TSRMLS_CC); }
864 29 : | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable { zend_do_add_array_element(&$$, &$6, &$3, 1 TSRMLS_CC); }
865 0 : | non_empty_array_pair_list ',' '&' w_variable { zend_do_add_array_element(&$$, &$4, NULL, 1 TSRMLS_CC); }
866 0 : | expr T_DOUBLE_ARROW '&' w_variable { zend_do_init_array(&$$, &$4, &$1, 1 TSRMLS_CC); }
867 0 : | '&' w_variable { zend_do_init_array(&$$, &$2, NULL, 1 TSRMLS_CC); }
868 0 : ;
869 :
870 : encaps_list:
871 578 : encaps_list encaps_var { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_add_variable(&$$, &$1, &$2 TSRMLS_CC); }
872 578 : | encaps_list T_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
873 1313 : | encaps_list T_NUM_STRING { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
874 20 : | encaps_list T_ENCAPSED_AND_WHITESPACE { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
875 1456 : | encaps_list T_CHARACTER { zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
876 49 : | encaps_list T_BAD_CHARACTER { zend_do_add_string(&$$, &$1, &$2 TSRMLS_CC); }
877 1 : | encaps_list '[' { Z_LVAL($2.u.constant) = (long) '['; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
878 20 : | encaps_list ']' { Z_LVAL($2.u.constant) = (long) ']'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
879 20 : | encaps_list '{' { Z_LVAL($2.u.constant) = (long) '{'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
880 3 : | encaps_list '}' { Z_LVAL($2.u.constant) = (long) '}'; zend_do_add_char(&$$, &$1, &$2 TSRMLS_CC); }
881 3 : | encaps_list T_OBJECT_OPERATOR { znode tmp; Z_LVAL($2.u.constant) = (long) '-'; zend_do_add_char(&tmp, &$1, &$2 TSRMLS_CC); Z_LVAL($2.u.constant) = (long) '>'; zend_do_add_char(&$$, &tmp, &$2 TSRMLS_CC); }
882 0 : | /* empty */ { zend_do_init_string(&$$ TSRMLS_CC); }
883 526 :
884 : ;
885 :
886 :
887 :
888 : encaps_var:
889 556 : T_VARIABLE { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
890 561 : | T_VARIABLE '[' { zend_do_begin_variable_parse(TSRMLS_C); } encaps_var_offset ']' { fetch_array_begin(&$$, &$1, &$4 TSRMLS_CC); }
891 10 : | 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); }
892 0 : | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(&$$, &$2, 1 TSRMLS_CC); }
893 0 : | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { zend_do_begin_variable_parse(TSRMLS_C); fetch_array_begin(&$$, &$2, &$4 TSRMLS_CC); }
894 0 : | T_CURLY_OPEN variable '}' { $$ = $2; }
895 17 : ;
896 :
897 :
898 : encaps_var_offset:
899 0 : T_STRING { $$ = $1; }
900 0 : | T_NUM_STRING { $$ = $1; }
901 5 : | T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 TSRMLS_CC); }
902 0 : ;
903 :
904 :
905 : internal_functions_in_yacc:
906 28 : T_ISSET '(' isset_variables ')' { $$ = $3; }
907 28 : | T_EMPTY '(' variable ')' { zend_do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 TSRMLS_CC); }
908 18 : | T_INCLUDE expr { zend_do_include_or_eval(ZEND_INCLUDE, &$$, &$2 TSRMLS_CC); }
909 116 : | T_INCLUDE_ONCE expr { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, &$$, &$2 TSRMLS_CC); }
910 0 : | T_EVAL '(' expr ')' { zend_do_include_or_eval(ZEND_EVAL, &$$, &$3 TSRMLS_CC); }
911 1 : | T_REQUIRE expr { zend_do_include_or_eval(ZEND_REQUIRE, &$$, &$2 TSRMLS_CC); }
912 0 : | T_REQUIRE_ONCE expr { zend_do_include_or_eval(ZEND_REQUIRE_ONCE, &$$, &$2 TSRMLS_CC); }
913 0 : ;
914 :
915 : isset_variables:
916 28 : variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); }
917 28 : | isset_variables ',' { zend_do_boolean_and_begin(&$1, &$2 TSRMLS_CC); } variable { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, &tmp, &$4 TSRMLS_CC); zend_do_boolean_and_end(&$$, &$1, &tmp, &$2 TSRMLS_CC); }
918 0 : ;
919 :
920 : class_constant:
921 15 : fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT TSRMLS_CC); }
922 : ;
923 :
924 : %%
925 :
926 : /*
927 : * Local variables:
928 : * tab-width: 4
929 : * c-basic-offset: 4
930 : * indent-tabs-mode: t
931 : * End:
932 : */
|