Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38054 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32013 invoked from network); 1 Jun 2008 16:10:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2008 16:10:21 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:40998] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/A9-54820-CE9C2484 for ; Sun, 01 Jun 2008 12:10:21 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 1 Jun 2008 19:11:32 +0300 Received: from [192.168.17.83] ([192.168.17.83]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Sun, 1 Jun 2008 09:10:40 -0700 Message-ID: <4842C9AF.6040803@zend.com> Date: Sun, 01 Jun 2008 19:09:19 +0300 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: 'PHP Internals' Content-Type: multipart/mixed; boundary="------------040105040207070505020503" X-OriginalArrivalTime: 01 Jun 2008 16:10:40.0846 (UTC) FILETIME=[098096E0:01C8C402] Subject: multiple use From: stas@zend.com (Stanislav Malyshev) --------------040105040207070505020503 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi! Attached is the patch that implements multiple elements in use statement, like this: use foo::bar as baz, foo::baz as bazbaz; Any objections to it? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com --------------040105040207070505020503 Content-Type: text/plain; name="multiuse.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="multiuse.diff" Index: zend_language_parser.y =================================================================== RCS file: /repository/ZendEngine2/zend_language_parser.y,v retrieving revision 1.160.2.4.2.8.2.20 diff -u -r1.160.2.4.2.8.2.20 zend_language_parser.y --- zend_language_parser.y 7 May 2008 12:04:37 -0000 1.160.2.4.2.8.2.20 +++ zend_language_parser.y 28 May 2008 19:12:45 -0000 @@ -172,13 +172,21 @@ | class_declaration_statement { zend_do_early_binding(TSRMLS_C); } | T_HALT_COMPILER '(' ')' ';' { zend_do_halt_compiler_register(TSRMLS_C); YYACCEPT; } | T_NAMESPACE namespace_name ';' { zend_do_namespace(&$2 TSRMLS_CC); } - | T_USE namespace_name ';' { zend_do_use(&$2, NULL, 0 TSRMLS_CC); } - | T_USE namespace_name T_AS T_STRING ';' { zend_do_use(&$2, &$4, 0 TSRMLS_CC); } - | T_USE T_PAAMAYIM_NEKUDOTAYIM T_STRING ';' { zend_do_use(&$3, NULL, 1 TSRMLS_CC); } - | T_USE T_PAAMAYIM_NEKUDOTAYIM T_STRING T_AS T_STRING ';' { zend_do_use(&$3, &$5, 1 TSRMLS_CC); } + | T_USE use_declarations ';' | constant_declaration ';' ; +use_declarations: + use_declarations ',' use_declaration + | use_declaration + +use_declaration: + namespace_name { zend_do_use(&$1, NULL, 0 TSRMLS_CC); } + | namespace_name T_AS T_STRING { zend_do_use(&$1, &$3, 0 TSRMLS_CC); } + | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_use(&$2, NULL, 1 TSRMLS_CC); } + | T_PAAMAYIM_NEKUDOTAYIM T_STRING T_AS T_STRING { zend_do_use(&$2, &$4, 1 TSRMLS_CC); } + + constant_declaration: constant_declaration ',' T_STRING '=' static_scalar { zend_do_declare_constant(&$3, &$5 TSRMLS_CC); } | T_CONST T_STRING '=' static_scalar { zend_do_declare_constant(&$2, &$4 TSRMLS_CC); } --------------040105040207070505020503--