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