2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
10 #define yyclearin (yychar = YYEMPTY)
11 #define yyerrok (yyerrflag = 0)
12 #define YYRECOVERING() (yyerrflag != 0)
16 #define yyparse error_parse
20 #define yylex error_lex
24 #define yyerror error_error
28 #define yychar error_char
32 #define yyval error_val
36 #define yylval error_lval
40 #define yydebug error_debug
44 #define yynerrs error_nerrs
48 #define yyerrflag error_errflag
49 #endif /* yyerrflag */
52 #define yylhs error_lhs
56 #define yylen error_len
60 #define yydefred error_defred
64 #define yydgoto error_dgoto
68 #define yysindex error_sindex
72 #define yyrindex error_rindex
76 #define yygindex error_gindex
80 #define yytable error_table
84 #define yycheck error_check
88 #define yyname error_name
92 #define yyrule error_rule
94 #define YYPREFIX "error_"
100 static void yyerror(const char *);
101 #line 102 "error.tab.c"
107 /* compatibility with bison */
109 /* compatibility with FreeBSD */
110 # ifdef YYPARSE_PARAM_TYPE
111 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
113 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
116 # define YYPARSE_DECL() yyparse(void)
119 /* Parameters sent to lex. */
121 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
122 # define YYLEX yylex(YYLEX_PARAM)
124 # define YYLEX_DECL() yylex(void)
125 # define YYLEX yylex()
128 /* Parameters sent to yyerror. */
130 #define YYERROR_DECL() yyerror(const char *s)
133 #define YYERROR_CALL(msg) yyerror(msg)
136 extern int YYPARSE_DECL();
138 #define YYERRCODE 256
139 static const short error_lhs[] = { -1,
142 static const short error_len[] = { 2,
145 static const short error_defred[] = { 0,
148 static const short error_dgoto[] = { 2,
150 static const short error_sindex[] = { -256,
153 static const short error_rindex[] = { 0,
156 static const short error_gindex[] = { 0,
158 #define YYTABLESIZE 0
159 static const short error_table[] = { 1,
161 static const short error_check[] = { 256,
169 static const char *yyname[] = {
173 static const char *yyrule[] = {
188 /* define the initial stack-sizes */
191 #define YYMAXDEPTH YYSTACKSIZE
194 #define YYSTACKSIZE YYMAXDEPTH
196 #define YYSTACKSIZE 500
197 #define YYMAXDEPTH 500
201 #define YYINITSTACKSIZE 500
211 /* variables for the parser stack */
212 static YYSTACKDATA yystack;
220 printf("yyparse() = %d\n", yyparse());
231 yyerror(const char* s)
235 #line 236 "error.tab.c"
238 #include <stdio.h> /* needed for printf */
241 #include <stdlib.h> /* needed for malloc, etc */
242 #include <string.h> /* needed for memset */
244 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
245 static int yygrowstack(YYSTACKDATA *data)
252 if ((newsize = data->stacksize) == 0)
253 newsize = YYINITSTACKSIZE;
254 else if (newsize >= YYMAXDEPTH)
256 else if ((newsize *= 2) > YYMAXDEPTH)
257 newsize = YYMAXDEPTH;
259 i = (int) (data->s_mark - data->s_base);
260 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
264 data->s_base = newss;
265 data->s_mark = newss + i;
267 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
271 data->l_base = newvs;
272 data->l_mark = newvs + i;
274 data->stacksize = newsize;
275 data->s_last = data->s_base + newsize - 1;
279 #if YYPURE || defined(YY_NO_LEAKS)
280 static void yyfreestack(YYSTACKDATA *data)
284 memset(data, 0, sizeof(*data));
287 #define yyfreestack(data) /* nothing */
290 #define YYABORT goto yyabort
291 #define YYREJECT goto yyabort
292 #define YYACCEPT goto yyaccept
293 #define YYERROR goto yyerrlab
298 int yym, yyn, yystate;
302 if ((yys = getenv("YYDEBUG")) != 0)
305 if (yyn >= '0' && yyn <= '9')
316 memset(&yystack, 0, sizeof(yystack));
319 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
320 yystack.s_mark = yystack.s_base;
321 yystack.l_mark = yystack.l_base;
326 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
329 if ((yychar = YYLEX) < 0) yychar = 0;
334 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
335 if (!yys) yys = "illegal-symbol";
336 printf("%sdebug: state %d, reading %d (%s)\n",
337 YYPREFIX, yystate, yychar, yys);
341 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
342 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
346 printf("%sdebug: state %d, shifting to state %d\n",
347 YYPREFIX, yystate, yytable[yyn]);
349 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
353 yystate = yytable[yyn];
354 *++yystack.s_mark = yytable[yyn];
355 *++yystack.l_mark = yylval;
357 if (yyerrflag > 0) --yyerrflag;
360 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
361 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
366 if (yyerrflag) goto yyinrecovery;
368 yyerror("syntax error");
381 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
382 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
386 printf("%sdebug: state %d, error recovery shifting\
387 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
389 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
393 yystate = yytable[yyn];
394 *++yystack.s_mark = yytable[yyn];
395 *++yystack.l_mark = yylval;
402 printf("%sdebug: error recovery discarding state %d\n",
403 YYPREFIX, *yystack.s_mark);
405 if (yystack.s_mark <= yystack.s_base) goto yyabort;
413 if (yychar == 0) goto yyabort;
418 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
419 if (!yys) yys = "illegal-symbol";
420 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
421 YYPREFIX, yystate, yychar, yys);
431 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
432 YYPREFIX, yystate, yyn, yyrule[yyn]);
436 yyval = yystack.l_mark[1-yym];
438 memset(&yyval, 0, sizeof yyval);
442 yystack.s_mark -= yym;
443 yystate = *yystack.s_mark;
444 yystack.l_mark -= yym;
446 if (yystate == 0 && yym == 0)
450 printf("%sdebug: after reduction, shifting from state 0 to\
451 state %d\n", YYPREFIX, YYFINAL);
454 *++yystack.s_mark = YYFINAL;
455 *++yystack.l_mark = yyval;
458 if ((yychar = YYLEX) < 0) yychar = 0;
463 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
464 if (!yys) yys = "illegal-symbol";
465 printf("%sdebug: state %d, reading %d (%s)\n",
466 YYPREFIX, YYFINAL, yychar, yys);
470 if (yychar == 0) goto yyaccept;
473 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
474 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
475 yystate = yytable[yyn];
477 yystate = yydgoto[yym];
480 printf("%sdebug: after reduction, shifting from state %d \
481 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
483 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
487 *++yystack.s_mark = (short) yystate;
488 *++yystack.l_mark = yyval;
492 yyerror("yacc stack overflow");
495 yyfreestack(&yystack);
499 yyfreestack(&yystack);