From 288c1c83d96836e5ce45a7d232c6d0271cc3ed52 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 28 Jan 2010 15:57:44 -0800 Subject: [PATCH] gc: tweak error messages, avoid internalization settings in bison R=r CC=golang-dev https://golang.org/cl/194129 --- src/cmd/gc/Makefile | 2 +- src/cmd/gc/go.errors | 16 ++++++++-------- src/cmd/gc/lex.c | 22 +++++++++++++--------- test/syntax/import.go | 2 +- test/syntax/semi1.go | 2 +- test/syntax/semi2.go | 2 +- test/syntax/semi3.go | 2 +- test/syntax/semi4.go | 2 +- test/syntax/semi5.go | 2 +- test/syntax/semi6.go | 2 +- test/syntax/semi7.go | 2 +- 11 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/cmd/gc/Makefile b/src/cmd/gc/Makefile index 16bfc66398..0ca9e9d28e 100644 --- a/src/cmd/gc/Makefile +++ b/src/cmd/gc/Makefile @@ -49,7 +49,7 @@ $(LIB): $(OFILES) $(OFILES): $(HFILES) y.tab.h: $(YFILES) - bison -v -y $(YFLAGS) $(YFILES) + LANG=C bison -v -y $(YFLAGS) $(YFILES) y.tab.c: y.tab.h test -f y.tab.c && touch y.tab.c diff --git a/src/cmd/gc/go.errors b/src/cmd/gc/go.errors index 215f28c5a2..3cb718adb1 100644 --- a/src/cmd/gc/go.errors +++ b/src/cmd/gc/go.errors @@ -15,28 +15,28 @@ static struct { // by that token list. % loadsys package LIMPORT '(' LLITERAL import_package import_there ',' - "unexpected , during import block", + "unexpected comma during import block", % loadsys package imports LFUNC LNAME '(' ')' '{' LIF if_header ';' - "unexpected ; or newline before {", + "unexpected semicolon or newline before {", % loadsys package imports LFUNC LNAME '(' ')' '{' LSWITCH if_header ';' - "unexpected ; or newline before {", + "unexpected semicolon or newline before {", % loadsys package imports LFUNC LNAME '(' ')' '{' LFOR for_header ';' - "unexpected ; or newline before {", + "unexpected semicolon or newline before {", % loadsys package imports LFUNC LNAME '(' ')' '{' LFOR ';' LBODY - "unexpected ; or newline before {", + "unexpected semicolon or newline before {", % loadsys package imports LFUNC LNAME '(' ')' ';' '{' - "unexpected ; or newline before {", + "unexpected semicolon or newline before {", % loadsys package imports LTYPE LNAME ';' - "unexpected ; or newline in type declaration", + "unexpected semicolon or newline in type declaration", % loadsys package imports LFUNC LNAME '(' ')' '{' if_stmt ';' LELSE - "unexpected ; or newline before else", + "unexpected semicolon or newline before else", % loadsys package imports LTYPE LNAME LINTERFACE '{' LNAME ',' LNAME "name list not allowed in interface type", diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c index 4d74bb9631..175d7a3efc 100644 --- a/src/cmd/gc/lex.c +++ b/src/cmd/gc/lex.c @@ -1523,6 +1523,10 @@ struct "LRSH", ">>", "LOROR", "||", "LNE", "!=", + + // spell out to avoid confusion with punctuation in error messages + "';'", "semicolon or newline", + "','", "comma", }; void @@ -1535,21 +1539,21 @@ yytinit(void) for(i=0; yytname[i] != nil; i++) { s = yytname[i]; + // apply yytfix if possible + for(j=0; j