3 /* static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; */
4 static char rcsid
[] = "$NetBSD: error.tab.c,v 1.4 1997/01/09 20:23:30 tls Exp $";
15 #define yyclearin (yychar = YYEMPTY)
16 #define yyerrok (yyerrflag = 0)
17 #define YYRECOVERING() (yyerrflag != 0)
19 /* compatibility with bison */
21 /* compatibility with FreeBSD */
22 #ifdef YYPARSE_PARAM_TYPE
23 #define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
25 #define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
28 #define YYPARSE_DECL() yyparse(void)
29 #endif /* YYPARSE_PARAM */
31 extern int YYPARSE_DECL();
33 static int yygrowstack(void);
34 #define yyparse error_parse
35 #define yylex error_lex
36 #define yyerror error_error
37 #define yychar error_char
38 #define yyval error_val
39 #define yylval error_lval
40 #define yydebug error_debug
41 #define yynerrs error_nerrs
42 #define yyerrflag error_errflag
44 #define yyssp error_ssp
46 #define yyvsp error_vsp
47 #define yylhs error_lhs
48 #define yylen error_len
49 #define yydefred error_defred
50 #define yydgoto error_dgoto
51 #define yysindex error_sindex
52 #define yyrindex error_rindex
53 #define yygindex error_gindex
54 #define yytable error_table
55 #define yycheck error_check
56 #define yyname error_name
57 #define yyrule error_rule
58 #define YYPREFIX "error_"
60 static const short error_lhs
[] = { -1,
63 static const short error_len
[] = { 2,
66 static const short error_defred
[] = { 0,
69 static const short error_dgoto
[] = { 2,
71 static const short error_sindex
[] = { -256,
74 static const short error_rindex
[] = { 0,
77 static const short error_gindex
[] = { 0,
80 static const short error_table
[] = { 1,
82 static const short error_check
[] = { 256,
90 static const char *error_name
[] = {
94 static const char *error_rule
[] = {
107 /* define the initial stack-sizes */
110 #define YYMAXDEPTH YYSTACKSIZE
113 #define YYSTACKSIZE YYMAXDEPTH
115 #define YYSTACKSIZE 500
116 #define YYMAXDEPTH 500
120 #define YYINITSTACKSIZE 500
131 /* variables for the parser stack */
133 static short *yysslim
;
134 static YYSTYPE
*yyvs
;
135 static unsigned yystacksize
;
137 main(){printf("yyparse() = %d\n",yyparse());}
139 yyerror(s
)char*s
;{printf("%s\n",s
);}
140 #line 139 "error.tab.c"
141 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
142 static int yygrowstack(void)
149 if ((newsize
= yystacksize
) == 0)
150 newsize
= YYINITSTACKSIZE
;
151 else if (newsize
>= YYMAXDEPTH
)
153 else if ((newsize
*= 2) > YYMAXDEPTH
)
154 newsize
= YYMAXDEPTH
;
158 ? (short *)realloc(yyss
, newsize
* sizeof(*newss
))
159 : (short *)malloc(newsize
* sizeof(*newss
));
166 ? (YYSTYPE
*)realloc(yyvs
, newsize
* sizeof(*newvs
))
167 : (YYSTYPE
*)malloc(newsize
* sizeof(*newvs
));
173 yystacksize
= newsize
;
174 yysslim
= yyss
+ newsize
- 1;
178 #define YYABORT goto yyabort
179 #define YYREJECT goto yyabort
180 #define YYACCEPT goto yyaccept
181 #define YYERROR goto yyerrlab
186 int yym
, yyn
, yystate
;
190 if ((yys
= getenv("YYDEBUG")) != 0)
193 if (yyn
>= '0' && yyn
<= '9')
203 if (yyss
== NULL
&& yygrowstack()) goto yyoverflow
;
210 if ((yyn
= yydefred
[yystate
]) != 0) goto yyreduce
;
213 if ((yychar
= yylex()) < 0) yychar
= 0;
218 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
219 if (!yys
) yys
= "illegal-symbol";
220 printf("%sdebug: state %d, reading %d (%s)\n",
221 YYPREFIX
, yystate
, yychar
, yys
);
225 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
226 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
230 printf("%sdebug: state %d, shifting to state %d\n",
231 YYPREFIX
, yystate
, yytable
[yyn
]);
233 if (yyssp
>= yysslim
&& yygrowstack())
237 yystate
= yytable
[yyn
];
238 *++yyssp
= yytable
[yyn
];
241 if (yyerrflag
> 0) --yyerrflag
;
244 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
245 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
250 if (yyerrflag
) goto yyinrecovery
;
252 yyerror("syntax error");
265 if ((yyn
= yysindex
[*yyssp
]) && (yyn
+= YYERRCODE
) >= 0 &&
266 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
270 printf("%sdebug: state %d, error recovery shifting\
271 to state %d\n", YYPREFIX
, *yyssp
, yytable
[yyn
]);
273 if (yyssp
>= yysslim
&& yygrowstack())
277 yystate
= yytable
[yyn
];
278 *++yyssp
= yytable
[yyn
];
286 printf("%sdebug: error recovery discarding state %d\n",
289 if (yyssp
<= yyss
) goto yyabort
;
297 if (yychar
== 0) goto yyabort
;
302 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
303 if (!yys
) yys
= "illegal-symbol";
304 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
305 YYPREFIX
, yystate
, yychar
, yys
);
315 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
316 YYPREFIX
, yystate
, yyn
, yyrule
[yyn
]);
320 yyval
= yyvsp
[1-yym
];
322 memset(&yyval
, 0, sizeof yyval
);
330 if (yystate
== 0 && yym
== 0)
334 printf("%sdebug: after reduction, shifting from state 0 to\
335 state %d\n", YYPREFIX
, YYFINAL
);
342 if ((yychar
= yylex()) < 0) yychar
= 0;
347 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
348 if (!yys
) yys
= "illegal-symbol";
349 printf("%sdebug: state %d, reading %d (%s)\n",
350 YYPREFIX
, YYFINAL
, yychar
, yys
);
354 if (yychar
== 0) goto yyaccept
;
357 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
358 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
359 yystate
= yytable
[yyn
];
361 yystate
= yydgoto
[yym
];
364 printf("%sdebug: after reduction, shifting from state %d \
365 to state %d\n", YYPREFIX
, *yyssp
, yystate
);
367 if (yyssp
>= yysslim
&& yygrowstack())
371 *++yyssp
= (short) yystate
;
376 yyerror("yacc stack overflow");