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