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)
19 #line 2 "code_error.y"
23 static void yyerror(const char *);
26 #line 26 "/dev/stdout"
32 /* compatibility with bison */
34 /* compatibility with FreeBSD */
35 # ifdef YYPARSE_PARAM_TYPE
36 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
38 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
41 # define YYPARSE_DECL() yyparse(void)
44 /* Parameters sent to lex. */
46 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
47 # define YYLEX yylex(YYLEX_PARAM)
49 # define YYLEX_DECL() yylex(void)
50 # define YYLEX yylex()
53 /* Parameters sent to yyerror. */
55 #define YYERROR_DECL() yyerror(const char *s)
58 #define YYERROR_CALL(msg) yyerror(msg)
61 extern int YYPARSE_DECL();
64 static const short yylhs[] = { -1,
67 static const short yylen[] = { 2,
70 static const short yydefred[] = { 0,
73 static const short yydgoto[] = { 2,
75 static const short yysindex[] = { -256,
78 static const short yyrindex[] = { 0,
81 static const short yygindex[] = { 0,
84 static const short yytable[] = { 1,
86 static const short yycheck[] = { 256,
93 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
95 static const char *yyname[] = {
97 "end-of-file","illegal-symbol",
99 static const char *yyrule[] = {
114 /* define the initial stack-sizes */
117 #define YYMAXDEPTH YYSTACKSIZE
120 #define YYSTACKSIZE YYMAXDEPTH
122 #define YYSTACKSIZE 10000
123 #define YYMAXDEPTH 10000
127 #define YYINITSTACKSIZE 200
137 /* variables for the parser stack */
138 static YYSTACKDATA yystack;
139 #line 12 "code_error.y"
144 extern int YYLEX_DECL();
150 printf("yyparse() = %d\n", yyparse());
161 yyerror(const char* s)
165 #line 164 "/dev/stdout"
168 #include <stdio.h> /* needed for printf */
171 #include <stdlib.h> /* needed for malloc, etc */
172 #include <string.h> /* needed for memset */
174 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
175 static int yygrowstack(YYSTACKDATA *data)
182 if ((newsize = data->stacksize) == 0)
183 newsize = YYINITSTACKSIZE;
184 else if (newsize >= YYMAXDEPTH)
186 else if ((newsize *= 2) > YYMAXDEPTH)
187 newsize = YYMAXDEPTH;
189 i = (int) (data->s_mark - data->s_base);
190 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
194 data->s_base = newss;
195 data->s_mark = newss + i;
197 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
201 data->l_base = newvs;
202 data->l_mark = newvs + i;
204 data->stacksize = newsize;
205 data->s_last = data->s_base + newsize - 1;
209 #if YYPURE || defined(YY_NO_LEAKS)
210 static void yyfreestack(YYSTACKDATA *data)
214 memset(data, 0, sizeof(*data));
217 #define yyfreestack(data) /* nothing */
220 #define YYABORT goto yyabort
221 #define YYREJECT goto yyabort
222 #define YYACCEPT goto yyaccept
223 #define YYERROR goto yyerrlab
228 int yym, yyn, yystate;
232 if ((yys = getenv("YYDEBUG")) != 0)
235 if (yyn >= '0' && yyn <= '9')
246 memset(&yystack, 0, sizeof(yystack));
249 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
250 yystack.s_mark = yystack.s_base;
251 yystack.l_mark = yystack.l_base;
256 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
259 if ((yychar = YYLEX) < 0) yychar = 0;
263 yys = yyname[YYTRANSLATE(yychar)];
264 printf("%sdebug: state %d, reading %d (%s)\n",
265 YYPREFIX, yystate, yychar, yys);
269 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
270 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
274 printf("%sdebug: state %d, shifting to state %d\n",
275 YYPREFIX, yystate, yytable[yyn]);
277 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
281 yystate = yytable[yyn];
282 *++yystack.s_mark = yytable[yyn];
283 *++yystack.l_mark = yylval;
285 if (yyerrflag > 0) --yyerrflag;
288 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
289 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
294 if (yyerrflag) goto yyinrecovery;
296 yyerror("syntax error");
309 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
310 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
314 printf("%sdebug: state %d, error recovery shifting\
315 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
317 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
321 yystate = yytable[yyn];
322 *++yystack.s_mark = yytable[yyn];
323 *++yystack.l_mark = yylval;
330 printf("%sdebug: error recovery discarding state %d\n",
331 YYPREFIX, *yystack.s_mark);
333 if (yystack.s_mark <= yystack.s_base) goto yyabort;
341 if (yychar == 0) goto yyabort;
345 yys = yyname[YYTRANSLATE(yychar)];
346 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
347 YYPREFIX, yystate, yychar, yys);
357 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
358 YYPREFIX, yystate, yyn, yyrule[yyn]);
362 yyval = yystack.l_mark[1-yym];
364 memset(&yyval, 0, sizeof yyval);
368 yystack.s_mark -= yym;
369 yystate = *yystack.s_mark;
370 yystack.l_mark -= yym;
372 if (yystate == 0 && yym == 0)
376 printf("%sdebug: after reduction, shifting from state 0 to\
377 state %d\n", YYPREFIX, YYFINAL);
380 *++yystack.s_mark = YYFINAL;
381 *++yystack.l_mark = yyval;
384 if ((yychar = YYLEX) < 0) yychar = 0;
388 yys = yyname[YYTRANSLATE(yychar)];
389 printf("%sdebug: state %d, reading %d (%s)\n",
390 YYPREFIX, YYFINAL, yychar, yys);
394 if (yychar == 0) goto yyaccept;
397 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
398 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
399 yystate = yytable[yyn];
401 yystate = yydgoto[yym];
404 printf("%sdebug: after reduction, shifting from state %d \
405 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
407 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
411 *++yystack.s_mark = (short) yystate;
412 *++yystack.l_mark = yyval;
416 yyerror("yacc stack overflow");
419 yyfreestack(&yystack);
423 yyfreestack(&yystack);