Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54243 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53634 invoked from network); 29 Jul 2011 02:25:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jul 2011 02:25:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=owenestea@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=owenestea@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.42 as permitted sender) X-PHP-List-Original-Sender: owenestea@gmail.com X-Host-Fingerprint: 209.85.161.42 mail-fx0-f42.google.com Received: from [209.85.161.42] ([209.85.161.42:63577] helo=mail-fx0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/81-35879-EF9123E4 for ; Thu, 28 Jul 2011 22:25:03 -0400 Received: by fxe23 with SMTP id 23so2102956fxe.29 for ; Thu, 28 Jul 2011 19:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=IFkTiOszJDsBH+q/o+P7hjEX7SG4eaED8IKc+ll8mcE=; b=rLdXDMRLYFVrSgAkf5WFz8s7U53vVOsXGI9lfoDteGjOWSK+9sYFmFIIJR83YsSuX3 +yOd0Och2aPKnEZySqQ5U2PP70nUzaUrwW7NDdv2dzOq5JRLO+OZXxPZphD618S2khwE Q8ctG/pN5oCD1bpJhWI84STekwyODvIoOvfgY= MIME-Version: 1.0 Received: by 10.204.156.86 with SMTP id v22mr217450bkw.214.1311906299295; Thu, 28 Jul 2011 19:24:59 -0700 (PDT) Received: by 10.204.42.4 with HTTP; Thu, 28 Jul 2011 19:24:59 -0700 (PDT) In-Reply-To: <1311897211.15749.0.camel@guybrush> References: <1311897211.15749.0.camel@guybrush> Date: Thu, 28 Jul 2011 19:24:59 -0700 Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] parsing break and continue statements From: owenestea@gmail.com (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=FCter : > 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 =A0"T_BREAK " (the same >> goes for the continue statement)? > > T_BREAK expr =A0allows things like > > =A0 $foo =3D rand(...); > =A0 break $foo; > > but we've dropped that for performance reasons in 5.4. > > johannes > >> Thanks in advance! >> >> kiyoto >> > > >