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