aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/parser.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2017-02-08 17:56:41 -0800
committerRobert Griesemer <gri@golang.org>2017-02-09 03:54:47 +0000
commit3c22e5ca271ca4ad17b34d965e6a9baf7b5cf94d (patch)
tree4e334b6df478459a3a7e82103af4c364c2f81208 /src/cmd/compile/internal/syntax/parser.go
parent7ad512e7ffe576c4894ea84b02e954846fbda643 (diff)
downloadgo-3c22e5ca271ca4ad17b34d965e6a9baf7b5cf94d.tar.xz
cmd/compile/internal/parser: improved syntax error for incorrect if/for/switch header
Starting the error message with "expecting" rather than "missing" causes the syntax error mechanism to add additional helpful info (it recognizes "expecting" but not "missing"). Fixes #17328. Change-Id: I8482ca5e5a6a6b22e0ed0d831b7328e264156334 Reviewed-on: https://go-review.googlesource.com/36637 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/syntax/parser.go')
-rw-r--r--src/cmd/compile/internal/syntax/parser.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/syntax/parser.go b/src/cmd/compile/internal/syntax/parser.go
index f016a6adbe..c1faa27894 100644
--- a/src/cmd/compile/internal/syntax/parser.go
+++ b/src/cmd/compile/internal/syntax/parser.go
@@ -1690,7 +1690,7 @@ func (p *parser) stmtBody(context string) []Stmt {
}
if !p.got(_Lbrace) {
- p.syntax_error("missing { after " + context)
+ p.syntax_error("expecting { after " + context)
p.advance(_Name, _Rbrace)
}