diff options
Diffstat (limited to 'Zend/zend-parser.y')
| -rw-r--r-- | Zend/zend-parser.y | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y index e2461a3962..b8eb3239da 100644 --- a/Zend/zend-parser.y +++ b/Zend/zend-parser.y @@ -43,7 +43,7 @@ %pure_parser %expect 4 -%left T_INCLUDE T_EVAL +%left T_INCLUDE T_EVAL T_IMPORT %left ',' %left T_LOGICAL_OR %left T_LOGICAL_XOR @@ -100,6 +100,7 @@ %token T_CONST %token T_RETURN %token T_REQUIRE +%token T_USE %token T_GLOBAL %token T_STATIC %token T_VAR @@ -179,13 +180,20 @@ statement: | T_ECHO echo_expr_list ';' | T_INLINE_HTML { do_echo(&$1 CLS_CC); } | expr ';' { do_free(&$1 CLS_CC); } - | T_REQUIRE expr ';' { if ($2.op_type==IS_CONST && $2.u.constant.type==IS_STRING) { require_filename($2.u.constant.value.str.val CLS_CC); zval_dtor(&$2.u.constant); } else { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } } + | T_REQUIRE expr ';' { if ($2.op_type==IS_CONST && $2.u.constant.type==IS_STRING) { require_filename($2.u.constant.value.str.val, 0 CLS_CC); zval_dtor(&$2.u.constant); } else { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } } + | T_USE use_filename ';' { require_filename($2.u.constant.value.str.val, 1 CLS_CC); zval_dtor(&$2.u.constant); } | T_UNSET '(' r_cvar ')' ';' { do_unset(&$3 CLS_CC); } | T_FOREACH '(' expr T_AS { do_foreach_begin(&$1, &$3, &$2, &$4 CLS_CC); } w_cvar foreach_optional_arg ')' { do_foreach_cont(&$6, &$7, &$4 CLS_CC); } foreach_statement { do_foreach_end(&$1, &$2 CLS_CC); } | ';' /* empty statement */ ; +use_filename: + T_CONSTANT_ENCAPSED_STRING { $$ = $1; } + | '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; } +; + + declaration_statement: T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); } '(' parameter_list ')' '{' inner_statement_list '}' { do_end_function_declaration(&$1 CLS_CC); } @@ -656,8 +664,9 @@ encaps_var_offset: internal_functions_in_yacc: T_ISSET '(' cvar ')' { do_isset_or_isempty(ZEND_ISSET, &$$, &$3 CLS_CC); } | T_EMPTY '(' cvar ')' { do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 CLS_CC); } - | T_INCLUDE expr { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } + | T_INCLUDE expr { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } | T_EVAL '(' expr ')' { do_include_or_eval(ZEND_EVAL, &$$, &$3 CLS_CC); } + | T_IMPORT '(' expr ')' { do_include_or_eval(ZEND_IMPORT, &$$, &$3 CLS_CC); } ; |
