summaryrefslogtreecommitdiff
path: root/Zend/zend_language_parser.y
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-03-16 18:43:21 +0800
committerXinchen Hui <laruence@php.net>2015-03-16 18:43:36 +0800
commiteeb8eced9b84cec85ae5652d0fe461bb2a7b3278 (patch)
tree3badef641961847f8f579c455810e3d6517eb905 /Zend/zend_language_parser.y
parent50e40334750b6e5bbccc2208ed3b470aac5673f2 (diff)
downloadphp-git-eeb8eced9b84cec85ae5652d0fe461bb2a7b3278.tar.gz
Improved parser (make use_type reuseable)
Diffstat (limited to 'Zend/zend_language_parser.y')
-rw-r--r--Zend/zend_language_parser.y12
1 files changed, 5 insertions, 7 deletions
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 69544ecf04..61ae8c5614 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -299,17 +299,14 @@ top_statement:
'{' top_statement_list '}'
{ $$ = zend_ast_create(ZEND_AST_NAMESPACE, NULL, $4); }
| T_USE mixed_group_use_declaration ';' { $$ = $2; }
- | T_USE T_FUNCTION group_use_declaration ';' { $$ = $3; $$->attr = T_FUNCTION; }
- | T_USE T_CONST group_use_declaration ';' { $$ = $3; $$->attr = T_CONST; }
+ | T_USE use_type group_use_declaration ';' { $$ = $3; $$->attr = $2; }
| T_USE use_declarations ';' { $$ = $2; $$->attr = T_CLASS; }
- | T_USE T_FUNCTION use_declarations ';' { $$ = $3; $$->attr = T_FUNCTION; }
- | T_USE T_CONST use_declarations ';' { $$ = $3; $$->attr = T_CONST; }
+ | T_USE use_type use_declarations ';' { $$ = $3; $$->attr = $2; }
| T_CONST const_list ';' { $$ = $2; }
;
use_type:
- /* empty */ { $$ = T_CLASS; }
- | T_FUNCTION { $$ = T_FUNCTION; }
+ T_FUNCTION { $$ = T_FUNCTION; }
| T_CONST { $$ = T_CONST; }
;
@@ -331,7 +328,8 @@ inline_use_declarations:
;
inline_use_declaration:
- use_type use_declaration { $$ = $2; $$->attr = $1; }
+ use_declaration { $$ = $1; $$->attr = T_CLASS; }
+ | use_type use_declaration { $$ = $2; $$->attr = $1; }
;
use_declarations: