xref: /csrg-svn/usr.bin/yacc/test/error.tab.c (revision 60322)
140077Sbostic #ifndef lint
2*60322Sbostic static char yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93";
340077Sbostic #endif
4*60322Sbostic #define YYBYACC 1
5*60322Sbostic #define YYMAJOR 1
6*60322Sbostic #define YYMINOR 9
7*60322Sbostic #define yyclearin (yychar=(-1))
8*60322Sbostic #define yyerrok (yyerrflag=0)
9*60322Sbostic #define YYRECOVERING (yyerrflag!=0)
10*60322Sbostic #define YYPREFIX "yy"
1140077Sbostic #define YYERRCODE 256
1240084Sbostic short yylhs[] = {                                        -1,
1340077Sbostic     0,
1440077Sbostic };
1540084Sbostic short yylen[] = {                                         2,
1640077Sbostic     1,
1740077Sbostic };
1840084Sbostic short yydefred[] = {                                      0,
1940077Sbostic     1,    0,
2040077Sbostic };
2140084Sbostic short yydgoto[] = {                                       2,
2240077Sbostic };
2340084Sbostic short yysindex[] = {                                   -256,
2440077Sbostic     0,    0,
2540077Sbostic };
2640084Sbostic short yyrindex[] = {                                      0,
2740077Sbostic     0,    0,
2840077Sbostic };
2940084Sbostic short yygindex[] = {                                      0,
3040077Sbostic };
3140084Sbostic #define YYTABLESIZE 0
3240084Sbostic short yytable[] = {                                       1,
3340077Sbostic };
3440084Sbostic short yycheck[] = {                                     256,
3540077Sbostic };
3640077Sbostic #define YYFINAL 2
3740077Sbostic #ifndef YYDEBUG
3840077Sbostic #define YYDEBUG 0
3940077Sbostic #endif
4040077Sbostic #define YYMAXTOKEN 0
4140077Sbostic #if YYDEBUG
4240084Sbostic char *yyname[] = {
4340077Sbostic "end-of-file",
4440077Sbostic };
4540084Sbostic char *yyrule[] = {
4640077Sbostic "$accept : S",
4740077Sbostic "S : error",
4840077Sbostic };
4940077Sbostic #endif
5040077Sbostic #ifndef YYSTYPE
5140077Sbostic typedef int YYSTYPE;
5240077Sbostic #endif
53*60322Sbostic #ifdef YYSTACKSIZE
54*60322Sbostic #undef YYMAXDEPTH
55*60322Sbostic #define YYMAXDEPTH YYSTACKSIZE
56*60322Sbostic #else
5740077Sbostic #ifdef YYMAXDEPTH
5840077Sbostic #define YYSTACKSIZE YYMAXDEPTH
5940077Sbostic #else
60*60322Sbostic #define YYSTACKSIZE 500
61*60322Sbostic #define YYMAXDEPTH 500
6240077Sbostic #endif
6340077Sbostic #endif
6440077Sbostic int yydebug;
6540077Sbostic int yynerrs;
6640077Sbostic int yyerrflag;
6740077Sbostic int yychar;
6840077Sbostic short *yyssp;
6940077Sbostic YYSTYPE *yyvsp;
7040077Sbostic YYSTYPE yyval;
7140077Sbostic YYSTYPE yylval;
7240077Sbostic short yyss[YYSTACKSIZE];
7340077Sbostic YYSTYPE yyvs[YYSTACKSIZE];
74*60322Sbostic #define yystacksize YYSTACKSIZE
7540084Sbostic #line 4 "error.y"
main()7640084Sbostic main(){printf("yyparse() = %d\n",yyparse());}
yylex()7740084Sbostic yylex(){return-1;}
yyerror(s)7840084Sbostic yyerror(s)char*s;{printf("%s\n",s);}
79*60322Sbostic #line 80 "error.tab.c"
8040084Sbostic #define YYABORT goto yyabort
81*60322Sbostic #define YYREJECT goto yyabort
8240077Sbostic #define YYACCEPT goto yyaccept
8340077Sbostic #define YYERROR goto yyerrlab
8440077Sbostic int
yyparse()8540077Sbostic yyparse()
8640077Sbostic {
8740077Sbostic     register int yym, yyn, yystate;
8840077Sbostic #if YYDEBUG
8940077Sbostic     register char *yys;
9040077Sbostic     extern char *getenv();
9140077Sbostic 
9240077Sbostic     if (yys = getenv("YYDEBUG"))
9340077Sbostic     {
9440077Sbostic         yyn = *yys;
95*60322Sbostic         if (yyn >= '0' && yyn <= '9')
9640077Sbostic             yydebug = yyn - '0';
9740077Sbostic     }
9840077Sbostic #endif
9940077Sbostic 
10040077Sbostic     yynerrs = 0;
10140077Sbostic     yyerrflag = 0;
10240077Sbostic     yychar = (-1);
10340077Sbostic 
10440077Sbostic     yyssp = yyss;
10540077Sbostic     yyvsp = yyvs;
10640077Sbostic     *yyssp = yystate = 0;
10740077Sbostic 
10840077Sbostic yyloop:
10940077Sbostic     if (yyn = yydefred[yystate]) goto yyreduce;
11040077Sbostic     if (yychar < 0)
11140077Sbostic     {
11240077Sbostic         if ((yychar = yylex()) < 0) yychar = 0;
11340077Sbostic #if YYDEBUG
11440077Sbostic         if (yydebug)
11540077Sbostic         {
11640077Sbostic             yys = 0;
11740077Sbostic             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
11840077Sbostic             if (!yys) yys = "illegal-symbol";
119*60322Sbostic             printf("%sdebug: state %d, reading %d (%s)\n",
120*60322Sbostic                     YYPREFIX, yystate, yychar, yys);
12140077Sbostic         }
12240077Sbostic #endif
12340077Sbostic     }
12440077Sbostic     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
12540077Sbostic             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
12640077Sbostic     {
12740077Sbostic #if YYDEBUG
12840077Sbostic         if (yydebug)
129*60322Sbostic             printf("%sdebug: state %d, shifting to state %d\n",
130*60322Sbostic                     YYPREFIX, yystate, yytable[yyn]);
13140077Sbostic #endif
13240077Sbostic         if (yyssp >= yyss + yystacksize - 1)
13340077Sbostic         {
13440077Sbostic             goto yyoverflow;
13540077Sbostic         }
13640077Sbostic         *++yyssp = yystate = yytable[yyn];
13740077Sbostic         *++yyvsp = yylval;
13840077Sbostic         yychar = (-1);
13940077Sbostic         if (yyerrflag > 0)  --yyerrflag;
14040077Sbostic         goto yyloop;
14140077Sbostic     }
14240077Sbostic     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
14340077Sbostic             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
14440077Sbostic     {
14540077Sbostic         yyn = yytable[yyn];
14640077Sbostic         goto yyreduce;
14740077Sbostic     }
14840077Sbostic     if (yyerrflag) goto yyinrecovery;
14940084Sbostic #ifdef lint
15040084Sbostic     goto yynewerror;
15140084Sbostic #endif
15240077Sbostic yynewerror:
15340077Sbostic     yyerror("syntax error");
15440084Sbostic #ifdef lint
15540084Sbostic     goto yyerrlab;
15640084Sbostic #endif
15740077Sbostic yyerrlab:
15840077Sbostic     ++yynerrs;
15940077Sbostic yyinrecovery:
16040077Sbostic     if (yyerrflag < 3)
16140077Sbostic     {
16240077Sbostic         yyerrflag = 3;
16340077Sbostic         for (;;)
16440077Sbostic         {
16540077Sbostic             if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
16640077Sbostic                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
16740077Sbostic             {
16840077Sbostic #if YYDEBUG
16940077Sbostic                 if (yydebug)
170*60322Sbostic                     printf("%sdebug: state %d, error recovery shifting\
171*60322Sbostic  to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
17240077Sbostic #endif
17340077Sbostic                 if (yyssp >= yyss + yystacksize - 1)
17440077Sbostic                 {
17540077Sbostic                     goto yyoverflow;
17640077Sbostic                 }
17740077Sbostic                 *++yyssp = yystate = yytable[yyn];
17840077Sbostic                 *++yyvsp = yylval;
17940077Sbostic                 goto yyloop;
18040077Sbostic             }
18140077Sbostic             else
18240077Sbostic             {
18340077Sbostic #if YYDEBUG
18440077Sbostic                 if (yydebug)
185*60322Sbostic                     printf("%sdebug: error recovery discarding state %d\n",
186*60322Sbostic                             YYPREFIX, *yyssp);
18740077Sbostic #endif
18840077Sbostic                 if (yyssp <= yyss) goto yyabort;
18940077Sbostic                 --yyssp;
19040077Sbostic                 --yyvsp;
19140077Sbostic             }
19240077Sbostic         }
19340077Sbostic     }
19440077Sbostic     else
19540077Sbostic     {
19640077Sbostic         if (yychar == 0) goto yyabort;
19740077Sbostic #if YYDEBUG
19840077Sbostic         if (yydebug)
19940077Sbostic         {
20040077Sbostic             yys = 0;
20140077Sbostic             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
20240077Sbostic             if (!yys) yys = "illegal-symbol";
203*60322Sbostic             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
204*60322Sbostic                     YYPREFIX, yystate, yychar, yys);
20540077Sbostic         }
20640077Sbostic #endif
20740077Sbostic         yychar = (-1);
20840077Sbostic         goto yyloop;
20940077Sbostic     }
21040077Sbostic yyreduce:
21140077Sbostic #if YYDEBUG
21240077Sbostic     if (yydebug)
213*60322Sbostic         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
214*60322Sbostic                 YYPREFIX, yystate, yyn, yyrule[yyn]);
21540077Sbostic #endif
21640077Sbostic     yym = yylen[yyn];
21740077Sbostic     yyval = yyvsp[1-yym];
21840077Sbostic     switch (yyn)
21940077Sbostic     {
22040077Sbostic     }
22140077Sbostic     yyssp -= yym;
22240077Sbostic     yystate = *yyssp;
22340077Sbostic     yyvsp -= yym;
22440077Sbostic     yym = yylhs[yyn];
22540077Sbostic     if (yystate == 0 && yym == 0)
22640077Sbostic     {
227*60322Sbostic #if YYDEBUG
22840077Sbostic         if (yydebug)
229*60322Sbostic             printf("%sdebug: after reduction, shifting from state 0 to\
230*60322Sbostic  state %d\n", YYPREFIX, YYFINAL);
23140077Sbostic #endif
23240077Sbostic         yystate = YYFINAL;
23340077Sbostic         *++yyssp = YYFINAL;
23440077Sbostic         *++yyvsp = yyval;
23540077Sbostic         if (yychar < 0)
23640077Sbostic         {
23740077Sbostic             if ((yychar = yylex()) < 0) yychar = 0;
23840077Sbostic #if YYDEBUG
23940077Sbostic             if (yydebug)
24040077Sbostic             {
24140077Sbostic                 yys = 0;
24240077Sbostic                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
24340077Sbostic                 if (!yys) yys = "illegal-symbol";
244*60322Sbostic                 printf("%sdebug: state %d, reading %d (%s)\n",
245*60322Sbostic                         YYPREFIX, YYFINAL, yychar, yys);
24640077Sbostic             }
24740077Sbostic #endif
24840077Sbostic         }
24940077Sbostic         if (yychar == 0) goto yyaccept;
25040077Sbostic         goto yyloop;
25140077Sbostic     }
25240077Sbostic     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
25340077Sbostic             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
25440077Sbostic         yystate = yytable[yyn];
25540077Sbostic     else
25640077Sbostic         yystate = yydgoto[yym];
257*60322Sbostic #if YYDEBUG
25840077Sbostic     if (yydebug)
259*60322Sbostic         printf("%sdebug: after reduction, shifting from state %d \
260*60322Sbostic to state %d\n", YYPREFIX, *yyssp, yystate);
26140077Sbostic #endif
26240077Sbostic     if (yyssp >= yyss + yystacksize - 1)
26340077Sbostic     {
26440077Sbostic         goto yyoverflow;
26540077Sbostic     }
26640077Sbostic     *++yyssp = yystate;
26740077Sbostic     *++yyvsp = yyval;
26840077Sbostic     goto yyloop;
26940077Sbostic yyoverflow:
27040077Sbostic     yyerror("yacc stack overflow");
27140077Sbostic yyabort:
27240077Sbostic     return (1);
27340077Sbostic yyaccept:
27440077Sbostic     return (0);
27540077Sbostic }
276