]>
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"
3 #if defined(__WIN32__) || defined(__GNUWIN32__)
4 /* all Win32 compilers can handle C++ comments, and C++ comments
5 is the only C++ in setup.h */
7 #include "wx/deprecated/setup.h"
10 #if !defined(wxUSE_PROLOGIO) || wxUSE_PROLOGIO
13 static char yysccsid
[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
18 #if defined(_MSC_VER) || defined(__VISAGECPP__)
21 #include "wx/deprecated/expr.h"
24 #define __EXTERN_C__ 1
27 #if defined(__cplusplus) || defined(__STDC__)
28 #if defined(__cplusplus) && defined(__EXTERN_C__)
35 int yyback(int *, int);
37 /* You may need to put /DLEX_SCANNER in your makefile
38 * if you're using LEX!
41 /* int yyoutput(int); */
47 #if defined(__cplusplus) || defined(__STDC__)
48 #if defined(__cplusplus) && defined(__EXTERN_C__)
55 /* struct pexpr *expr; */
68 #define CLOSE_SQUARE 10
73 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
74 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
77 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
78 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
80 short yydefred
[] = { 1,
81 0, 0, 0, 0, 2, 0, 5, 3, 0, 0,
82 0, 15, 7, 20, 0, 0, 13, 4, 0, 0,
83 0, 0, 8, 0, 6, 0, 18, 0, 12, 11,
86 short yydgoto
[] = { 1,
89 short yysindex
[] = { 0,
90 -2, 9, 2, 1, 0, 10, 0, 0, 11, -5,
91 17, 0, 0, 0, 14, -1, 0, 0, 33, 38,
92 41, 16, 0, 11, 0, 29, 0, 40, 0, 0,
95 short yyrindex
[] = { 0,
96 0, 0, 0, 0, 0, 0, 0, 0, 42, 21,
97 24, 0, 0, 0, 0, 30, 0, 0, 0, 0,
98 0, 0, 0, 31, 0, 27, 0, 24, 0, 0,
101 short yygindex
[] = { 0,
104 #define YYTABLESIZE 254
105 short yytable
[] = { 3,
106 19, 10, 11, 12, 24, 9, 4, 20, 21, 4,
107 13, 10, 11, 12, 8, 30, 10, 28, 12, 4,
108 9, 7, 18, 23, 4, 16, 16, 22, 14, 14,
109 16, 17, 17, 14, 10, 9, 17, 25, 26, 10,
110 9, 27, 31, 9, 32, 6, 9, 29, 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, 0, 0, 0, 0, 0, 0, 0,
133 short yycheck
[] = { 2,
134 9, 1, 2, 3, 6, 4, 9, 13, 14, 9,
135 10, 1, 2, 3, 13, 24, 1, 2, 3, 9,
136 4, 13, 13, 10, 9, 5, 6, 11, 5, 6,
137 10, 5, 6, 10, 5, 5, 10, 5, 1, 10,
138 10, 1, 14, 4, 1, 1, 5, 22, -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, -1, -1, -1, -1, -1, -1, -1,
165 #define YYMAXTOKEN 14
168 "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
169 "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
172 "$accept : commands",
174 "commands : commands command",
175 "command : WORD PERIOD",
176 "command : expr PERIOD",
177 "command : error PERIOD",
178 "expr : WORD OPEN arglist CLOSE",
179 "expr : OPEN_SQUARE CLOSE_SQUARE",
180 "expr : OPEN_SQUARE arglist CLOSE_SQUARE",
183 "arglist : arg COMMA arglist",
184 "arg : WORD EQUALS arg1",
189 "arg1 : INTEGER PERIOD INTEGER",
190 "arg1 : INTEGER EXP INTEGER",
191 "arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
195 #define yyclearin (yychar=(-1))
196 #define yyerrok (yyerrflag=0)
199 #define YYMAXDEPTH YYSTACKSIZE
203 #define YYSTACKSIZE YYMAXDEPTH
205 #define YYSTACKSIZE 600
206 #define YYMAXDEPTH 600
217 short yyss
[YYSTACKSIZE
];
218 YYSTYPE yyvs
[YYSTACKSIZE
];
219 #define yystacksize YYSTACKSIZE
236 /* Ansi prototype. If this doesn't work for you... uncomment
240 void yyerror(char *s
)
246 * Unfortunately, my DOS version of FLEX
247 * requires yywrap to be #def'ed, whereas
248 * the UNIX flex expects a proper function.
251 /* Not sure if __SC__ is the appropriate thing
261 # if !(defined(__VISAGECPP__) && __IBMC__ >= 400)
262 /* VA 4.0 thinks this is multiply defined (in lex_yy.c) */
263 int yywrap() { return 1; }
268 #define YYABORT goto yyabort
269 #define YYACCEPT goto yyaccept
270 #define YYERROR goto yyerrlab
274 register int yym
, yyn
, yystate
;
277 extern char *getenv();
279 yys
= getenv("YYDEBUG");
283 if (yyn
>= '0' && yyn
<= '9')
294 *yyssp
= yystate
= 0;
297 yyn
= yydefred
[yystate
];
298 if (yyn
!= 0) goto yyreduce
;
301 if ((yychar
= yylex()) < 0) yychar
= 0;
306 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
307 if (!yys
) yys
= "illegal-symbol";
308 printf("yydebug: state %d, reading %d (%s)\n", yystate
,
313 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
314 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
318 printf("yydebug: state %d, shifting to state %d\n",
319 yystate
, yytable
[yyn
]);
321 if (yyssp
>= yyss
+ yystacksize
- 1)
325 *++yyssp
= yystate
= yytable
[yyn
];
328 if (yyerrflag
> 0) --yyerrflag
;
331 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
332 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
337 if (yyerrflag
) goto yyinrecovery
;
342 yyerror("syntax error");
354 if ((yyn
= yysindex
[*yyssp
]) && (yyn
+= YYERRCODE
) >= 0 &&
355 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
359 printf("yydebug: state %d, error recovery shifting\
360 to state %d\n", *yyssp
, yytable
[yyn
]);
362 if (yyssp
>= yyss
+ yystacksize
- 1)
366 *++yyssp
= yystate
= yytable
[yyn
];
374 printf("yydebug: error recovery discarding state %d\n",
377 if (yyssp
<= yyss
) goto yyabort
;
385 if (yychar
== 0) goto yyabort
;
390 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
391 if (!yys
) yys
= "illegal-symbol";
392 printf("yydebug: state %d, error recovery discards token %d (%s)\n",
393 yystate
, yychar
, yys
);
402 printf("yydebug: state %d, reducing by rule %d (%s)\n",
403 yystate
, yyn
, yyrule
[yyn
]);
406 yyval
= yyvsp
[1-yym
];
411 {process_command(proio_cons(wxmake_word(yyvsp
[-1].s
), NULL
)); free(yyvsp
[-1].s
);}
415 {process_command(yyvsp
[-1].s
);}
419 {syntax_error("Unrecognized command.");}
423 {yyval
.s
= proio_cons(wxmake_word(yyvsp
[-3].s
), yyvsp
[-1].s
); free(yyvsp
[-3].s
);}
427 {yyval
.s
= proio_cons(NULL
, NULL
);}
431 {yyval
.s
= yyvsp
[-1].s
; }
439 {yyval
.s
= proio_cons(yyvsp
[0].s
, NULL
);}
443 {yyval
.s
= proio_cons(yyvsp
[-2].s
, yyvsp
[0].s
);}
447 {yyval
.s
= proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp
[-2].s
), proio_cons(yyvsp
[0].s
, NULL
)));
452 {yyval
.s
= yyvsp
[0].s
; }
456 {yyval
.s
= wxmake_word(yyvsp
[0].s
); free(yyvsp
[0].s
);}
460 {yyval
.s
= wxmake_string(yyvsp
[0].s
); free(yyvsp
[0].s
);}
464 {yyval
.s
= wxmake_integer(yyvsp
[0].s
); free(yyvsp
[0].s
);}
468 {yyval
.s
= wxmake_real(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
472 {yyval
.s
= wxmake_exp(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
476 {yyval
.s
= wxmake_exp2(yyvsp
[-4].s
, yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-4].s
); free(yyvsp
[-2].s
);
481 {yyval
.s
= yyvsp
[0].s
;}
489 if (yystate
== 0 && yym
== 0)
493 printf("yydebug: after reduction, shifting from state 0 to\
494 state %d\n", YYFINAL
);
501 if ((yychar
= yylex()) < 0) yychar
= 0;
506 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
507 if (!yys
) yys
= "illegal-symbol";
508 printf("yydebug: state %d, reading %d (%s)\n",
509 YYFINAL
, yychar
, yys
);
513 if (yychar
== 0) goto yyaccept
;
516 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
517 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
518 yystate
= yytable
[yyn
];
520 yystate
= yydgoto
[yym
];
523 printf("yydebug: after reduction, shifting from state %d \
524 to state %d\n", *yyssp
, yystate
);
526 if (yyssp
>= yyss
+ yystacksize
- 1)
534 yyerror("yacc stack overflow");
541 #endif /* wxUSE_PROLOGIO */