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