Skip to content

Commit 5583e8a

Browse files
committed
spec: fix EBNF for slice syntax
The () parentheses grouped wrongly. Removed them completely in favor of separate 2- and 3-index slice alternatives which is clearer. Fixes #14477. Change-Id: I0b7521ac912130d9ea8740b8793b3b88e2609418 Reviewed-on: https://go-review.googlesource.com/19853 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 735e5a4 commit 5583e8a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

doc/go_spec.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Version of January 5, 2016",
3+
"Subtitle": "Version of February 23, 2016",
44
"Path": "/ref/spec"
55
}-->
66

@@ -2443,9 +2443,8 @@ <h3 id="Primary_expressions">Primary expressions</h3>
24432443

24442444
Selector = "." identifier .
24452445
Index = "[" Expression "]" .
2446-
Slice = "[" ( [ Expression ] ":" [ Expression ] ) |
2447-
( [ Expression ] ":" Expression ":" Expression )
2448-
"]" .
2446+
Slice = "[" [ Expression ] ":" [ Expression ] "]" |
2447+
"[" [ Expression ] ":" Expression ":" Expression "]" .
24492448
TypeAssertion = "." "(" Type ")" .
24502449
Arguments = "(" [ ( ExpressionList | Type [ "," ExpressionList ] ) [ "..." ] [ "," ] ] ")" .
24512450
</pre>

0 commit comments

Comments
 (0)