Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54312 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95816 invoked from network); 3 Aug 2011 12:26:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2011 12:26:39 -0000 Authentication-Results: pb1.pair.com header.from=juzna.cz@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=juzna.cz@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.42 as permitted sender) X-PHP-List-Original-Sender: juzna.cz@gmail.com X-Host-Fingerprint: 209.85.218.42 mail-yi0-f42.google.com Received: from [209.85.218.42] ([209.85.218.42:53735] helo=mail-yi0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/A2-11280-E7E393E4 for ; Wed, 03 Aug 2011 08:26:39 -0400 Received: by yih10 with SMTP id 10so451351yih.29 for ; Wed, 03 Aug 2011 05:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=VaSw/88Bo+1644Lf3tNPXz1fQYolMTkPgEX89xGTBnM=; b=qaU+1JjCOPszok1rx1Bjljg0g5nK6xWCH8GXtQxj22euE/JTCf5u/9AZ1BWDKXDT+2 qVK3keM0HZGl9bPH+c7u1C5NNcHqsk55goeR8hhYTRwvtLuFdb4sP1A2UGD5w4OD1HOT 8f63HTq+PgCHb3rwY3JUktTu+EkZq8pNeOK8M= Received: by 10.42.163.129 with SMTP id c1mr813176icy.179.1312374396325; Wed, 03 Aug 2011 05:26:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.37.12 with HTTP; Wed, 3 Aug 2011 05:26:16 -0700 (PDT) In-Reply-To: References: <1311897211.15749.0.camel@guybrush> Date: Wed, 3 Aug 2011 13:26:16 +0100 Message-ID: To: Kiyoto Tamura Cc: =?UTF-8?Q?Johannes_Schl=C3=BCter?= , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] parsing break and continue statements From: juzna.cz@gmail.com (Jan Dolecek) I guess to get a clear error message, because this is a BC change. Many people would wonder why working scripts are causing parse errors after upgrade of php. Makes sense to have error messages as clear as possible ;) Jan Dolecek juzna.cz@gmail.com 2011/7/29 Kiyoto Tamura : > Hi Johannes, > > Thanks for your reply :) What I meant was that why does the parser > still accept any expression after T_BREAK/CONTINUE and defer the error > check to zend_do_brk_cont? Isn't it clearer to only accept if the > expression following T_BREAK/CONTINUE is a positive integer (if there > is any expression at all)? > > Kiyoto > > 2011/7/28 Johannes Schl=C3=BCter : >> On Thu, 2011-07-28 at 16:10 -0700, Kiyoto Tamura wrote: >>> Hi, >>> >>> I am new to the PHP internals, and I was just looking through the code >>> related to parsing break/continue statements. It looks that as of PHP >>> 5.4, Zend/zend_language_parser.y accepts both "T_BREAK expr" and >>> "T_CONTINUE expr" and check to make sure "expr" is a positive integer >>> in the function zend_do_brk_cont. Doesn't it make more sense to >>> replace "T_BREAK expr" with =C2=A0"T_BREAK " (the sam= e >>> goes for the continue statement)? >> >> T_BREAK expr =C2=A0allows things like >> >> =C2=A0 $foo =3D rand(...); >> =C2=A0 break $foo; >> >> but we've dropped that for performance reasons in 5.4. >> >> johannes >> >>> Thanks in advance! >>> >>> kiyoto >>> >> >> >> > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >