pci: don't do sanity check for missing pci bus, the check can misfire.
[minix.git] / commands / byacc / error.c
blob3ed564c629b4814d978c40d56a0773153a6a3924
1 /* routines for printing error messages */
3 #include "defs.h"
6 fatal(msg)
7 char *msg;
9 fprintf(stderr, "%s: f - %s\n", myname, msg);
10 done(2);
14 no_space()
16 fprintf(stderr, "%s: f - out of space\n", myname);
17 done(2);
21 open_error(filename)
22 char *filename;
24 fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
25 done(2);
29 unexpected_EOF()
31 fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
32 myname, lineno, input_file_name);
33 done(1);
37 print_pos(st_line, st_cptr)
38 char *st_line;
39 char *st_cptr;
41 register char *s;
43 if (st_line == 0) return;
44 for (s = st_line; *s != '\n'; ++s)
46 if (isprint(*s) || *s == '\t')
47 putc(*s, stderr);
48 else
49 putc('?', stderr);
51 putc('\n', stderr);
52 for (s = st_line; s < st_cptr; ++s)
54 if (*s == '\t')
55 putc('\t', stderr);
56 else
57 putc(' ', stderr);
59 putc('^', stderr);
60 putc('\n', stderr);
64 syntax_error(st_lineno, st_line, st_cptr)
65 int st_lineno;
66 char *st_line;
67 char *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);
72 done(1);
76 unterminated_comment(c_lineno, c_line, c_cptr)
77 int c_lineno;
78 char *c_line;
79 char *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);
84 done(1);
88 unterminated_string(s_lineno, s_line, s_cptr)
89 int s_lineno;
90 char *s_line;
91 char *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);
96 done(1);
100 unterminated_text(t_lineno, t_line, t_cptr)
101 int t_lineno;
102 char *t_line;
103 char *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);
108 done(1);
112 unterminated_union(u_lineno, u_line, u_cptr)
113 int u_lineno;
114 char *u_line;
115 char *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);
120 done(1);
124 over_unionized(u_cptr)
125 char *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);
130 done(1);
134 illegal_tag(t_lineno, t_line, t_cptr)
135 int t_lineno;
136 char *t_line;
137 char *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);
142 done(1);
146 illegal_character(c_cptr)
147 char *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);
152 done(1);
156 used_reserved(s)
157 char *s;
159 fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \
160 %s\n", myname, lineno, input_file_name, s);
161 done(1);
165 tokenized_start(s)
166 char *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);
170 done(1);
174 retyped_warning(s)
175 char *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);
182 reprec_warning(s)
183 char *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);
190 revalued_warning(s)
191 char *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);
198 terminal_start(s)
199 char *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);
203 done(1);
207 restarted_warning()
209 fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
210 redeclared\n", myname, lineno, input_file_name);
214 no_grammar()
216 fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
217 specified\n", myname, lineno, input_file_name);
218 done(1);
222 terminal_lhs(s_lineno)
223 int 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);
227 done(1);
231 prec_redeclared()
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)
239 int a_lineno;
240 char *a_line;
241 char *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);
246 done(1);
250 dollar_warning(a_lineno, i)
251 int a_lineno;
252 int 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)
260 int a_lineno;
261 char *a_line;
262 char *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);
267 done(1);
271 untyped_lhs()
273 fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n",
274 myname, lineno, input_file_name);
275 done(1);
279 untyped_rhs(i, s)
280 int i;
281 char *s;
283 fprintf(stderr, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n",
284 myname, lineno, input_file_name, i, s);
285 done(1);
289 unknown_rhs(i)
290 int i;
292 fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n",
293 myname, lineno, input_file_name, i);
294 done(1);
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);
305 undefined_goal(s)
306 char *s;
308 fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s);
309 done(1);
313 undefined_symbol_warning(s)
314 char *s;
316 fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s);