1994-05-27 12:33:43 +00:00
|
|
|
#ifndef lint
|
1999-07-23 23:13:44 +00:00
|
|
|
static char const yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
|
1994-05-27 12:33:43 +00:00
|
|
|
#endif
|
1999-07-23 23:13:44 +00:00
|
|
|
#include <stdlib.h>
|
1994-05-27 12:33:43 +00:00
|
|
|
#define YYBYACC 1
|
|
|
|
#define YYMAJOR 1
|
|
|
|
#define YYMINOR 9
|
1999-07-23 23:13:44 +00:00
|
|
|
#define YYLEX yylex()
|
|
|
|
#define YYEMPTY -1
|
|
|
|
#define yyclearin (yychar=(YYEMPTY))
|
1994-05-27 12:33:43 +00:00
|
|
|
#define yyerrok (yyerrflag=0)
|
|
|
|
#define YYRECOVERING (yyerrflag!=0)
|
1999-07-23 23:13:44 +00:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
#include <stdlib.h>
|
|
|
|
#else
|
|
|
|
extern char *getenv();
|
|
|
|
extern void *realloc();
|
|
|
|
#endif
|
|
|
|
static int yygrowstack();
|
1994-05-27 12:33:43 +00:00
|
|
|
#define YYPREFIX "yy"
|
|
|
|
#define YYERRCODE 256
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yylhs[] = { -1,
|
1994-05-27 12:33:43 +00:00
|
|
|
0,
|
|
|
|
};
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yylen[] = { 2,
|
1994-05-27 12:33:43 +00:00
|
|
|
1,
|
|
|
|
};
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yydefred[] = { 0,
|
1994-05-27 12:33:43 +00:00
|
|
|
1, 0,
|
|
|
|
};
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yydgoto[] = { 2,
|
1994-05-27 12:33:43 +00:00
|
|
|
};
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yysindex[] = { -256,
|
1994-05-27 12:33:43 +00:00
|
|
|
0, 0,
|
|
|
|
};
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yyrindex[] = { 0,
|
1994-05-27 12:33:43 +00:00
|
|
|
0, 0,
|
|
|
|
};
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yygindex[] = { 0,
|
1994-05-27 12:33:43 +00:00
|
|
|
};
|
|
|
|
#define YYTABLESIZE 0
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yytable[] = { 1,
|
1994-05-27 12:33:43 +00:00
|
|
|
};
|
1999-07-23 23:13:44 +00:00
|
|
|
const short yycheck[] = { 256,
|
1994-05-27 12:33:43 +00:00
|
|
|
};
|
|
|
|
#define YYFINAL 2
|
|
|
|
#ifndef YYDEBUG
|
|
|
|
#define YYDEBUG 0
|
1999-07-23 23:13:44 +00:00
|
|
|
#elif YYDEBUG
|
|
|
|
#include <stdio.h>
|
1994-05-27 12:33:43 +00:00
|
|
|
#endif
|
|
|
|
#define YYMAXTOKEN 0
|
|
|
|
#if YYDEBUG
|
1999-07-23 23:13:44 +00:00
|
|
|
const char * const yyname[] = {
|
1994-05-27 12:33:43 +00:00
|
|
|
"end-of-file",
|
|
|
|
};
|
1999-07-23 23:13:44 +00:00
|
|
|
const char * const yyrule[] = {
|
1994-05-27 12:33:43 +00:00
|
|
|
"$accept : S",
|
|
|
|
"S : error",
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#ifndef YYSTYPE
|
|
|
|
typedef int YYSTYPE;
|
|
|
|
#endif
|
|
|
|
#ifdef YYSTACKSIZE
|
|
|
|
#undef YYMAXDEPTH
|
|
|
|
#define YYMAXDEPTH YYSTACKSIZE
|
|
|
|
#else
|
|
|
|
#ifdef YYMAXDEPTH
|
|
|
|
#define YYSTACKSIZE YYMAXDEPTH
|
|
|
|
#else
|
1999-07-23 23:13:44 +00:00
|
|
|
#define YYSTACKSIZE 10000
|
|
|
|
#define YYMAXDEPTH 10000
|
1994-05-27 12:33:43 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
1999-07-23 23:13:44 +00:00
|
|
|
#define YYINITSTACKSIZE 200
|
1994-05-27 12:33:43 +00:00
|
|
|
int yydebug;
|
|
|
|
int yynerrs;
|
|
|
|
int yyerrflag;
|
|
|
|
int yychar;
|
|
|
|
short *yyssp;
|
|
|
|
YYSTYPE *yyvsp;
|
|
|
|
YYSTYPE yyval;
|
|
|
|
YYSTYPE yylval;
|
1999-07-23 23:13:44 +00:00
|
|
|
short *yyss;
|
|
|
|
short *yysslim;
|
|
|
|
YYSTYPE *yyvs;
|
|
|
|
int yystacksize;
|
1994-05-27 12:33:43 +00:00
|
|
|
#line 4 "error.y"
|
|
|
|
main(){printf("yyparse() = %d\n",yyparse());}
|
|
|
|
yylex(){return-1;}
|
|
|
|
yyerror(s)char*s;{printf("%s\n",s);}
|
1999-07-23 23:13:44 +00:00
|
|
|
#line 92 "error.tab.c"
|
|
|
|
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
|
|
|
|
static int yygrowstack()
|
|
|
|
{
|
|
|
|
int newsize, i;
|
|
|
|
short *newss;
|
|
|
|
YYSTYPE *newvs;
|
|
|
|
|
|
|
|
if ((newsize = yystacksize) == 0)
|
|
|
|
newsize = YYINITSTACKSIZE;
|
|
|
|
else if (newsize >= YYMAXDEPTH)
|
|
|
|
return -1;
|
|
|
|
else if ((newsize *= 2) > YYMAXDEPTH)
|
|
|
|
newsize = YYMAXDEPTH;
|
|
|
|
i = yyssp - yyss;
|
|
|
|
if ((newss = (short *)realloc(yyss, newsize * sizeof *newss)) == NULL)
|
|
|
|
return -1;
|
|
|
|
yyss = newss;
|
|
|
|
yyssp = newss + i;
|
|
|
|
if ((newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs)) == NULL)
|
|
|
|
return -1;
|
|
|
|
yyvs = newvs;
|
|
|
|
yyvsp = newvs + i;
|
|
|
|
yystacksize = newsize;
|
|
|
|
yysslim = yyss + newsize - 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
#define YYABORT goto yyabort
|
|
|
|
#define YYREJECT goto yyabort
|
|
|
|
#define YYACCEPT goto yyaccept
|
|
|
|
#define YYERROR goto yyerrlab
|
1999-07-23 23:13:44 +00:00
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
int
|
|
|
|
yyparse()
|
|
|
|
{
|
|
|
|
register int yym, yyn, yystate;
|
|
|
|
#if YYDEBUG
|
1999-07-23 23:13:44 +00:00
|
|
|
register const char *yys;
|
1994-05-27 12:33:43 +00:00
|
|
|
|
1999-07-23 23:13:44 +00:00
|
|
|
if ((yys = getenv("YYDEBUG")))
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
yyn = *yys;
|
|
|
|
if (yyn >= '0' && yyn <= '9')
|
|
|
|
yydebug = yyn - '0';
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
yynerrs = 0;
|
|
|
|
yyerrflag = 0;
|
|
|
|
yychar = (-1);
|
|
|
|
|
1999-07-23 23:13:44 +00:00
|
|
|
if (yyss == NULL && yygrowstack()) goto yyoverflow;
|
1994-05-27 12:33:43 +00:00
|
|
|
yyssp = yyss;
|
|
|
|
yyvsp = yyvs;
|
|
|
|
*yyssp = yystate = 0;
|
|
|
|
|
|
|
|
yyloop:
|
1999-07-23 23:13:44 +00:00
|
|
|
if ((yyn = yydefred[yystate])) goto yyreduce;
|
1994-05-27 12:33:43 +00:00
|
|
|
if (yychar < 0)
|
|
|
|
{
|
|
|
|
if ((yychar = yylex()) < 0) yychar = 0;
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
{
|
|
|
|
yys = 0;
|
|
|
|
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
|
|
|
|
if (!yys) yys = "illegal-symbol";
|
|
|
|
printf("%sdebug: state %d, reading %d (%s)\n",
|
|
|
|
YYPREFIX, yystate, yychar, yys);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
|
|
|
|
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
|
|
|
|
{
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
printf("%sdebug: state %d, shifting to state %d\n",
|
|
|
|
YYPREFIX, yystate, yytable[yyn]);
|
|
|
|
#endif
|
1999-07-23 23:13:44 +00:00
|
|
|
if (yyssp >= yysslim && yygrowstack())
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
goto yyoverflow;
|
|
|
|
}
|
|
|
|
*++yyssp = yystate = yytable[yyn];
|
|
|
|
*++yyvsp = yylval;
|
|
|
|
yychar = (-1);
|
|
|
|
if (yyerrflag > 0) --yyerrflag;
|
|
|
|
goto yyloop;
|
|
|
|
}
|
|
|
|
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
|
|
|
|
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
|
|
|
|
{
|
|
|
|
yyn = yytable[yyn];
|
|
|
|
goto yyreduce;
|
|
|
|
}
|
|
|
|
if (yyerrflag) goto yyinrecovery;
|
1999-07-23 23:13:44 +00:00
|
|
|
#if defined(lint) || defined(__GNUC__)
|
1994-05-27 12:33:43 +00:00
|
|
|
goto yynewerror;
|
|
|
|
#endif
|
|
|
|
yynewerror:
|
|
|
|
yyerror("syntax error");
|
1999-07-23 23:13:44 +00:00
|
|
|
#if defined(lint) || defined(__GNUC__)
|
1994-05-27 12:33:43 +00:00
|
|
|
goto yyerrlab;
|
|
|
|
#endif
|
|
|
|
yyerrlab:
|
|
|
|
++yynerrs;
|
|
|
|
yyinrecovery:
|
|
|
|
if (yyerrflag < 3)
|
|
|
|
{
|
|
|
|
yyerrflag = 3;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
|
|
|
|
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
|
|
|
|
{
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
printf("%sdebug: state %d, error recovery shifting\
|
|
|
|
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
|
|
|
|
#endif
|
1999-07-23 23:13:44 +00:00
|
|
|
if (yyssp >= yysslim && yygrowstack())
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
goto yyoverflow;
|
|
|
|
}
|
|
|
|
*++yyssp = yystate = yytable[yyn];
|
|
|
|
*++yyvsp = yylval;
|
|
|
|
goto yyloop;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
printf("%sdebug: error recovery discarding state %d\n",
|
|
|
|
YYPREFIX, *yyssp);
|
|
|
|
#endif
|
|
|
|
if (yyssp <= yyss) goto yyabort;
|
|
|
|
--yyssp;
|
|
|
|
--yyvsp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (yychar == 0) goto yyabort;
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
{
|
|
|
|
yys = 0;
|
|
|
|
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
|
|
|
|
if (!yys) yys = "illegal-symbol";
|
|
|
|
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
|
|
|
|
YYPREFIX, yystate, yychar, yys);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
yychar = (-1);
|
|
|
|
goto yyloop;
|
|
|
|
}
|
|
|
|
yyreduce:
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
|
|
|
|
YYPREFIX, yystate, yyn, yyrule[yyn]);
|
|
|
|
#endif
|
|
|
|
yym = yylen[yyn];
|
|
|
|
yyval = yyvsp[1-yym];
|
|
|
|
switch (yyn)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
yyssp -= yym;
|
|
|
|
yystate = *yyssp;
|
|
|
|
yyvsp -= yym;
|
|
|
|
yym = yylhs[yyn];
|
|
|
|
if (yystate == 0 && yym == 0)
|
|
|
|
{
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
printf("%sdebug: after reduction, shifting from state 0 to\
|
|
|
|
state %d\n", YYPREFIX, YYFINAL);
|
|
|
|
#endif
|
|
|
|
yystate = YYFINAL;
|
|
|
|
*++yyssp = YYFINAL;
|
|
|
|
*++yyvsp = yyval;
|
|
|
|
if (yychar < 0)
|
|
|
|
{
|
|
|
|
if ((yychar = yylex()) < 0) yychar = 0;
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
{
|
|
|
|
yys = 0;
|
|
|
|
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
|
|
|
|
if (!yys) yys = "illegal-symbol";
|
|
|
|
printf("%sdebug: state %d, reading %d (%s)\n",
|
|
|
|
YYPREFIX, YYFINAL, yychar, yys);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
if (yychar == 0) goto yyaccept;
|
|
|
|
goto yyloop;
|
|
|
|
}
|
|
|
|
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
|
|
|
|
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
|
|
|
|
yystate = yytable[yyn];
|
|
|
|
else
|
|
|
|
yystate = yydgoto[yym];
|
|
|
|
#if YYDEBUG
|
|
|
|
if (yydebug)
|
|
|
|
printf("%sdebug: after reduction, shifting from state %d \
|
|
|
|
to state %d\n", YYPREFIX, *yyssp, yystate);
|
|
|
|
#endif
|
1999-07-23 23:13:44 +00:00
|
|
|
if (yyssp >= yysslim && yygrowstack())
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
goto yyoverflow;
|
|
|
|
}
|
|
|
|
*++yyssp = yystate;
|
|
|
|
*++yyvsp = yyval;
|
|
|
|
goto yyloop;
|
|
|
|
yyoverflow:
|
|
|
|
yyerror("yacc stack overflow");
|
|
|
|
yyabort:
|
|
|
|
return (1);
|
|
|
|
yyaccept:
|
|
|
|
return (0);
|
|
|
|
}
|