]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/deprecated/dosyacc.c
1 /* include platform.h first to get __WIN32__ definition */
2 #include "wx/platform.h"
4 #include "wx/deprecated/setup.h"
6 #if !defined(wxUSE_PROLOGIO) || wxUSE_PROLOGIO
8 #if !defined(lint) && 0
9 static char yysccsid
[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
14 #if defined(_MSC_VER) || defined(__VISAGECPP__)
17 #include "wx/deprecated/expr.h"
20 #define __EXTERN_C__ 1
23 #if defined(__cplusplus) || defined(__STDC__)
24 #if defined(__cplusplus) && defined(__EXTERN_C__)
31 int yyback(int *, int);
33 /* You may need to put /DLEX_SCANNER in your makefile
34 * if you're using LEX!
37 /* int yyoutput(int); */
43 #if defined(__cplusplus) || defined(__STDC__)
44 #if defined(__cplusplus) && defined(__EXTERN_C__)
48 // #line 36 "parser.y"
51 /* struct pexpr *expr; */
64 #define CLOSE_SQUARE 10
69 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
70 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
73 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
74 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
76 short 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,
82 short yydgoto
[] = { 1,
85 short 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,
91 short 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,
97 short yygindex
[] = { 0,
100 #define YYTABLESIZE 254
101 short 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,
129 short 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,
161 #define YYMAXTOKEN 14
164 "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
165 "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
168 "$accept : 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",
179 "arglist : arg COMMA arglist",
180 "arg : WORD EQUALS arg1",
185 "arg1 : INTEGER PERIOD INTEGER",
186 "arg1 : INTEGER EXP INTEGER",
187 "arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
191 #define yyclearin (yychar=(-1))
192 #define yyerrok (yyerrflag=0)
195 #define YYMAXDEPTH YYSTACKSIZE
199 #define YYSTACKSIZE YYMAXDEPTH
201 #define YYSTACKSIZE 600
202 #define YYMAXDEPTH 600
213 short yyss
[YYSTACKSIZE
];
214 YYSTYPE yyvs
[YYSTACKSIZE
];
215 #define yystacksize YYSTACKSIZE
216 // #line 118 "parser.y"
228 /* Ansi prototype. If this doesn't work for you... uncomment
232 void yyerror(char *s
)
238 * Unfortunately, my DOS version of FLEX
239 * requires yywrap to be #def'ed, whereas
240 * the UNIX flex expects a proper function.
243 /* Not sure if __SC__ is the appropriate thing
247 #if 0 /* VS: doesn't work... */
254 # if !(defined(__VISAGECPP__) && __IBMC__ >= 400)
255 /* VA 4.0 thinks this is multiply defined (in lex_yy.c) */
256 int yywrap() { return 1; }
262 // #line 247 "y_tab.c"
263 #define YYABORT goto yyabort
264 #define YYACCEPT goto yyaccept
265 #define YYERROR goto yyerrlab
269 register int yym
, yyn
, yystate
;
272 extern char *getenv();
274 yys
= getenv("YYDEBUG");
278 if (yyn
>= '0' && yyn
<= '9')
289 *yyssp
= yystate
= 0;
292 yyn
= yydefred
[yystate
];
293 if (yyn
!= 0) goto yyreduce
;
296 if ((yychar
= yylex()) < 0) yychar
= 0;
301 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
302 if (!yys
) yys
= "illegal-symbol";
303 printf("yydebug: state %d, reading %d (%s)\n", yystate
,
308 yyn
= yysindex
[yystate
];
309 if ((yyn
) && (yyn
+= yychar
) >= 0 &&
310 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
314 printf("yydebug: state %d, shifting to state %d\n",
315 yystate
, yytable
[yyn
]);
317 if (yyssp
>= yyss
+ yystacksize
- 1)
321 *++yyssp
= yystate
= yytable
[yyn
];
324 if (yyerrflag
> 0) --yyerrflag
;
327 yyn
= yyrindex
[yystate
];
328 if ((yyn
) && (yyn
+= yychar
) >= 0 &&
329 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
334 if (yyerrflag
) goto yyinrecovery
;
339 yyerror("syntax error");
351 yyn
= yysindex
[*yyssp
];
352 if ((yyn
) && (yyn
+= YYERRCODE
) >= 0 &&
353 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
357 printf("yydebug: state %d, error recovery shifting\
358 to state %d\n", *yyssp
, yytable
[yyn
]);
360 if (yyssp
>= yyss
+ yystacksize
- 1)
364 *++yyssp
= yystate
= yytable
[yyn
];
372 printf("yydebug: error recovery discarding state %d\n",
375 if (yyssp
<= yyss
) goto yyabort
;
383 if (yychar
== 0) goto yyabort
;
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
);
400 printf("yydebug: state %d, reducing by rule %d (%s)\n",
401 yystate
, yyn
, yyrule
[yyn
]);
404 yyval
= yyvsp
[1-yym
];
408 // #line 68 "parser.y"
409 {process_command(proio_cons(wxmake_word(yyvsp
[-1].s
), NULL
)); free(yyvsp
[-1].s
);}
412 // #line 70 "parser.y"
413 {process_command(yyvsp
[-1].s
);}
416 // #line 72 "parser.y"
417 {syntax_error("Unrecognized command.");}
420 // #line 76 "parser.y"
421 {yyval
.s
= proio_cons(wxmake_word(yyvsp
[-3].s
), yyvsp
[-1].s
); free(yyvsp
[-3].s
);}
424 // #line 78 "parser.y"
425 {yyval
.s
= proio_cons(NULL
, NULL
);}
428 // #line 80 "parser.y"
429 {yyval
.s
= yyvsp
[-1].s
; }
432 // #line 84 "parser.y"
436 // #line 86 "parser.y"
437 {yyval
.s
= proio_cons(yyvsp
[0].s
, NULL
);}
440 // #line 89 "parser.y"
441 {yyval
.s
= proio_cons(yyvsp
[-2].s
, yyvsp
[0].s
);}
444 // #line 93 "parser.y"
445 {yyval
.s
= proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp
[-2].s
), proio_cons(yyvsp
[0].s
, NULL
)));
449 // #line 96 "parser.y"
450 {yyval
.s
= yyvsp
[0].s
; }
453 // #line 99 "parser.y"
454 {yyval
.s
= wxmake_word(yyvsp
[0].s
); free(yyvsp
[0].s
);}
457 // #line 101 "parser.y"
458 {yyval
.s
= wxmake_string(yyvsp
[0].s
); free(yyvsp
[0].s
);}
461 // #line 103 "parser.y"
462 {yyval
.s
= wxmake_integer(yyvsp
[0].s
); free(yyvsp
[0].s
);}
465 // #line 105 "parser.y"
466 {yyval
.s
= wxmake_real(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
469 // #line 107 "parser.y"
470 {yyval
.s
= wxmake_exp(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
473 // #line 110 "parser.y"
474 {yyval
.s
= wxmake_exp2(yyvsp
[-4].s
, yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-4].s
); free(yyvsp
[-2].s
);
478 // #line 114 "parser.y"
479 {yyval
.s
= yyvsp
[0].s
;}
481 // #line 461 "y_tab.c"
487 if (yystate
== 0 && yym
== 0)
491 printf("yydebug: after reduction, shifting from state 0 to\
492 state %d\n", YYFINAL
);
499 if ((yychar
= yylex()) < 0) yychar
= 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
);
511 if (yychar
== 0) goto yyaccept
;
515 if ((yyn
) && (yyn
+= yystate
) >= 0 &&
516 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
517 yystate
= yytable
[yyn
];
519 yystate
= yydgoto
[yym
];
522 printf("yydebug: after reduction, shifting from state %d \
523 to state %d\n", *yyssp
, yystate
);
525 if (yyssp
>= yyss
+ yystacksize
- 1)
533 yyerror("yacc stack overflow");
540 #endif /* wxUSE_PROLOGIO */