Commit f716c5c5 authored by Russ Cox's avatar Russ Cox

cmd/internal/gc: restore detail in plain syntax errors

Change-Id: Ifc4b25fa57d0c9242968246d2193aa29f6b87700
Reviewed-on: https://go-review.googlesource.com/5950Reviewed-by: 's avatarAustin Clements <austin@google.com>
parent 79c12958
...@@ -127,8 +127,12 @@ var yychar_subr int ...@@ -127,8 +127,12 @@ var yychar_subr int
var yyerror_lastsyntax int var yyerror_lastsyntax int
func Yyerror(fmt_ string, args ...interface{}) { func Yyerror(fmt_ string, args ...interface{}) {
// bison used to invoke yyerror("syntax error").
// With Go yacc we get yyerror("%s", "syntax error").
// Convert to keep the old code working.
if fmt_ == "%s" && len(args) == 1 && args[0] == "syntax error" { if fmt_ == "%s" && len(args) == 1 && args[0] == "syntax error" {
nsyntaxerrors++ fmt_ = "syntax error"
args = nil
} }
if strings.HasPrefix(fmt_, "syntax error") { if strings.HasPrefix(fmt_, "syntax error") {
nsyntaxerrors++ nsyntaxerrors++
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment