Re: parsing break and continue statements
| From: | Johannes Schlüter | Date: | Thu, 28 Jul 2011 23:53:30 +0000 |
| Subject: | Re: parsing break and continue statements | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54240@lists.php.net to get a copy of this message | ||
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 "T_BREAK <positive integer>" (the same
> goes for the continue statement)?
T_BREAK expr allows things like
$foo = rand(...);
break $foo;
but we've dropped that for performance reasons in 5.4.
johannes
> Thanks in advance!
>
> kiyoto
>