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