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