p = &nonterms[g_getcont(temp)];
if (p->n_rule) {
error(linecount,
-"nonterminal %s already defined", lextoken.t_string);
+"Nonterminal %s already defined", lextoken.t_string);
}
/*
* Remember the order in which the nonterminals
if ((q->t_flags & PERSISTENT) &&
kind == FIXED) {
error(linecount,
- "illegal %%persistent");
+ "Illegal %%persistent");
}
*/
}
+ termdeleted = 0;
*p_rule++ = elem;
}
]* { register p_term q;
if (!level) unput(ch);
if (level || flag == 1) putc(ch,f);
if ((!level) && flag == 2 && !semicolon) {
- error(linecount,"missing ';'");
+ error(linecount,"Missing ';'");
}
return;
}
ch = input();
}
if (ch == '\n') {
- error(linecount,"newline in string");
+ error(linecount,"Newline in string");
unput(match);
}
putc(ch,f);
p_mem alloc();
+doclose(f)
+ FILE *f;
+{
+ if (ferror(f) != 0) {
+ fatal(0,"Write error on temporary");
+ }
+ fclose(f);
+}
+
gencode(argc) {
register p_file p = files;
copyfile(incl_file);
generate(p);
getaction(2);
- if (ferror(fpars) != 0) {
- fatal(0,"Write error on temporary");
- }
- fclose(fpars);
+ doclose(fpars);
/* And install */
install(genname(p->f_name),p->f_name);
p++;
p->t_tokno);
}
}
- if (ferror(fpars) != 0) {
- fatal(0,"write error on temporary");
- }
- fclose(fpars);
+ doclose(fpars);
install(HFILE, ".");
}
}
fputs("#define LL_NEWMESS\n", f);
copyfile(rec_file);
- if (ferror(f) != 0) {
- fatal(0,"write error on temporary");
- }
- fclose(f);
+ doclose(f);
install(RFILE, ".");
}
if (type1 == LITERAL || type == LITERAL) {
continue;
}
- if (type != UNKNOWN) {
+ if (type == TERMINAL) {
error(linecount,
- "%s : illegal type",
+ "%s: is already a nonterminal",
+ str);
+ continue;
+ }
+ else if (type == NONTERM) {
+ error(linecount,
+ "%s : is already a token",
str);
continue;
}
}
if (option==ENTERING) {
error(linecount,
- "%s : already defined",str);
+ "%s : is already defined",str);
}
p->h_type.g_lineno = linecount;
return &(p->h_type);
for (p = nonterms; p < maxnt; p++) {
if (! p->n_rule) { /* undefined */
f_input = p->n_string;
- error(p->n_lineno,"nonterminal %s not defined",
+ error(p->n_lineno,"Nonterminal %s not defined",
p->n_name);
}
}
for (s = x->f_list; s; s = s->o_next) {
p = &nonterms[s->o_index];
if (! (p->n_flags & REACHABLE)) {
- error(p->n_lineno,"nonterminal %s unreachable",
+ warning(p->n_lineno,"nonterminal %s unreachable",
p->n_name);
}
}
for (;;) {
ch = input();
if (ch == '\n' || ch == EOF) {
- error(linecount,"missing '");
+ error(linecount,"Missing '");
break;
}
if (ch == '\'') break;
}
w++;
}
- error(linecount,"illegal reserved word");
+ error(linecount,"Illegal reserved word");
}
lextoken.t_string = ltext;
return C_IDENT;
int saved; /* line count on which comment starts */
saved = linecount;
- if (input() != '*') error(linecount,"illegal comment");
+ if (input() != '*') error(linecount,"Illegal comment");
do {
ch = input();
while (ch == '*') {