aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2018-02-01 14:08:45 -0800
committerRobert Griesemer <gri@golang.org>2018-02-02 00:22:16 +0000
commit851e98f0ee59d3027ec82363aedc741ad14100f9 (patch)
tree64173f8c168fc5b1cf628f9c097126195892f125
parentcbe1a61e74cee4e4f7f93529da56edb1a4e878a9 (diff)
downloadgo-851e98f0ee59d3027ec82363aedc741ad14100f9.tar.gz
go-851e98f0ee59d3027ec82363aedc741ad14100f9.zip
spec: remove need for separate Function production (cleanup)
The EBNF production Function = Signature FunctionBody . was used in FunctionDecl, MethodDecl, and FunctionLit, but only for the latter it shortened the syntax slightly. This change "inlines" Function which simplifies FunctionDecl and MethodDecl and gets rid of the Function production. This has no impact on the specified language. Also, the Function production is never referred to by the prose, so it's safe to remove it from the spec. Finally, neither go/ast nor go/parser have a representation of this production via a corresponding node or parse function, so no possibly valuable documentation is lost, either. Change-Id: Ia2875d31c6ec2d2079081ef481e50bad4f43c694 Reviewed-on: https://go-review.googlesource.com/91515 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
-rw-r--r--doc/go_spec.html9
1 files changed, 4 insertions, 5 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 33b66cb905..9a166ccdf4 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
- "Subtitle": "Version of January 23, 2018",
+ "Subtitle": "Version of February 1, 2018",
"Path": "/ref/spec"
}-->
@@ -2148,9 +2148,8 @@ to a function.
</p>
<pre class="ebnf">
-FunctionDecl = "func" FunctionName ( Function | Signature ) .
+FunctionDecl = "func" FunctionName Signature [ FunctionBody ] .
FunctionName = identifier .
-Function = Signature FunctionBody .
FunctionBody = Block .
</pre>
@@ -2196,7 +2195,7 @@ and associates the method with the receiver's <i>base type</i>.
</p>
<pre class="ebnf">
-MethodDecl = "func" Receiver MethodName ( Function | Signature ) .
+MethodDecl = "func" Receiver MethodName Signature [ FunctionBody ] .
Receiver = Parameters .
</pre>
@@ -2518,7 +2517,7 @@ A function literal represents an anonymous <a href="#Function_declarations">func
</p>
<pre class="ebnf">
-FunctionLit = "func" Function .
+FunctionLit = "func" Signature FunctionBody .
</pre>
<pre>