[php-langspec][Issue #235] - yield and array initializer precedence not specified correctly
| From: | noreply@php.net | Date: | Fri, 15 Mar 2019 08:50:27 +0000 |
| Subject: | [php-langspec][Issue #235] - yield and array initializer precedence not specified correctly | ||
| Groups: | php.standards | ||
| Request: | Send a blank email to standards-+get-1417@lists.php.net to get a copy of this message | ||
You can view the Issue on github:
https://github.com/php/php-langspec/issues/235
Opened By: nikic
Issue Description:
Split off from #208:
Currently
[array-element-initializer](https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#grammar-array-element-initializer)
specifies that the key and value are both ordinary expressions. As specified, this is ambiguous with
[yield-expression](https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#grammar-yield-expression).
PHP resolves this as follows:
```php
[yield "foo" => "bar"]
// is
[(yield "foo" => "bar")]
// rather than
[(yield "foo") => "bar"]
```
However, I'm not sure how this can be specified in grammar form.