]> git.saurik.com Git - wxWidgets.git/blame - contrib/src/deprecated/dosyacc.c
Applied patch [ 919791 ] [widgets sample] Update wxListbox selection handling
[wxWidgets.git] / contrib / src / deprecated / dosyacc.c
CommitLineData
4a3bdee6
JS
1/* include platform.h first to get __WIN32__ definition */
2#include "wx/platform.h"
4a3bdee6 3#include "wx/setup.h"
c6dafd93 4#include "wx/deprecated/setup.h"
4a3bdee6
JS
5
6#if !defined(wxUSE_PROLOGIO) || wxUSE_PROLOGIO
7
5a410e44 8#if !defined(lint) && 0
4a3bdee6
JS
9static char yysccsid[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
10#endif
11#define YYBYACC 1
5a410e44 12// #line 2 "parser.y"
4a3bdee6
JS
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__)
25extern "C" {
26#endif
27#endif
28int yylex(void);
29int yylook(void);
30int yywrap(void);
31int 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); */
38void yyoutput(int);
39#else
40void yyoutput(int);
41#endif
42
43#if defined(__cplusplus) || defined(__STDC__)
44#if defined(__cplusplus) && defined(__EXTERN_C__)
45}
46#endif
47#endif
5a410e44 48// #line 36 "parser.y"
4a3bdee6
JS
49typedef union {
50 char *s;
51/* struct pexpr *expr; */
52} YYSTYPE;
5a410e44 53// #line 44 "y_tab.c"
4a3bdee6
JS
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
68short 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};
72short 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};
76short 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};
82short yydgoto[] = { 1,
83 5, 14, 15, 16, 17,
84};
85short 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};
91short 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};
97short yygindex[] = { 0,
98 0, 45, -8, 0, 26,
99};
100#define YYTABLESIZE 254
101short 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};
129short 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
163char *yyname[] = {
164"end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
165"ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
166};
167char *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
205int yydebug;
206int yynerrs;
207int yyerrflag;
208int yychar;
209short *yyssp;
210YYSTYPE *yyvsp;
211YYSTYPE yyval;
212YYSTYPE yylval;
213short yyss[YYSTACKSIZE];
214YYSTYPE yyvs[YYSTACKSIZE];
215#define yystacksize YYSTACKSIZE
5a410e44 216// #line 118 "parser.y"
4a3bdee6 217
c6dafd93 218#include "doslex.c"
4a3bdee6
JS
219
220/*
221void yyerror(s)
222char *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
232void 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
15e8daec 247#if 0 /* VS: doesn't work... */
4a3bdee6
JS
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
15e8daec
VS
260#endif
261
5a410e44 262// #line 247 "y_tab.c"
4a3bdee6
JS
263#define YYABORT goto yyabort
264#define YYACCEPT goto yyaccept
265#define YYERROR goto yyerrlab
266int
267PROIO_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
291yyloop:
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 }
5a410e44
JS
308 yyn = yysindex[yystate];
309 if ((yyn) && (yyn += yychar) >= 0 &&
4a3bdee6
JS
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 }
5a410e44
JS
327 yyn = yyrindex[yystate];
328 if ((yyn) && (yyn += yychar) >= 0 &&
4a3bdee6
JS
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;
4a3bdee6 337yynewerror:
5a410e44 338#endif
4a3bdee6
JS
339 yyerror("syntax error");
340#ifdef lint
341 goto yyerrlab;
4a3bdee6 342yyerrlab:
5a410e44 343#endif
4a3bdee6
JS
344 ++yynerrs;
345yyinrecovery:
346 if (yyerrflag < 3)
347 {
348 yyerrflag = 3;
349 for (;;)
350 {
5a410e44
JS
351 yyn = yysindex[*yyssp];
352 if ((yyn) && (yyn += YYERRCODE) >= 0 &&
4a3bdee6
JS
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 }
397yyreduce:
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 {
407case 3:
5a410e44 408// #line 68 "parser.y"
4a3bdee6
JS
409{process_command(proio_cons(wxmake_word(yyvsp[-1].s), NULL)); free(yyvsp[-1].s);}
410break;
411case 4:
5a410e44 412// #line 70 "parser.y"
4a3bdee6
JS
413{process_command(yyvsp[-1].s);}
414break;
415case 5:
5a410e44 416// #line 72 "parser.y"
4a3bdee6
JS
417{syntax_error("Unrecognized command.");}
418break;
419case 6:
5a410e44 420// #line 76 "parser.y"
4a3bdee6
JS
421{yyval.s = proio_cons(wxmake_word(yyvsp[-3].s), yyvsp[-1].s); free(yyvsp[-3].s);}
422break;
423case 7:
5a410e44 424// #line 78 "parser.y"
4a3bdee6
JS
425{yyval.s = proio_cons(NULL, NULL);}
426break;
427case 8:
5a410e44 428// #line 80 "parser.y"
4a3bdee6
JS
429{yyval.s = yyvsp[-1].s; }
430break;
431case 9:
5a410e44 432// #line 84 "parser.y"
4a3bdee6
JS
433{yyval.s = NULL;}
434break;
435case 10:
5a410e44 436// #line 86 "parser.y"
4a3bdee6
JS
437{yyval.s = proio_cons(yyvsp[0].s, NULL);}
438break;
439case 11:
5a410e44 440// #line 89 "parser.y"
4a3bdee6
JS
441{yyval.s = proio_cons(yyvsp[-2].s, yyvsp[0].s);}
442break;
443case 12:
5a410e44 444// #line 93 "parser.y"
4a3bdee6
JS
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); }
447break;
448case 13:
5a410e44 449// #line 96 "parser.y"
4a3bdee6
JS
450{yyval.s = yyvsp[0].s; }
451break;
452case 14:
5a410e44 453// #line 99 "parser.y"
4a3bdee6
JS
454{yyval.s = wxmake_word(yyvsp[0].s); free(yyvsp[0].s);}
455break;
456case 15:
5a410e44 457// #line 101 "parser.y"
4a3bdee6
JS
458{yyval.s = wxmake_string(yyvsp[0].s); free(yyvsp[0].s);}
459break;
460case 16:
5a410e44 461// #line 103 "parser.y"
4a3bdee6
JS
462{yyval.s = wxmake_integer(yyvsp[0].s); free(yyvsp[0].s);}
463break;
464case 17:
5a410e44 465// #line 105 "parser.y"
4a3bdee6
JS
466{yyval.s = wxmake_real(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); }
467break;
468case 18:
5a410e44 469// #line 107 "parser.y"
4a3bdee6
JS
470{yyval.s = wxmake_exp(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); }
471break;
472case 19:
5a410e44 473// #line 110 "parser.y"
4a3bdee6
JS
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); }
476break;
477case 20:
5a410e44 478// #line 114 "parser.y"
4a3bdee6
JS
479{yyval.s = yyvsp[0].s;}
480break;
5a410e44 481// #line 461 "y_tab.c"
4a3bdee6
JS
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 }
5a410e44
JS
514 yyn = yygindex[yym];
515 if ((yyn) && (yyn += yystate) >= 0 &&
4a3bdee6
JS
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 \
523to 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;
532yyoverflow:
533 yyerror("yacc stack overflow");
534yyabort:
535 return (1);
536yyaccept:
537 return (0);
538}
539
540#endif /* wxUSE_PROLOGIO */