summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-04-15 20:51:17 -0700
committerRob Pike <r@golang.org>2009-04-15 20:51:17 -0700
commit34de30a3ab3ec917222972aa988f6ab9d990bdbe (patch)
treefeaee0b8e48f6d3704ed3d35160d4026b95c1f26
parent88c25089749701eefd1deff17ca076abe18c716f (diff)
downloadgolang-34de30a3ab3ec917222972aa988f6ab9d990bdbe.tar.gz
tweak grammar and associated prose to permit things like x.y in range clauses.
R=rsc DELTA=5 (3 added, 0 deleted, 2 changed) OCL=27536 CL=27540
-rw-r--r--doc/go_spec.html7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 9d8d2b4e0..e788050b1 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -3452,7 +3452,7 @@ of iteration variables - and then executes the block.
</p>
<pre class="grammar">
-RangeClause = IdentifierList ( "=" | ":=" ) "range" Expression .
+RangeClause = ExpressionList ( "=" | ":=" ) "range" Expression .
</pre>
<p>
@@ -3460,7 +3460,10 @@ The type of the right-hand expression in the "range" clause must be an
array, slice, string or map, or a pointer to an array, slice, string or map;
or it may be a channel.
Except for channels,
-the identifier list must contain one or two identifiers denoting the
+the identifier list must contain one or two expressions
+(as in assignments, these must be a
+variable, pointer indirection, field selector, or index expression)
+denoting the
iteration variables. On each iteration,
the first variable is set to the string, array or slice index or
map key, and the second variable, if present, is set to the corresponding