Lines 7-36
Link Here
|
7 |
#include "defs.h" |
7 |
#include "defs.h" |
8 |
|
8 |
|
9 |
|
9 |
|
10 |
fatal(msg) |
10 |
void fatal(char *msg) |
11 |
char *msg; |
|
|
12 |
{ |
11 |
{ |
13 |
fprintf(stderr, "%s: f - %s\n", myname, msg); |
12 |
fprintf(stderr, "%s: f - %s\n", myname, msg); |
14 |
done(2); |
13 |
done(2); |
15 |
} |
14 |
} |
16 |
|
15 |
|
17 |
|
16 |
|
18 |
no_space() |
17 |
void no_space() |
19 |
{ |
18 |
{ |
20 |
fprintf(stderr, "%s: f - out of space\n", myname); |
19 |
fprintf(stderr, "%s: f - out of space\n", myname); |
21 |
done(2); |
20 |
done(2); |
22 |
} |
21 |
} |
23 |
|
22 |
|
24 |
|
23 |
|
25 |
open_error(filename) |
24 |
void open_error(char *filename) |
26 |
char *filename; |
|
|
27 |
{ |
25 |
{ |
28 |
fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename); |
26 |
fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename); |
29 |
done(2); |
27 |
done(2); |
30 |
} |
28 |
} |
31 |
|
29 |
|
32 |
|
30 |
|
33 |
unexpected_EOF() |
31 |
void unexpected_EOF() |
34 |
{ |
32 |
{ |
35 |
fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n", |
33 |
fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n", |
36 |
myname, lineno, input_file_name); |
34 |
myname, lineno, input_file_name); |
Lines 38-46
Link Here
|
38 |
} |
36 |
} |
39 |
|
37 |
|
40 |
|
38 |
|
41 |
print_pos(st_line, st_cptr) |
39 |
void print_pos(char *st_line, char *st_cptr) |
42 |
char *st_line; |
|
|
43 |
char *st_cptr; |
44 |
{ |
40 |
{ |
45 |
register char *s; |
41 |
register char *s; |
46 |
|
42 |
|
Lines 65-74
Link Here
|
65 |
} |
61 |
} |
66 |
|
62 |
|
67 |
|
63 |
|
68 |
syntax_error(st_lineno, st_line, st_cptr) |
64 |
void syntax_error(int st_lineno, char *st_line, char *st_cptr) |
69 |
int st_lineno; |
|
|
70 |
char *st_line; |
71 |
char *st_cptr; |
72 |
{ |
65 |
{ |
73 |
fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n", |
66 |
fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n", |
74 |
myname, st_lineno, input_file_name); |
67 |
myname, st_lineno, input_file_name); |
Lines 77-86
Link Here
|
77 |
} |
70 |
} |
78 |
|
71 |
|
79 |
|
72 |
|
80 |
unterminated_comment(c_lineno, c_line, c_cptr) |
73 |
void unterminated_comment(int c_lineno, char *c_line, char *c_cptr) |
81 |
int c_lineno; |
|
|
82 |
char *c_line; |
83 |
char *c_cptr; |
84 |
{ |
74 |
{ |
85 |
fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n", |
75 |
fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n", |
86 |
myname, c_lineno, input_file_name); |
76 |
myname, c_lineno, input_file_name); |
Lines 88-98
Link Here
|
88 |
done(1); |
78 |
done(1); |
89 |
} |
79 |
} |
90 |
|
80 |
|
91 |
|
81 |
void unterminated_string(int s_lineno, char *s_line, char *s_cptr) |
92 |
unterminated_string(s_lineno, s_line, s_cptr) |
|
|
93 |
int s_lineno; |
94 |
char *s_line; |
95 |
char *s_cptr; |
96 |
{ |
82 |
{ |
97 |
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n", |
83 |
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n", |
98 |
myname, s_lineno, input_file_name); |
84 |
myname, s_lineno, input_file_name); |
Lines 101-110
Link Here
|
101 |
} |
87 |
} |
102 |
|
88 |
|
103 |
|
89 |
|
104 |
unterminated_text(t_lineno, t_line, t_cptr) |
90 |
void unterminated_text(int t_lineno, char *t_line, char *t_cptr) |
105 |
int t_lineno; |
|
|
106 |
char *t_line; |
107 |
char *t_cptr; |
108 |
{ |
91 |
{ |
109 |
fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n", |
92 |
fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n", |
110 |
myname, t_lineno, input_file_name); |
93 |
myname, t_lineno, input_file_name); |
Lines 113-122
Link Here
|
113 |
} |
96 |
} |
114 |
|
97 |
|
115 |
|
98 |
|
116 |
unterminated_union(u_lineno, u_line, u_cptr) |
99 |
void unterminated_union(int u_lineno, char *u_line, char *u_cptr) |
117 |
int u_lineno; |
|
|
118 |
char *u_line; |
119 |
char *u_cptr; |
120 |
{ |
100 |
{ |
121 |
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \ |
101 |
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \ |
122 |
declaration\n", myname, u_lineno, input_file_name); |
102 |
declaration\n", myname, u_lineno, input_file_name); |
Lines 125-132
Link Here
|
125 |
} |
105 |
} |
126 |
|
106 |
|
127 |
|
107 |
|
128 |
over_unionized(u_cptr) |
108 |
void over_unionized(char *u_cptr) |
129 |
char *u_cptr; |
|
|
130 |
{ |
109 |
{ |
131 |
fprintf(stderr, "%s: e - line %d of \"%s\", too many %%union \ |
110 |
fprintf(stderr, "%s: e - line %d of \"%s\", too many %%union \ |
132 |
declarations\n", myname, lineno, input_file_name); |
111 |
declarations\n", myname, lineno, input_file_name); |
Lines 135-144
Link Here
|
135 |
} |
114 |
} |
136 |
|
115 |
|
137 |
|
116 |
|
138 |
illegal_tag(t_lineno, t_line, t_cptr) |
117 |
void illegal_tag(int t_lineno, char *t_line, char *t_cptr) |
139 |
int t_lineno; |
|
|
140 |
char *t_line; |
141 |
char *t_cptr; |
142 |
{ |
118 |
{ |
143 |
fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n", |
119 |
fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n", |
144 |
myname, t_lineno, input_file_name); |
120 |
myname, t_lineno, input_file_name); |
Lines 147-154
Link Here
|
147 |
} |
123 |
} |
148 |
|
124 |
|
149 |
|
125 |
|
150 |
illegal_character(c_cptr) |
126 |
void illegal_character(char *c_cptr) |
151 |
char *c_cptr; |
|
|
152 |
{ |
127 |
{ |
153 |
fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n", |
128 |
fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n", |
154 |
myname, lineno, input_file_name); |
129 |
myname, lineno, input_file_name); |
Lines 157-164
Link Here
|
157 |
} |
132 |
} |
158 |
|
133 |
|
159 |
|
134 |
|
160 |
used_reserved(s) |
135 |
void used_reserved(char *s) |
161 |
char *s; |
|
|
162 |
{ |
136 |
{ |
163 |
fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \ |
137 |
fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \ |
164 |
%s\n", myname, lineno, input_file_name, s); |
138 |
%s\n", myname, lineno, input_file_name, s); |
Lines 166-173
Link Here
|
166 |
} |
140 |
} |
167 |
|
141 |
|
168 |
|
142 |
|
169 |
tokenized_start(s) |
143 |
void tokenized_start(char *s) |
170 |
char *s; |
|
|
171 |
{ |
144 |
{ |
172 |
fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \ |
145 |
fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \ |
173 |
declared to be a token\n", myname, lineno, input_file_name, s); |
146 |
declared to be a token\n", myname, lineno, input_file_name, s); |
Lines 175-206
Link Here
|
175 |
} |
148 |
} |
176 |
|
149 |
|
177 |
|
150 |
|
178 |
retyped_warning(s) |
151 |
void retyped_warning(char *s) |
179 |
char *s; |
|
|
180 |
{ |
152 |
{ |
181 |
fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \ |
153 |
fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \ |
182 |
redeclared\n", myname, lineno, input_file_name, s); |
154 |
redeclared\n", myname, lineno, input_file_name, s); |
183 |
} |
155 |
} |
184 |
|
156 |
|
185 |
|
157 |
|
186 |
reprec_warning(s) |
158 |
void reprec_warning(char *s) |
187 |
char *s; |
|
|
188 |
{ |
159 |
{ |
189 |
fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \ |
160 |
fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \ |
190 |
redeclared\n", myname, lineno, input_file_name, s); |
161 |
redeclared\n", myname, lineno, input_file_name, s); |
191 |
} |
162 |
} |
192 |
|
163 |
|
193 |
|
164 |
|
194 |
revalued_warning(s) |
165 |
void revalued_warning(char *s) |
195 |
char *s; |
|
|
196 |
{ |
166 |
{ |
197 |
fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \ |
167 |
fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \ |
198 |
redeclared\n", myname, lineno, input_file_name, s); |
168 |
redeclared\n", myname, lineno, input_file_name, s); |
199 |
} |
169 |
} |
200 |
|
170 |
|
201 |
|
171 |
|
202 |
terminal_start(s) |
172 |
void terminal_start(char *s) |
203 |
char *s; |
|
|
204 |
{ |
173 |
{ |
205 |
fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \ |
174 |
fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \ |
206 |
token\n", myname, lineno, input_file_name, s); |
175 |
token\n", myname, lineno, input_file_name, s); |
Lines 208-221
Link Here
|
208 |
} |
177 |
} |
209 |
|
178 |
|
210 |
|
179 |
|
211 |
restarted_warning() |
180 |
void restarted_warning() |
212 |
{ |
181 |
{ |
213 |
fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \ |
182 |
fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \ |
214 |
redeclared\n", myname, lineno, input_file_name); |
183 |
redeclared\n", myname, lineno, input_file_name); |
215 |
} |
184 |
} |
216 |
|
185 |
|
217 |
|
186 |
|
218 |
no_grammar() |
187 |
void no_grammar() |
219 |
{ |
188 |
{ |
220 |
fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \ |
189 |
fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \ |
221 |
specified\n", myname, lineno, input_file_name); |
190 |
specified\n", myname, lineno, input_file_name); |
Lines 223-230
Link Here
|
223 |
} |
192 |
} |
224 |
|
193 |
|
225 |
|
194 |
|
226 |
terminal_lhs(s_lineno) |
195 |
void terminal_lhs(int s_lineno) |
227 |
int s_lineno; |
|
|
228 |
{ |
196 |
{ |
229 |
fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \ |
197 |
fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \ |
230 |
of a production\n", myname, s_lineno, input_file_name); |
198 |
of a production\n", myname, s_lineno, input_file_name); |
Lines 232-248
Link Here
|
232 |
} |
200 |
} |
233 |
|
201 |
|
234 |
|
202 |
|
235 |
prec_redeclared() |
203 |
void prec_redeclared() |
236 |
{ |
204 |
{ |
237 |
fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \ |
205 |
fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \ |
238 |
specifiers\n", myname, lineno, input_file_name); |
206 |
specifiers\n", myname, lineno, input_file_name); |
239 |
} |
207 |
} |
240 |
|
208 |
|
241 |
|
209 |
|
242 |
unterminated_action(a_lineno, a_line, a_cptr) |
210 |
void unterminated_action(int a_lineno, char *a_line, char *a_cptr) |
243 |
int a_lineno; |
|
|
244 |
char *a_line; |
245 |
char *a_cptr; |
246 |
{ |
211 |
{ |
247 |
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n", |
212 |
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n", |
248 |
myname, a_lineno, input_file_name); |
213 |
myname, a_lineno, input_file_name); |
Lines 251-269
Link Here
|
251 |
} |
216 |
} |
252 |
|
217 |
|
253 |
|
218 |
|
254 |
dollar_warning(a_lineno, i) |
219 |
void dollar_warning(int a_lineno, int i) |
255 |
int a_lineno; |
|
|
256 |
int i; |
257 |
{ |
220 |
{ |
258 |
fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \ |
221 |
fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \ |
259 |
end of the current rule\n", myname, a_lineno, input_file_name, i); |
222 |
end of the current rule\n", myname, a_lineno, input_file_name, i); |
260 |
} |
223 |
} |
261 |
|
224 |
|
262 |
|
225 |
|
263 |
dollar_error(a_lineno, a_line, a_cptr) |
226 |
void dollar_error(int a_lineno, char *a_line, char *a_cptr) |
264 |
int a_lineno; |
|
|
265 |
char *a_line; |
266 |
char *a_cptr; |
267 |
{ |
227 |
{ |
268 |
fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n", |
228 |
fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n", |
269 |
myname, a_lineno, input_file_name); |
229 |
myname, a_lineno, input_file_name); |
Lines 272-278
Link Here
|
272 |
} |
232 |
} |
273 |
|
233 |
|
274 |
|
234 |
|
275 |
untyped_lhs() |
235 |
void untyped_lhs() |
276 |
{ |
236 |
{ |
277 |
fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n", |
237 |
fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n", |
278 |
myname, lineno, input_file_name); |
238 |
myname, lineno, input_file_name); |
Lines 280-288
Link Here
|
280 |
} |
240 |
} |
281 |
|
241 |
|
282 |
|
242 |
|
283 |
untyped_rhs(i, s) |
243 |
void untyped_rhs(int i, char *s) |
284 |
int i; |
|
|
285 |
char *s; |
286 |
{ |
244 |
{ |
287 |
fprintf(stderr, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n", |
245 |
fprintf(stderr, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n", |
288 |
myname, lineno, input_file_name, i, s); |
246 |
myname, lineno, input_file_name, i, s); |
Lines 290-297
Link Here
|
290 |
} |
248 |
} |
291 |
|
249 |
|
292 |
|
250 |
|
293 |
unknown_rhs(i) |
251 |
void unknown_rhs(int i) |
294 |
int i; |
|
|
295 |
{ |
252 |
{ |
296 |
fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n", |
253 |
fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n", |
297 |
myname, lineno, input_file_name, i); |
254 |
myname, lineno, input_file_name, i); |
Lines 299-321
Link Here
|
299 |
} |
256 |
} |
300 |
|
257 |
|
301 |
|
258 |
|
302 |
default_action_warning() |
259 |
void default_action_warning() |
303 |
{ |
260 |
{ |
304 |
fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \ |
261 |
fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \ |
305 |
undefined value to $$\n", myname, lineno, input_file_name); |
262 |
undefined value to $$\n", myname, lineno, input_file_name); |
306 |
} |
263 |
} |
307 |
|
264 |
|
308 |
|
265 |
|
309 |
undefined_goal(s) |
266 |
void undefined_goal(char *s) |
310 |
char *s; |
|
|
311 |
{ |
267 |
{ |
312 |
fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s); |
268 |
fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s); |
313 |
done(1); |
269 |
done(1); |
314 |
} |
270 |
} |
315 |
|
271 |
|
316 |
|
272 |
|
317 |
undefined_symbol_warning(s) |
273 |
void undefined_symbol_warning(char *s) |
318 |
char *s; |
|
|
319 |
{ |
274 |
{ |
320 |
fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s); |
275 |
fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s); |
321 |
} |
276 |
} |