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