summaryrefslogtreecommitdiff
path: root/test/btyacc/err_inherit3.tab.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/btyacc/err_inherit3.tab.c')
-rw-r--r--test/btyacc/err_inherit3.tab.c137
1 files changed, 71 insertions, 66 deletions
diff --git a/test/btyacc/err_inherit3.tab.c b/test/btyacc/err_inherit3.tab.c
index 93b2706..6cb563e 100644
--- a/test/btyacc/err_inherit3.tab.c
+++ b/test/btyacc/err_inherit3.tab.c
@@ -1,6 +1,6 @@
/* original parser id follows */
/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
-/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
#define YYBYACC 1
#define YYMAJOR 1
@@ -136,13 +136,13 @@ extern symbol *mksymbol(type t, class c, name id);
#define YYLEX_DECL() yylex(void)
#define YYERROR_DECL() yyerror(const char *s)
#endif
-#line 39 "err_inherit3.y"
#ifdef YYSTYPE
#undef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
#endif
#ifndef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
+#line 39 "err_inherit3.y"
typedef union
{
class cval;
@@ -199,53 +199,54 @@ extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
static const YYINT err_inherit3_lhs[] = { -1,
- 5, 6, 0, 7, 0, 3, 3, 4, 4, 8,
- 1, 1, 9, 2,
+ 5, 6, 0, 0, 3, 3, 4, 4, 7, 1,
+ 1, 8, 2,
};
static const YYINT err_inherit3_len[] = { 2,
- 0, 0, 5, 0, 3, 1, 1, 1, 1, 0,
- 3, 1, 0, 3,
+ 0, 0, 5, 2, 1, 1, 1, 1, 0, 3,
+ 1, 0, 3,
};
static const YYINT err_inherit3_defred[] = { 0,
- 6, 7, 8, 9, 0, 0, 4, 1, 13, 2,
- 5, 2, 0, 0, 12, 3, 0, 14, 0, 11,
+ 5, 6, 7, 8, 0, 0, 12, 1, 4, 2,
+ 2, 0, 0, 11, 13, 0, 3, 0, 10,
};
static const YYINT err_inherit3_stos[] = { 0,
- 257, 258, 259, 260, 263, 266, 267, 267, 270, 268,
- 265, 272, 269, 269, 261, 264, 271, 264, 264, 261,
+ 257, 258, 259, 260, 263, 266, 267, 267, 265, 271,
+ 268, 269, 269, 261, 264, 270, 264, 264, 261,
};
static const YYINT err_inherit3_dgoto[] = { 5,
- 16, 11, 6, 7, 10, 13, 9, 17, 12,
+ 15, 9, 6, 7, 11, 12, 16, 10,
};
static const YYINT err_inherit3_sindex[] = { -257,
0, 0, 0, 0, 0, -254, 0, 0, 0, 0,
- 0, 0, -253, -253, 0, 0, -253, 0, -252, 0,
+ 0, -253, -253, 0, 0, -253, 0, -252, 0,
};
static const YYINT err_inherit3_rindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#if YYBTYACC
static const YYINT err_inherit3_cindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#endif
static const YYINT err_inherit3_gindex[] = { 0,
- -10, 0, 0, 4, 0, -1, 0, 0, 0,
+ -9, 0, 0, 4, 0, 1, 0, 0,
};
-#define YYTABLESIZE 11
+#define YYTABLESIZE 12
static const YYINT err_inherit3_table[] = { 1,
- 2, 3, 4, 18, 3, 4, 19, 15, 20, 8,
- 14,
+ 2, 3, 4, 17, 3, 4, 18, 14, 19, 8,
+ 0, 13,
};
static const YYINT err_inherit3_check[] = { 257,
- 258, 259, 260, 14, 259, 260, 17, 261, 261, 6,
- 12,
+ 258, 259, 260, 13, 259, 260, 16, 261, 261, 6,
+ -1, 11,
};
#if YYBTYACC
static const YYINT err_inherit3_ctable[] = { -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1,
};
#endif
#define YYFINAL 5
@@ -253,7 +254,7 @@ static const YYINT err_inherit3_ctable[] = { -1,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 261
-#define YYUNDFTOKEN 273
+#define YYUNDFTOKEN 272
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
#if YYDEBUG
static const char *const err_inherit3_name[] = {
@@ -266,24 +267,23 @@ static const char *const err_inherit3_name[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
"NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
-"$$2","$$3","$$4","$$5","illegal-symbol",
+"$$2","$$3","$$4","illegal-symbol",
};
static const char *const err_inherit3_rule[] = {
"$accept : declaration",
"$$1 :",
"$$2 :",
"declaration : class type $$1 $$2 namelist",
-"$$3 :",
-"declaration : type $$3 locnamelist",
+"declaration : type locnamelist",
"class : GLOBAL",
"class : LOCAL",
"type : REAL",
"type : INTEGER",
-"$$4 :",
-"namelist : $$4 namelist NAME",
+"$$3 :",
+"namelist : $$3 namelist NAME",
"namelist : NAME",
-"$$5 :",
-"locnamelist : $$5 $$2 namelist",
+"$$4 :",
+"locnamelist : $$4 $$2 namelist",
};
#endif
@@ -348,9 +348,9 @@ do \
typedef struct {
unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
+ YYINT *s_base;
+ YYINT *s_mark;
+ YYINT *s_last;
YYSTYPE *l_base;
YYSTYPE *l_mark;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@@ -473,18 +473,18 @@ YYDESTRUCT_DECL()
#endif /* YYBTYACC */
#if YYDEBUG
-#include <stdio.h> /* needed for printf */
+#include <stdio.h> /* needed for printf */
#endif
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack(YYSTACKDATA *data)
{
int i;
unsigned newsize;
- short *newss;
+ YYINT *newss;
YYSTYPE *newvs;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
YYLTYPE *newps;
@@ -498,7 +498,7 @@ static int yygrowstack(YYSTACKDATA *data)
newsize = YYMAXDEPTH;
i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
if (newss == 0)
return YYENOMEM;
@@ -562,7 +562,7 @@ yyNewState(unsigned size)
#endif
return p;
}
- p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
if (p->yystack.s_base == NULL) return NULL;
p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
if (p->yystack.l_base == NULL) return NULL;
@@ -622,6 +622,8 @@ YYPARSE_DECL()
yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
yyps->save = 0;
#endif /* YYBTYACC */
+ yym = 0;
+ yyn = 0;
yynerrs = 0;
yyerrflag = 0;
yychar = YYEMPTY;
@@ -695,11 +697,10 @@ yyloop:
} while (0);
#endif /* YYBTYACC */
if (yychar < 0) yychar = YYEOF;
- /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
#if YYDEBUG
if (yydebug)
{
- yys = yyname[YYTRANSLATE(yychar)];
+ if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
YYDEBUGSTR, yydepth, yystate, yychar, yys);
#ifdef YYSTYPE_TOSTRING
@@ -758,7 +759,7 @@ yyloop:
save->state = yystate;
save->errflag = yyerrflag;
save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
- memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@@ -839,7 +840,7 @@ yyloop:
if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
goto yyoverflow;
yystate = yyctable[ctry];
- *++yystack.s_mark = (short) yystate;
+ *++yystack.s_mark = (YYINT) yystate;
*++yystack.l_mark = yylval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*++yystack.p_mark = yylloc;
@@ -885,9 +886,18 @@ yyloop:
yynewerrflag = 1;
goto yyerrhandler;
- goto yyerrlab;
+ goto yyerrlab; /* redundant goto avoids 'unused label' warning */
yyerrlab:
+ /* explicit YYERROR from an action -- pop the rhs of the rule reduced
+ * before looking for error recovery */
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+
yynewerrflag = 0;
yyerrhandler:
while (yyps->save)
@@ -912,7 +922,7 @@ yyerrhandler:
yyerrctx->state = yystate;
yyerrctx->errflag = yyerrflag;
yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
- memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@@ -928,7 +938,7 @@ yyerrhandler:
yylexp = yylexemes + save->lexeme;
yychar = YYEMPTY;
yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
- memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@@ -963,7 +973,7 @@ yyerrhandler:
yylloc = yylpp[-1];
#endif
yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
- memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
@@ -985,7 +995,7 @@ yyerrhandler:
#endif
#if !YYBTYACC
- goto yyerrlab;
+ goto yyerrlab; /* redundant goto avoids 'unused label' warning */
yyerrlab:
#endif
++yynerrs;
@@ -1054,7 +1064,7 @@ yyinrecovery:
#if YYDEBUG
if (yydebug)
{
- yys = yyname[YYTRANSLATE(yychar)];
+ if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
YYDEBUGSTR, yydepth, yystate, yychar, yys);
}
@@ -1134,54 +1144,50 @@ case 3:
{ yyval.nlist = yystack.l_mark[0].nlist; }
break;
case 4:
-#line 52 "err_inherit3.y"
-yyval.tval = yystack.l_mark[0].tval;
-break;
-case 5:
#line 53 "err_inherit3.y"
{ yyval.nlist = yystack.l_mark[0].nlist; }
break;
-case 6:
+case 5:
#line 56 "err_inherit3.y"
{ yyval.cval = cGLOBAL; }
break;
-case 7:
+case 6:
#line 57 "err_inherit3.y"
{ yyval.cval = cLOCAL; }
break;
-case 8:
+case 7:
#line 60 "err_inherit3.y"
{ yyval.tval = tREAL; }
break;
-case 9:
+case 8:
#line 61 "err_inherit3.y"
{ yyval.tval = tINTEGER; }
break;
-case 10:
+case 9:
#line 64 "err_inherit3.y"
yyval.cval = yystack.l_mark[-2];
break;
-case 11:
+case 10:
#line 65 "err_inherit3.y"
{ yyval.nlist->s = mksymbol(yystack.l_mark[-5].tval, yystack.l_mark[-5].cval, yystack.l_mark[0].id);
yyval.nlist->next = yystack.l_mark[-1].nlist;
}
break;
-case 12:
+case 11:
#line 69 "err_inherit3.y"
{ yyval.nlist->s = mksymbol(yystack.l_mark[-3], yystack.l_mark[-3], yystack.l_mark[0].id);
yyval.nlist->next = NULL;
}
break;
-case 13:
+case 12:
#line 74 "err_inherit3.y"
yyval.cval = cLOCAL;
break;
-case 14:
+case 13:
#line 75 "err_inherit3.y"
{ yyval.nlist = yystack.l_mark[0].nlist; }
break;
-#line 1185 "err_inherit3.tab.c"
+#line 1191 "err_inherit3.tab.c"
default:
break;
}
@@ -1269,12 +1275,11 @@ break;
} while (0);
#endif /* YYBTYACC */
if (yychar < 0) yychar = YYEOF;
- /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
#if YYDEBUG
if (yydebug)
{
- yys = yyname[YYTRANSLATE(yychar)];
- fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
}
#endif
@@ -1301,7 +1306,7 @@ break;
}
#endif
if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
- *++yystack.s_mark = (short) yystate;
+ *++yystack.s_mark = (YYINT) yystate;
*++yystack.l_mark = yyval;
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
*++yystack.p_mark = yyloc;
@@ -1336,7 +1341,7 @@ yyvalid:
yylexp = yylexemes + yypath->lexeme;
yychar = YYEMPTY;
yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
- memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)