// 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",
"LRSH", ">>",
"LOROR", "||",
"LNE", "!=",
+
+ // spell out to avoid confusion with punctuation in error messages
+ "';'", "semicolon or newline",
+ "','", "comma",
};
void
for(i=0; yytname[i] != nil; i++) {
s = yytname[i];
+ // apply yytfix if possible
+ for(j=0; j<nelem(yytfix); j++) {
+ if(strcmp(s, yytfix[j].have) == 0) {
+ yytname[i] = yytfix[j].want;
+ goto loop;
+ }
+ }
+
// turn 'x' into x.
if(s[0] == '\'') {
t = strdup(s+1);
t[strlen(t)-1] = '\0';
yytname[i] = t;
- continue;
- }
-
- // apply yytfix to the rest
- for(j=0; j<nelem(yytfix); j++) {
- if(strcmp(s, yytfix[j].have) == 0) {
- yytname[i] = yytfix[j].want;
- break;
- }
}
+ loop:;
}
}