2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
13 #define yyclearin (yychar = YYEMPTY)
14 #define yyerrok (yyerrflag = 0)
15 #define YYRECOVERING() (yyerrflag != 0)
17 /* compatibility with bison */
19 /* compatibility with FreeBSD */
20 #ifdef YYPARSE_PARAM_TYPE
21 #define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
23 #define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
26 #define YYPARSE_DECL() yyparse(void)
27 #endif /* YYPARSE_PARAM */
29 extern int YYPARSE_DECL();
31 static int yygrowstack(void);
32 #define yyparse error_parse
33 #define yylex error_lex
34 #define yyerror error_error
35 #define yychar error_char
36 #define yyval error_val
37 #define yylval error_lval
38 #define yydebug error_debug
39 #define yynerrs error_nerrs
40 #define yyerrflag error_errflag
42 #define yyssp error_ssp
44 #define yyvsp error_vsp
45 #define yylhs error_lhs
46 #define yylen error_len
47 #define yydefred error_defred
48 #define yydgoto error_dgoto
49 #define yysindex error_sindex
50 #define yyrindex error_rindex
51 #define yygindex error_gindex
52 #define yytable error_table
53 #define yycheck error_check
54 #define yyname error_name
55 #define yyrule error_rule
56 #define YYPREFIX "error_"
58 static const short error_lhs[] = { -1,
61 static const short error_len[] = { 2,
64 static const short error_defred[] = { 0,
67 static const short error_dgoto[] = { 2,
69 static const short error_sindex[] = { -256,
72 static const short error_rindex[] = { 0,
75 static const short error_gindex[] = { 0,
78 static const short error_table[] = { 1,
80 static const short error_check[] = { 256,
88 static const char *error_name[] = {
92 static const char *error_rule[] = {
105 /* define the initial stack-sizes */
108 #define YYMAXDEPTH YYSTACKSIZE
111 #define YYSTACKSIZE YYMAXDEPTH
113 #define YYSTACKSIZE 500
114 #define YYMAXDEPTH 500
118 #define YYINITSTACKSIZE 500
129 /* variables for the parser stack */
131 static short *yysslim;
132 static YYSTYPE *yyvs;
133 static unsigned yystacksize;
135 main(){printf("yyparse() = %d\n",yyparse());}
137 yyerror(s)char*s;{printf("%s\n",s);}
138 #line 139 "error.tab.c"
139 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
140 static int yygrowstack(void)
147 if ((newsize = yystacksize) == 0)
148 newsize = YYINITSTACKSIZE;
149 else if (newsize >= YYMAXDEPTH)
151 else if ((newsize *= 2) > YYMAXDEPTH)
152 newsize = YYMAXDEPTH;
156 ? (short *)realloc(yyss, newsize * sizeof(*newss))
157 : (short *)malloc(newsize * sizeof(*newss));
164 ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
165 : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
171 yystacksize = newsize;
172 yysslim = yyss + newsize - 1;
176 #define YYABORT goto yyabort
177 #define YYREJECT goto yyabort
178 #define YYACCEPT goto yyaccept
179 #define YYERROR goto yyerrlab
184 int yym, yyn, yystate;
188 if ((yys = getenv("YYDEBUG")) != 0)
191 if (yyn >= '0' && yyn <= '9')
201 if (yyss == NULL && yygrowstack()) goto yyoverflow;
208 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
211 if ((yychar = yylex()) < 0) yychar = 0;
216 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
217 if (!yys) yys = "illegal-symbol";
218 printf("%sdebug: state %d, reading %d (%s)\n",
219 YYPREFIX, yystate, yychar, yys);
223 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
224 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
228 printf("%sdebug: state %d, shifting to state %d\n",
229 YYPREFIX, yystate, yytable[yyn]);
231 if (yyssp >= yysslim && yygrowstack())
235 yystate = yytable[yyn];
236 *++yyssp = yytable[yyn];
239 if (yyerrflag > 0) --yyerrflag;
242 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
243 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
248 if (yyerrflag) goto yyinrecovery;
250 yyerror("syntax error");
263 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
264 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
268 printf("%sdebug: state %d, error recovery shifting\
269 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
271 if (yyssp >= yysslim && yygrowstack())
275 yystate = yytable[yyn];
276 *++yyssp = yytable[yyn];
284 printf("%sdebug: error recovery discarding state %d\n",
287 if (yyssp <= yyss) goto yyabort;
295 if (yychar == 0) goto yyabort;
300 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
301 if (!yys) yys = "illegal-symbol";
302 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
303 YYPREFIX, yystate, yychar, yys);
313 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
314 YYPREFIX, yystate, yyn, yyrule[yyn]);
318 yyval = yyvsp[1-yym];
320 memset(&yyval, 0, sizeof yyval);
328 if (yystate == 0 && yym == 0)
332 printf("%sdebug: after reduction, shifting from state 0 to\
333 state %d\n", YYPREFIX, YYFINAL);
340 if ((yychar = yylex()) < 0) yychar = 0;
345 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
346 if (!yys) yys = "illegal-symbol";
347 printf("%sdebug: state %d, reading %d (%s)\n",
348 YYPREFIX, YYFINAL, yychar, yys);
352 if (yychar == 0) goto yyaccept;
355 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
356 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
357 yystate = yytable[yyn];
359 yystate = yydgoto[yym];
362 printf("%sdebug: after reduction, shifting from state %d \
363 to state %d\n", YYPREFIX, *yyssp, yystate);
365 if (yyssp >= yysslim && yygrowstack())
369 *++yyssp = (short) yystate;
374 yyerror("yacc stack overflow");