summaryrefslogtreecommitdiffstats
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorhoek <hoek@FreeBSD.org>1999-07-23 23:13:44 +0000
committerhoek <hoek@FreeBSD.org>1999-07-23 23:13:44 +0000
commit65200072445496b0e9fc1ccec1519a4eb8c1643a (patch)
tree3798c191e0a144c90415a9165cd2f6260f91f89e /usr.bin/yacc
parent2258385cd925fc032e1b84f885485f82b1dfb141 (diff)
downloadFreeBSD-src-65200072445496b0e9fc1ccec1519a4eb8c1643a.zip
FreeBSD-src-65200072445496b0e9fc1ccec1519a4eb8c1643a.tar.gz
Regenerate to match changes made in the embedded yacc parser.
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/test/error.tab.c98
1 files changed, 70 insertions, 28 deletions
diff --git a/usr.bin/yacc/test/error.tab.c b/usr.bin/yacc/test/error.tab.c
index ffc6e37..2e309b8 100644
--- a/usr.bin/yacc/test/error.tab.c
+++ b/usr.bin/yacc/test/error.tab.c
@@ -1,48 +1,60 @@
#ifndef lint
-static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+static char const yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#endif
+#include <stdlib.h>
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
-#define yyclearin (yychar=(-1))
+#define YYLEX yylex()
+#define YYEMPTY -1
+#define yyclearin (yychar=(YYEMPTY))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING (yyerrflag!=0)
+#if defined(c_plusplus) || defined(__cplusplus)
+#include <stdlib.h>
+#else
+extern char *getenv();
+extern void *realloc();
+#endif
+static int yygrowstack();
#define YYPREFIX "yy"
#define YYERRCODE 256
-short yylhs[] = { -1,
+const short yylhs[] = { -1,
0,
};
-short yylen[] = { 2,
+const short yylen[] = { 2,
1,
};
-short yydefred[] = { 0,
+const short yydefred[] = { 0,
1, 0,
};
-short yydgoto[] = { 2,
+const short yydgoto[] = { 2,
};
-short yysindex[] = { -256,
+const short yysindex[] = { -256,
0, 0,
};
-short yyrindex[] = { 0,
+const short yyrindex[] = { 0,
0, 0,
};
-short yygindex[] = { 0,
+const short yygindex[] = { 0,
};
#define YYTABLESIZE 0
-short yytable[] = { 1,
+const short yytable[] = { 1,
};
-short yycheck[] = { 256,
+const short yycheck[] = { 256,
};
#define YYFINAL 2
#ifndef YYDEBUG
#define YYDEBUG 0
+#elif YYDEBUG
+#include <stdio.h>
#endif
#define YYMAXTOKEN 0
#if YYDEBUG
-char *yyname[] = {
+const char * const yyname[] = {
"end-of-file",
};
-char *yyrule[] = {
+const char * const yyrule[] = {
"$accept : S",
"S : error",
};
@@ -57,10 +69,11 @@ typedef int YYSTYPE;
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
-#define YYSTACKSIZE 500
-#define YYMAXDEPTH 500
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
#endif
#endif
+#define YYINITSTACKSIZE 200
int yydebug;
int yynerrs;
int yyerrflag;
@@ -69,27 +82,55 @@ short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
-short yyss[YYSTACKSIZE];
-YYSTYPE yyvs[YYSTACKSIZE];
-#define yystacksize YYSTACKSIZE
+short *yyss;
+short *yysslim;
+YYSTYPE *yyvs;
+int yystacksize;
#line 4 "error.y"
main(){printf("yyparse() = %d\n",yyparse());}
yylex(){return-1;}
yyerror(s)char*s;{printf("%s\n",s);}
-#line 80 "error.tab.c"
+#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;
+}
+
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
+
int
yyparse()
{
register int yym, yyn, yystate;
#if YYDEBUG
- register char *yys;
- extern char *getenv();
+ register const char *yys;
- if (yys = getenv("YYDEBUG"))
+ if ((yys = getenv("YYDEBUG")))
{
yyn = *yys;
if (yyn >= '0' && yyn <= '9')
@@ -101,12 +142,13 @@ yyparse()
yyerrflag = 0;
yychar = (-1);
+ if (yyss == NULL && yygrowstack()) goto yyoverflow;
yyssp = yyss;
yyvsp = yyvs;
*yyssp = yystate = 0;
yyloop:
- if (yyn = yydefred[yystate]) goto yyreduce;
+ if ((yyn = yydefred[yystate])) goto yyreduce;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
@@ -129,7 +171,7 @@ yyloop:
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
- if (yyssp >= yyss + yystacksize - 1)
+ if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
@@ -146,12 +188,12 @@ yyloop:
goto yyreduce;
}
if (yyerrflag) goto yyinrecovery;
-#ifdef lint
+#if defined(lint) || defined(__GNUC__)
goto yynewerror;
#endif
yynewerror:
yyerror("syntax error");
-#ifdef lint
+#if defined(lint) || defined(__GNUC__)
goto yyerrlab;
#endif
yyerrlab:
@@ -170,7 +212,7 @@ yyinrecovery:
printf("%sdebug: state %d, error recovery shifting\
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
- if (yyssp >= yyss + yystacksize - 1)
+ if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
@@ -259,7 +301,7 @@ yyreduce:
printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yyssp, yystate);
#endif
- if (yyssp >= yyss + yystacksize - 1)
+ if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
OpenPOWER on IntegriCloud