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