1 /* routines for printing error messages */
9 fprintf(stderr
, "%s: f - %s\n", myname
, msg
);
16 fprintf(stderr
, "%s: f - out of space\n", myname
);
24 fprintf(stderr
, "%s: f - cannot open \"%s\"\n", myname
, filename
);
31 fprintf(stderr
, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
32 myname
, lineno
, input_file_name
);
37 print_pos(st_line
, st_cptr
)
43 if (st_line
== 0) return;
44 for (s
= st_line
; *s
!= '\n'; ++s
)
46 if (isprint(*s
) || *s
== '\t')
52 for (s
= st_line
; s
< st_cptr
; ++s
)
64 syntax_error(st_lineno
, st_line
, st_cptr
)
69 fprintf(stderr
, "%s: e - line %d of \"%s\", syntax error\n",
70 myname
, st_lineno
, input_file_name
);
71 print_pos(st_line
, st_cptr
);
76 unterminated_comment(c_lineno
, c_line
, c_cptr
)
81 fprintf(stderr
, "%s: e - line %d of \"%s\", unmatched /*\n",
82 myname
, c_lineno
, input_file_name
);
83 print_pos(c_line
, c_cptr
);
88 unterminated_string(s_lineno
, s_line
, s_cptr
)
93 fprintf(stderr
, "%s: e - line %d of \"%s\", unterminated string\n",
94 myname
, s_lineno
, input_file_name
);
95 print_pos(s_line
, s_cptr
);
100 unterminated_text(t_lineno
, t_line
, t_cptr
)
105 fprintf(stderr
, "%s: e - line %d of \"%s\", unmatched %%{\n",
106 myname
, t_lineno
, input_file_name
);
107 print_pos(t_line
, t_cptr
);
112 unterminated_union(u_lineno
, u_line
, u_cptr
)
117 fprintf(stderr
, "%s: e - line %d of \"%s\", unterminated %%union \
118 declaration\n", myname
, u_lineno
, input_file_name
);
119 print_pos(u_line
, u_cptr
);
124 over_unionized(u_cptr
)
127 fprintf(stderr
, "%s: e - line %d of \"%s\", too many %%union \
128 declarations\n", myname
, lineno
, input_file_name
);
129 print_pos(line
, u_cptr
);
134 illegal_tag(t_lineno
, t_line
, t_cptr
)
139 fprintf(stderr
, "%s: e - line %d of \"%s\", illegal tag\n",
140 myname
, t_lineno
, input_file_name
);
141 print_pos(t_line
, t_cptr
);
146 illegal_character(c_cptr
)
149 fprintf(stderr
, "%s: e - line %d of \"%s\", illegal character\n",
150 myname
, lineno
, input_file_name
);
151 print_pos(line
, c_cptr
);
159 fprintf(stderr
, "%s: e - line %d of \"%s\", illegal use of reserved symbol \
160 %s\n", myname
, lineno
, input_file_name
, s
);
168 fprintf(stderr
, "%s: e - line %d of \"%s\", the start symbol %s cannot be \
169 declared to be a token\n", myname
, lineno
, input_file_name
, s
);
177 fprintf(stderr
, "%s: w - line %d of \"%s\", the type of %s has been \
178 redeclared\n", myname
, lineno
, input_file_name
, s
);
185 fprintf(stderr
, "%s: w - line %d of \"%s\", the precedence of %s has been \
186 redeclared\n", myname
, lineno
, input_file_name
, s
);
193 fprintf(stderr
, "%s: w - line %d of \"%s\", the value of %s has been \
194 redeclared\n", myname
, lineno
, input_file_name
, s
);
201 fprintf(stderr
, "%s: e - line %d of \"%s\", the start symbol %s is a \
202 token\n", myname
, lineno
, input_file_name
, s
);
209 fprintf(stderr
, "%s: w - line %d of \"%s\", the start symbol has been \
210 redeclared\n", myname
, lineno
, input_file_name
);
216 fprintf(stderr
, "%s: e - line %d of \"%s\", no grammar has been \
217 specified\n", myname
, lineno
, input_file_name
);
222 terminal_lhs(s_lineno
)
225 fprintf(stderr
, "%s: e - line %d of \"%s\", a token appears on the lhs \
226 of a production\n", myname
, s_lineno
, input_file_name
);
233 fprintf(stderr
, "%s: w - line %d of \"%s\", conflicting %%prec \
234 specifiers\n", myname
, lineno
, input_file_name
);
238 unterminated_action(a_lineno
, a_line
, a_cptr
)
243 fprintf(stderr
, "%s: e - line %d of \"%s\", unterminated action\n",
244 myname
, a_lineno
, input_file_name
);
245 print_pos(a_line
, a_cptr
);
250 dollar_warning(a_lineno
, i
)
254 fprintf(stderr
, "%s: w - line %d of \"%s\", $%d references beyond the \
255 end of the current rule\n", myname
, a_lineno
, input_file_name
, i
);
259 dollar_error(a_lineno
, a_line
, a_cptr
)
264 fprintf(stderr
, "%s: e - line %d of \"%s\", illegal $-name\n",
265 myname
, a_lineno
, input_file_name
);
266 print_pos(a_line
, a_cptr
);
273 fprintf(stderr
, "%s: e - line %d of \"%s\", $$ is untyped\n",
274 myname
, lineno
, input_file_name
);
283 fprintf(stderr
, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n",
284 myname
, lineno
, input_file_name
, i
, s
);
292 fprintf(stderr
, "%s: e - line %d of \"%s\", $%d is untyped\n",
293 myname
, lineno
, input_file_name
, i
);
298 default_action_warning()
300 fprintf(stderr
, "%s: w - line %d of \"%s\", the default action assigns an \
301 undefined value to $$\n", myname
, lineno
, input_file_name
);
308 fprintf(stderr
, "%s: e - the start symbol %s is undefined\n", myname
, s
);
313 undefined_symbol_warning(s
)
316 fprintf(stderr
, "%s: w - the symbol %s is undefined\n", myname
, s
);