]>
Commit | Line | Data |
---|---|---|
1 | #ifndef lint | |
2 | static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; | |
3 | #endif | |
4 | #define YYBYACC 1 | |
5 | #define YYMAJOR 1 | |
6 | #define YYMINOR 9 | |
7 | #define yyclearin (yychar=(-1)) | |
8 | #define yyerrok (yyerrflag=0) | |
9 | #define YYRECOVERING (yyerrflag!=0) | |
10 | #define YYPREFIX "yy" | |
11 | #line 2 "../common/parser.y" | |
12 | #include <string.h> | |
13 | #include "wx/expr.h" | |
14 | ||
15 | #ifndef __EXTERN_C__ | |
16 | #define __EXTERN_C__ 1 | |
17 | #endif | |
18 | ||
19 | #if defined(__cplusplus) || defined(__STDC__) | |
20 | #if defined(__cplusplus) && defined(__EXTERN_C__) | |
21 | extern "C" { | |
22 | #endif | |
23 | #endif | |
24 | int yylex(void); | |
25 | int yylook(void); | |
26 | int yywrap(void); | |
27 | int yyback(int *, int); | |
28 | void yyerror(char *); | |
29 | ||
30 | /* You may need to put /DLEX_SCANNER in your makefile | |
31 | * if you're using LEX! | |
32 | */ | |
33 | #ifdef LEX_SCANNER | |
34 | /* int yyoutput(int); */ | |
35 | void yyoutput(int); | |
36 | #else | |
37 | void yyoutput(int); | |
38 | #endif | |
39 | ||
40 | #if defined(__cplusplus) || defined(__STDC__) | |
41 | #if defined(__cplusplus) && defined(__EXTERN_C__) | |
42 | } | |
43 | #endif | |
44 | #endif | |
45 | #line 37 "../common/parser.y" | |
46 | typedef union { | |
47 | char *s; | |
48 | /* struct pexpr *expr; */ | |
49 | } YYSTYPE; | |
50 | #line 51 "y_tab.c" | |
51 | #define INTEGER 1 | |
52 | #define WORD 2 | |
53 | #define STRING 3 | |
54 | #define PERIOD 13 | |
55 | #define OPEN 4 | |
56 | #define CLOSE 5 | |
57 | #define COMMA 6 | |
58 | #define NEWLINE 7 | |
59 | #define ERROR 8 | |
60 | #define OPEN_SQUARE 9 | |
61 | #define CLOSE_SQUARE 10 | |
62 | #define EQUALS 11 | |
63 | #define EXP 14 | |
64 | #define YYERRCODE 256 | |
65 | short yylhs[] = { -1, | |
66 | 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, | |
67 | 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, | |
68 | }; | |
69 | short yylen[] = { 2, | |
70 | 0, 2, 2, 2, 2, 4, 2, 3, 0, 1, | |
71 | 3, 3, 1, 1, 1, 1, 3, 3, 5, 1, | |
72 | }; | |
73 | short yydefred[] = { 1, | |
74 | 0, 0, 0, 0, 2, 0, 5, 3, 0, 0, | |
75 | 0, 15, 7, 20, 0, 0, 13, 4, 0, 0, | |
76 | 0, 0, 8, 0, 6, 0, 18, 0, 12, 11, | |
77 | 0, 19, | |
78 | }; | |
79 | short yydgoto[] = { 1, | |
80 | 5, 14, 15, 16, 17, | |
81 | }; | |
82 | short yysindex[] = { 0, | |
83 | -2, 9, 2, 1, 0, 10, 0, 0, 11, -5, | |
84 | 17, 0, 0, 0, 14, -1, 0, 0, 33, 38, | |
85 | 41, 16, 0, 11, 0, 29, 0, 40, 0, 0, | |
86 | 44, 0, | |
87 | }; | |
88 | short yyrindex[] = { 0, | |
89 | 0, 0, 0, 0, 0, 0, 0, 0, 42, 21, | |
90 | 24, 0, 0, 0, 0, 30, 0, 0, 0, 0, | |
91 | 0, 0, 0, 31, 0, 27, 0, 24, 0, 0, | |
92 | 0, 0, | |
93 | }; | |
94 | short yygindex[] = { 0, | |
95 | 0, 45, -8, 0, 26, | |
96 | }; | |
97 | #define YYTABLESIZE 254 | |
98 | short yytable[] = { 3, | |
99 | 19, 10, 11, 12, 24, 9, 4, 20, 21, 4, | |
100 | 13, 10, 11, 12, 8, 30, 10, 28, 12, 4, | |
101 | 9, 7, 18, 23, 4, 16, 16, 22, 14, 14, | |
102 | 16, 17, 17, 14, 10, 9, 17, 25, 26, 10, | |
103 | 9, 27, 31, 9, 32, 6, 9, 29, 0, 0, | |
104 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
105 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
106 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
107 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
108 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
109 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
110 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
111 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
112 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
113 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
114 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
115 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
116 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
117 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
118 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
119 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
120 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
121 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
122 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
123 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
124 | 0, 0, 0, 2, | |
125 | }; | |
126 | short yycheck[] = { 2, | |
127 | 9, 1, 2, 3, 6, 4, 9, 13, 14, 9, | |
128 | 10, 1, 2, 3, 13, 24, 1, 2, 3, 9, | |
129 | 4, 13, 13, 10, 9, 5, 6, 11, 5, 6, | |
130 | 10, 5, 6, 10, 5, 5, 10, 5, 1, 10, | |
131 | 10, 1, 14, 4, 1, 1, 5, 22, -1, -1, | |
132 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
133 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
134 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
135 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
136 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
137 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
138 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
139 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
140 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
141 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
142 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
143 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
144 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
145 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
146 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
147 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
148 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
149 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
150 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
151 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
152 | -1, -1, -1, 256, | |
153 | }; | |
154 | #define YYFINAL 1 | |
155 | #ifndef YYDEBUG | |
156 | #define YYDEBUG 0 | |
157 | #endif | |
158 | #define YYMAXTOKEN 14 | |
159 | #if YYDEBUG | |
160 | char *yyname[] = { | |
161 | "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE", | |
162 | "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP", | |
163 | }; | |
164 | char *yyrule[] = { | |
165 | "$accept : commands", | |
166 | "commands :", | |
167 | "commands : commands command", | |
168 | "command : WORD PERIOD", | |
169 | "command : expr PERIOD", | |
170 | "command : error PERIOD", | |
171 | "expr : WORD OPEN arglist CLOSE", | |
172 | "expr : OPEN_SQUARE CLOSE_SQUARE", | |
173 | "expr : OPEN_SQUARE arglist CLOSE_SQUARE", | |
174 | "arglist :", | |
175 | "arglist : arg", | |
176 | "arglist : arg COMMA arglist", | |
177 | "arg : WORD EQUALS arg1", | |
178 | "arg : arg1", | |
179 | "arg1 : WORD", | |
180 | "arg1 : STRING", | |
181 | "arg1 : INTEGER", | |
182 | "arg1 : INTEGER PERIOD INTEGER", | |
183 | "arg1 : INTEGER EXP INTEGER", | |
184 | "arg1 : INTEGER PERIOD INTEGER EXP INTEGER", | |
185 | "arg1 : expr", | |
186 | }; | |
187 | #endif | |
188 | #ifdef YYSTACKSIZE | |
189 | #undef YYMAXDEPTH | |
190 | #define YYMAXDEPTH YYSTACKSIZE | |
191 | #else | |
192 | #ifdef YYMAXDEPTH | |
193 | #define YYSTACKSIZE YYMAXDEPTH | |
194 | #else | |
195 | #define YYSTACKSIZE 500 | |
196 | #define YYMAXDEPTH 500 | |
197 | #endif | |
198 | #endif | |
199 | int yydebug; | |
200 | int yynerrs; | |
201 | int yyerrflag; | |
202 | int yychar; | |
203 | short *yyssp; | |
204 | YYSTYPE *yyvsp; | |
205 | YYSTYPE yyval; | |
206 | YYSTYPE yylval; | |
207 | short yyss[YYSTACKSIZE]; | |
208 | YYSTYPE yyvs[YYSTACKSIZE]; | |
209 | #define yystacksize YYSTACKSIZE | |
210 | #line 119 "../common/parser.y" | |
211 | ||
212 | #include "../common/lex_yy.c" | |
213 | ||
214 | /* | |
215 | void yyerror(s) | |
216 | char *s; | |
217 | { | |
218 | syntax_error(s); | |
219 | } | |
220 | */ | |
221 | ||
222 | /* Ansi prototype. If this doesn't work for you... uncomment | |
223 | the above instead. | |
224 | */ | |
225 | ||
226 | void yyerror(char *s) | |
227 | { | |
228 | syntax_error(s); | |
229 | } | |
230 | ||
231 | /* | |
232 | * Unfortunately, my DOS version of FLEX | |
233 | * requires yywrap to be #def'ed, whereas | |
234 | * the UNIX flex expects a proper function. | |
235 | */ | |
236 | ||
237 | /* Not sure if __SC__ is the appropriate thing | |
238 | * to test | |
239 | */ | |
240 | ||
241 | #ifndef __SC__ | |
242 | #ifdef USE_DEFINE | |
243 | #ifndef yywrap | |
244 | #define yywrap() 1 | |
245 | #endif | |
246 | #else if !defined(__alpha) && !defined(__ultrix) | |
247 | int yywrap() { return 1; } | |
248 | #endif | |
249 | #endif | |
250 | #line 251 "y_tab.c" | |
251 | #define YYABORT goto yyabort | |
252 | #define YYREJECT goto yyabort | |
253 | #define YYACCEPT goto yyaccept | |
254 | #define YYERROR goto yyerrlab | |
255 | int | |
256 | yyparse() | |
257 | { | |
258 | register int yym, yyn, yystate; | |
259 | #if YYDEBUG | |
260 | register char *yys; | |
261 | extern char *getenv(); | |
262 | ||
263 | if (yys = getenv("YYDEBUG")) | |
264 | { | |
265 | yyn = *yys; | |
266 | if (yyn >= '0' && yyn <= '9') | |
267 | yydebug = yyn - '0'; | |
268 | } | |
269 | #endif | |
270 | ||
271 | yynerrs = 0; | |
272 | yyerrflag = 0; | |
273 | yychar = (-1); | |
274 | ||
275 | yyssp = yyss; | |
276 | yyvsp = yyvs; | |
277 | *yyssp = yystate = 0; | |
278 | ||
279 | yyloop: | |
280 | if (yyn = yydefred[yystate]) goto yyreduce; | |
281 | if (yychar < 0) | |
282 | { | |
283 | if ((yychar = yylex()) < 0) yychar = 0; | |
284 | #if YYDEBUG | |
285 | if (yydebug) | |
286 | { | |
287 | yys = 0; | |
288 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; | |
289 | if (!yys) yys = "illegal-symbol"; | |
290 | printf("%sdebug: state %d, reading %d (%s)\n", | |
291 | YYPREFIX, yystate, yychar, yys); | |
292 | } | |
293 | #endif | |
294 | } | |
295 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && | |
296 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) | |
297 | { | |
298 | #if YYDEBUG | |
299 | if (yydebug) | |
300 | printf("%sdebug: state %d, shifting to state %d\n", | |
301 | YYPREFIX, yystate, yytable[yyn]); | |
302 | #endif | |
303 | if (yyssp >= yyss + yystacksize - 1) | |
304 | { | |
305 | goto yyoverflow; | |
306 | } | |
307 | *++yyssp = yystate = yytable[yyn]; | |
308 | *++yyvsp = yylval; | |
309 | yychar = (-1); | |
310 | if (yyerrflag > 0) --yyerrflag; | |
311 | goto yyloop; | |
312 | } | |
313 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && | |
314 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) | |
315 | { | |
316 | yyn = yytable[yyn]; | |
317 | goto yyreduce; | |
318 | } | |
319 | if (yyerrflag) goto yyinrecovery; | |
320 | #ifdef lint | |
321 | goto yynewerror; | |
322 | #endif | |
323 | yynewerror: | |
324 | yyerror("syntax error"); | |
325 | #ifdef lint | |
326 | goto yyerrlab; | |
327 | #endif | |
328 | yyerrlab: | |
329 | ++yynerrs; | |
330 | yyinrecovery: | |
331 | if (yyerrflag < 3) | |
332 | { | |
333 | yyerrflag = 3; | |
334 | for (;;) | |
335 | { | |
336 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && | |
337 | yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) | |
338 | { | |
339 | #if YYDEBUG | |
340 | if (yydebug) | |
341 | printf("%sdebug: state %d, error recovery shifting\ | |
342 | to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); | |
343 | #endif | |
344 | if (yyssp >= yyss + yystacksize - 1) | |
345 | { | |
346 | goto yyoverflow; | |
347 | } | |
348 | *++yyssp = yystate = yytable[yyn]; | |
349 | *++yyvsp = yylval; | |
350 | goto yyloop; | |
351 | } | |
352 | else | |
353 | { | |
354 | #if YYDEBUG | |
355 | if (yydebug) | |
356 | printf("%sdebug: error recovery discarding state %d\n", | |
357 | YYPREFIX, *yyssp); | |
358 | #endif | |
359 | if (yyssp <= yyss) goto yyabort; | |
360 | --yyssp; | |
361 | --yyvsp; | |
362 | } | |
363 | } | |
364 | } | |
365 | else | |
366 | { | |
367 | if (yychar == 0) goto yyabort; | |
368 | #if YYDEBUG | |
369 | if (yydebug) | |
370 | { | |
371 | yys = 0; | |
372 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; | |
373 | if (!yys) yys = "illegal-symbol"; | |
374 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", | |
375 | YYPREFIX, yystate, yychar, yys); | |
376 | } | |
377 | #endif | |
378 | yychar = (-1); | |
379 | goto yyloop; | |
380 | } | |
381 | yyreduce: | |
382 | #if YYDEBUG | |
383 | if (yydebug) | |
384 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", | |
385 | YYPREFIX, yystate, yyn, yyrule[yyn]); | |
386 | #endif | |
387 | yym = yylen[yyn]; | |
388 | yyval = yyvsp[1-yym]; | |
389 | switch (yyn) | |
390 | { | |
391 | case 3: | |
392 | #line 69 "../common/parser.y" | |
393 | {process_command(proio_cons(make_word(yyvsp[-1].s), NULL)); free(yyvsp[-1].s);} | |
394 | break; | |
395 | case 4: | |
396 | #line 71 "../common/parser.y" | |
397 | {process_command(yyvsp[-1].s);} | |
398 | break; | |
399 | case 5: | |
400 | #line 73 "../common/parser.y" | |
401 | {syntax_error("Unrecognized command.");} | |
402 | break; | |
403 | case 6: | |
404 | #line 77 "../common/parser.y" | |
405 | {yyval.s = proio_cons(make_word(yyvsp[-3].s), yyvsp[-1].s); free(yyvsp[-3].s);} | |
406 | break; | |
407 | case 7: | |
408 | #line 79 "../common/parser.y" | |
409 | {yyval.s = proio_cons(NULL, NULL);} | |
410 | break; | |
411 | case 8: | |
412 | #line 81 "../common/parser.y" | |
413 | {yyval.s = yyvsp[-1].s; } | |
414 | break; | |
415 | case 9: | |
416 | #line 85 "../common/parser.y" | |
417 | {yyval.s = NULL;} | |
418 | break; | |
419 | case 10: | |
420 | #line 87 "../common/parser.y" | |
421 | {yyval.s = proio_cons(yyvsp[0].s, NULL);} | |
422 | break; | |
423 | case 11: | |
424 | #line 90 "../common/parser.y" | |
425 | {yyval.s = proio_cons(yyvsp[-2].s, yyvsp[0].s);} | |
426 | break; | |
427 | case 12: | |
428 | #line 94 "../common/parser.y" | |
429 | {yyval.s = proio_cons(make_word("="), proio_cons(make_word(yyvsp[-2].s), proio_cons(yyvsp[0].s, NULL))); | |
430 | free(yyvsp[-2].s); } | |
431 | break; | |
432 | case 13: | |
433 | #line 97 "../common/parser.y" | |
434 | {yyval.s = yyvsp[0].s; } | |
435 | break; | |
436 | case 14: | |
437 | #line 100 "../common/parser.y" | |
438 | {yyval.s = make_word(yyvsp[0].s); free(yyvsp[0].s);} | |
439 | break; | |
440 | case 15: | |
441 | #line 102 "../common/parser.y" | |
442 | {yyval.s = make_string(yyvsp[0].s); free(yyvsp[0].s);} | |
443 | break; | |
444 | case 16: | |
445 | #line 104 "../common/parser.y" | |
446 | {yyval.s = make_integer(yyvsp[0].s); free(yyvsp[0].s);} | |
447 | break; | |
448 | case 17: | |
449 | #line 106 "../common/parser.y" | |
450 | {yyval.s = make_real(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); } | |
451 | break; | |
452 | case 18: | |
453 | #line 108 "../common/parser.y" | |
454 | {yyval.s = make_exp(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); } | |
455 | break; | |
456 | case 19: | |
457 | #line 111 "../common/parser.y" | |
458 | {yyval.s = make_exp2(yyvsp[-4].s, yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-4].s); free(yyvsp[-2].s); | |
459 | free(yyvsp[0].s); } | |
460 | break; | |
461 | case 20: | |
462 | #line 115 "../common/parser.y" | |
463 | {yyval.s = yyvsp[0].s;} | |
464 | break; | |
465 | #line 466 "y_tab.c" | |
466 | } | |
467 | yyssp -= yym; | |
468 | yystate = *yyssp; | |
469 | yyvsp -= yym; | |
470 | yym = yylhs[yyn]; | |
471 | if (yystate == 0 && yym == 0) | |
472 | { | |
473 | #if YYDEBUG | |
474 | if (yydebug) | |
475 | printf("%sdebug: after reduction, shifting from state 0 to\ | |
476 | state %d\n", YYPREFIX, YYFINAL); | |
477 | #endif | |
478 | yystate = YYFINAL; | |
479 | *++yyssp = YYFINAL; | |
480 | *++yyvsp = yyval; | |
481 | if (yychar < 0) | |
482 | { | |
483 | if ((yychar = yylex()) < 0) yychar = 0; | |
484 | #if YYDEBUG | |
485 | if (yydebug) | |
486 | { | |
487 | yys = 0; | |
488 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; | |
489 | if (!yys) yys = "illegal-symbol"; | |
490 | printf("%sdebug: state %d, reading %d (%s)\n", | |
491 | YYPREFIX, YYFINAL, yychar, yys); | |
492 | } | |
493 | #endif | |
494 | } | |
495 | if (yychar == 0) goto yyaccept; | |
496 | goto yyloop; | |
497 | } | |
498 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && | |
499 | yyn <= YYTABLESIZE && yycheck[yyn] == yystate) | |
500 | yystate = yytable[yyn]; | |
501 | else | |
502 | yystate = yydgoto[yym]; | |
503 | #if YYDEBUG | |
504 | if (yydebug) | |
505 | printf("%sdebug: after reduction, shifting from state %d \ | |
506 | to state %d\n", YYPREFIX, *yyssp, yystate); | |
507 | #endif | |
508 | if (yyssp >= yyss + yystacksize - 1) | |
509 | { | |
510 | goto yyoverflow; | |
511 | } | |
512 | *++yyssp = yystate; | |
513 | *++yyvsp = yyval; | |
514 | goto yyloop; | |
515 | yyoverflow: | |
516 | yyerror("yacc stack overflow"); | |
517 | yyabort: | |
518 | return (1); | |
519 | yyaccept: | |
520 | return (0); | |
521 | } |