com php-langspec: Fix yield / yield from precedence: spec/10-expressions.md spec/19-grammar.md

[email protected] (Nikita Popov) Fri, 15 Mar 2019 08:47:54 +0000
Newsgroups php.standards.cvs
Message-ID <[email protected]>
Commit:    b0dadd509b0fa94667f96ef32af4481ff2a23e1e=0AAuthor:    Nikita Pop=
ov <[email protected]>         Fri, 15 Mar 2019 09:47:54 +0100=0AParents=
:   1058a5042032e0ad00aed869ce80b839f3927d2c=0ABranches:  master=0A=0ALink:=
       http://git.php.net/?p=3Dphp-langspec.git;a=3Dcommitdiff;h=3Db0dadd50=
9b0fa94667f96ef32af4481ff2a23e1e=0A=0ALog:=0AFix yield / yield from precede=
nce=0A=0AChanged paths:=0A  M  spec/10-expressions.md=0A  M  spec/19-gramma=
r.md=0A=0A=0ADiff:=0Adiff --git a/spec/10-expressions.md b/spec/10-expressi=
ons.md=0Aindex 1523179..3ae61b3 100644=0A--- a/spec/10-expressions.md=0A+++=
 b/spec/10-expressions.md=0A@@ -3097,17 +3097,25 @@ $a[$i++] +=3D 50; // $a=
[1] =3D 250, $i =E2=86=92 2=0A **Syntax**=0A =0A <!-- GRAMMAR=0A+yield-from=
-expression:=0A+  'yield from' assignment-expression=0A+=0A yield-expressio=
n:=0A-  assignment-expression=0A-  'yield' array-element-initializer=0A-  '=
yield from' expression=0A+  yield-from-expression=0A+  'yield'=0A+  'yield'=
 yield-expression=0A+  'yield' yield-from-expression '=3D>' yield-expressio=
n=0A -->=0A =0A <pre>=0A+<i id=3D"grammar-yield-from-expression">yield-from=
-expression:</i>=0A+   yield from   <i><a href=3D"#grammar-assignment-expre=
ssion">assignment-expression</a></i>=0A+=0A <i id=3D"grammar-yield-expressi=
on">yield-expression:</i>=0A-   <i><a href=3D"#grammar-assignment-expressio=
n">assignment-expression</a></i>=0A-   yield   <i><a href=3D"#grammar-array=
-element-initializer">array-element-initializer</a></i>=0A-   yield from   =
<i><a href=3D"#grammar-expression">expression</a></i>=0A+   <i><a href=3D"#=
grammar-yield-from-expression">yield-from-expression</a></i>=0A+   yield=0A=
+   yield   <i><a href=3D"#grammar-yield-expression">yield-expression</a></=
i>=0A+   yield   <i><a href=3D"#grammar-yield-from-expression">yield-from-e=
xpression</a></i>   =3D&gt;   <i><a href=3D"#grammar-yield-expression">yiel=
d-expression</a></i>=0A </pre>=0A =0A **Semantics**=0A@@ -3127,22 +3135,13 =
@@ The `yield` operator produces the result `NULL` unless the method=0A [`G=
enerator->send`](14-classes.md#class-generator) was called to provide a res=
ult value. This=0A operator has the side effect of generating the next valu=
e in the collection.=0A =0A-Before being used, an *element-key* must have, =
or be converted to, type=0A-`int` or `string`. Keys with `float` or `bool` =
values, or numeric strings, are=0A-[converted to `int`](08-conversions.md#c=
onverting-to-integer-type). Values of all other key types are [converted to=
=0A-`string`](08-conversions.md#converting-to-string-type).=0A-=0A-If *elem=
ent-key* is omitted from an *array-element-initializer*, an=0A+If the key i=
s omitted from an a *yield-expression*, an=0A element key of type `int` is =
associated with the corresponding=0A-*element-value*. The key associated is=
 one more than the previously=0A+value. The key associated is one more than=
 the previously=0A assigned int key for this collection. However, if this i=
s the first=0A-element in this collection with an `int` key, key zero is us=
ed. If=0A-*element-key* is provided, it is associated with the correspondin=
g=0A-*element-value*. The resulting key/value pair is made available by=0A-=
`yield`.=0A+element in this collection with an `int` key, zero is used.=0A =
=0A-If *array-element-initializer* is omitted, default int-key assignment i=
s=0A-used and each value is `NULL`.=0A+If the value is also omitted, `NULL`=
 will be used instead.=0A =0A If the generator function definition declares=
 that it returns byRef,=0A each value in a key/value pair is yielded byRef.=
=0A@@ -3151,15 +3150,15 @@ The following applies only to the `yield from` f=
orm:=0A =0A A generator function (referred to as a *delegating generator*) =
can delegate to another generator function (referred to as a *subgenerator*=
), a Traversable object, or an array, each of which is designated by *expre=
ssion*.=0A =0A-Each value yielded by *expression* is passed directly to the=
 delegating generator's caller.=0A+Each value yielded by *assignment-expres=
sion* is passed directly to the delegating generator's caller.=0A =0A-Each =
value sent to the delegating generator's `send` method is passed to the sub=
generator's `send` method. If *expression* is not a generator function, any=
 sent values are ignored.=0A+Each value sent to the delegating generator's =
`send` method is passed to the subgenerator's `send` method. If *assignment=
-expression* is not a generator function, any sent values are ignored.=0A =
=0A-Exceptions thrown by *expression* are propagated up to the delegating g=
enerator.=0A+Exceptions thrown by *assignment-expression* are propagated up=
 to the delegating generator.=0A =0A Upon traversable completion, `NULL` is=
 returned to the delegating generator if the traversable is not a generator=
. If the traversable is a generator, its return value is sent to the delega=
ting generator as the value of the `yield from` *expression*.=0A =0A-An exc=
eption of type `Error` is thrown if *expression* evaluates to a generator t=
hat previously terminated with an uncaught exception, or it evaluates to so=
mething that is neither Traversable nor an array.=0A+An exception of type `=
Error` is thrown if *assignment-expression* evaluates to a generator that p=
reviously terminated with an uncaught exception, or it evaluates to somethi=
ng that is neither Traversable nor an array.=0A =0A **Examples**=0A =0Adiff=
 --git a/spec/19-grammar.md b/spec/19-grammar.md=0Aindex 8e2e69f..8d51d22 1=
00644=0A--- a/spec/19-grammar.md=0A+++ b/spec/19-grammar.md=0A@@ -672,10 +6=
72,14 @@ The grammar notation is described in [Grammars section](09-lexical=
-structure.md#=0A <i id=3D"grammar-compound-assignment-operator">compound-a=
ssignment-operator: one of</i>=0A    **=3D   *=3D   /=3D   %=3D   +=3D   -=
=3D   .=3D   &lt;&lt;=3D   &gt;&gt;=3D   &amp;=3D   ^=3D   |=3D=0A =0A+<i i=
d=3D"grammar-yield-from-expression">yield-from-expression:</i>=0A+   yield =
from   <i><a href=3D"#grammar-assignment-expression">assignment-expression<=
/a></i>=0A+=0A <i id=3D"grammar-yield-expression">yield-expression:</i>=0A-=
   <i><a href=3D"#grammar-assignment-expression">assignment-expression</a><=
/i>=0A-   yield   <i><a href=3D"#grammar-array-element-initializer">array-e=
lement-initializer</a></i>=0A-   yield from   <i><a href=3D"#grammar-expres=
sion">expression</a></i>=0A+   <i><a href=3D"#grammar-yield-from-expression=
">yield-from-expression</a></i>=0A+   yield=0A+   yield   <i><a href=3D"#gr=
ammar-yield-expression">yield-expression</a></i>=0A+   yield   <i><a href=
=3D"#grammar-yield-from-expression">yield-from-expression</a></i>   =3D&gt;=
   <i><a href=3D"#grammar-yield-expression">yield-expression</a></i>=0A =0A=
 <i id=3D"grammar-logical-AND-expression-2">logical-AND-expression-2:</i>=
=0A    <i><a href=3D"#grammar-yield-expression">yield-expression</a></i>=0A