2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
8 #define YYPATCH 20140101
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
21 static void yyerror(const char *);
22 #line 22 "/dev/stdout"
28 /* compatibility with bison */
30 /* compatibility with FreeBSD */
31 # ifdef YYPARSE_PARAM_TYPE
32 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
34 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
37 # define YYPARSE_DECL() yyparse(void)
40 /* Parameters sent to lex. */
42 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
43 # define YYLEX yylex(YYLEX_PARAM)
45 # define YYLEX_DECL() yylex(void)
46 # define YYLEX yylex()
49 /* Parameters sent to yyerror. */
51 #define YYERROR_DECL() yyerror(const char *s)
54 #define YYERROR_CALL(msg) yyerror(msg)
57 extern int YYPARSE_DECL();
60 static const short yylhs[] = { -1,
63 static const short yylen[] = { 2,
66 static const short yydefred[] = { 0,
69 static const short yydgoto[] = { 2,
71 static const short yysindex[] = { -256,
74 static const short yyrindex[] = { 0,
77 static const short yygindex[] = { 0,
80 static const short yytable[] = { 1,
82 static const short yycheck[] = { 256,
89 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
91 static const char *yyname[] = {
93 "end-of-file","illegal-symbol",
95 static const char *yyrule[] = {
110 /* define the initial stack-sizes */
113 #define YYMAXDEPTH YYSTACKSIZE
116 #define YYSTACKSIZE YYMAXDEPTH
118 #define YYSTACKSIZE 10000
119 #define YYMAXDEPTH 10000
123 #define YYINITSTACKSIZE 200
133 /* variables for the parser stack */
134 static YYSTACKDATA yystack;
142 printf("yyparse() = %d\n", yyparse());
153 yyerror(const char* s)
157 #line 156 "/dev/stdout"
160 #include <stdio.h> /* needed for printf */
163 #include <stdlib.h> /* needed for malloc, etc */
164 #include <string.h> /* needed for memset */
166 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
167 static int yygrowstack(YYSTACKDATA *data)
174 if ((newsize = data->stacksize) == 0)
175 newsize = YYINITSTACKSIZE;
176 else if (newsize >= YYMAXDEPTH)
178 else if ((newsize *= 2) > YYMAXDEPTH)
179 newsize = YYMAXDEPTH;
181 i = (int) (data->s_mark - data->s_base);
182 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
186 data->s_base = newss;
187 data->s_mark = newss + i;
189 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
193 data->l_base = newvs;
194 data->l_mark = newvs + i;
196 data->stacksize = newsize;
197 data->s_last = data->s_base + newsize - 1;
201 #if YYPURE || defined(YY_NO_LEAKS)
202 static void yyfreestack(YYSTACKDATA *data)
206 memset(data, 0, sizeof(*data));
209 #define yyfreestack(data) /* nothing */
212 #define YYABORT goto yyabort
213 #define YYREJECT goto yyabort
214 #define YYACCEPT goto yyaccept
215 #define YYERROR goto yyerrlab
220 int yym, yyn, yystate;
224 if ((yys = getenv("YYDEBUG")) != 0)
227 if (yyn >= '0' && yyn <= '9')
238 memset(&yystack, 0, sizeof(yystack));
241 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
242 yystack.s_mark = yystack.s_base;
243 yystack.l_mark = yystack.l_base;
248 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
251 if ((yychar = YYLEX) < 0) yychar = 0;
255 yys = yyname[YYTRANSLATE(yychar)];
256 printf("%sdebug: state %d, reading %d (%s)\n",
257 YYPREFIX, yystate, yychar, yys);
261 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
262 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
266 printf("%sdebug: state %d, shifting to state %d\n",
267 YYPREFIX, yystate, yytable[yyn]);
269 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
273 yystate = yytable[yyn];
274 *++yystack.s_mark = yytable[yyn];
275 *++yystack.l_mark = yylval;
277 if (yyerrflag > 0) --yyerrflag;
280 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
281 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
286 if (yyerrflag) goto yyinrecovery;
288 yyerror("syntax error");
301 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
302 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
306 printf("%sdebug: state %d, error recovery shifting\
307 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
309 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
313 yystate = yytable[yyn];
314 *++yystack.s_mark = yytable[yyn];
315 *++yystack.l_mark = yylval;
322 printf("%sdebug: error recovery discarding state %d\n",
323 YYPREFIX, *yystack.s_mark);
325 if (yystack.s_mark <= yystack.s_base) goto yyabort;
333 if (yychar == 0) goto yyabort;
337 yys = yyname[YYTRANSLATE(yychar)];
338 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
339 YYPREFIX, yystate, yychar, yys);
349 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
350 YYPREFIX, yystate, yyn, yyrule[yyn]);
354 yyval = yystack.l_mark[1-yym];
356 memset(&yyval, 0, sizeof yyval);
360 yystack.s_mark -= yym;
361 yystate = *yystack.s_mark;
362 yystack.l_mark -= yym;
364 if (yystate == 0 && yym == 0)
368 printf("%sdebug: after reduction, shifting from state 0 to\
369 state %d\n", YYPREFIX, YYFINAL);
372 *++yystack.s_mark = YYFINAL;
373 *++yystack.l_mark = yyval;
376 if ((yychar = YYLEX) < 0) yychar = 0;
380 yys = yyname[YYTRANSLATE(yychar)];
381 printf("%sdebug: state %d, reading %d (%s)\n",
382 YYPREFIX, YYFINAL, yychar, yys);
386 if (yychar == 0) goto yyaccept;
389 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
390 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
391 yystate = yytable[yyn];
393 yystate = yydgoto[yym];
396 printf("%sdebug: after reduction, shifting from state %d \
397 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
399 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
403 *++yystack.s_mark = (short) yystate;
404 *++yystack.l_mark = yyval;
408 yyerror("yacc stack overflow");
411 yyfreestack(&yystack);
415 yyfreestack(&yystack);