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