php/php-langspec

Describe list expression differently to remove some constraits

zhujinxuan opened this issue · 0 comments

Hi, I think it is perhaps better to document the list-expression in this way, which automatically ensures there is at least one valid element:

list-intrinsic:
   list   (   list-expression-list   )

list-expression-list:
  commas? list-element commas?
  commas? list-element , list-expression-list?

commas:
  ,
  , commas

list-element
   expression   =>   list-or-variable
   list-or-variable

Then we can remove the following constraints documentation:

At least one of the elements of the list-expression-list must be non-empty.

I think this makes the document a bit neater and parser can write the list parser just by reading the expression.

I can submit a PR if you think this is a good change.