]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/gc, cmd/yacc: restore remaining custom error messages
authorMatthew Dempsky <mdempsky@google.com>
Fri, 3 Apr 2015 00:01:14 +0000 (17:01 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 3 Apr 2015 23:40:40 +0000 (23:40 +0000)
commit4f2a73011f2d076d97a2b46492ab21f26a33222b
treee98cd73442bb9cb8f3375774133120f2771a2c72
parent0c9f3e4972ceaa71d82835c213b9b1617ee07bf1
cmd/internal/gc, cmd/yacc: restore remaining custom error messages

This CL extends cmd/yacc to expose a yyErrorVerbose variable that
changes the error messages from just "syntax error" to "syntax error:
unexpected ${tokname}".

It also moves the yyToknames table generation to after rules have been
processed so that entries can be generated for tokens that aren't
mentioned in the preamble (e.g., '.' in the case of go.y).

Lastly, it restores gc's old code for applying yytfix to yyToknames,
except that substituting "LLITERAL" with litbuf happens in Yyerror.

Fixes #9968.

Change-Id: Icec188d11fdabc1dae31b8a471c35b5c7f6deec7
Reviewed-on: https://go-review.googlesource.com/8432
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/internal/gc/lex.go
src/cmd/internal/gc/subr.go
src/cmd/internal/gc/y.go
src/cmd/internal/gc/yymsg.go
src/cmd/yacc/yacc.go
test/fixedbugs/bug349.go
test/fixedbugs/bug388.go
test/fixedbugs/bug435.go