[PR][php-langspec][#169][master] - Fix constant-expression specification

[email protected] Fri, 11 Nov 2016 20:44:29 +0000
Newsgroups php.standards
Message-ID <[email protected]>
You can view the Pull Request on github:
https://github.com/php/php-langspec/pull/169

Warning: according to github, the Pull Request cannot be merged without manual conflict resolution!

Pull Request Description:
Previously, a `constant-expression` was defined as a superset of `expression`, and a `primary-expression` as a superset of `constant-expression`, which causes confusion when attempting to parse the grammar for a few reasons:
  1. `constant-expression->array-creation-expression` and `expression->yield-expression-> ... -> postfix-expression -> array-creation-expression`, which meant that constant-expression was rendered completely redundant within the grammar.
  2. `primary-expression -> constant-expression -> expression`, which makes determining operator precedence challenging.
  3. `constant-expression->expression` is improperly specified as requiring a scalar type, when it could also be an array.

This fix addresses all of these issues by more concretely defining the constant-expression type in `19-grammar.md`, and updating the constraints defined in `10-expressions.md`.