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