diff --git a/CHANGES b/CHANGES index 1c3f44205558..67abb971e2bf 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,82 @@ +2016-06-06 Thomas E. Dickey + + * configure: regen + + * aclocal.m4: improved autoconf macros: + CF_CC_ENV_FLAGS - don't limit the check to -I, -U and -D options, since the + added options can include various compiler options before and after + preprocessor options. + CF_PROG_LINT - add cpplint to programs to use; drop ad hoc tdlint and alint. + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + + * lalr.c: indented + + * btyaccpar.c: regen + + * skel2c: + adjust whitespace so that generated skeleton will follow the same format + as other code + + * mkpar.c, verbose.c, lr0.c, reader.c, error.c, output.c: indented + + * reader.c: fix two compiler warnings + + * test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/rename_debug.c, btyaccpar.c, test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/ok_syntax1.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/rename_debug.c, yaccpar.c: + regen + +2016-06-06 Tom.Shields + + * btyaccpar.skel, yaccpar.skel: + small fix for an edge case of initialized data in Chris Dodd's btyacc changes: + "Avoid crash when input pops up an Action error at the first token" + +2016-06-01 Thomas E. Dickey + + * test/yacc/quote_calc2-s.tab.c, test/yacc/quote_calc3-s.tab.c, test/yacc/quote_calc3.tab.c, test/yacc/quote_calc4-s.tab.c, test/yacc/quote_calc4.tab.c, test/yacc/varsyntax_calc1.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/err_syntax24.error, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/ok_syntax1.tab.c, test/yacc/pure_calc.tab.c, test/yacc/pure_error.tab.c, test/yacc/quote_calc-s.tab.c, test/yacc/quote_calc.tab.c, test/yacc/quote_calc2.tab.c, test/yacc/calc.tab.c, test/yacc/calc1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/yacc/code_calc.code.c, test/yacc/code_calc.tab.c, test/yacc/code_calc.tab.h, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/rename_debug.c, yaccpar.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/err_syntax13.tab.c, test/btyacc/err_syntax14.tab.c, test/btyacc/err_syntax15.tab.c, test/btyacc/err_syntax16.tab.c, test/btyacc/err_syntax17.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax19.tab.c, test/btyacc/err_syntax2.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/err_syntax21.tab.c, test/btyacc/err_syntax22.tab.c, test/btyacc/err_syntax23.tab.c, test/btyacc/err_syntax24.error, test/btyacc/err_syntax24.tab.c, test/btyacc/err_syntax25.tab.c, test/btyacc/err_syntax26.tab.c, test/btyacc/err_syntax27.tab.c, test/btyacc/err_syntax3.tab.c, test/btyacc/err_syntax4.tab.c, test/btyacc/err_syntax5.tab.c, test/btyacc/err_syntax6.tab.c, test/btyacc/err_syntax7.tab.c, test/btyacc/err_syntax7a.tab.c, test/btyacc/err_syntax7b.tab.c, test/btyacc/err_syntax8.tab.c, test/btyacc/err_syntax8a.tab.c, test/btyacc/err_syntax9.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.output, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.error, test/btyacc/btyacc_demo.output, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_calc.tab.c, test/btyacc/code_calc.tab.h, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit1.tab.c, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit3.output, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.output, test/btyacc/err_inherit4.tab.c, test/btyacc/err_inherit5.tab.c, test/btyacc/err_syntax1.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/rename_debug.c, btyaccpar.c: + regen + +2016-06-01 Tom.Shields + + * btyaccpar.skel, defs.h, error.c, output.c, reader.c, test/code_calc.y, test/err_inherit4.y, test/run_make.sh, yaccpar.skel: + fixes for issues in btyacc (report by Francis Andre): + + + correction to the placement of the #line directive for a %union specification + + + recovery of a set of casts originally added into btyaccpar.c rather than into + btyaccpar.skel, and so are lost whenever building from scratch + + + Chris Dodd's btyacc improved handling of inherited attributes to eliminate + implicit empty copy rules that are not necessary, and thereby avoiding the + introduction of extra parsing ambiguity + + + Chris Dodd's added support for @-N syntax to reference inherited position + information + + + correction to bad interaction between %token-table and YYDEBUG, where YYDEBUG + was required to be defined in order to compile the generated code + + + correction to yyname[] access in code included with YYDEBUG defined for + single character symbols not recognized (e.g., input containing '&' character + where grammar doesn't define that as a symbol) - map to existing + "illegal-symbol" entry in byname[] + + + fixes to test/run_make.sh: skip test-err_* files; in the bison test phase + skip additional files that contain features not supported by bison and + inhibit new bison warning messages + + + minor changes to btyaccpar.skel & yaccpar.skel so they are more similar in + their commonality; makes it easier to maintain the pair of files using + vimdiff + + + changes to a couple of test cases for coverage of #3, #4 and #5 above + +2016-06-01 Thomas E. Dickey + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + 2016-03-24 Thomas E. Dickey * reader.c: unused variable diff --git a/MANIFEST b/MANIFEST index 7d7e53484cd1..6df6f292a585 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for byacc-20160324, version t20160324 +MANIFEST for byacc-20160606, version t20160606 -------------------------------------------------------------------------------- MANIFEST this file ACKNOWLEDGEMENTS original version of byacc - 1993 diff --git a/VERSION b/VERSION index 9be40626b9a0..602e5397582c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -20160324 +20160606 diff --git a/aclocal.m4 b/aclocal.m4 index f98d0895249e..7be01e8e201a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl $Id: aclocal.m4,v 1.39 2016/03/25 00:06:44 tom Exp $ +dnl $Id: aclocal.m4,v 1.40 2016/06/07 00:48:07 tom Exp $ dnl Macros for byacc configure script (Thomas E. Dickey) dnl --------------------------------------------------------------------------- dnl Copyright 2004-2015,2016 Thomas E. Dickey @@ -171,11 +171,15 @@ ifelse([$3],,[ :]dnl ])dnl ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_CC_ENV_FLAGS version: 2 updated: 2015/04/12 15:39:00 +dnl CF_CC_ENV_FLAGS version: 3 updated: 2016/05/21 18:10:17 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content dnl into CC. This will not help with broken scripts that wrap the compiler with dnl options, but eliminates a more common category of user confusion. +dnl +dnl Caveat: this also disallows blanks in the pathname for the compiler, but +dnl the nuisance of having inconsistent settings for compiler and preprocessor +dnl outweighs that limitation. AC_DEFUN([CF_CC_ENV_FLAGS], [ # This should have been defined by AC_PROG_CC @@ -183,13 +187,16 @@ AC_DEFUN([CF_CC_ENV_FLAGS], AC_MSG_CHECKING(\$CC variable) case "$CC" in -(*[[\ \ ]]-[[IUD]]*) +(*[[\ \ ]]-*) AC_MSG_RESULT(broken) AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... - cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` + cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]][[ ]]*//'` CC=`echo "$CC" | sed -e 's/[[ ]].*//'` CF_ADD_CFLAGS($cf_flags) + CF_VERBOSE(resulting CC: '$CC') + CF_VERBOSE(resulting CFLAGS: '$CFLAGS') + CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') ;; (*) AC_MSG_RESULT(ok) @@ -1010,11 +1017,11 @@ AC_SUBST(GROFF_NOTE) AC_SUBST(NROFF_NOTE) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14 +dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54 dnl ------------ AC_DEFUN([CF_PROG_LINT], [ -AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint) +AC_CHECK_PROGS(LINT, lint cppcheck splint) AC_SUBST(LINT_OPTS) ])dnl dnl --------------------------------------------------------------------------- diff --git a/btyaccpar.c b/btyaccpar.c index d195b5021b48..42070193d969 100644 --- a/btyaccpar.c +++ b/btyaccpar.c @@ -2,7 +2,7 @@ * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @ */ -/* @Id: btyaccpar.skel,v 1.1 2014/04/02 22:44:41 tom Exp @ */ +/* @Id: btyaccpar.skel,v 1.3 2016/06/06 23:35:55 Tom.Shields Exp @ */ #include "defs.h" @@ -18,7 +18,7 @@ const char *const banner[] = { "/* 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", CONCAT1("#define YYMAJOR ", YYMAJOR), @@ -66,8 +66,10 @@ const char *const tables[] = "#endif /* YYBTYACC */", #endif /* defined(YYBTYACC) */ "", - "#if YYDEBUG", + "#if YYDEBUG || defined(yytname)", "extern const char *const yyname[];", + "#endif", + "#if YYDEBUG", "extern const char *const yyrule[];", "#endif", 0 @@ -148,9 +150,9 @@ const char *const hdr_defs[] = "", "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)", @@ -293,18 +295,18 @@ const char *const body_1[] = #endif /* defined(YYBTYACC) */ "", "#if YYDEBUG", - "#include /* needed for printf */", + "#include /* needed for printf */", "#endif", "", - "#include /* needed for malloc, etc */", - "#include /* needed for memset */", + "#include /* needed for malloc, etc */", + "#include /* 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;", @@ -318,7 +320,7 @@ const char *const body_1[] = " 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;", "", @@ -383,7 +385,7 @@ const char *const body_1[] = "#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;", @@ -455,6 +457,8 @@ const char *const body_2[] = " yyps->save = 0;", "#endif /* YYBTYACC */", #endif /* defined(YYBTYACC) */ + " yym = 0;", + " yyn = 0;", " yynerrs = 0;", " yyerrflag = 0;", " yychar = YYEMPTY;", @@ -532,11 +536,10 @@ const char *const body_2[] = "#endif /* YYBTYACC */", #endif /* defined(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", @@ -598,7 +601,7 @@ const char *const body_2[] = " 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)", @@ -679,7 +682,7 @@ const char *const body_2[] = " 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;", @@ -727,9 +730,18 @@ const char *const body_2[] = "", " 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)", @@ -754,7 +766,7 @@ const char *const body_2[] = " 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)", @@ -770,7 +782,7 @@ const char *const body_2[] = " 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)", @@ -805,7 +817,7 @@ const char *const body_2[] = " 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)", @@ -828,7 +840,7 @@ const char *const body_2[] = "#endif", "", "#if !YYBTYACC", - " goto yyerrlab;", + " goto yyerrlab; /* redundant goto avoids 'unused label' warning */", "yyerrlab:", "#endif", " ++yynerrs;", @@ -899,7 +911,7 @@ const char *const body_2[] = "#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);", " }", @@ -1070,12 +1082,11 @@ const char *const trailer[] = "#endif /* YYBTYACC */", #endif /* defined(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", @@ -1104,7 +1115,7 @@ const char *const trailer[] = " }", "#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;", @@ -1140,7 +1151,7 @@ const char *const trailer[] = " 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)", diff --git a/btyaccpar.skel b/btyaccpar.skel index 265be42c0aec..97fc264255db 100644 --- a/btyaccpar.skel +++ b/btyaccpar.skel @@ -1,4 +1,4 @@ -/* $Id: btyaccpar.skel,v 1.1 2014/04/02 22:44:41 tom Exp $ */ +/* $Id: btyaccpar.skel,v 1.3 2016/06/06 23:35:55 Tom.Shields Exp $ */ #include "defs.h" @@ -45,8 +45,10 @@ extern const YYINT yycheck[]; extern const YYINT yyctable[]; %%endif -#if YYDEBUG +#if YYDEBUG || defined(yytname) extern const char *const yyname[]; +#endif +#if YYDEBUG extern const char *const yyrule[]; #endif %% global_vars @@ -113,9 +115,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) @@ -238,7 +240,7 @@ static short *yylexemes = 0; %%endif #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -249,7 +251,7 @@ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -263,7 +265,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; @@ -327,7 +329,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; @@ -388,6 +390,8 @@ YYPARSE_DECL() yyps = yyNewState(0); if (yyps == 0) goto yyenomem; yyps->save = 0; %%endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -427,8 +431,8 @@ yyloop: /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; @@ -461,11 +465,10 @@ yyloop: } while (0); %%endif 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 @@ -524,12 +527,12 @@ 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, (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, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + 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) save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = yytable[yyn]; if (yyctable[ctry] == -1) @@ -584,7 +587,7 @@ yyloop: yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -605,7 +608,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; @@ -651,9 +654,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) @@ -678,14 +690,14 @@ 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, (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, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + 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) yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); - memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif - yyerrctx->lexeme = yylvp - yylvals; + yyerrctx->lexeme = (int) (yylvp - yylvals); } yylvp = yylvals + save->lexeme; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -694,12 +706,12 @@ 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, (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, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + 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) yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); - memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif ctry = ++save->ctry; yystate = save->state; @@ -729,12 +741,12 @@ 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, (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, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + 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) yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); - memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yyerrctx->state; yyFreeState(yyerrctx); @@ -751,7 +763,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -820,7 +832,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); } @@ -938,8 +950,8 @@ yyreduce: /* in trial mode; save scanner results for future parse attempts */ if (yylvp == yylvlim) { /* Enlarge lexical value queue */ - int p = yylvp - yylvals; - int s = yylvlim - yylvals; + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) @@ -975,12 +987,11 @@ yyreduce: } while (0); %%endif 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 @@ -1007,7 +1018,7 @@ yyreduce: } #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; @@ -1042,12 +1053,12 @@ 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, (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, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); + 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) yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); - memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); #endif yystate = yypath->state; goto yyloop; diff --git a/configure b/configure index b793edf63601..86f9dce852a4 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Revision: 1.21 . # Guess values for system-dependent variables and create Makefiles. -# Generated by Autoconf 2.52.20141204. +# Generated by Autoconf 2.52.20150926. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. @@ -767,7 +767,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.52.20141204. Invocation command line was +generated by GNU Autoconf 2.52.20150926. Invocation command line was $ $0 $@ @@ -1949,13 +1949,13 @@ esac echo "$as_me:1949: checking \$CC variable" >&5 echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 case "$CC" in -(*[\ \ ]-[IUD]*) +(*[\ \ ]-*) echo "$as_me:1953: result: broken" >&5 echo "${ECHO_T}broken" >&6 { echo "$as_me:1955: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} # humor him... - cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ]//'` + cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ][ ]*//'` CC=`echo "$CC" | sed -e 's/[ ].*//'` cf_fix_cppflags=no @@ -2036,14 +2036,26 @@ if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi + test -n "$verbose" && echo " resulting CC: '$CC'" 1>&6 + +echo "${as_me:-configure}:2041: testing resulting CC: '$CC' ..." 1>&5 + + test -n "$verbose" && echo " resulting CFLAGS: '$CFLAGS'" 1>&6 + +echo "${as_me:-configure}:2045: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5 + + test -n "$verbose" && echo " resulting CPPFLAGS: '$CPPFLAGS'" 1>&6 + +echo "${as_me:-configure}:2049: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5 + ;; (*) - echo "$as_me:2041: result: ok" >&5 + echo "$as_me:2053: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac -echo "$as_me:2046: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:2058: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then @@ -2063,11 +2075,11 @@ fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:2066: result: yes" >&5 + echo "$as_me:2078: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:2070: result: no" >&5 + echo "$as_me:2082: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -2084,7 +2096,7 @@ fi # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:2087: checking for a BSD compatible install" >&5 +echo "$as_me:2099: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -2133,7 +2145,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:2136: result: $INSTALL" >&5 +echo "$as_me:2148: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -2144,7 +2156,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo "$as_me:2147: checking if filesystem supports mixed-case filenames" >&5 +echo "$as_me:2159: checking if filesystem supports mixed-case filenames" >&5 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 if test "${cf_cv_mixedcase+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2171,7 +2183,7 @@ else fi fi -echo "$as_me:2174: result: $cf_cv_mixedcase" >&5 +echo "$as_me:2186: result: $cf_cv_mixedcase" >&5 echo "${ECHO_T}$cf_cv_mixedcase" >&6 test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF @@ -2182,7 +2194,7 @@ for ac_prog in exctags ctags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2185: checking for $ac_word" >&5 +echo "$as_me:2197: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CTAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2197,7 +2209,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CTAGS="$ac_prog" -echo "$as_me:2200: found $ac_dir/$ac_word" >&5 +echo "$as_me:2212: found $ac_dir/$ac_word" >&5 break done @@ -2205,10 +2217,10 @@ fi fi CTAGS=$ac_cv_prog_CTAGS if test -n "$CTAGS"; then - echo "$as_me:2208: result: $CTAGS" >&5 + echo "$as_me:2220: result: $CTAGS" >&5 echo "${ECHO_T}$CTAGS" >&6 else - echo "$as_me:2211: result: no" >&5 + echo "$as_me:2223: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2219,7 +2231,7 @@ for ac_prog in exetags etags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2222: checking for $ac_word" >&5 +echo "$as_me:2234: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ETAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2234,7 +2246,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ETAGS="$ac_prog" -echo "$as_me:2237: found $ac_dir/$ac_word" >&5 +echo "$as_me:2249: found $ac_dir/$ac_word" >&5 break done @@ -2242,10 +2254,10 @@ fi fi ETAGS=$ac_cv_prog_ETAGS if test -n "$ETAGS"; then - echo "$as_me:2245: result: $ETAGS" >&5 + echo "$as_me:2257: result: $ETAGS" >&5 echo "${ECHO_T}$ETAGS" >&6 else - echo "$as_me:2248: result: no" >&5 + echo "$as_me:2260: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2254,7 +2266,7 @@ done # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. set dummy ${CTAGS:-ctags}; ac_word=$2 -echo "$as_me:2257: checking for $ac_word" >&5 +echo "$as_me:2269: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2269,7 +2281,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_LOWER_TAGS="yes" -echo "$as_me:2272: found $ac_dir/$ac_word" >&5 +echo "$as_me:2284: found $ac_dir/$ac_word" >&5 break done @@ -2278,17 +2290,17 @@ fi fi MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS if test -n "$MAKE_LOWER_TAGS"; then - echo "$as_me:2281: result: $MAKE_LOWER_TAGS" >&5 + echo "$as_me:2293: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else - echo "$as_me:2284: result: no" >&5 + echo "$as_me:2296: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$cf_cv_mixedcase" = yes ; then # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. set dummy ${ETAGS:-etags}; ac_word=$2 -echo "$as_me:2291: checking for $ac_word" >&5 +echo "$as_me:2303: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2303,7 +2315,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_UPPER_TAGS="yes" -echo "$as_me:2306: found $ac_dir/$ac_word" >&5 +echo "$as_me:2318: found $ac_dir/$ac_word" >&5 break done @@ -2312,10 +2324,10 @@ fi fi MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS if test -n "$MAKE_UPPER_TAGS"; then - echo "$as_me:2315: result: $MAKE_UPPER_TAGS" >&5 + echo "$as_me:2327: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else - echo "$as_me:2318: result: no" >&5 + echo "$as_me:2330: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2339,7 +2351,7 @@ for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2342: checking for $ac_word" >&5 +echo "$as_me:2354: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2354,7 +2366,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AWK="$ac_prog" -echo "$as_me:2357: found $ac_dir/$ac_word" >&5 +echo "$as_me:2369: found $ac_dir/$ac_word" >&5 break done @@ -2362,25 +2374,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$as_me:2365: result: $AWK" >&5 + echo "$as_me:2377: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else - echo "$as_me:2368: result: no" >&5 + echo "$as_me:2380: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done -test -z "$AWK" && { { echo "$as_me:2375: error: No awk program found" >&5 +test -z "$AWK" && { { echo "$as_me:2387: error: No awk program found" >&5 echo "$as_me: error: No awk program found" >&2;} { (exit 1); exit 1; }; } -for ac_prog in tdlint lint alint splint lclint +for ac_prog in lint cppcheck splint do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2383: checking for $ac_word" >&5 +echo "$as_me:2395: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LINT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2395,7 +2407,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_LINT="$ac_prog" -echo "$as_me:2398: found $ac_dir/$ac_word" >&5 +echo "$as_me:2410: found $ac_dir/$ac_word" >&5 break done @@ -2403,10 +2415,10 @@ fi fi LINT=$ac_cv_prog_LINT if test -n "$LINT"; then - echo "$as_me:2406: result: $LINT" >&5 + echo "$as_me:2418: result: $LINT" >&5 echo "${ECHO_T}$LINT" >&6 else - echo "$as_me:2409: result: no" >&5 + echo "$as_me:2421: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2451,14 +2463,14 @@ case $host_os in ;; (linux*|gnu*|mint*|k*bsd*-gnu) -echo "$as_me:2454: checking if we must define _GNU_SOURCE" >&5 +echo "$as_me:2466: checking if we must define _GNU_SOURCE" >&5 echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 if test "${cf_cv_gnu_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2461 "configure" +#line 2473 "configure" #include "confdefs.h" #include int @@ -2473,16 +2485,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2476: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2488: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2479: \$? = $ac_status" >&5 + echo "$as_me:2491: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2482: \"$ac_try\"") >&5 + { (eval echo "$as_me:2494: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2485: \$? = $ac_status" >&5 + echo "$as_me:2497: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else @@ -2491,7 +2503,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 2494 "configure" +#line 2506 "configure" #include "confdefs.h" #include int @@ -2506,16 +2518,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2509: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2521: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2512: \$? = $ac_status" >&5 + echo "$as_me:2524: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2515: \"$ac_try\"") >&5 + { (eval echo "$as_me:2527: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2518: \$? = $ac_status" >&5 + echo "$as_me:2530: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else @@ -2530,7 +2542,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2533: result: $cf_cv_gnu_source" >&5 +echo "$as_me:2545: result: $cf_cv_gnu_source" >&5 echo "${ECHO_T}$cf_cv_gnu_source" >&6 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" @@ -2555,16 +2567,16 @@ cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -echo "$as_me:2558: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:2570: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -echo "${as_me:-configure}:2564: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:2576: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2567 "configure" +#line 2579 "configure" #include "confdefs.h" #include int @@ -2579,16 +2591,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2582: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2594: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2585: \$? = $ac_status" >&5 + echo "$as_me:2597: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2588: \"$ac_try\"") >&5 + { (eval echo "$as_me:2600: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2591: \$? = $ac_status" >&5 + echo "$as_me:2603: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -2609,7 +2621,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 2612 "configure" +#line 2624 "configure" #include "confdefs.h" #include int @@ -2624,16 +2636,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2627: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2639: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2630: \$? = $ac_status" >&5 + echo "$as_me:2642: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2633: \"$ac_try\"") >&5 + { (eval echo "$as_me:2645: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2636: \$? = $ac_status" >&5 + echo "$as_me:2648: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2644,15 +2656,15 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:2647: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:2659: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" -echo "${as_me:-configure}:2652: testing if the second compile does not leave our definition intact error ..." 1>&5 +echo "${as_me:-configure}:2664: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2655 "configure" +#line 2667 "configure" #include "confdefs.h" #include int @@ -2667,16 +2679,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2670: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2682: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2673: \$? = $ac_status" >&5 + echo "$as_me:2685: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2676: \"$ac_try\"") >&5 + { (eval echo "$as_me:2688: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2679: \$? = $ac_status" >&5 + echo "$as_me:2691: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2692,7 +2704,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2695: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:2707: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then @@ -2791,6 +2803,9 @@ fi (openbsd*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; +(os2*) + cf_XOPEN_SOURCE= + ;; (osf[45]*) cf_xopen_source="-D_OSF_SOURCE" ;; @@ -2810,14 +2825,14 @@ fi ;; (*) -echo "$as_me:2813: checking if we should define _XOPEN_SOURCE" >&5 +echo "$as_me:2828: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2820 "configure" +#line 2835 "configure" #include "confdefs.h" #include @@ -2836,16 +2851,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2839: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2854: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2842: \$? = $ac_status" >&5 + echo "$as_me:2857: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2845: \"$ac_try\"") >&5 + { (eval echo "$as_me:2860: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2848: \$? = $ac_status" >&5 + echo "$as_me:2863: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2854,7 +2869,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 2857 "configure" +#line 2872 "configure" #include "confdefs.h" #include @@ -2873,16 +2888,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2876: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2891: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2879: \$? = $ac_status" >&5 + echo "$as_me:2894: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2882: \"$ac_try\"") >&5 + { (eval echo "$as_me:2897: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2885: \$? = $ac_status" >&5 + echo "$as_me:2900: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2897,7 +2912,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2900: result: $cf_cv_xopen_source" >&5 +echo "$as_me:2915: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -3005,16 +3020,16 @@ cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -echo "$as_me:3008: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:3023: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -echo "${as_me:-configure}:3014: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:3029: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3017 "configure" +#line 3032 "configure" #include "confdefs.h" #include int @@ -3029,16 +3044,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3032: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3047: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3035: \$? = $ac_status" >&5 + echo "$as_me:3050: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3038: \"$ac_try\"") >&5 + { (eval echo "$as_me:3053: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3041: \$? = $ac_status" >&5 + echo "$as_me:3056: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -3059,7 +3074,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 3062 "configure" +#line 3077 "configure" #include "confdefs.h" #include int @@ -3074,16 +3089,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3077: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3092: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3080: \$? = $ac_status" >&5 + echo "$as_me:3095: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3083: \"$ac_try\"") >&5 + { (eval echo "$as_me:3098: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3086: \$? = $ac_status" >&5 + echo "$as_me:3101: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3094,15 +3109,15 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:3097: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:3112: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" -echo "${as_me:-configure}:3102: testing if the second compile does not leave our definition intact error ..." 1>&5 +echo "${as_me:-configure}:3117: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3105 "configure" +#line 3120 "configure" #include "confdefs.h" #include int @@ -3117,16 +3132,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3120: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3135: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3123: \$? = $ac_status" >&5 + echo "$as_me:3138: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3126: \"$ac_try\"") >&5 + { (eval echo "$as_me:3141: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3129: \$? = $ac_status" >&5 + echo "$as_me:3144: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3142,7 +3157,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3145: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:3160: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then @@ -3300,7 +3315,7 @@ done if test -n "$cf_new_cflags" ; then test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 -echo "${as_me:-configure}:3303: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 +echo "${as_me:-configure}:3318: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 CFLAGS="$CFLAGS $cf_new_cflags" fi @@ -3308,7 +3323,7 @@ fi if test -n "$cf_new_cppflags" ; then test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 -echo "${as_me:-configure}:3311: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 +echo "${as_me:-configure}:3326: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi @@ -3316,7 +3331,7 @@ fi if test -n "$cf_new_extra_cppflags" ; then test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 -echo "${as_me:-configure}:3319: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 +echo "${as_me:-configure}:3334: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi @@ -3324,10 +3339,10 @@ fi fi if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then - echo "$as_me:3327: checking if _XOPEN_SOURCE really is set" >&5 + echo "$as_me:3342: checking if _XOPEN_SOURCE really is set" >&5 echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 3330 "configure" +#line 3345 "configure" #include "confdefs.h" #include int @@ -3342,16 +3357,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3345: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3360: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3348: \$? = $ac_status" >&5 + echo "$as_me:3363: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3351: \"$ac_try\"") >&5 + { (eval echo "$as_me:3366: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3354: \$? = $ac_status" >&5 + echo "$as_me:3369: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set=yes else @@ -3360,12 +3375,12 @@ cat conftest.$ac_ext >&5 cf_XOPEN_SOURCE_set=no fi rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:3363: result: $cf_XOPEN_SOURCE_set" >&5 + echo "$as_me:3378: result: $cf_XOPEN_SOURCE_set" >&5 echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 if test $cf_XOPEN_SOURCE_set = yes then cat >conftest.$ac_ext <<_ACEOF -#line 3368 "configure" +#line 3383 "configure" #include "confdefs.h" #include int @@ -3380,16 +3395,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3383: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3398: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3386: \$? = $ac_status" >&5 + echo "$as_me:3401: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3389: \"$ac_try\"") >&5 + { (eval echo "$as_me:3404: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3392: \$? = $ac_status" >&5 + echo "$as_me:3407: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set_ok=yes else @@ -3400,19 +3415,19 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext if test $cf_XOPEN_SOURCE_set_ok = no then - { echo "$as_me:3403: WARNING: _XOPEN_SOURCE is lower than requested" >&5 + { echo "$as_me:3418: WARNING: _XOPEN_SOURCE is lower than requested" >&5 echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} fi else -echo "$as_me:3408: checking if we should define _XOPEN_SOURCE" >&5 +echo "$as_me:3423: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3415 "configure" +#line 3430 "configure" #include "confdefs.h" #include @@ -3431,16 +3446,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3434: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3449: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3437: \$? = $ac_status" >&5 + echo "$as_me:3452: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3440: \"$ac_try\"") >&5 + { (eval echo "$as_me:3455: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3443: \$? = $ac_status" >&5 + echo "$as_me:3458: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3449,7 +3464,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 3452 "configure" +#line 3467 "configure" #include "confdefs.h" #include @@ -3468,16 +3483,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3471: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3486: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3474: \$? = $ac_status" >&5 + echo "$as_me:3489: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3477: \"$ac_try\"") >&5 + { (eval echo "$as_me:3492: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3480: \$? = $ac_status" >&5 + echo "$as_me:3495: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3492,7 +3507,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3495: result: $cf_cv_xopen_source" >&5 +echo "$as_me:3510: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -3596,7 +3611,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return=return -echo "$as_me:3599: checking how to run the C preprocessor" >&5 +echo "$as_me:3614: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -3617,18 +3632,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 3620 "configure" +#line 3635 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:3625: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3640: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3631: \$? = $ac_status" >&5 + echo "$as_me:3646: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3651,17 +3666,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 3654 "configure" +#line 3669 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:3658: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3673: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3664: \$? = $ac_status" >&5 + echo "$as_me:3679: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3698,7 +3713,7 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:3701: result: $CPP" >&5 +echo "$as_me:3716: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -3708,18 +3723,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 3711 "configure" +#line 3726 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:3716: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3731: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3722: \$? = $ac_status" >&5 + echo "$as_me:3737: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3742,17 +3757,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 3745 "configure" +#line 3760 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:3749: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3764: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3755: \$? = $ac_status" >&5 + echo "$as_me:3770: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3780,7 +3795,7 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:3783: error: C preprocessor \"$CPP\" fails sanity check" >&5 + { { echo "$as_me:3798: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -3795,23 +3810,23 @@ ac_main_return=return for ac_header in fcntl.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:3798: checking for $ac_header" >&5 +echo "$as_me:3813: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3804 "configure" +#line 3819 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:3808: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3823: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:3814: \$? = $ac_status" >&5 + echo "$as_me:3829: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3830,7 +3845,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:3833: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:3848: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:3858: checking for working mkstemp" >&5 echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6 if test "${cf_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3851,7 +3866,7 @@ if test "$cross_compiling" = yes; then cf_cv_func_mkstemp=maybe else cat >conftest.$ac_ext <<_ACEOF -#line 3854 "configure" +#line 3869 "configure" #include "confdefs.h" #include @@ -3889,15 +3904,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:3892: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3907: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3895: \$? = $ac_status" >&5 + echo "$as_me:3910: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:3897: \"$ac_try\"") >&5 + { (eval echo "$as_me:3912: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3900: \$? = $ac_status" >&5 + echo "$as_me:3915: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_mkstemp=yes @@ -3912,16 +3927,16 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:3915: result: $cf_cv_func_mkstemp" >&5 +echo "$as_me:3930: result: $cf_cv_func_mkstemp" >&5 echo "${ECHO_T}$cf_cv_func_mkstemp" >&6 if test "x$cf_cv_func_mkstemp" = xmaybe ; then - echo "$as_me:3918: checking for mkstemp" >&5 + echo "$as_me:3933: checking for mkstemp" >&5 echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 if test "${ac_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3924 "configure" +#line 3939 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mkstemp (); below. */ @@ -3952,16 +3967,16 @@ f = mkstemp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3955: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3970: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3958: \$? = $ac_status" >&5 + echo "$as_me:3973: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3961: \"$ac_try\"") >&5 + { (eval echo "$as_me:3976: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3964: \$? = $ac_status" >&5 + echo "$as_me:3979: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mkstemp=yes else @@ -3971,7 +3986,7 @@ ac_cv_func_mkstemp=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:3974: result: $ac_cv_func_mkstemp" >&5 +echo "$as_me:3989: result: $ac_cv_func_mkstemp" >&5 echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 fi @@ -3986,13 +4001,13 @@ fi for ac_func in vsnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:3989: checking for $ac_func" >&5 +echo "$as_me:4004: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3995 "configure" +#line 4010 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -4023,16 +4038,16 @@ f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4026: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4041: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4029: \$? = $ac_status" >&5 + echo "$as_me:4044: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4032: \"$ac_try\"") >&5 + { (eval echo "$as_me:4047: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4035: \$? = $ac_status" >&5 + echo "$as_me:4050: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -4042,7 +4057,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:4045: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:4060: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:4070: checking for maximum table size" >&5 echo $ECHO_N "checking for maximum table size... $ECHO_C" >&6 # Check whether --with-max-table-size or --without-max-table-size was given. @@ -4062,12 +4077,12 @@ if test "${with_max_table_size+set}" = set; then fi; if test -n "$with_max_table_size" then - echo "$as_me:4065: result: $with_max_table_size" >&5 + echo "$as_me:4080: result: $with_max_table_size" >&5 echo "${ECHO_T}$with_max_table_size" >&6 check=`expr "$with_max_table_size" + 0` if test "x$check" != "x$with_max_table_size" then - { { echo "$as_me:4070: error: invalid value for --with-max-table-size: $with_max_table_size" >&5 + { { echo "$as_me:4085: error: invalid value for --with-max-table-size: $with_max_table_size" >&5 echo "$as_me: error: invalid value for --with-max-table-size: $with_max_table_size" >&2;} { (exit 1); exit 1; }; } fi @@ -4077,11 +4092,11 @@ cat >>confdefs.h <&5 + echo "$as_me:4095: result: default" >&5 echo "${ECHO_T}default" >&6 fi -echo "$as_me:4084: checking if backtracking extension is wanted" >&5 +echo "$as_me:4099: checking if backtracking extension is wanted" >&5 echo $ECHO_N "checking if backtracking extension is wanted... $ECHO_C" >&6 # Check whether --enable-btyacc or --disable-btyacc was given. @@ -4089,7 +4104,7 @@ if test "${enable_btyacc+set}" = set; then enableval="$enable_btyacc" fi; -echo "$as_me:4092: result: $enable_btyacc" >&5 +echo "$as_me:4107: result: $enable_btyacc" >&5 echo "${ECHO_T}$enable_btyacc" >&6 if test "$enable_btyacc" = "yes"; then @@ -4104,7 +4119,7 @@ fi if ( test "$GCC" = yes || test "$GXX" = yes ) then -echo "$as_me:4107: checking if you want to check for gcc warnings" >&5 +echo "$as_me:4122: checking if you want to check for gcc warnings" >&5 echo $ECHO_N "checking if you want to check for gcc warnings... $ECHO_C" >&6 # Check whether --with-warnings or --without-warnings was given. @@ -4114,7 +4129,7 @@ if test "${with_warnings+set}" = set; then else cf_opt_with_warnings=no fi; -echo "$as_me:4117: result: $cf_opt_with_warnings" >&5 +echo "$as_me:4132: result: $cf_opt_with_warnings" >&5 echo "${ECHO_T}$cf_opt_with_warnings" >&6 if test "$cf_opt_with_warnings" != no ; then @@ -4136,10 +4151,10 @@ cat > conftest.i <&5 + { echo "$as_me:4154: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <&5 + if { (eval echo "$as_me:4206: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4194: \$? = $ac_status" >&5 + echo "$as_me:4209: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4196: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:4211: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case $cf_attribute in @@ -4257,12 +4272,12 @@ INTEL_COMPILER=no if test "$GCC" = yes ; then case $host_os in (linux*|gnu*) - echo "$as_me:4260: checking if this is really Intel C compiler" >&5 + echo "$as_me:4275: checking if this is really Intel C compiler" >&5 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -no-gcc" cat >conftest.$ac_ext <<_ACEOF -#line 4265 "configure" +#line 4280 "configure" #include "confdefs.h" int @@ -4279,16 +4294,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4282: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4297: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4285: \$? = $ac_status" >&5 + echo "$as_me:4300: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4288: \"$ac_try\"") >&5 + { (eval echo "$as_me:4303: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4291: \$? = $ac_status" >&5 + echo "$as_me:4306: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" @@ -4299,7 +4314,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4302: result: $INTEL_COMPILER" >&5 + echo "$as_me:4317: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac @@ -4308,12 +4323,12 @@ fi CLANG_COMPILER=no if test "$GCC" = yes ; then - echo "$as_me:4311: checking if this is really Clang C compiler" >&5 + echo "$as_me:4326: checking if this is really Clang C compiler" >&5 echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Qunused-arguments" cat >conftest.$ac_ext <<_ACEOF -#line 4316 "configure" +#line 4331 "configure" #include "confdefs.h" int @@ -4330,16 +4345,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4333: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4348: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4336: \$? = $ac_status" >&5 + echo "$as_me:4351: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4339: \"$ac_try\"") >&5 + { (eval echo "$as_me:4354: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4342: \$? = $ac_status" >&5 + echo "$as_me:4357: \$? = $ac_status" >&5 (exit $ac_status); }; }; then CLANG_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" @@ -4350,12 +4365,12 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4353: result: $CLANG_COMPILER" >&5 + echo "$as_me:4368: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi cat > conftest.$ac_ext <&5 + { echo "$as_me:4390: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" @@ -4388,12 +4403,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4391: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4406: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4394: \$? = $ac_status" >&5 + echo "$as_me:4409: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4396: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4411: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi @@ -4402,7 +4417,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 elif test "$GCC" = yes then - { echo "$as_me:4405: checking for $CC warning options..." >&5 + { echo "$as_me:4420: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= @@ -4426,12 +4441,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} Wundef $cf_gcc_warnings $cf_warn_CONST Wwrite-strings do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4429: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4444: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4432: \$? = $ac_status" >&5 + echo "$as_me:4447: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4434: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4449: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in (Wcast-qual) @@ -4442,7 +4457,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 ([34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:4445: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4460: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4452,7 +4467,7 @@ echo "${as_me:-configure}:4445: testing feature is broken in gcc $GCC_VERSION .. ([12].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:4455: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4470: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4468,7 +4483,7 @@ rm -rf conftest* fi fi -echo "$as_me:4471: checking if you want to see long compiling messages" >&5 +echo "$as_me:4486: checking if you want to see long compiling messages" >&5 echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 # Check whether --enable-echo or --disable-echo was given. @@ -4502,10 +4517,10 @@ else ECHO_CC='' fi; -echo "$as_me:4505: result: $enableval" >&5 +echo "$as_me:4520: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 -echo "$as_me:4508: checking if you want to use dmalloc for testing" >&5 +echo "$as_me:4523: checking if you want to use dmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 # Check whether --with-dmalloc or --without-dmalloc was given. @@ -4522,7 +4537,7 @@ EOF else with_dmalloc= fi; -echo "$as_me:4525: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:4540: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case .$with_cflags in @@ -4616,23 +4631,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:4619: checking for dmalloc.h" >&5 + echo "$as_me:4634: checking for dmalloc.h" >&5 echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4625 "configure" +#line 4640 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4629: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4644: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4635: \$? = $ac_status" >&5 + echo "$as_me:4650: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4651,11 +4666,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4654: result: $ac_cv_header_dmalloc_h" >&5 +echo "$as_me:4669: result: $ac_cv_header_dmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 if test $ac_cv_header_dmalloc_h = yes; then -echo "$as_me:4658: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:4673: checking for dmalloc_debug in -ldmalloc" >&5 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4663,7 +4678,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4666 "configure" +#line 4681 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4682,16 +4697,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4685: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4700: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4688: \$? = $ac_status" >&5 + echo "$as_me:4703: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4691: \"$ac_try\"") >&5 + { (eval echo "$as_me:4706: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4694: \$? = $ac_status" >&5 + echo "$as_me:4709: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -4702,7 +4717,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4705: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:4720: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then cat >>confdefs.h <&5 +echo "$as_me:4735: checking if you want to use dbmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 # Check whether --with-dbmalloc or --without-dbmalloc was given. @@ -4734,7 +4749,7 @@ EOF else with_dbmalloc= fi; -echo "$as_me:4737: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:4752: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case .$with_cflags in @@ -4828,23 +4843,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:4831: checking for dbmalloc.h" >&5 + echo "$as_me:4846: checking for dbmalloc.h" >&5 echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dbmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4837 "configure" +#line 4852 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4841: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4856: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4847: \$? = $ac_status" >&5 + echo "$as_me:4862: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4863,11 +4878,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4866: result: $ac_cv_header_dbmalloc_h" >&5 +echo "$as_me:4881: result: $ac_cv_header_dbmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 if test $ac_cv_header_dbmalloc_h = yes; then -echo "$as_me:4870: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:4885: checking for debug_malloc in -ldbmalloc" >&5 echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4875,7 +4890,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4878 "configure" +#line 4893 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4894,16 +4909,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4897: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4912: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4900: \$? = $ac_status" >&5 + echo "$as_me:4915: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4903: \"$ac_try\"") >&5 + { (eval echo "$as_me:4918: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4906: \$? = $ac_status" >&5 + echo "$as_me:4921: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -4914,7 +4929,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4917: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:4932: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then cat >>confdefs.h <&5 +echo "$as_me:4947: checking if you want to use valgrind for testing" >&5 echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 # Check whether --with-valgrind or --without-valgrind was given. @@ -4946,7 +4961,7 @@ EOF else with_valgrind= fi; -echo "$as_me:4949: result: ${with_valgrind:-no}" >&5 +echo "$as_me:4964: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case .$with_cflags in @@ -5039,7 +5054,7 @@ fi ;; esac -echo "$as_me:5042: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:5057: checking if you want to perform memory-leak testing" >&5 echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 # Check whether --enable-leaks or --disable-leaks was given. @@ -5049,7 +5064,7 @@ if test "${enable_leaks+set}" = set; then else : ${with_no_leaks:=no} fi; -echo "$as_me:5052: result: $with_no_leaks" >&5 +echo "$as_me:5067: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$with_no_leaks" = yes ; then @@ -5066,7 +5081,7 @@ fi # Extract the first word of "groff", so it can be a program name with args. set dummy groff; ac_word=$2 -echo "$as_me:5069: checking for $ac_word" >&5 +echo "$as_me:5084: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GROFF_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5083,7 +5098,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_GROFF_PATH="$ac_dir/$ac_word" - echo "$as_me:5086: found $ac_dir/$ac_word" >&5 + echo "$as_me:5101: found $ac_dir/$ac_word" >&5 break fi done @@ -5095,16 +5110,16 @@ fi GROFF_PATH=$ac_cv_path_GROFF_PATH if test -n "$GROFF_PATH"; then - echo "$as_me:5098: result: $GROFF_PATH" >&5 + echo "$as_me:5113: result: $GROFF_PATH" >&5 echo "${ECHO_T}$GROFF_PATH" >&6 else - echo "$as_me:5101: result: no" >&5 + echo "$as_me:5116: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "nroff", so it can be a program name with args. set dummy nroff; ac_word=$2 -echo "$as_me:5107: checking for $ac_word" >&5 +echo "$as_me:5122: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_NROFF_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5121,7 +5136,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_NROFF_PATH="$ac_dir/$ac_word" - echo "$as_me:5124: found $ac_dir/$ac_word" >&5 + echo "$as_me:5139: found $ac_dir/$ac_word" >&5 break fi done @@ -5133,10 +5148,10 @@ fi NROFF_PATH=$ac_cv_path_NROFF_PATH if test -n "$NROFF_PATH"; then - echo "$as_me:5136: result: $NROFF_PATH" >&5 + echo "$as_me:5151: result: $NROFF_PATH" >&5 echo "${ECHO_T}$NROFF_PATH" >&6 else - echo "$as_me:5139: result: no" >&5 + echo "$as_me:5154: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -5149,7 +5164,7 @@ else GROFF_NOTE= fi -echo "$as_me:5152: checking for program to convert manpage to html" >&5 +echo "$as_me:5167: checking for program to convert manpage to html" >&5 echo $ECHO_N "checking for program to convert manpage to html... $ECHO_C" >&6 # Check whether --with-man2html or --without-man2html was given. @@ -5164,11 +5179,11 @@ cf_with_groff=no case $cf_man2html in (yes) - echo "$as_me:5167: result: man2html" >&5 + echo "$as_me:5182: result: man2html" >&5 echo "${ECHO_T}man2html" >&6 # Extract the first word of "man2html", so it can be a program name with args. set dummy man2html; ac_word=$2 -echo "$as_me:5171: checking for $ac_word" >&5 +echo "$as_me:5186: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_cf_man2html+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5185,7 +5200,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_cf_man2html="$ac_dir/$ac_word" - echo "$as_me:5188: found $ac_dir/$ac_word" >&5 + echo "$as_me:5203: found $ac_dir/$ac_word" >&5 break fi done @@ -5197,10 +5212,10 @@ fi cf_man2html=$ac_cv_path_cf_man2html if test -n "$cf_man2html"; then - echo "$as_me:5200: result: $cf_man2html" >&5 + echo "$as_me:5215: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 else - echo "$as_me:5203: result: no" >&5 + echo "$as_me:5218: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -5208,18 +5223,18 @@ fi (no|groff|*/groff*) cf_with_groff=yes cf_man2html=$GROFF_PATH - echo "$as_me:5211: result: $cf_man2html" >&5 + echo "$as_me:5226: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; (*) - echo "$as_me:5215: result: $cf_man2html" >&5 + echo "$as_me:5230: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; esac MAN2HTML_TEMP="man2html.tmp" cat >$MAN2HTML_TEMP <>$MAN2HTML_TEMP <&5 + { { echo "$as_me:5294: error: expected a pathname, not \"$cf_man2html\"" >&5 echo "$as_me: error: expected a pathname, not \"$cf_man2html\"" >&2;} { (exit 1); exit 1; }; } ;; esac MAN2HTML_PATH="$cf_man2html" - echo "$as_me:5286: checking for $cf_man2html top/bottom margins" >&5 + echo "$as_me:5301: checking for $cf_man2html top/bottom margins" >&5 echo $ECHO_N "checking for $cf_man2html top/bottom margins... $ECHO_C" >&6 # for this example, expect 3 lines of content, the remainder is head/foot @@ -5301,10 +5316,10 @@ CF_EOF cf_man2html_bot=`expr $cf_man2html_bot - 2 - $cf_man2html_top` cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" - echo "$as_me:5304: result: $cf_man2html_top_bot" >&5 + echo "$as_me:5319: result: $cf_man2html_top_bot" >&5 echo "${ECHO_T}$cf_man2html_top_bot" >&6 - echo "$as_me:5307: checking for pagesize to use" >&5 + echo "$as_me:5322: checking for pagesize to use" >&5 echo $ECHO_N "checking for pagesize to use... $ECHO_C" >&6 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 do @@ -5329,7 +5344,7 @@ CF_EOF test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 rm -rf conftest* - echo "$as_me:5332: result: $cf_man2html_page" >&5 + echo "$as_me:5347: result: $cf_man2html_page" >&5 echo "${ECHO_T}$cf_man2html_page" >&6 cat >>$MAN2HTML_TEMP <&5 +echo "$as_me:5366: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5357 "configure" +#line 5372 "configure" #include "confdefs.h" #include #include @@ -5362,13 +5377,13 @@ else #include _ACEOF -if { (eval echo "$as_me:5365: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:5380: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:5371: \$? = $ac_status" >&5 + echo "$as_me:5386: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -5390,7 +5405,7 @@ rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 5393 "configure" +#line 5408 "configure" #include "confdefs.h" #include @@ -5408,7 +5423,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 5411 "configure" +#line 5426 "configure" #include "confdefs.h" #include @@ -5429,7 +5444,7 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line 5432 "configure" +#line 5447 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) @@ -5455,15 +5470,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5458: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5473: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5461: \$? = $ac_status" >&5 + echo "$as_me:5476: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5463: \"$ac_try\"") >&5 + { (eval echo "$as_me:5478: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5466: \$? = $ac_status" >&5 + echo "$as_me:5481: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -5476,7 +5491,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:5479: result: $ac_cv_header_stdc" >&5 +echo "$as_me:5494: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then @@ -5492,28 +5507,28 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:5495: checking for $ac_header" >&5 +echo "$as_me:5510: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5501 "configure" +#line 5516 "configure" #include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5507: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5522: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5510: \$? = $ac_status" >&5 + echo "$as_me:5525: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5513: \"$ac_try\"") >&5 + { (eval echo "$as_me:5528: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5516: \$? = $ac_status" >&5 + echo "$as_me:5531: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else @@ -5523,7 +5538,7 @@ eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:5526: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:5541: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:5551: checking for mode_t" >&5 echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 if test "${ac_cv_type_mode_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5542 "configure" +#line 5557 "configure" #include "confdefs.h" $ac_includes_default int @@ -5554,16 +5569,16 @@ if (sizeof (mode_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5557: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5572: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5560: \$? = $ac_status" >&5 + echo "$as_me:5575: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5563: \"$ac_try\"") >&5 + { (eval echo "$as_me:5578: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5566: \$? = $ac_status" >&5 + echo "$as_me:5581: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_mode_t=yes else @@ -5573,7 +5588,7 @@ ac_cv_type_mode_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:5576: result: $ac_cv_type_mode_t" >&5 +echo "$as_me:5591: result: $ac_cv_type_mode_t" >&5 echo "${ECHO_T}$ac_cv_type_mode_t" >&6 if test $ac_cv_type_mode_t = yes; then : @@ -5666,7 +5681,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:5669: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:5684: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -5795,7 +5810,7 @@ EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:5842: error: ambiguous option: $1 + { { echo "$as_me:5857: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -5858,7 +5873,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:5861: error: unrecognized option: $1 + -*) { { echo "$as_me:5876: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -5877,7 +5892,7 @@ cat >&5 << _ACEOF ## Running config.status. ## ## ----------------------- ## -This file was extended by $as_me 2.52.20141204, executed with +This file was extended by $as_me 2.52.20150926, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS @@ -5895,7 +5910,7 @@ do # Handling of arguments. "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config_h.in" ;; - *) { { echo "$as_me:5898: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:5913: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -6052,10 +6067,28 @@ EOF # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + # It is possible to make a multiline substitution using escaped newlines. + # Ensure that we do not split the substitution between script fragments. + ac_BEG=$ac_end + ac_END=`expr $ac_end + $ac_max_sed_lines` + sed "1,${ac_BEG}d; ${ac_END}p; q" $tmp/subs.sed >$tmp/subs.next + if test -s $tmp/subs.next; then + grep '^s,@[^@,][^@,]*@,.*\\$' $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + grep "^s,@[^@,][^@,]*@,.*,;t t$" $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + if test $ac_beg -gt 1; then + ac_end=`expr $ac_end - 1` + continue + fi + fi + fi + fi + if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -6138,7 +6171,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:6141: creating $ac_file" >&5 + { echo "$as_me:6174: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -6156,7 +6189,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:6159: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:6192: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -6169,7 +6202,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:6172: error: cannot find input file: $f" >&5 + { { echo "$as_me:6205: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -6185,7 +6218,7 @@ cat >>$CONFIG_STATUS <<\EOF if test -n "$ac_seen"; then ac_used=`grep '@datarootdir@' $ac_item` if test -z "$ac_used"; then - { echo "$as_me:6188: WARNING: datarootdir was used implicitly but not set: + { echo "$as_me:6221: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&2;} @@ -6194,7 +6227,7 @@ $ac_seen" >&2;} fi ac_seen=`grep '${datarootdir}' $ac_item` if test -n "$ac_seen"; then - { echo "$as_me:6197: WARNING: datarootdir was used explicitly but not set: + { echo "$as_me:6230: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&2;} @@ -6231,7 +6264,7 @@ s,@INSTALL@,$ac_INSTALL,;t t ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` if test -z "$ac_init"; then ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` - { echo "$as_me:6234: WARNING: Variable $ac_name is used but was not set: + { echo "$as_me:6267: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&5 echo "$as_me: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&2;} @@ -6242,7 +6275,7 @@ $ac_seen" >&2;} egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out if test -s $tmp/out; then ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` - { echo "$as_me:6245: WARNING: Some variables may not be substituted: + { echo "$as_me:6278: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} @@ -6291,7 +6324,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:6294: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:6327: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -6302,7 +6335,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:6305: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:6338: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -6315,7 +6348,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:6318: error: cannot find input file: $f" >&5 + { { echo "$as_me:6351: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -6433,7 +6466,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:6436: $ac_file is unchanged" >&5 + { echo "$as_me:6469: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/defs.h b/defs.h index 0124a84a5d86..aacc954c1307 100644 --- a/defs.h +++ b/defs.h @@ -1,4 +1,4 @@ -/* $Id: defs.h,v 1.51 2014/10/02 22:38:13 tom Exp $ */ +/* $Id: defs.h,v 1.52 2016/06/01 22:56:37 Tom.Shields Exp $ */ #ifdef HAVE_CONFIG_H #include @@ -426,7 +426,7 @@ extern void arg_type_disagree_warning(int a_lineno, int i, char *a_name); extern void at_error(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN; extern void at_warning(int a_lineno, int i); extern void bad_formals(void) GCC_NORETURN; -extern void default_action_warning(void); +extern void default_action_warning(char *s); extern void destructor_redeclared_warning(int a_lineno, char *a_line, char *a_cptr); extern void dollar_error(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN; extern void dollar_warning(int a_lineno, int i); diff --git a/error.c b/error.c index a042aec71e73..dd626353f45f 100644 --- a/error.c +++ b/error.c @@ -1,4 +1,4 @@ -/* $Id: error.c,v 1.11 2014/04/07 22:22:49 tom Exp $ */ +/* $Id: error.c,v 1.13 2016/06/07 00:15:16 tom Exp $ */ /* routines for printing error messages */ @@ -267,11 +267,12 @@ unknown_rhs(int i) } void -default_action_warning(void) +default_action_warning(char *s) { fprintf(stderr, - "%s: w - line %d of \"%s\", the default action assigns an \ -undefined value to $$\n", myname, lineno, input_file_name); + "%s: w - line %d of \"%s\", the default action for %s assigns an \ +undefined value to $$\n", + myname, lineno, input_file_name, s); } void diff --git a/lalr.c b/lalr.c index bf7e6a83d9a7..8d19b1a1ee95 100644 --- a/lalr.c +++ b/lalr.c @@ -1,4 +1,4 @@ -/* $Id: lalr.c,v 1.11 2014/09/18 00:26:39 tom Exp $ */ +/* $Id: lalr.c,v 1.12 2016/06/07 00:28:03 tom Exp $ */ #include "defs.h" @@ -10,12 +10,12 @@ typedef struct shorts shorts; static Value_t map_goto(int state, int symbol); -static Value_t **transpose(Value_t ** R, int n); +static Value_t **transpose(Value_t **R, int n); static void add_lookback_edge(int stateno, int ruleno, int gotono); static void build_relations(void); static void compute_FOLLOWS(void); static void compute_lookaheads(void); -static void digraph(Value_t ** relation); +static void digraph(Value_t **relation); static void initialize_F(void); static void initialize_LA(void); static void set_accessing_symbol(void); @@ -147,12 +147,12 @@ initialize_LA(void) k = 0; for (i = 0; i < nstates; i++) { - lookaheads[i] = (Value_t) k; + lookaheads[i] = (Value_t)k; rp = reduction_table[i]; if (rp) k += rp->nreds; } - lookaheads[nstates] = (Value_t) k; + lookaheads[nstates] = (Value_t)k; LA = NEW2(k * tokensetsize, unsigned); LAruleno = NEW2(k, Value_t); @@ -212,15 +212,15 @@ set_goto_map(void) k = 0; for (i = ntokens; i < nsyms; i++) { - temp_map[i] = (Value_t) k; + temp_map[i] = (Value_t)k; k += goto_map[i]; } for (i = ntokens; i < nsyms; i++) goto_map[i] = temp_map[i]; - goto_map[nsyms] = (Value_t) ngotos; - temp_map[nsyms] = (Value_t) ngotos; + goto_map[nsyms] = (Value_t)ngotos; + temp_map[nsyms] = (Value_t)ngotos; from_state = NEW2(ngotos, Value_t); to_state = NEW2(ngotos, Value_t); @@ -264,7 +264,7 @@ map_goto(int state, int symbol) middle = (low + high) >> 1; s = from_state[middle]; if (s == state) - return (Value_t) (middle); + return (Value_t)(middle); else if (s < state) low = middle + 1; else @@ -463,12 +463,12 @@ add_lookback_edge(int stateno, int ruleno, int gotono) sp = NEW(shorts); sp->next = lookback[i]; - sp->value = (Value_t) gotono; + sp->value = (Value_t)gotono; lookback[i] = sp; } static Value_t ** -transpose(Value_t ** R2, int n) +transpose(Value_t **R2, int n) { Value_t **new_R; Value_t **temp_R; @@ -512,7 +512,7 @@ transpose(Value_t ** R2, int n) if (sp) { while (*sp >= 0) - *temp_R[*sp++]++ = (Value_t) i; + *temp_R[*sp++]++ = (Value_t)i; } } @@ -562,11 +562,11 @@ compute_lookaheads(void) } static void -digraph(Value_t ** relation) +digraph(Value_t **relation) { int i; - infinity = (Value_t) (ngotos + 2); + infinity = (Value_t)(ngotos + 2); INDEX = NEW2(ngotos + 1, Value_t); VERTICES = NEW2(ngotos + 1, Value_t); top = 0; @@ -598,7 +598,7 @@ traverse(int i) Value_t height; unsigned *base; - VERTICES[++top] = (Value_t) i; + VERTICES[++top] = (Value_t)i; INDEX[i] = height = top; base = F + i * tokensetsize; diff --git a/lr0.c b/lr0.c index cf0e95dc5cbc..0ac211fd8582 100644 --- a/lr0.c +++ b/lr0.c @@ -1,4 +1,4 @@ -/* $Id: lr0.c,v 1.18 2015/07/11 00:53:38 tom Exp $ */ +/* $Id: lr0.c,v 1.19 2016/06/07 00:21:53 tom Exp $ */ #include "defs.h" @@ -236,7 +236,7 @@ initialize_states(void) p->link = 0; p->number = 0; p->accessing_symbol = 0; - p->nitems = (Value_t) i; + p->nitems = (Value_t)i; for (i = 0; start_derives[i] >= 0; ++i) p->items[i] = rrhs[start_derives[i]]; @@ -272,7 +272,7 @@ new_itemsets(void) ksp = kernel_base[symbol]; } - *ksp++ = (Value_t) (i + 1); + *ksp++ = (Value_t)(i + 1); kernel_end[symbol] = ksp; } } @@ -301,9 +301,9 @@ new_state(int symbol) n = (unsigned)(iend - isp1); p = (core *)allocate((sizeof(core) + (n - 1) * sizeof(Value_t))); - p->accessing_symbol = (Value_t) symbol; - p->number = (Value_t) nstates; - p->nitems = (Value_t) n; + p->accessing_symbol = (Value_t)symbol; + p->number = (Value_t)nstates; + p->nitems = (Value_t)n; isp2 = p->items; while (isp1 < iend) @@ -409,7 +409,7 @@ save_shifts(void) (unsigned)(nshifts - 1) * sizeof(Value_t))); p->number = this_state->number; - p->nshifts = (Value_t) nshifts; + p->nshifts = (Value_t)nshifts; sp1 = shiftset; sp2 = p->shift; @@ -447,7 +447,7 @@ save_reductions(void) item = ritem[*isp]; if (item < 0) { - redset[count++] = (Value_t) - item; + redset[count++] = (Value_t)-item; } } diff --git a/mkpar.c b/mkpar.c index 653c202251e9..759cb7e73b99 100644 --- a/mkpar.c +++ b/mkpar.c @@ -1,4 +1,4 @@ -/* $Id: mkpar.c,v 1.14 2014/04/01 23:05:37 tom Exp $ */ +/* $Id: mkpar.c,v 1.15 2016/06/07 00:22:12 tom Exp $ */ #include "defs.h" @@ -84,7 +84,7 @@ get_shifts(int stateno) if (sp) { to_state2 = sp->shift; - for (i = (Value_t) (sp->nshifts - 1); i >= 0; i--) + for (i = (Value_t)(sp->nshifts - 1); i >= 0; i--) { k = to_state2[i]; symbol = accessing_symbol[k]; @@ -153,8 +153,8 @@ add_reduce(action *actions, temp = NEW(action); temp->next = next; - temp->symbol = (Value_t) symbol; - temp->number = (Value_t) ruleno; + temp->symbol = (Value_t)symbol; + temp->number = (Value_t)ruleno; temp->prec = rprec[ruleno]; temp->action_code = REDUCE; temp->assoc = rassoc[ruleno]; @@ -372,7 +372,7 @@ defreds(void) defred = NEW2(nstates, Value_t); for (i = 0; i < nstates; i++) - defred[i] = (Value_t) sole_reduction(i); + defred[i] = (Value_t)sole_reduction(i); } static void diff --git a/output.c b/output.c index ecd9494cac38..8b6d8b2dd318 100644 --- a/output.c +++ b/output.c @@ -1,4 +1,4 @@ -/* $Id: output.c,v 1.74 2014/10/05 23:21:09 tom Exp $ */ +/* $Id: output.c,v 1.76 2016/06/07 00:14:34 tom Exp $ */ #include "defs.h" @@ -54,7 +54,7 @@ puts_code(FILE * fp, const char *s) } static void -puts_param_types(FILE * fp, param * list, int more) +puts_param_types(FILE * fp, param *list, int more) { param *p; @@ -79,7 +79,7 @@ puts_param_types(FILE * fp, param * list, int more) } static void -puts_param_names(FILE * fp, param * list, int more) +puts_param_names(FILE * fp, param *list, int more) { param *p; @@ -366,7 +366,7 @@ find_conflict_base(int cbase) if (j + cbase >= nconflicts) break; } - return (Value_t) i; + return (Value_t)i; } #endif @@ -412,7 +412,7 @@ token_actions(void) conflictcount++; conflicts[nconflicts++] = -1; j = find_conflict_base(cbase); - actionrow[csym + 2 * ntokens] = (Value_t) (j + 1); + actionrow[csym + 2 * ntokens] = (Value_t)(j + 1); if (j == cbase) { cbase = nconflicts; @@ -457,7 +457,7 @@ token_actions(void) else conflicts[nconflicts++] = -1; } - conflicts[nconflicts++] = (Value_t) (p->number - 2); + conflicts[nconflicts++] = (Value_t)(p->number - 2); } } #endif @@ -468,7 +468,7 @@ token_actions(void) conflictcount++; conflicts[nconflicts++] = -1; j = find_conflict_base(cbase); - actionrow[csym + 2 * ntokens] = (Value_t) (j + 1); + actionrow[csym + 2 * ntokens] = (Value_t)(j + 1); if (j == cbase) { cbase = nconflicts; @@ -512,7 +512,7 @@ token_actions(void) *s++ = actionrow[j]; } } - width[i] = (Value_t) (max - min + 1); + width[i] = (Value_t)(max - min + 1); } if (reducecount > 0) { @@ -529,10 +529,10 @@ token_actions(void) if (max < symbol_value[j]) max = symbol_value[j]; *r++ = symbol_value[j]; - *s++ = (Value_t) (actionrow[ntokens + j] - 2); + *s++ = (Value_t)(actionrow[ntokens + j] - 2); } } - width[nstates + i] = (Value_t) (max - min + 1); + width[nstates + i] = (Value_t)(max - min + 1); } #if defined(YYBTYACC) if (backtrack && conflictcount > 0) @@ -550,10 +550,10 @@ token_actions(void) if (max < symbol_value[j]) max = symbol_value[j]; *r++ = symbol_value[j]; - *s++ = (Value_t) (actionrow[2 * ntokens + j] - 1); + *s++ = (Value_t)(actionrow[2 * ntokens + j] - 1); } } - width[2 * nstates + i] = (Value_t) (max - min + 1); + width[2 * nstates + i] = (Value_t)(max - min + 1); } #endif } @@ -635,7 +635,7 @@ save_column(int symbol, int default_state) } tally[symno] = count; - width[symno] = (Value_t) (sp1[-1] - sp[0] + 1); + width[symno] = (Value_t)(sp1[-1] - sp[0] + 1); } static void @@ -871,7 +871,7 @@ pack_table(void) state = matching_vector(i); if (state < 0) - place = (Value_t) pack_vector(i); + place = (Value_t)pack_vector(i); else place = base[state]; @@ -1198,6 +1198,16 @@ output_defines(FILE * fp) if (fp != defines_file || iflag) fprintf(fp, "#define YYERRCODE %d\n", symbol_value[1]); + if (token_table && rflag && fp != externs_file) + { + if (fp == code_file) + ++outline; + fputs("#undef yytname\n", fp); + if (fp == code_file) + ++outline; + fputs("#define yytname yyname\n", fp); + } + if (fp == defines_file || (iflag && !dflag)) { if (unionized) @@ -1307,8 +1317,11 @@ output_debug(void) */ if (token_table) { - output_line("#undef yytname"); - output_line("#define yytname yyname"); + if (!rflag) + { + output_line("#undef yytname"); + output_line("#define yytname yyname"); + } } else { diff --git a/package/byacc.spec b/package/byacc.spec index c18affa6ef0f..219bdfca1a4a 100644 --- a/package/byacc.spec +++ b/package/byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20160324 +%define AppVersion 20160606 %define UseProgram yacc -# $XTermId: byacc.spec,v 1.29 2016/03/24 23:55:52 tom Exp $ +# $XTermId: byacc.spec,v 1.31 2016/06/07 00:44:26 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/debian/changelog b/package/debian/changelog index 91b9c182ca4d..25dde429680a 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,3 +1,15 @@ +byacc (20160606) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Mon, 06 Jun 2016 20:44:26 -0400 + +byacc (20160601) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Mon, 06 Jun 2016 05:21:18 -0400 + byacc (20160324) unstable; urgency=low * maintenance updates diff --git a/package/mingw-byacc.spec b/package/mingw-byacc.spec index 6ec6649c5ba0..86bbf8919325 100644 --- a/package/mingw-byacc.spec +++ b/package/mingw-byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20160324 +%define AppVersion 20160606 %define UseProgram yacc -# $XTermId: mingw-byacc.spec,v 1.11 2016/03/24 23:55:52 tom Exp $ +# $XTermId: mingw-byacc.spec,v 1.13 2016/06/07 00:44:26 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/pkgsrc/Makefile b/package/pkgsrc/Makefile index bb568d1946f3..bff3d5194e5d 100644 --- a/package/pkgsrc/Makefile +++ b/package/pkgsrc/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $ # -DISTNAME= byacc-20160324 +DISTNAME= byacc-20160606 PKGREVISION= 1 CATEGORIES= devel MASTER_SITES= ftp://invisible-island.net/byacc/ diff --git a/reader.c b/reader.c index 812db446ce85..0f305059c948 100644 --- a/reader.c +++ b/reader.c @@ -1,4 +1,4 @@ -/* $Id: reader.c,v 1.60 2016/03/25 00:51:07 tom Exp $ */ +/* $Id: reader.c,v 1.63 2016/06/07 00:17:51 tom Exp $ */ #include "defs.h" @@ -43,6 +43,9 @@ static bucket *goal; static Value_t prec; static int gensym; static char last_was_action; +#if defined(YYBTYACC) +static int trialaction; +#endif static int maxitems; static bucket **pitem; @@ -123,7 +126,7 @@ get_line(void) return; } - if (line == 0 || linesize != (LINESIZE + 1)) + if (line == NULL || linesize != (LINESIZE + 1)) { if (line) FREE(line); @@ -163,8 +166,8 @@ dup_line(void) { char *p, *s, *t; - if (line == 0) - return (0); + if (line == NULL) + return (NULL); s = line; while (*s != '\n') ++s; @@ -199,7 +202,7 @@ skip_comment(void) if (*s == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_comment(st_lineno, st_line, st_cptr); s = cptr; } @@ -213,10 +216,10 @@ next_inline(void) { char *s; - if (line == 0) + if (line == NULL) { get_line(); - if (line == 0) + if (line == NULL) return (EOF); } @@ -236,7 +239,7 @@ next_inline(void) else if (s[1] == '/') { get_line(); - if (line == 0) + if (line == NULL) return (EOF); s = cptr; break; @@ -308,8 +311,8 @@ keywords[] = { { "pure-parser", PURE_PARSER }, { "right", RIGHT }, { "start", START }, - { "term", TOKEN }, - { "token", TOKEN }, + { "term", TOKEN }, + { "token", TOKEN }, { "token-table", TOKEN_TABLE }, { "type", TYPE }, { "union", UNION }, @@ -386,6 +389,7 @@ keyword(void) return (NONASSOC); } syntax_error(lineno, line, t_cptr); + /*NOTREACHED */ } static void @@ -446,7 +450,7 @@ copy_string(int quote) if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_string(s_lineno, s_line, s_cptr); } } @@ -494,7 +498,7 @@ copy_comment(void) if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_comment(c_lineno, c_line, c_cptr); } } @@ -515,7 +519,7 @@ copy_text(void) if (*cptr == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_text(t_lineno, t_line, t_cptr); } if (!lflag) @@ -602,15 +606,15 @@ copy_union(void) over_unionized(cptr - 6); unionized = 1; - if (!lflag) - fprintf(text_file, line_format, lineno, input_file_name); - puts_both("#ifdef YYSTYPE\n"); puts_both("#undef YYSTYPE_IS_DECLARED\n"); puts_both("#define YYSTYPE_IS_DECLARED 1\n"); puts_both("#endif\n"); puts_both("#ifndef YYSTYPE_IS_DECLARED\n"); puts_both("#define YYSTYPE_IS_DECLARED 1\n"); + + if (!lflag) + fprintf(text_file, line_format, lineno, input_file_name); puts_both("typedef union"); depth = 0; @@ -621,7 +625,7 @@ copy_union(void) { case '\n': get_line(); - if (line == 0) + if (line == NULL) unterminated_union(u_lineno, u_line, u_cptr); goto loop; @@ -857,7 +861,7 @@ copy_param(int k) else if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unexpected_EOF(); --cptr; buf_size += (size_t) linesize; @@ -992,7 +996,7 @@ get_literal(void) { case '\n': get_line(); - if (line == 0) + if (line == NULL) unterminated_string(s_lineno, s_line, s_cptr); continue; @@ -1186,7 +1190,7 @@ get_number(void) n = 0; for (c = *cptr; isdigit(c); c = *++cptr) - n = (Value_t) (10 * n + (c - '0')); + n = (Value_t)(10 * n + (c - '0')); return (n); } @@ -1317,7 +1321,7 @@ declare_tokens(int assoc) { if (bp->prec && prec != bp->prec) reprec_warning(bp->name); - bp->assoc = (Assoc_t) assoc; + bp->assoc = (Assoc_t)assoc; bp->prec = prec; } @@ -1325,6 +1329,7 @@ declare_tokens(int assoc) if (c == EOF) unexpected_EOF(); + value = UNDEFINED; if (isdigit(c)) { value = get_number(); @@ -1429,7 +1434,7 @@ static void declare_types(void) { int c; - bucket *bp; + bucket *bp = NULL; char *tag = NULL; c = nextc(); @@ -1749,7 +1754,7 @@ parse_arginfo(bucket *a, char *args, int argslen) char *p = args, *tmp; int i, redec = 0; - if (a->args > 0) + if (a->args >= 0) { if (a->args != argslen) arg_number_disagree_warning(rescan_lineno, a->name); @@ -1831,7 +1836,7 @@ compile_arg(char **theptr, char *yyvaltag) for (j = 0, i++; i < nitems; i++) if (pitem[i]->class != ARGUMENT) - offsets[++j] = (Value_t) (i - nitems + 1); + offsets[++j] = (Value_t)(i - nitems + 1); } rhs = pitem + nitems - 1; @@ -1883,8 +1888,8 @@ compile_arg(char **theptr, char *yyvaltag) unknown_arg_warning(rescan_lineno, "$", arg, NULL, NULL); else if (!tag) tag = plhs[nrules]->argtags[i]; - msprintf(c, "yystack.l_mark[%d]", i - plhs[nrules]->args + 1 - - n); + msprintf(c, "yystack.l_mark[%d]", + i - plhs[nrules]->args + 1 - n); if (tag) msprintf(c, ".%s", tag); else if (havetags) @@ -1910,6 +1915,90 @@ compile_arg(char **theptr, char *yyvaltag) return msdone(c); } +static int +can_elide_arg(char **theptr, char *yyvaltag) +{ + char *p = *theptr; + int rv = 0; + int i, j, n = 0; + Value_t *offsets = NULL, maxoffset = 0; + bucket **rhs; + char *tag = 0; + + if (*p++ != '$') + return 0; + if (*p == '<') + { + if (!(p = parse_id(++p, &tag)) || *p++ != '>') + return 0; + } + for (i = nitems - 1; pitem[i]; --i) + { + n++; + if (pitem[i]->class != ARGUMENT) + maxoffset++; + } + if (maxoffset > 0) + { + offsets = TMALLOC(Value_t, maxoffset + 1); + NO_SPACE(offsets); + + for (j = 0, i++; i < nitems; i++) + if (pitem[i]->class != ARGUMENT) + offsets[++j] = (Value_t)(i - nitems + 1); + } + rhs = pitem + nitems - 1; + + if (isdigit(*p) || *p == '-') + { + int val; + if (!(p = parse_int(p, &val))) + rv = 0; + else + { + if (val <= 0) + rv = 1 - val + n; + else if (val > maxoffset) + rv = 0; + else + { + i = offsets[val]; + rv = 1 - i; + if (!tag) + tag = rhs[i]->tag; + } + } + } + else if (isalpha(*p) || *p == '_') + { + char *arg; + if (!(p = parse_id(p, &arg))) + return 0; + for (i = plhs[nrules]->args - 1; i >= 0; i--) + if (arg == plhs[nrules]->argnames[i]) + break; + if (i >= 0) + { + if (!tag) + tag = plhs[nrules]->argtags[i]; + rv = plhs[nrules]->args + n - i; + } + } + if (tag && yyvaltag) + { + if (strcmp(tag, yyvaltag)) + rv = 0; + } + else if (tag || yyvaltag) + rv = 0; + if (maxoffset > 0) + FREE(offsets); + if (*p || rv <= 0) + return 0; + *theptr = p + 1; + return rv; +} + #define ARG_CACHE_SIZE 1024 static struct arg_cache { @@ -1961,7 +2050,7 @@ clean_arg_cache(void) arg_cache[i] = NULL; } } -#endif +#endif /* defined(YYBTYACC) */ static void advance_to_start(void) @@ -2060,12 +2149,10 @@ end_rule(void) for (i = nitems - 1; (i > 0) && pitem[i]; --i) continue; if (pitem[i + 1] == 0 || pitem[i + 1]->tag != plhs[nrules]->tag) - default_action_warning(); + default_action_warning(plhs[nrules]->name); } else - { - default_action_warning(); - } + default_action_warning(plhs[nrules]->name); } last_was_action = 0; @@ -2093,7 +2180,7 @@ insert_empty_rule(void) bp->args = 0; #endif - nitems = (Value_t) (nitems + 2); + nitems = (Value_t)(nitems + 2); if (nitems > maxitems) expand_items(); bpp = pitem + nitems - 1; @@ -2124,13 +2211,14 @@ insert_arg_rule(char *arg, char *tag) { rule = nrules; insert_arg_cache(code, rule); + trialaction = 1; /* arg rules always run in trial mode */ fprintf(f, "case %d:\n", rule - 2); if (!lflag) fprintf(f, line_format, line_number, input_file_name); fprintf(f, "%s;\n", code); fprintf(f, "break;\n"); insert_empty_rule(); - plhs[rule]->tag = tag; + plhs[rule]->tag = cache_tag(tag, strlen(tag)); plhs[rule]->class = ARGUMENT; } else @@ -2201,11 +2289,33 @@ add_symbol(void) } else if (bp->args != argslen) wrong_number_args_warning("", bp->name); - if (bp->args > 0 && argslen > 0) + if (args != 0) { - char *ap; - int i; - for (ap = args, i = 0; i < argslen; i++) + char *ap = args; + int i = 0; + int elide_cnt = can_elide_arg(&ap, bp->argtags[0]); + + if (elide_cnt > argslen) + elide_cnt = 0; + if (elide_cnt) + { + for (i = 1; i < elide_cnt; i++) + if (can_elide_arg(&ap, bp->argtags[i]) != elide_cnt - i) + { + elide_cnt = 0; + break; + } + } + if (elide_cnt) + { + assert(i == elide_cnt); + } + else + { + ap = args; + i = 0; + } + for (; i < argslen; i++) ap = insert_arg_rule(ap, bp->argtags[i]); free(args); } @@ -2223,7 +2333,6 @@ copy_action(void) int i, j, n; int depth; #if defined(YYBTYACC) - int trialaction = 0; int haveyyval = 0; #endif char *tag; @@ -2237,15 +2346,16 @@ copy_action(void) if (last_was_action) insert_empty_rule(); last_was_action = 1; +#if defined(YYBTYACC) + trialaction = (*cptr == L_BRAC); +#endif fprintf(f, "case %d:\n", nrules - 2); #if defined(YYBTYACC) if (backtrack) { - if (*cptr != L_BRAC) + if (!trialaction) fprintf(f, " if (!yytrial)\n"); - else - trialaction = 1; } #endif if (!lflag) @@ -2277,7 +2387,7 @@ copy_action(void) { if (pitem[i]->class != ARGUMENT) { - offsets[++j] = (Value_t) (i - nitems + 1); + offsets[++j] = (Value_t)(i - nitems + 1); } } } @@ -2336,8 +2446,8 @@ copy_action(void) break; if (i < 0) unknown_arg_warning(d_lineno, "$", arg, d_line, d_cptr); - fprintf(f, "yystack.l_mark[%d].%s", i - plhs[nrules]->args + - 1 - n, tag); + fprintf(f, "yystack.l_mark[%d].%s", + i - plhs[nrules]->args + 1 - n, tag); FREE(d_line); goto loop; } @@ -2450,6 +2560,13 @@ copy_action(void) fprintf(f, "yystack.p_mark[%d]", offsets[i]); goto loop; } + else if (cptr[1] == '-') + { + cptr += 2; + i = get_number(); + fprintf(f, "yystack.p_mark[%d]", -i - n); + goto loop; + } } #endif if (isalpha(c) || c == '_' || c == '$') @@ -2510,7 +2627,7 @@ copy_action(void) if (depth > 0) goto loop; fprintf(f, "\nbreak;\n"); - free(a_line); + FREE(a_line); if (maxoffset > 0) FREE(offsets); return; @@ -2553,7 +2670,7 @@ copy_action(void) } #endif fprintf(f, "\nbreak;\n"); - free(a_line); + FREE(a_line); if (maxoffset > 0) FREE(offsets); return; @@ -2896,6 +3013,7 @@ mark_symbol(void) else { syntax_error(lineno, line, cptr); + /*NOTREACHED */ } if (rprec[nrules] != UNDEFINED && bp->prec != rprec[nrules]) @@ -3066,8 +3184,8 @@ pack_symbols(void) if (bp->class == TERM) ++ntokens; } - start_symbol = (Value_t) ntokens; - nvars = (Value_t) (nsyms - ntokens); + start_symbol = (Value_t)ntokens; + nvars = (Value_t)(nsyms - ntokens); symbol_name = TMALLOC(char *, nsyms); NO_SPACE(symbol_name); @@ -3102,7 +3220,7 @@ pack_symbols(void) v[start_symbol] = 0; i = 1; - j = (Value_t) (start_symbol + 1); + j = (Value_t)(start_symbol + 1); for (bp = first_symbol; bp; bp = bp->next) { if (bp->class == TERM) @@ -3115,8 +3233,8 @@ pack_symbols(void) for (i = 1; i < ntokens; ++i) v[i]->index = i; - goal->index = (Index_t) (start_symbol + 1); - k = (Value_t) (start_symbol + 2); + goal->index = (Index_t)(start_symbol + 1); + k = (Value_t)(start_symbol + 2); while (++i < nsyms) if (v[i] != goal) { @@ -3126,7 +3244,7 @@ pack_symbols(void) goal->value = 0; k = 1; - for (i = (Value_t) (start_symbol + 1); i < nsyms; ++i) + for (i = (Value_t)(start_symbol + 1); i < nsyms; ++i) { if (v[i] != goal) { @@ -3199,7 +3317,7 @@ pack_symbols(void) symbol_prec[start_symbol] = 0; symbol_assoc[start_symbol] = TOKEN; #if defined(YYBTYACC) - symbol_pval[start_symbol] = (Value_t) (max_tok_pval + 1); + symbol_pval[start_symbol] = (Value_t)(max_tok_pval + 1); #endif for (++i; i < nsyms; ++i) { @@ -3209,7 +3327,7 @@ pack_symbols(void) symbol_prec[k] = v[i]->prec; symbol_assoc[k] = v[i]->assoc; #if defined(YYBTYACC) - symbol_pval[k] = (Value_t) ((max_tok_pval + 1) + v[i]->value + 1); + symbol_pval[k] = (Value_t)((max_tok_pval + 1) + v[i]->value + 1); if (destructor) { symbol_destructor[k] = v[i]->destructor; @@ -3296,7 +3414,7 @@ pack_grammar(void) } ++j; } - ritem[j] = (Value_t) - i; + ritem[j] = (Value_t)-i; ++j; if (rprec[i] == UNDEFINED) { @@ -3454,7 +3572,7 @@ reader(void) #ifdef NO_LEAKS static param * -free_declarations(param * list) +free_declarations(param *list) { while (list != 0) { diff --git a/skel2c b/skel2c index d6f9f590949b..d979359265c9 100644 --- a/skel2c +++ b/skel2c @@ -4,7 +4,7 @@ function noident(given) { return given; } BEGIN { havesection = 0; - version = "$Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp $"; + version = "$Id: skel2c,v 1.4 2016/06/07 00:26:09 tom Exp $"; nsec = 0; ifdef = ""; printf "/* This file generated automatically using\n * %s\n */\n\n", @@ -42,10 +42,10 @@ BEGIN { havesection = 0; if (ifdef != "") { if (NF >= 2) { printf " \"#endif /* %s */\",\n", $2; - printf "#endif /* defined(%s) */\n", $2; + printf "#endif\t\t\t/* defined(%s) */\n", $2; } else { printf " \"#endif /* %s */\",\n", ifdef; - printf "#endif /* defined(%s) */\n", ifdef; + printf "#endif\t\t\t/* defined(%s) */\n", ifdef; } ifdef = ""; } else { diff --git a/test/btyacc/btyacc_calc1.tab.c b/test/btyacc/btyacc_calc1.tab.c index f7e6a30c8ddd..17e7962609dd 100644 --- a/test/btyacc/btyacc_calc1.tab.c +++ b/test/btyacc/btyacc_calc1.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 @@ -140,13 +140,13 @@ int dcheck(INTERVAL); double dreg[26]; INTERVAL vreg[26]; -#line 29 "btyacc_calc1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 29 "btyacc_calc1.y" typedef union { int ival; @@ -438,9 +438,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) @@ -622,18 +622,18 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -647,7 +647,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; @@ -711,7 +711,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; @@ -821,6 +821,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; @@ -894,11 +896,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 @@ -957,7 +958,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) @@ -1038,7 +1039,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; @@ -1084,9 +1085,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) @@ -1111,7 +1121,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) @@ -1127,7 +1137,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) @@ -1162,7 +1172,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) @@ -1184,7 +1194,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1253,7 +1263,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); } @@ -1513,7 +1523,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1517 "btyacc_calc1.tab.c" +#line 1527 "btyacc_calc1.tab.c" default: break; } @@ -1601,12 +1611,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 @@ -1633,7 +1642,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; @@ -1668,7 +1677,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) diff --git a/test/btyacc/btyacc_demo.error b/test/btyacc/btyacc_demo.error index 4542fbf3b9ca..c070d881ffae 100644 --- a/test/btyacc/btyacc_demo.error +++ b/test/btyacc/btyacc_demo.error @@ -1 +1 @@ -YACC: 7 shift/reduce conflicts, 5 reduce/reduce conflicts. +YACC: 12 shift/reduce conflicts. diff --git a/test/btyacc/btyacc_demo.output b/test/btyacc/btyacc_demo.output index bc64d2467e75..a281c242a37c 100644 --- a/test/btyacc/btyacc_demo.output +++ b/test/btyacc/btyacc_demo.output @@ -16,86 +16,81 @@ 9 decl_list : decl_list $$2 decl - 10 $$3 : + 10 decl : decl_specs declarator_list ';' - 11 decl : decl_specs $$2 $$3 declarator_list ';' + 11 $$3 : - 12 $$4 : + 12 decl : decl_specs declarator $$3 block_statement - 13 decl : decl_specs $$2 $$3 declarator $$4 block_statement + 13 decl_specs : decl_spec + 14 | decl_specs $$2 decl_spec - 14 decl_specs : decl_spec - 15 | decl_specs $$2 decl_spec + 15 cv_quals : + 16 | cv_quals cv_qual - 16 cv_quals : - 17 | cv_quals cv_qual + 17 decl_spec : cv_qual + 18 | typename + 19 | EXTERN + 20 | REGISTER + 21 | STATIC - 18 decl_spec : cv_qual - 19 | typename - 20 | EXTERN - 21 | REGISTER - 22 | STATIC + 22 cv_qual : CONST + 23 | VOLATILE - 23 cv_qual : CONST - 24 | VOLATILE + 24 $$4 : 25 $$5 : - 26 $$6 : + 26 declarator_list : declarator_list ',' $$4 $$5 declarator + 27 | declarator - 27 declarator_list : declarator_list ',' $$5 $$6 declarator - 28 | declarator + 28 declarator : + 29 | ID - 29 declarator : - 30 | ID + 30 $$6 : 31 $$7 : - 32 $$8 : + 32 declarator : '(' $$6 $$7 declarator ')' + 33 | '*' cv_quals $$4 $$5 declarator + 34 | declarator '[' $$4 expr ']' + 35 | declarator '(' $$4 formal_arg_list ')' cv_quals - 33 declarator : '(' $$7 $$8 declarator ')' - 34 | '*' cv_quals $$5 $$6 declarator - 35 | declarator '[' $$5 expr ']' - 36 | declarator '(' $$5 formal_arg_list ')' cv_quals + 36 formal_arg_list : + 37 | nonempty_formal_arg_list - 37 formal_arg_list : - 38 | nonempty_formal_arg_list + 38 nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$6 formal_arg + 39 | formal_arg - 39 nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg - 40 | formal_arg + 40 formal_arg : decl_specs declarator - 41 formal_arg : decl_specs $$2 $$3 declarator + 41 expr : expr '+' $$6 expr + 42 | expr '-' $$6 expr + 43 | expr '*' $$6 expr + 44 | expr '%' $$6 expr + 45 | expr '/' $$6 expr + 46 | '*' $$2 expr + 47 | ID + 48 | CONSTANT - 42 expr : expr '+' $$7 expr - 43 | expr '-' $$7 expr - 44 | expr '*' $$7 expr - 45 | expr '%' $$7 expr - 46 | expr '/' $$7 expr - 47 | '*' $$2 expr - 48 | ID - 49 | CONSTANT + 49 statement : decl + 50 | expr ';' - 50 statement : decl + 51 $$8 : - 51 $$9 : + 52 $$9 : - 52 statement : $$9 expr ';' + 53 statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE $$9 statement + 54 | IF '(' $$6 expr ')' THEN $$8 statement - 53 $$10 : + 55 $$10 : - 54 $$11 : + 56 statement : $$10 block_statement - 55 statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement - 56 | IF '(' $$7 expr ')' THEN $$10 statement + 57 statement_list : + 58 | statement_list $$2 statement - 57 $$12 : - - 58 statement : $$12 block_statement - - 59 statement_list : - 60 | statement_list $$2 statement - - 61 block_statement : '{' $$2 statement_list '}' + 59 block_statement : '{' $$2 statement_list '}' state 0 $accept : . input $end (0) @@ -160,35 +155,35 @@ state 4 state 5 - decl_spec : EXTERN . (20) + decl_spec : EXTERN . (19) + + . reduce 19 + + +state 6 + decl_spec : REGISTER . (20) . reduce 20 -state 6 - decl_spec : REGISTER . (21) +state 7 + decl_spec : STATIC . (21) . reduce 21 -state 7 - decl_spec : STATIC . (22) +state 8 + cv_qual : CONST . (22) . reduce 22 -state 8 - cv_qual : CONST . (23) +state 9 + cv_qual : VOLATILE . (23) . reduce 23 -state 9 - cv_qual : VOLATILE . (24) - - . reduce 24 - - state 10 opt_scope : CLCL . (2) @@ -201,50 +196,114 @@ state 11 . reduce 9 +12: shift/reduce conflict (shift 18, reduce 28) on '(' +12: shift/reduce conflict (shift 19, reduce 8) on ID state 12 - decl : decl_specs . $$2 $$3 declarator_list ';' (11) - decl : decl_specs . $$2 $$3 declarator $$4 block_statement (13) - decl_specs : decl_specs . $$2 decl_spec (15) + decl : decl_specs . declarator_list ';' (10) + decl : decl_specs . declarator $$3 block_statement (12) + decl_specs : decl_specs . $$2 decl_spec (14) $$2 : . (8) + declarator : . (28) - . reduce 8 + '*' shift 17 + '(' [trial] shift 18 + ID [trial] shift 19 + '(' [trial] reduce 28 + '[' reduce 28 + ID [trial] reduce 8 + EXTERN reduce 8 + REGISTER reduce 8 + STATIC reduce 8 + CONST reduce 8 + VOLATILE reduce 8 + CLCL reduce 8 + ';' reduce 28 + ',' reduce 28 + '{' reduce 28 - $$2 goto 17 + declarator_list goto 20 + declarator goto 21 + $$2 goto 22 state 13 - decl_specs : decl_spec . (14) + decl_specs : decl_spec . (13) - . reduce 14 + . reduce 13 state 14 - decl_spec : typename . (19) + decl_spec : typename . (18) - . reduce 19 + . reduce 18 state 15 - decl_spec : cv_qual . (18) + decl_spec : cv_qual . (17) - . reduce 18 + . reduce 17 state 16 opt_scope : opt_scope . ID CLCL (3) typename : opt_scope . ID (4) - ID shift 18 + ID shift 23 . error -17: reduce/reduce conflict (reduce 1, reduce 10) on ID state 17 - decl : decl_specs $$2 . $$3 declarator_list ';' (11) - decl : decl_specs $$2 . $$3 declarator $$4 block_statement (13) - decl_specs : decl_specs $$2 . decl_spec (15) + declarator : '*' . cv_quals $$4 $$5 declarator (33) + cv_quals : . (15) + + . reduce 15 + + cv_quals goto 24 + + +state 18 + declarator : '(' . $$6 $$7 declarator ')' (32) + $$6 : . (30) + + . reduce 30 + + $$6 goto 25 + + +state 19 + declarator : ID . (29) + + . reduce 29 + + +state 20 + decl : decl_specs declarator_list . ';' (10) + declarator_list : declarator_list . ',' $$4 $$5 declarator (26) + + ';' shift 26 + ',' shift 27 + . error + + +state 21 + decl : decl_specs declarator . $$3 block_statement (12) + declarator_list : declarator . (27) + declarator : declarator . '[' $$4 expr ']' (34) + declarator : declarator . '(' $$4 formal_arg_list ')' cv_quals (35) + $$3 : . (11) + + '(' shift 28 + '[' shift 29 + ';' reduce 27 + ',' reduce 27 + '{' reduce 11 + + $$3 goto 30 + + +state 22 + decl_specs : decl_specs $$2 . decl_spec (14) opt_scope : . (1) - $$3 : . (10) EXTERN shift 5 REGISTER shift 6 @@ -252,28 +311,20 @@ state 17 CONST shift 8 VOLATILE shift 9 CLCL shift 10 - '*' reduce 10 - '(' reduce 10 - '[' reduce 10 - ID [trial] reduce 1 - ID [trial] reduce 10 - ';' reduce 10 - ',' reduce 10 - '{' reduce 10 + ID reduce 1 - decl_spec goto 19 + decl_spec goto 31 typename goto 14 cv_qual goto 15 opt_scope goto 16 - $$3 goto 20 -18: shift/reduce conflict (shift 21, reduce 4) on CLCL -state 18 +23: shift/reduce conflict (shift 32, reduce 4) on CLCL +state 23 opt_scope : opt_scope ID . CLCL (3) typename : opt_scope ID . (4) - CLCL [trial] shift 21 + CLCL [trial] shift 32 '*' reduce 4 '(' reduce 4 '[' reduce 4 @@ -290,200 +341,132 @@ state 18 '{' reduce 4 -state 19 - decl_specs : decl_specs $$2 decl_spec . (15) +state 24 + cv_quals : cv_quals . cv_qual (16) + declarator : '*' cv_quals . $$4 $$5 declarator (33) + $$4 : . (24) - . reduce 15 + CONST shift 8 + VOLATILE shift 9 + '*' reduce 24 + '(' reduce 24 + '[' reduce 24 + ID reduce 24 + ';' reduce 24 + ',' reduce 24 + ')' reduce 24 + '{' reduce 24 + + cv_qual goto 33 + $$4 goto 34 -20: shift/reduce conflict (shift 23, reduce 29) on '(' -state 20 - decl : decl_specs $$2 $$3 . declarator_list ';' (11) - decl : decl_specs $$2 $$3 . declarator $$4 block_statement (13) - declarator : . (29) +state 25 + declarator : '(' $$6 . $$7 declarator ')' (32) + $$7 : . (31) - '*' shift 22 - '(' [trial] shift 23 - ID shift 24 - '(' [trial] reduce 29 - '[' reduce 29 - ';' reduce 29 - ',' reduce 29 - '{' reduce 29 + . reduce 31 - declarator_list goto 25 - declarator goto 26 + $$7 goto 35 -state 21 +state 26 + decl : decl_specs declarator_list ';' . (10) + + . reduce 10 + + +state 27 + declarator_list : declarator_list ',' . $$4 $$5 declarator (26) + $$4 : . (24) + + . reduce 24 + + $$4 goto 36 + + +state 28 + declarator : declarator '(' . $$4 formal_arg_list ')' cv_quals (35) + $$4 : . (24) + + . reduce 24 + + $$4 goto 37 + + +state 29 + declarator : declarator '[' . $$4 expr ']' (34) + $$4 : . (24) + + . reduce 24 + + $$4 goto 38 + + +state 30 + decl : decl_specs declarator $$3 . block_statement (12) + + '{' shift 39 + . error + + block_statement goto 40 + + +state 31 + decl_specs : decl_specs $$2 decl_spec . (14) + + . reduce 14 + + +state 32 opt_scope : opt_scope ID CLCL . (3) . reduce 3 -state 22 - declarator : '*' . cv_quals $$5 $$6 declarator (34) - cv_quals : . (16) +state 33 + cv_quals : cv_quals cv_qual . (16) . reduce 16 - cv_quals goto 27 - - -state 23 - declarator : '(' . $$7 $$8 declarator ')' (33) - $$7 : . (31) - - . reduce 31 - - $$7 goto 28 - - -state 24 - declarator : ID . (30) - - . reduce 30 - - -state 25 - decl : decl_specs $$2 $$3 declarator_list . ';' (11) - declarator_list : declarator_list . ',' $$5 $$6 declarator (27) - - ';' shift 29 - ',' shift 30 - . error - - -state 26 - decl : decl_specs $$2 $$3 declarator . $$4 block_statement (13) - declarator_list : declarator . (28) - declarator : declarator . '[' $$5 expr ']' (35) - declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36) - $$4 : . (12) - - '(' shift 31 - '[' shift 32 - ';' reduce 28 - ',' reduce 28 - '{' reduce 12 - - $$4 goto 33 - - -state 27 - cv_quals : cv_quals . cv_qual (17) - declarator : '*' cv_quals . $$5 $$6 declarator (34) - $$5 : . (25) - - CONST shift 8 - VOLATILE shift 9 - '*' reduce 25 - '(' reduce 25 - '[' reduce 25 - ID reduce 25 - ';' reduce 25 - ',' reduce 25 - ')' reduce 25 - '{' reduce 25 - - cv_qual goto 34 - $$5 goto 35 - - -state 28 - declarator : '(' $$7 . $$8 declarator ')' (33) - $$8 : . (32) - - . reduce 32 - - $$8 goto 36 - - -state 29 - decl : decl_specs $$2 $$3 declarator_list ';' . (11) - - . reduce 11 - - -state 30 - declarator_list : declarator_list ',' . $$5 $$6 declarator (27) - $$5 : . (25) - - . reduce 25 - - $$5 goto 37 - - -state 31 - declarator : declarator '(' . $$5 formal_arg_list ')' cv_quals (36) - $$5 : . (25) - - . reduce 25 - - $$5 goto 38 - - -state 32 - declarator : declarator '[' . $$5 expr ']' (35) - $$5 : . (25) - - . reduce 25 - - $$5 goto 39 - - -state 33 - decl : decl_specs $$2 $$3 declarator $$4 . block_statement (13) - - '{' shift 40 - . error - - block_statement goto 41 - state 34 - cv_quals : cv_quals cv_qual . (17) + declarator : '*' cv_quals $$4 . $$5 declarator (33) + $$5 : . (25) - . reduce 17 + . reduce 25 + + $$5 goto 41 +35: shift/reduce conflict (shift 18, reduce 28) on '(' state 35 - declarator : '*' cv_quals $$5 . $$6 declarator (34) - $$6 : . (26) + declarator : '(' $$6 $$7 . declarator ')' (32) + declarator : . (28) - . reduce 26 + '*' shift 17 + '(' [trial] shift 18 + ID shift 19 + '(' [trial] reduce 28 + '[' reduce 28 + ')' reduce 28 - $$6 goto 42 + declarator goto 42 -36: shift/reduce conflict (shift 23, reduce 29) on '(' state 36 - declarator : '(' $$7 $$8 . declarator ')' (33) - declarator : . (29) + declarator_list : declarator_list ',' $$4 . $$5 declarator (26) + $$5 : . (25) - '*' shift 22 - '(' [trial] shift 23 - ID shift 24 - '(' [trial] reduce 29 - '[' reduce 29 - ')' reduce 29 + . reduce 25 - declarator goto 43 + $$5 goto 43 state 37 - declarator_list : declarator_list ',' $$5 . $$6 declarator (27) - $$6 : . (26) - - . reduce 26 - - $$6 goto 44 - - -state 38 - declarator : declarator '(' $$5 . formal_arg_list ')' cv_quals (36) + declarator : declarator '(' $$4 . formal_arg_list ')' cv_quals (35) opt_scope : . (1) - formal_arg_list : . (37) + formal_arg_list : . (36) EXTERN shift 5 REGISTER shift 6 @@ -492,311 +475,311 @@ state 38 VOLATILE shift 9 CLCL shift 10 ID reduce 1 - ')' reduce 37 + ')' reduce 36 - formal_arg goto 45 - decl_specs goto 46 + formal_arg goto 44 + decl_specs goto 45 decl_spec goto 13 typename goto 14 cv_qual goto 15 opt_scope goto 16 - formal_arg_list goto 47 - nonempty_formal_arg_list goto 48 + formal_arg_list goto 46 + nonempty_formal_arg_list goto 47 + + +state 38 + declarator : declarator '[' $$4 . expr ']' (34) + + '*' shift 48 + ID shift 49 + CONSTANT shift 50 + . error + + expr goto 51 state 39 - declarator : declarator '[' $$5 . expr ']' (35) + block_statement : '{' . $$2 statement_list '}' (59) + $$2 : . (8) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 - . error + . reduce 8 - expr goto 52 + $$2 goto 52 state 40 - block_statement : '{' . $$2 statement_list '}' (61) - $$2 : . (8) + decl : decl_specs declarator $$3 block_statement . (12) - . reduce 8 - - $$2 goto 53 + . reduce 12 +41: shift/reduce conflict (shift 18, reduce 28) on '(' state 41 - decl : decl_specs $$2 $$3 declarator $$4 block_statement . (13) + declarator : '*' cv_quals $$4 $$5 . declarator (33) + declarator : . (28) - . reduce 13 + '*' shift 17 + '(' [trial] shift 18 + ID shift 19 + '(' [trial] reduce 28 + '[' reduce 28 + ';' reduce 28 + ',' reduce 28 + ')' reduce 28 + '{' reduce 28 + + declarator goto 53 -42: shift/reduce conflict (shift 23, reduce 29) on '(' state 42 - declarator : '*' cv_quals $$5 $$6 . declarator (34) - declarator : . (29) + declarator : '(' $$6 $$7 declarator . ')' (32) + declarator : declarator . '[' $$4 expr ']' (34) + declarator : declarator . '(' $$4 formal_arg_list ')' cv_quals (35) - '*' shift 22 - '(' [trial] shift 23 - ID shift 24 - '(' [trial] reduce 29 - '[' reduce 29 - ';' reduce 29 - ',' reduce 29 - ')' reduce 29 - '{' reduce 29 - - declarator goto 54 - - -state 43 - declarator : '(' $$7 $$8 declarator . ')' (33) - declarator : declarator . '[' $$5 expr ']' (35) - declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36) - - '(' shift 31 - '[' shift 32 - ')' shift 55 + '(' shift 28 + '[' shift 29 + ')' shift 54 . error -44: shift/reduce conflict (shift 23, reduce 29) on '(' -state 44 - declarator_list : declarator_list ',' $$5 $$6 . declarator (27) - declarator : . (29) +43: shift/reduce conflict (shift 18, reduce 28) on '(' +state 43 + declarator_list : declarator_list ',' $$4 $$5 . declarator (26) + declarator : . (28) - '*' shift 22 - '(' [trial] shift 23 - ID shift 24 - '(' [trial] reduce 29 - '[' reduce 29 - ';' reduce 29 - ',' reduce 29 + '*' shift 17 + '(' [trial] shift 18 + ID shift 19 + '(' [trial] reduce 28 + '[' reduce 28 + ';' reduce 28 + ',' reduce 28 + + declarator goto 55 + + +state 44 + nonempty_formal_arg_list : formal_arg . (39) + + . reduce 39 + + +45: shift/reduce conflict (shift 18, reduce 28) on '(' +45: shift/reduce conflict (shift 19, reduce 8) on ID +state 45 + decl_specs : decl_specs . $$2 decl_spec (14) + formal_arg : decl_specs . declarator (40) + $$2 : . (8) + declarator : . (28) + + '*' shift 17 + '(' [trial] shift 18 + ID [trial] shift 19 + '(' [trial] reduce 28 + '[' reduce 28 + ID [trial] reduce 8 + EXTERN reduce 8 + REGISTER reduce 8 + STATIC reduce 8 + CONST reduce 8 + VOLATILE reduce 8 + CLCL reduce 8 + ',' reduce 28 + ')' reduce 28 declarator goto 56 - - -state 45 - nonempty_formal_arg_list : formal_arg . (40) - - . reduce 40 + $$2 goto 22 state 46 - decl_specs : decl_specs . $$2 decl_spec (15) - formal_arg : decl_specs . $$2 $$3 declarator (41) - $$2 : . (8) + declarator : declarator '(' $$4 formal_arg_list . ')' cv_quals (35) - . reduce 8 - - $$2 goto 57 - - -state 47 - declarator : declarator '(' $$5 formal_arg_list . ')' cv_quals (36) - - ')' shift 58 + ')' shift 57 . error +state 47 + formal_arg_list : nonempty_formal_arg_list . (37) + nonempty_formal_arg_list : nonempty_formal_arg_list . ',' $$6 formal_arg (38) + + ',' shift 58 + ')' reduce 37 + + state 48 - formal_arg_list : nonempty_formal_arg_list . (38) - nonempty_formal_arg_list : nonempty_formal_arg_list . ',' $$7 formal_arg (39) - - ',' shift 59 - ')' reduce 38 - - -state 49 - expr : '*' . $$2 expr (47) + expr : '*' . $$2 expr (46) $$2 : . (8) . reduce 8 - $$2 goto 60 + $$2 goto 59 + + +state 49 + expr : ID . (47) + + . reduce 47 state 50 - expr : ID . (48) + expr : CONSTANT . (48) . reduce 48 state 51 - expr : CONSTANT . (49) + declarator : declarator '[' $$4 expr . ']' (34) + expr : expr . '+' $$6 expr (41) + expr : expr . '-' $$6 expr (42) + expr : expr . '*' $$6 expr (43) + expr : expr . '%' $$6 expr (44) + expr : expr . '/' $$6 expr (45) - . reduce 49 + '+' shift 60 + '-' shift 61 + '*' shift 62 + '/' shift 63 + '%' shift 64 + ']' shift 65 + . error state 52 - declarator : declarator '[' $$5 expr . ']' (35) - expr : expr . '+' $$7 expr (42) - expr : expr . '-' $$7 expr (43) - expr : expr . '*' $$7 expr (44) - expr : expr . '%' $$7 expr (45) - expr : expr . '/' $$7 expr (46) + block_statement : '{' $$2 . statement_list '}' (59) + statement_list : . (57) - '+' shift 61 - '-' shift 62 - '*' shift 63 - '/' shift 64 - '%' shift 65 - ']' shift 66 - . error + . reduce 57 + + statement_list goto 66 state 53 - block_statement : '{' $$2 . statement_list '}' (61) - statement_list : . (59) + declarator : '*' cv_quals $$4 $$5 declarator . (33) + declarator : declarator . '[' $$4 expr ']' (34) + declarator : declarator . '(' $$4 formal_arg_list ')' cv_quals (35) - . reduce 59 - - statement_list goto 67 + '(' shift 28 + '[' shift 29 + ';' reduce 33 + ',' reduce 33 + ')' reduce 33 + '{' reduce 33 state 54 - declarator : '*' cv_quals $$5 $$6 declarator . (34) - declarator : declarator . '[' $$5 expr ']' (35) - declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36) + declarator : '(' $$6 $$7 declarator ')' . (32) - '(' shift 31 - '[' shift 32 - ';' reduce 34 - ',' reduce 34 - ')' reduce 34 - '{' reduce 34 + . reduce 32 state 55 - declarator : '(' $$7 $$8 declarator ')' . (33) + declarator_list : declarator_list ',' $$4 $$5 declarator . (26) + declarator : declarator . '[' $$4 expr ']' (34) + declarator : declarator . '(' $$4 formal_arg_list ')' cv_quals (35) - . reduce 33 + '(' shift 28 + '[' shift 29 + ';' reduce 26 + ',' reduce 26 state 56 - declarator_list : declarator_list ',' $$5 $$6 declarator . (27) - declarator : declarator . '[' $$5 expr ']' (35) - declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36) + declarator : declarator . '[' $$4 expr ']' (34) + declarator : declarator . '(' $$4 formal_arg_list ')' cv_quals (35) + formal_arg : decl_specs declarator . (40) - '(' shift 31 - '[' shift 32 - ';' reduce 27 - ',' reduce 27 + '(' shift 28 + '[' shift 29 + ',' reduce 40 + ')' reduce 40 -57: reduce/reduce conflict (reduce 1, reduce 10) on ID state 57 - decl_specs : decl_specs $$2 . decl_spec (15) - formal_arg : decl_specs $$2 . $$3 declarator (41) - opt_scope : . (1) - $$3 : . (10) + declarator : declarator '(' $$4 formal_arg_list ')' . cv_quals (35) + cv_quals : . (15) - EXTERN shift 5 - REGISTER shift 6 - STATIC shift 7 - CONST shift 8 - VOLATILE shift 9 - CLCL shift 10 - '*' reduce 10 - '(' reduce 10 - '[' reduce 10 - ID [trial] reduce 1 - ID [trial] reduce 10 - ',' reduce 10 - ')' reduce 10 + . reduce 15 - decl_spec goto 19 - typename goto 14 - cv_qual goto 15 - opt_scope goto 16 - $$3 goto 68 + cv_quals goto 67 state 58 - declarator : declarator '(' $$5 formal_arg_list ')' . cv_quals (36) - cv_quals : . (16) + nonempty_formal_arg_list : nonempty_formal_arg_list ',' . $$6 formal_arg (38) + $$6 : . (30) - . reduce 16 + . reduce 30 - cv_quals goto 69 + $$6 goto 68 state 59 - nonempty_formal_arg_list : nonempty_formal_arg_list ',' . $$7 formal_arg (39) - $$7 : . (31) + expr : '*' $$2 . expr (46) - . reduce 31 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 + . error - $$7 goto 70 + expr goto 69 state 60 - expr : '*' $$2 . expr (47) + expr : expr '+' . $$6 expr (41) + $$6 : . (30) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 - . error + . reduce 30 - expr goto 71 + $$6 goto 70 state 61 - expr : expr '+' . $$7 expr (42) - $$7 : . (31) + expr : expr '-' . $$6 expr (42) + $$6 : . (30) - . reduce 31 + . reduce 30 - $$7 goto 72 + $$6 goto 71 state 62 - expr : expr '-' . $$7 expr (43) - $$7 : . (31) + expr : expr '*' . $$6 expr (43) + $$6 : . (30) - . reduce 31 + . reduce 30 - $$7 goto 73 + $$6 goto 72 state 63 - expr : expr '*' . $$7 expr (44) - $$7 : . (31) + expr : expr '/' . $$6 expr (45) + $$6 : . (30) - . reduce 31 + . reduce 30 - $$7 goto 74 + $$6 goto 73 state 64 - expr : expr '/' . $$7 expr (46) - $$7 : . (31) + expr : expr '%' . $$6 expr (44) + $$6 : . (30) - . reduce 31 + . reduce 30 - $$7 goto 75 + $$6 goto 74 state 65 - expr : expr '%' . $$7 expr (45) - $$7 : . (31) + declarator : declarator '[' $$4 expr ']' . (34) - . reduce 31 - - $$7 goto 76 + . reduce 34 state 66 - declarator : declarator '[' $$5 expr ']' . (35) - - . reduce 35 - - -state 67 - statement_list : statement_list . $$2 statement (60) - block_statement : '{' $$2 statement_list . '}' (61) + statement_list : statement_list . $$2 statement (58) + block_statement : '{' $$2 statement_list . '}' (59) $$2 : . (8) - '}' shift 77 + '}' shift 75 '*' reduce 8 ID reduce 8 CONSTANT reduce 8 @@ -809,43 +792,27 @@ state 67 CLCL reduce 8 '{' reduce 8 - $$2 goto 78 + $$2 goto 76 -68: shift/reduce conflict (shift 23, reduce 29) on '(' -state 68 - formal_arg : decl_specs $$2 $$3 . declarator (41) - declarator : . (29) - - '*' shift 22 - '(' [trial] shift 23 - ID shift 24 - '(' [trial] reduce 29 - '[' reduce 29 - ',' reduce 29 - ')' reduce 29 - - declarator goto 79 - - -state 69 - cv_quals : cv_quals . cv_qual (17) - declarator : declarator '(' $$5 formal_arg_list ')' cv_quals . (36) +state 67 + cv_quals : cv_quals . cv_qual (16) + declarator : declarator '(' $$4 formal_arg_list ')' cv_quals . (35) CONST shift 8 VOLATILE shift 9 - '(' reduce 36 - '[' reduce 36 - ';' reduce 36 - ',' reduce 36 - ')' reduce 36 - '{' reduce 36 + '(' reduce 35 + '[' reduce 35 + ';' reduce 35 + ',' reduce 35 + ')' reduce 35 + '{' reduce 35 - cv_qual goto 34 + cv_qual goto 33 -state 70 - nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 . formal_arg (39) +state 68 + nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$6 . formal_arg (38) opt_scope : . (1) EXTERN shift 5 @@ -856,145 +823,151 @@ state 70 CLCL shift 10 ID reduce 1 - formal_arg goto 80 - decl_specs goto 46 + formal_arg goto 77 + decl_specs goto 45 decl_spec goto 13 typename goto 14 cv_qual goto 15 opt_scope goto 16 -state 71 - expr : expr . '+' $$7 expr (42) - expr : expr . '-' $$7 expr (43) - expr : expr . '*' $$7 expr (44) - expr : expr . '%' $$7 expr (45) - expr : expr . '/' $$7 expr (46) - expr : '*' $$2 expr . (47) +state 69 + expr : expr . '+' $$6 expr (41) + expr : expr . '-' $$6 expr (42) + expr : expr . '*' $$6 expr (43) + expr : expr . '%' $$6 expr (44) + expr : expr . '/' $$6 expr (45) + expr : '*' $$2 expr . (46) - . reduce 47 + . reduce 46 + + +state 70 + expr : expr '+' $$6 . expr (41) + + '*' shift 48 + ID shift 49 + CONSTANT shift 50 + . error + + expr goto 78 + + +state 71 + expr : expr '-' $$6 . expr (42) + + '*' shift 48 + ID shift 49 + CONSTANT shift 50 + . error + + expr goto 79 state 72 - expr : expr '+' $$7 . expr (42) + expr : expr '*' $$6 . expr (43) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 + . error + + expr goto 80 + + +state 73 + expr : expr '/' $$6 . expr (45) + + '*' shift 48 + ID shift 49 + CONSTANT shift 50 . error expr goto 81 -state 73 - expr : expr '-' $$7 . expr (43) +state 74 + expr : expr '%' $$6 . expr (44) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 . error expr goto 82 -state 74 - expr : expr '*' $$7 . expr (44) - - '*' shift 49 - ID shift 50 - CONSTANT shift 51 - . error - - expr goto 83 - - state 75 - expr : expr '/' $$7 . expr (46) + block_statement : '{' $$2 statement_list '}' . (59) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 - . error - - expr goto 84 + . reduce 59 +76: shift/reduce conflict (shift 49, reduce 1) on ID state 76 - expr : expr '%' $$7 . expr (45) - - '*' shift 49 - ID shift 50 - CONSTANT shift 51 - . error - - expr goto 85 - - -state 77 - block_statement : '{' $$2 statement_list '}' . (61) - - . reduce 61 - - -78: reduce/reduce conflict (reduce 1, reduce 51) on ID -state 78 - statement_list : statement_list $$2 . statement (60) + statement_list : statement_list $$2 . statement (58) opt_scope : . (1) - $$9 : . (51) - $$12 : . (57) + $$10 : . (55) + '*' shift 48 + ID [trial] shift 49 + CONSTANT shift 50 EXTERN shift 5 REGISTER shift 6 STATIC shift 7 CONST shift 8 VOLATILE shift 9 - IF shift 86 + IF shift 83 CLCL shift 10 - '*' reduce 51 ID [trial] reduce 1 - ID [trial] reduce 51 - CONSTANT reduce 51 - '{' reduce 57 + '{' reduce 55 - decl goto 87 - statement goto 88 + expr goto 84 + decl goto 85 + statement goto 86 decl_specs goto 12 decl_spec goto 13 typename goto 14 cv_qual goto 15 opt_scope goto 16 - $$9 goto 89 - $$12 goto 90 + $$10 goto 87 + + +state 77 + nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$6 formal_arg . (38) + + . reduce 38 + + +state 78 + expr : expr . '+' $$6 expr (41) + expr : expr '+' $$6 expr . (41) + expr : expr . '-' $$6 expr (42) + expr : expr . '*' $$6 expr (43) + expr : expr . '%' $$6 expr (44) + expr : expr . '/' $$6 expr (45) + + '*' shift 62 + '/' shift 63 + '%' shift 64 + '+' reduce 41 + '-' reduce 41 + ';' reduce 41 + ')' reduce 41 + ']' reduce 41 state 79 - declarator : declarator . '[' $$5 expr ']' (35) - declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36) - formal_arg : decl_specs $$2 $$3 declarator . (41) + expr : expr . '+' $$6 expr (41) + expr : expr . '-' $$6 expr (42) + expr : expr '-' $$6 expr . (42) + expr : expr . '*' $$6 expr (43) + expr : expr . '%' $$6 expr (44) + expr : expr . '/' $$6 expr (45) - '(' shift 31 - '[' shift 32 - ',' reduce 41 - ')' reduce 41 - - -state 80 - nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg . (39) - - . reduce 39 - - -state 81 - expr : expr . '+' $$7 expr (42) - expr : expr '+' $$7 expr . (42) - expr : expr . '-' $$7 expr (43) - expr : expr . '*' $$7 expr (44) - expr : expr . '%' $$7 expr (45) - expr : expr . '/' $$7 expr (46) - - '*' shift 63 - '/' shift 64 - '%' shift 65 + '*' shift 62 + '/' shift 63 + '%' shift 64 '+' reduce 42 '-' reduce 42 ';' reduce 42 @@ -1002,299 +975,266 @@ state 81 ']' reduce 42 -state 82 - expr : expr . '+' $$7 expr (42) - expr : expr . '-' $$7 expr (43) - expr : expr '-' $$7 expr . (43) - expr : expr . '*' $$7 expr (44) - expr : expr . '%' $$7 expr (45) - expr : expr . '/' $$7 expr (46) +state 80 + expr : expr . '+' $$6 expr (41) + expr : expr . '-' $$6 expr (42) + expr : expr . '*' $$6 expr (43) + expr : expr '*' $$6 expr . (43) + expr : expr . '%' $$6 expr (44) + expr : expr . '/' $$6 expr (45) - '*' shift 63 - '/' shift 64 - '%' shift 65 - '+' reduce 43 - '-' reduce 43 - ';' reduce 43 - ')' reduce 43 - ']' reduce 43 + . reduce 43 -state 83 - expr : expr . '+' $$7 expr (42) - expr : expr . '-' $$7 expr (43) - expr : expr . '*' $$7 expr (44) - expr : expr '*' $$7 expr . (44) - expr : expr . '%' $$7 expr (45) - expr : expr . '/' $$7 expr (46) - - . reduce 44 - - -state 84 - expr : expr . '+' $$7 expr (42) - expr : expr . '-' $$7 expr (43) - expr : expr . '*' $$7 expr (44) - expr : expr . '%' $$7 expr (45) - expr : expr . '/' $$7 expr (46) - expr : expr '/' $$7 expr . (46) - - . reduce 46 - - -state 85 - expr : expr . '+' $$7 expr (42) - expr : expr . '-' $$7 expr (43) - expr : expr . '*' $$7 expr (44) - expr : expr . '%' $$7 expr (45) - expr : expr '%' $$7 expr . (45) - expr : expr . '/' $$7 expr (46) +state 81 + expr : expr . '+' $$6 expr (41) + expr : expr . '-' $$6 expr (42) + expr : expr . '*' $$6 expr (43) + expr : expr . '%' $$6 expr (44) + expr : expr . '/' $$6 expr (45) + expr : expr '/' $$6 expr . (45) . reduce 45 -state 86 - statement : IF . '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement (55) - statement : IF . '(' $$7 expr ')' THEN $$10 statement (56) +state 82 + expr : expr . '+' $$6 expr (41) + expr : expr . '-' $$6 expr (42) + expr : expr . '*' $$6 expr (43) + expr : expr . '%' $$6 expr (44) + expr : expr '%' $$6 expr . (44) + expr : expr . '/' $$6 expr (45) - '(' shift 91 + . reduce 44 + + +state 83 + statement : IF . '(' $$6 expr ')' THEN $$8 statement ELSE $$9 statement (53) + statement : IF . '(' $$6 expr ')' THEN $$8 statement (54) + + '(' shift 88 . error +state 84 + expr : expr . '+' $$6 expr (41) + expr : expr . '-' $$6 expr (42) + expr : expr . '*' $$6 expr (43) + expr : expr . '%' $$6 expr (44) + expr : expr . '/' $$6 expr (45) + statement : expr . ';' (50) + + '+' shift 60 + '-' shift 61 + '*' shift 62 + '/' shift 63 + '%' shift 64 + ';' shift 89 + . error + + +state 85 + statement : decl . (49) + + . reduce 49 + + +state 86 + statement_list : statement_list $$2 statement . (58) + + . reduce 58 + + state 87 - statement : decl . (50) + statement : $$10 . block_statement (56) + + '{' shift 39 + . error + + block_statement goto 90 + + +state 88 + statement : IF '(' . $$6 expr ')' THEN $$8 statement ELSE $$9 statement (53) + statement : IF '(' . $$6 expr ')' THEN $$8 statement (54) + $$6 : . (30) + + . reduce 30 + + $$6 goto 91 + + +state 89 + statement : expr ';' . (50) . reduce 50 -state 88 - statement_list : statement_list $$2 statement . (60) +state 90 + statement : $$10 block_statement . (56) - . reduce 60 + . reduce 56 -state 89 - statement : $$9 . expr ';' (52) +state 91 + statement : IF '(' $$6 . expr ')' THEN $$8 statement ELSE $$9 statement (53) + statement : IF '(' $$6 . expr ')' THEN $$8 statement (54) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 . error expr goto 92 -state 90 - statement : $$12 . block_statement (58) - - '{' shift 40 - . error - - block_statement goto 93 - - -state 91 - statement : IF '(' . $$7 expr ')' THEN $$10 statement ELSE $$11 statement (55) - statement : IF '(' . $$7 expr ')' THEN $$10 statement (56) - $$7 : . (31) - - . reduce 31 - - $$7 goto 94 - - state 92 - expr : expr . '+' $$7 expr (42) - expr : expr . '-' $$7 expr (43) - expr : expr . '*' $$7 expr (44) - expr : expr . '%' $$7 expr (45) - expr : expr . '/' $$7 expr (46) - statement : $$9 expr . ';' (52) + expr : expr . '+' $$6 expr (41) + expr : expr . '-' $$6 expr (42) + expr : expr . '*' $$6 expr (43) + expr : expr . '%' $$6 expr (44) + expr : expr . '/' $$6 expr (45) + statement : IF '(' $$6 expr . ')' THEN $$8 statement ELSE $$9 statement (53) + statement : IF '(' $$6 expr . ')' THEN $$8 statement (54) - '+' shift 61 - '-' shift 62 - '*' shift 63 - '/' shift 64 - '%' shift 65 - ';' shift 95 + '+' shift 60 + '-' shift 61 + '*' shift 62 + '/' shift 63 + '%' shift 64 + ')' shift 93 . error state 93 - statement : $$12 block_statement . (58) + statement : IF '(' $$6 expr ')' . THEN $$8 statement ELSE $$9 statement (53) + statement : IF '(' $$6 expr ')' . THEN $$8 statement (54) - . reduce 58 + THEN shift 94 + . error state 94 - statement : IF '(' $$7 . expr ')' THEN $$10 statement ELSE $$11 statement (55) - statement : IF '(' $$7 . expr ')' THEN $$10 statement (56) + statement : IF '(' $$6 expr ')' THEN . $$8 statement ELSE $$9 statement (53) + statement : IF '(' $$6 expr ')' THEN . $$8 statement (54) + $$8 : . (51) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 - . error + . reduce 51 - expr goto 96 + $$8 goto 95 +95: shift/reduce conflict (shift 49, reduce 1) on ID state 95 - statement : $$9 expr ';' . (52) + statement : IF '(' $$6 expr ')' THEN $$8 . statement ELSE $$9 statement (53) + statement : IF '(' $$6 expr ')' THEN $$8 . statement (54) + opt_scope : . (1) + $$10 : . (55) - . reduce 52 + '*' shift 48 + ID [trial] shift 49 + CONSTANT shift 50 + EXTERN shift 5 + REGISTER shift 6 + STATIC shift 7 + CONST shift 8 + VOLATILE shift 9 + IF shift 83 + CLCL shift 10 + ID [trial] reduce 1 + '{' reduce 55 + + expr goto 84 + decl goto 85 + statement goto 96 + decl_specs goto 12 + decl_spec goto 13 + typename goto 14 + cv_qual goto 15 + opt_scope goto 16 + $$10 goto 87 +96: shift/reduce conflict (shift 97, reduce 54) on ELSE state 96 - expr : expr . '+' $$7 expr (42) - expr : expr . '-' $$7 expr (43) - expr : expr . '*' $$7 expr (44) - expr : expr . '%' $$7 expr (45) - expr : expr . '/' $$7 expr (46) - statement : IF '(' $$7 expr . ')' THEN $$10 statement ELSE $$11 statement (55) - statement : IF '(' $$7 expr . ')' THEN $$10 statement (56) + statement : IF '(' $$6 expr ')' THEN $$8 statement . ELSE $$9 statement (53) + statement : IF '(' $$6 expr ')' THEN $$8 statement . (54) - '+' shift 61 - '-' shift 62 - '*' shift 63 - '/' shift 64 - '%' shift 65 - ')' shift 97 - . error + ELSE [trial] shift 97 + '*' reduce 54 + ID reduce 54 + CONSTANT reduce 54 + EXTERN reduce 54 + REGISTER reduce 54 + STATIC reduce 54 + CONST reduce 54 + VOLATILE reduce 54 + IF reduce 54 + ELSE [trial] reduce 54 + CLCL reduce 54 + '{' reduce 54 + '}' reduce 54 state 97 - statement : IF '(' $$7 expr ')' . THEN $$10 statement ELSE $$11 statement (55) - statement : IF '(' $$7 expr ')' . THEN $$10 statement (56) + statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE . $$9 statement (53) + $$9 : . (52) - THEN shift 98 - . error + . reduce 52 + + $$9 goto 98 +98: shift/reduce conflict (shift 49, reduce 1) on ID state 98 - statement : IF '(' $$7 expr ')' THEN . $$10 statement ELSE $$11 statement (55) - statement : IF '(' $$7 expr ')' THEN . $$10 statement (56) - $$10 : . (53) + statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE $$9 . statement (53) + opt_scope : . (1) + $$10 : . (55) + + '*' shift 48 + ID [trial] shift 49 + CONSTANT shift 50 + EXTERN shift 5 + REGISTER shift 6 + STATIC shift 7 + CONST shift 8 + VOLATILE shift 9 + IF shift 83 + CLCL shift 10 + ID [trial] reduce 1 + '{' reduce 55 + + expr goto 84 + decl goto 85 + statement goto 99 + decl_specs goto 12 + decl_spec goto 13 + typename goto 14 + cv_qual goto 15 + opt_scope goto 16 + $$10 goto 87 + + +state 99 + statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE $$9 statement . (53) . reduce 53 - $$10 goto 99 + +State 12 contains 2 shift/reduce conflicts. +State 23 contains 1 shift/reduce conflict. +State 35 contains 1 shift/reduce conflict. +State 41 contains 1 shift/reduce conflict. +State 43 contains 1 shift/reduce conflict. +State 45 contains 2 shift/reduce conflicts. +State 76 contains 1 shift/reduce conflict. +State 95 contains 1 shift/reduce conflict. +State 96 contains 1 shift/reduce conflict. +State 98 contains 1 shift/reduce conflict. -99: reduce/reduce conflict (reduce 1, reduce 51) on ID -state 99 - statement : IF '(' $$7 expr ')' THEN $$10 . statement ELSE $$11 statement (55) - statement : IF '(' $$7 expr ')' THEN $$10 . statement (56) - opt_scope : . (1) - $$9 : . (51) - $$12 : . (57) - - EXTERN shift 5 - REGISTER shift 6 - STATIC shift 7 - CONST shift 8 - VOLATILE shift 9 - IF shift 86 - CLCL shift 10 - '*' reduce 51 - ID [trial] reduce 1 - ID [trial] reduce 51 - CONSTANT reduce 51 - '{' reduce 57 - - decl goto 87 - statement goto 100 - decl_specs goto 12 - decl_spec goto 13 - typename goto 14 - cv_qual goto 15 - opt_scope goto 16 - $$9 goto 89 - $$12 goto 90 - - -100: shift/reduce conflict (shift 101, reduce 56) on ELSE -state 100 - statement : IF '(' $$7 expr ')' THEN $$10 statement . ELSE $$11 statement (55) - statement : IF '(' $$7 expr ')' THEN $$10 statement . (56) - - ELSE [trial] shift 101 - '*' reduce 56 - ID reduce 56 - CONSTANT reduce 56 - EXTERN reduce 56 - REGISTER reduce 56 - STATIC reduce 56 - CONST reduce 56 - VOLATILE reduce 56 - IF reduce 56 - ELSE [trial] reduce 56 - CLCL reduce 56 - '{' reduce 56 - '}' reduce 56 - - -state 101 - statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE . $$11 statement (55) - $$11 : . (54) - - . reduce 54 - - $$11 goto 102 - - -102: reduce/reduce conflict (reduce 1, reduce 51) on ID -state 102 - statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 . statement (55) - opt_scope : . (1) - $$9 : . (51) - $$12 : . (57) - - EXTERN shift 5 - REGISTER shift 6 - STATIC shift 7 - CONST shift 8 - VOLATILE shift 9 - IF shift 86 - CLCL shift 10 - '*' reduce 51 - ID [trial] reduce 1 - ID [trial] reduce 51 - CONSTANT reduce 51 - '{' reduce 57 - - decl goto 87 - statement goto 103 - decl_specs goto 12 - decl_spec goto 13 - typename goto 14 - cv_qual goto 15 - opt_scope goto 16 - $$9 goto 89 - $$12 goto 90 - - -state 103 - statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement . (55) - - . reduce 55 - - -State 17 contains 1 reduce/reduce conflict. -State 18 contains 1 shift/reduce conflict. -State 20 contains 1 shift/reduce conflict. -State 36 contains 1 shift/reduce conflict. -State 42 contains 1 shift/reduce conflict. -State 44 contains 1 shift/reduce conflict. -State 57 contains 1 reduce/reduce conflict. -State 68 contains 1 shift/reduce conflict. -State 78 contains 1 reduce/reduce conflict. -State 99 contains 1 reduce/reduce conflict. -State 100 contains 1 shift/reduce conflict. -State 102 contains 1 reduce/reduce conflict. - - -29 terminals, 31 nonterminals -62 grammar rules, 104 states +29 terminals, 29 nonterminals +60 grammar rules, 100 states grammar parser grammar symbol# value# symbol @@ -1356,5 +1296,3 @@ symbol# value# symbol 55 296 $$8 56 297 $$9 57 298 $$10 - 58 299 $$11 - 59 300 $$12 diff --git a/test/btyacc/btyacc_demo.tab.c b/test/btyacc/btyacc_demo.tab.c index cd7995bc7f17..0954a4039fe0 100644 --- a/test/btyacc/btyacc_demo.tab.c +++ b/test/btyacc/btyacc_demo.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 @@ -145,13 +145,13 @@ typedef struct Decl { #include "btyacc_demo.tab.h" #include #include -#line 36 "btyacc_demo.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 36 "btyacc_demo.y" typedef union { Scope *scope; Expr *expr; @@ -231,163 +231,160 @@ extern int YYPARSE_DECL(); #define YYERRCODE 256 typedef short YYINT; static const YYINT demo_lhs[] = { -1, - 15, 15, 15, 12, 18, 0, 4, 19, 4, 20, - 2, 21, 2, 10, 10, 13, 13, 11, 11, 11, - 11, 11, 14, 14, 22, 23, 3, 3, 8, 8, - 24, 25, 8, 8, 8, 8, 16, 16, 17, 17, - 9, 1, 1, 1, 1, 1, 1, 1, 1, 5, - 26, 5, 27, 28, 5, 5, 29, 5, 6, 6, - 7, + 15, 15, 15, 12, 18, 0, 4, 19, 4, 2, + 20, 2, 10, 10, 13, 13, 11, 11, 11, 11, + 11, 14, 14, 21, 22, 3, 3, 8, 8, 23, + 24, 8, 8, 8, 8, 16, 16, 17, 17, 9, + 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, + 25, 26, 5, 5, 27, 5, 6, 6, 7, }; static const YYINT demo_len[] = { 2, - 0, 1, 3, 2, 0, 2, 0, 0, 3, 0, - 5, 0, 6, 1, 3, 0, 2, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 5, 1, 0, 1, - 0, 0, 5, 5, 5, 6, 0, 1, 4, 1, - 4, 4, 4, 4, 4, 4, 3, 1, 1, 1, - 0, 3, 0, 0, 11, 8, 0, 2, 0, 3, - 4, + 0, 1, 3, 2, 0, 2, 0, 0, 3, 3, + 0, 4, 1, 3, 0, 2, 1, 1, 1, 1, + 1, 1, 1, 0, 0, 5, 1, 0, 1, 0, + 0, 5, 5, 5, 6, 0, 1, 4, 1, 2, + 4, 4, 4, 4, 4, 3, 1, 1, 1, 2, + 0, 0, 11, 8, 0, 2, 0, 3, 4, }; static const YYINT demo_defred[] = { 5, - 0, 7, 0, 0, 20, 21, 22, 23, 24, 2, - 9, 8, 14, 19, 18, 0, 0, 0, 15, 0, - 3, 16, 31, 30, 0, 0, 0, 32, 11, 25, - 25, 25, 0, 17, 26, 0, 26, 0, 0, 8, - 13, 0, 0, 0, 40, 8, 0, 0, 8, 48, - 49, 0, 59, 0, 33, 0, 0, 16, 31, 0, - 31, 31, 31, 31, 31, 35, 0, 0, 0, 0, - 47, 0, 0, 0, 0, 0, 61, 0, 0, 39, - 0, 0, 44, 46, 45, 0, 50, 60, 0, 0, - 31, 0, 58, 0, 52, 0, 0, 53, 0, 0, - 54, 0, 55, + 0, 7, 0, 0, 19, 20, 21, 22, 23, 2, + 9, 0, 13, 18, 17, 0, 15, 30, 29, 0, + 0, 0, 0, 0, 31, 10, 24, 24, 24, 0, + 14, 3, 16, 25, 0, 25, 0, 0, 8, 12, + 0, 0, 0, 39, 0, 0, 0, 8, 47, 48, + 0, 57, 0, 32, 0, 0, 15, 30, 0, 30, + 30, 30, 30, 30, 34, 0, 0, 0, 46, 0, + 0, 0, 0, 0, 59, 0, 38, 0, 0, 43, + 45, 44, 0, 0, 49, 58, 0, 30, 50, 56, + 0, 0, 0, 51, 0, 0, 52, 0, 53, }; static const YYINT demo_stos[] = { 0, 271, 289, 275, 290, 261, 262, 263, 264, 265, 269, - 273, 281, 282, 283, 285, 286, 290, 259, 282, 291, - 269, 42, 40, 259, 274, 279, 284, 295, 59, 44, - 40, 91, 292, 285, 293, 296, 293, 293, 293, 123, - 278, 294, 279, 294, 280, 281, 287, 288, 42, 259, - 260, 272, 290, 279, 41, 279, 290, 41, 44, 290, - 43, 45, 42, 47, 37, 93, 277, 291, 284, 295, - 272, 295, 295, 295, 295, 295, 125, 290, 279, 280, - 272, 272, 272, 272, 272, 266, 273, 276, 297, 300, - 40, 272, 278, 295, 59, 272, 41, 267, 298, 276, - 268, 299, 276, + 273, 281, 282, 283, 285, 286, 42, 40, 259, 274, + 279, 290, 259, 284, 294, 59, 44, 40, 91, 291, + 282, 269, 285, 292, 295, 292, 292, 292, 123, 278, + 293, 279, 293, 280, 281, 287, 288, 42, 259, 260, + 272, 290, 279, 41, 279, 279, 41, 44, 290, 43, + 45, 42, 47, 37, 93, 277, 284, 294, 272, 294, + 294, 294, 294, 294, 125, 290, 280, 272, 272, 272, + 272, 272, 266, 272, 273, 276, 298, 40, 59, 278, + 294, 272, 41, 267, 296, 276, 268, 297, 276, }; static const YYINT demo_dgoto[] = { 1, - 52, 87, 25, 3, 88, 67, 41, 26, 45, 12, - 13, 14, 27, 15, 16, 47, 48, 2, 4, 20, - 33, 35, 42, 28, 36, 89, 99, 102, 90, + 84, 85, 20, 3, 86, 66, 40, 21, 44, 12, + 13, 14, 24, 15, 16, 46, 47, 2, 22, 30, + 34, 41, 25, 35, 95, 98, 87, }; static const YYINT demo_sindex[] = { 0, - 0, 0, 0, -124, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -256, -124, 0, 0, -33, - 0, 0, 0, 0, 34, -4, -205, 0, 0, 0, - 0, 0, -110, 0, 0, -33, 0, -124, -15, 0, - 0, -33, -36, -33, 0, 0, 4, 7, 0, 0, - 0, 5, 0, -4, 0, -4, -124, 0, 0, -15, - 0, 0, 0, 0, 0, 0, -46, -33, -205, -124, - 0, -15, -15, -15, -15, -15, 0, -91, -4, 0, - 122, 122, 0, 0, 0, 40, 0, 0, -15, -110, - 0, 106, 0, -15, 0, 113, -183, 0, -91, 0, - 0, -91, 0, + 0, 0, 0, -103, 0, 0, 0, 0, 0, 0, + 0, -31, 0, 0, 0, -238, 0, 0, 0, 4, + -36, -103, 0, -133, 0, 0, 0, 0, 0, -94, + 0, 0, 0, 0, -40, 0, -103, -33, 0, 0, + -40, -25, -40, 0, -31, 8, 15, 0, 0, 0, + -2, 0, -36, 0, -36, -36, 0, 0, -33, 0, + 0, 0, 0, 0, 0, -92, -133, -103, 0, -33, + -33, -33, -33, -33, 0, -8, 0, 23, 23, 0, + 0, 0, 11, 75, 0, 0, -94, 0, 0, 0, + -33, 96, -194, 0, -8, 0, 0, -8, 0, }; static const YYINT demo_rindex[] = { 0, - 0, 0, 1, -157, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -28, -22, 0, -29, - 0, 0, 0, 0, 0, -27, -34, 0, 0, 0, - 0, 0, 0, 0, 0, 8, 0, -12, 0, 0, - 0, -20, 0, 32, 0, 0, 0, 69, 0, 0, - 0, 0, 0, -18, 0, 56, 33, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -31, -1, -6, -157, - 0, 0, 0, 0, 0, 0, 0, -14, 63, 0, - 13, 23, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -14, -42, - 0, -14, 0, + 0, 0, 1, -181, 0, 0, 0, 0, 0, 0, + 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, + -39, -181, 12, -34, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -5, 0, -11, 0, 0, 0, + -17, 0, 28, 0, -41, 0, 47, 0, 0, 0, + 0, 0, -13, 0, 18, 70, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -19, -27, -181, 0, 0, + 0, 0, 0, 0, 0, -29, 0, 56, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -29, -30, 0, -29, 0, }; #if YYBTYACC static const YYINT demo_cindex[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -145, -150, 0, 81, + 0, -22, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -179, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, + 58, 0, 62, 0, -21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, - 0, 91, 0, 112, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -113, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -96, -92, - 0, -82, 0, + 0, 0, 0, 0, 0, -146, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -143, -147, 0, -134, 0, }; #endif static const YYINT demo_gindex[] = { 0, - 53, 175, 0, 0, 9, 0, 90, 76, 111, 27, - 29, 0, 124, -25, 0, 0, 0, 0, 21, 126, - 0, 136, 147, 71, 0, 0, 0, 0, 0, + 9, 143, 0, 0, 50, 0, 63, 101, 83, 7, + 130, 0, 98, 2, 0, 0, 0, 0, 19, 0, + 10, 117, 66, 0, 0, 0, 0, }; -#define YYTABLESIZE 270 -static const YYINT demo_table[] = { 56, - 6, 34, 18, 31, 55, 25, 25, 25, 22, 25, - 8, 10, 40, 10, 29, 10, 28, 4, 4, 4, - 29, 4, 34, 29, 25, 34, 49, 51, 37, 29, - 10, 28, 17, 36, 36, 31, 4, 36, 29, 29, - 34, 65, 29, 34, 58, 19, 63, 61, 29, 62, - 59, 64, 36, 42, 32, 42, 25, 42, 8, 9, - 53, 29, 10, 43, 46, 43, 57, 43, 4, 60, - 29, 42, 10, 10, 10, 29, 10, 30, 77, 91, - 56, 43, 56, 98, 36, 19, 32, 78, 25, 29, - 29, 8, 29, 29, 10, 12, 46, 66, 29, 27, - 4, 1, 29, 41, 34, 42, 41, 100, 57, 38, - 103, 43, 71, 0, 27, 43, 36, 54, 4, 56, - 7, 7, 29, 10, 81, 82, 83, 84, 85, 70, - 7, 72, 73, 74, 75, 76, 5, 6, 7, 8, - 9, 92, 65, 79, 10, 0, 96, 63, 61, 65, - 62, 7, 64, 97, 63, 61, 7, 62, 65, 64, - 9, 94, 9, 63, 95, 37, 38, 39, 64, 5, - 6, 7, 8, 9, 86, 13, 9, 10, 11, 93, - 80, 69, 68, 44, 0, 0, 0, 0, 0, 0, +#define YYTABLESIZE 286 +static const YYINT demo_table[] = { 28, + 6, 17, 28, 28, 27, 24, 24, 24, 48, 24, + 17, 54, 35, 35, 28, 54, 35, 0, 0, 27, + 23, 4, 8, 28, 24, 33, 28, 33, 39, 36, + 33, 35, 75, 48, 64, 28, 36, 37, 38, 62, + 60, 28, 61, 45, 63, 33, 51, 27, 57, 28, + 88, 4, 4, 4, 29, 4, 24, 52, 58, 64, + 28, 26, 26, 35, 62, 29, 59, 69, 33, 63, + 4, 28, 94, 28, 45, 28, 26, 1, 78, 79, + 80, 81, 82, 11, 76, 28, 28, 37, 24, 6, + 65, 0, 54, 55, 54, 35, 41, 0, 41, 92, + 41, 0, 4, 8, 42, 28, 42, 28, 42, 33, + 40, 64, 9, 40, 41, 9, 62, 60, 28, 61, + 12, 63, 42, 68, 9, 70, 71, 72, 73, 74, + 8, 9, 64, 89, 4, 42, 93, 62, 60, 28, + 61, 53, 63, 55, 96, 56, 11, 99, 41, 90, + 77, 31, 43, 91, 67, 0, 42, 5, 6, 7, + 8, 9, 0, 0, 0, 10, 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, 56, 56, 56, 56, - 56, 56, 56, 56, 25, 24, 56, 8, 8, 8, - 8, 8, 8, 8, 8, 0, 4, 8, 4, 4, - 4, 4, 4, 50, 51, 51, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, - 0, 8, 8, 8, 8, 8, 0, 0, 0, 8, + 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, 19, 8, + 8, 8, 8, 8, 24, 49, 50, 8, 54, 54, + 54, 54, 54, 54, 54, 54, 3, 3, 54, 8, + 8, 8, 8, 8, 8, 8, 8, 1, 0, 8, + 0, 50, 5, 6, 7, 8, 9, 83, 0, 8, + 10, 8, 8, 8, 8, 8, 0, 0, 0, 8, + 4, 0, 4, 4, 4, 4, 4, 8, 8, 8, + 8, 8, 0, 0, 0, 8, }; -static const YYINT demo_check[] = { 42, - 0, 27, 259, 40, 41, 40, 41, 42, 42, 44, - 42, 40, 123, 42, 44, 44, 44, 40, 41, 42, - 41, 44, 41, 44, 59, 44, 42, 42, 41, 59, - 59, 59, 12, 40, 41, 40, 59, 44, 59, 41, - 59, 37, 44, 69, 41, 17, 42, 43, 41, 45, - 44, 47, 59, 41, 91, 43, 91, 45, 264, 265, - 40, 91, 91, 41, 38, 43, 46, 45, 91, 49, - 91, 59, 40, 41, 42, 44, 44, 44, 125, 40, - 123, 59, 125, 267, 91, 57, 91, 67, 123, 91, - 59, 123, 59, 123, 123, 123, 70, 93, 91, 44, - 123, 259, 123, 41, 123, 93, 44, 99, 123, 41, - 102, 36, 60, 259, 59, 93, 123, 42, 269, 44, - 40, 40, 91, 91, 72, 73, 74, 75, 76, 59, - 40, 61, 62, 63, 64, 65, 261, 262, 263, 264, - 265, 89, 37, 68, 269, 259, 94, 42, 43, 37, - 45, 40, 47, 41, 42, 43, 40, 45, 37, 47, - 259, 91, 259, 42, 59, 30, 31, 32, 47, 261, - 262, 263, 264, 265, 266, 268, 259, 269, 4, 90, - 70, 58, 57, 37, -1, -1, -1, -1, -1, -1, +static const YYINT demo_check[] = { 41, + 0, 42, 44, 40, 44, 40, 41, 42, 42, 44, + 42, 42, 40, 41, 40, 41, 44, 40, 40, 59, + 259, 3, 42, 41, 59, 24, 44, 41, 123, 41, + 44, 59, 125, 42, 37, 41, 27, 28, 29, 42, + 43, 59, 45, 37, 47, 59, 38, 44, 41, 91, + 40, 40, 41, 42, 91, 44, 91, 39, 44, 37, + 44, 44, 59, 91, 42, 91, 48, 59, 67, 47, + 59, 44, 267, 91, 68, 59, 59, 259, 70, 71, + 72, 73, 74, 123, 66, 91, 59, 41, 123, 269, + 93, 40, 123, 123, 125, 123, 41, 40, 43, 91, + 45, 40, 91, 123, 41, 123, 43, 91, 45, 123, + 41, 37, 259, 44, 59, 259, 42, 43, 91, 45, + 268, 47, 59, 58, 259, 60, 61, 62, 63, 64, + 264, 265, 37, 59, 123, 35, 41, 42, 43, 123, + 45, 41, 47, 43, 95, 45, 4, 98, 93, 87, + 68, 22, 36, 88, 57, -1, 93, 261, 262, 263, + 264, 265, -1, -1, -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 259, 260, 261, 262, - 263, 264, 265, 266, 259, 259, 269, 259, 260, 261, - 262, 263, 264, 265, 266, -1, 259, 269, 261, 262, - 263, 264, 265, 259, 260, 260, 259, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 259, - -1, 261, 262, 263, 264, 265, -1, -1, -1, 269, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 259, 261, + 262, 263, 264, 265, 259, 259, 260, 269, 259, 260, + 261, 262, 263, 264, 265, 266, 259, 259, 269, 259, + 260, 261, 262, 263, 264, 265, 266, 259, -1, 269, + -1, 260, 261, 262, 263, 264, 265, 266, -1, 259, + 269, 261, 262, 263, 264, 265, -1, -1, -1, 269, + 259, -1, 261, 262, 263, 264, 265, 261, 262, 263, + 264, 265, -1, -1, -1, 269, }; #if YYBTYACC -static const YYINT demo_ctable[] = { -1, - 1, 10, -1, 21, 4, -1, 23, 29, -1, 1, - 51, -1, 101, 56, -1, -1, -1, -1, -1, -1, +static const YYINT demo_ctable[] = { 18, + 28, -1, 19, 8, -1, 32, 4, -1, 49, 1, + -1, 97, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -412,7 +409,9 @@ static const YYINT demo_ctable[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, }; #endif #define YYFINAL 1 @@ -420,7 +419,7 @@ static const YYINT demo_ctable[] = { -1, #define YYDEBUG 0 #endif #define YYMAXTOKEN 269 -#define YYUNDFTOKEN 301 +#define YYUNDFTOKEN 299 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) #if YYDEBUG static const char *const demo_name[] = { @@ -438,7 +437,7 @@ static const char *const demo_name[] = { "statement_list","block_statement","declarator","formal_arg","decl_specs", "decl_spec","typename","cv_quals","cv_qual","opt_scope","formal_arg_list", "nonempty_formal_arg_list","$$1","$$2","$$3","$$4","$$5","$$6","$$7","$$8", -"$$9","$$10","$$11","$$12","illegal-symbol", +"$$9","$$10","illegal-symbol", }; static const char *const demo_rule[] = { "$accept : input", @@ -451,10 +450,9 @@ static const char *const demo_rule[] = { "decl_list :", "$$2 :", "decl_list : decl_list $$2 decl", +"decl : decl_specs declarator_list ';'", "$$3 :", -"decl : decl_specs $$2 $$3 declarator_list ';'", -"$$4 :", -"decl : decl_specs $$2 $$3 declarator $$4 block_statement", +"decl : decl_specs declarator $$3 block_statement", "decl_specs : decl_spec", "decl_specs : decl_specs $$2 decl_spec", "cv_quals :", @@ -466,40 +464,39 @@ static const char *const demo_rule[] = { "decl_spec : STATIC", "cv_qual : CONST", "cv_qual : VOLATILE", +"$$4 :", "$$5 :", -"$$6 :", -"declarator_list : declarator_list ',' $$5 $$6 declarator", +"declarator_list : declarator_list ',' $$4 $$5 declarator", "declarator_list : declarator", "declarator :", "declarator : ID", +"$$6 :", "$$7 :", -"$$8 :", -"declarator : '(' $$7 $$8 declarator ')'", -"declarator : '*' cv_quals $$5 $$6 declarator", -"declarator : declarator '[' $$5 expr ']'", -"declarator : declarator '(' $$5 formal_arg_list ')' cv_quals", +"declarator : '(' $$6 $$7 declarator ')'", +"declarator : '*' cv_quals $$4 $$5 declarator", +"declarator : declarator '[' $$4 expr ']'", +"declarator : declarator '(' $$4 formal_arg_list ')' cv_quals", "formal_arg_list :", "formal_arg_list : nonempty_formal_arg_list", -"nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg", +"nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$6 formal_arg", "nonempty_formal_arg_list : formal_arg", -"formal_arg : decl_specs $$2 $$3 declarator", -"expr : expr '+' $$7 expr", -"expr : expr '-' $$7 expr", -"expr : expr '*' $$7 expr", -"expr : expr '%' $$7 expr", -"expr : expr '/' $$7 expr", +"formal_arg : decl_specs declarator", +"expr : expr '+' $$6 expr", +"expr : expr '-' $$6 expr", +"expr : expr '*' $$6 expr", +"expr : expr '%' $$6 expr", +"expr : expr '/' $$6 expr", "expr : '*' $$2 expr", "expr : ID", "expr : CONSTANT", "statement : decl", +"statement : expr ';'", +"$$8 :", "$$9 :", -"statement : $$9 expr ';'", +"statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE $$9 statement", +"statement : IF '(' $$6 expr ')' THEN $$8 statement", "$$10 :", -"$$11 :", -"statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement", -"statement : IF '(' $$7 expr ')' THEN $$10 statement", -"$$12 :", -"statement : $$12 block_statement", +"statement : $$10 block_statement", "statement_list :", "statement_list : statement_list $$2 statement", "block_statement : '{' $$2 statement_list '}'", @@ -567,9 +564,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) @@ -659,7 +656,7 @@ extern Expr * var_expr(Scope *scope, char *id); extern Code * build_expr_code(Expr *expr); extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt); extern Code * code_append(Code *stmt_list, Code *stmt); -#line 663 "btyacc_demo.tab.c" +#line 660 "btyacc_demo.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -676,7 +673,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 680 "btyacc_demo.tab.c" +#line 677 "btyacc_demo.tab.c" case 45: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -685,7 +682,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 689 "btyacc_demo.tab.c" +#line 686 "btyacc_demo.tab.c" case 42: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -694,7 +691,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 698 "btyacc_demo.tab.c" +#line 695 "btyacc_demo.tab.c" case 47: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -703,7 +700,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 707 "btyacc_demo.tab.c" +#line 704 "btyacc_demo.tab.c" case 37: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -712,7 +709,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 716 "btyacc_demo.tab.c" +#line 713 "btyacc_demo.tab.c" case 257: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -721,7 +718,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 725 "btyacc_demo.tab.c" +#line 722 "btyacc_demo.tab.c" case 258: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -730,7 +727,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 734 "btyacc_demo.tab.c" +#line 731 "btyacc_demo.tab.c" case 40: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -739,7 +736,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 743 "btyacc_demo.tab.c" +#line 740 "btyacc_demo.tab.c" case 91: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -748,7 +745,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 752 "btyacc_demo.tab.c" +#line 749 "btyacc_demo.tab.c" case 46: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -757,7 +754,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 761 "btyacc_demo.tab.c" +#line 758 "btyacc_demo.tab.c" case 259: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -766,7 +763,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).id); } break; -#line 770 "btyacc_demo.tab.c" +#line 767 "btyacc_demo.tab.c" case 260: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -775,7 +772,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).expr); } break; -#line 779 "btyacc_demo.tab.c" +#line 776 "btyacc_demo.tab.c" case 261: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -784,7 +781,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 788 "btyacc_demo.tab.c" +#line 785 "btyacc_demo.tab.c" case 262: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -793,7 +790,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 797 "btyacc_demo.tab.c" +#line 794 "btyacc_demo.tab.c" case 263: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -802,7 +799,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 806 "btyacc_demo.tab.c" +#line 803 "btyacc_demo.tab.c" case 264: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -811,7 +808,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 815 "btyacc_demo.tab.c" +#line 812 "btyacc_demo.tab.c" case 265: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -820,7 +817,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 824 "btyacc_demo.tab.c" +#line 821 "btyacc_demo.tab.c" case 266: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -829,7 +826,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 833 "btyacc_demo.tab.c" +#line 830 "btyacc_demo.tab.c" case 267: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -838,7 +835,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 842 "btyacc_demo.tab.c" +#line 839 "btyacc_demo.tab.c" case 268: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -847,7 +844,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 851 "btyacc_demo.tab.c" +#line 848 "btyacc_demo.tab.c" case 269: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -856,7 +853,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 860 "btyacc_demo.tab.c" +#line 857 "btyacc_demo.tab.c" case 59: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -865,7 +862,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 869 "btyacc_demo.tab.c" +#line 866 "btyacc_demo.tab.c" case 44: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -874,7 +871,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 878 "btyacc_demo.tab.c" +#line 875 "btyacc_demo.tab.c" case 41: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -883,7 +880,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 887 "btyacc_demo.tab.c" +#line 884 "btyacc_demo.tab.c" case 93: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -892,7 +889,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 896 "btyacc_demo.tab.c" +#line 893 "btyacc_demo.tab.c" case 123: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -901,7 +898,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 905 "btyacc_demo.tab.c" +#line 902 "btyacc_demo.tab.c" case 125: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -910,7 +907,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 914 "btyacc_demo.tab.c" +#line 911 "btyacc_demo.tab.c" case 270: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -919,7 +916,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 923 "btyacc_demo.tab.c" +#line 920 "btyacc_demo.tab.c" case 271: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -928,7 +925,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 932 "btyacc_demo.tab.c" +#line 929 "btyacc_demo.tab.c" case 272: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -937,7 +934,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).expr); } break; -#line 941 "btyacc_demo.tab.c" +#line 938 "btyacc_demo.tab.c" case 273: #line 67 "btyacc_demo.y" { /* 'msg' is a 'char *' indicating the context of destructor invocation*/ @@ -947,7 +944,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).decl->scope); free((*val).decl->type); } break; -#line 951 "btyacc_demo.tab.c" +#line 948 "btyacc_demo.tab.c" case 274: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -956,7 +953,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 960 "btyacc_demo.tab.c" +#line 957 "btyacc_demo.tab.c" case 275: #line 83 "btyacc_demo.y" { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n", @@ -965,7 +962,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); /* in this example, we don't know what to do here */ } break; -#line 969 "btyacc_demo.tab.c" +#line 966 "btyacc_demo.tab.c" case 276: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -974,7 +971,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 978 "btyacc_demo.tab.c" +#line 975 "btyacc_demo.tab.c" case 277: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -983,7 +980,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 987 "btyacc_demo.tab.c" +#line 984 "btyacc_demo.tab.c" case 278: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -992,7 +989,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 996 "btyacc_demo.tab.c" +#line 993 "btyacc_demo.tab.c" case 279: #line 73 "btyacc_demo.y" { printf("%s accessed by symbol with type (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n", @@ -1001,7 +998,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).decl); } break; -#line 1005 "btyacc_demo.tab.c" +#line 1002 "btyacc_demo.tab.c" case 280: #line 73 "btyacc_demo.y" { printf("%s accessed by symbol with type (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n", @@ -1010,7 +1007,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).decl); } break; -#line 1014 "btyacc_demo.tab.c" +#line 1011 "btyacc_demo.tab.c" case 281: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1019,7 +1016,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1023 "btyacc_demo.tab.c" +#line 1020 "btyacc_demo.tab.c" case 282: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1028,7 +1025,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1032 "btyacc_demo.tab.c" +#line 1029 "btyacc_demo.tab.c" case 283: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1037,7 +1034,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1041 "btyacc_demo.tab.c" +#line 1038 "btyacc_demo.tab.c" case 284: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1046,7 +1043,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1050 "btyacc_demo.tab.c" +#line 1047 "btyacc_demo.tab.c" case 285: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1055,7 +1052,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1059 "btyacc_demo.tab.c" +#line 1056 "btyacc_demo.tab.c" case 286: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1064,7 +1061,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1068 "btyacc_demo.tab.c" +#line 1065 "btyacc_demo.tab.c" case 287: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1073,7 +1070,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).dlist); } break; -#line 1077 "btyacc_demo.tab.c" +#line 1074 "btyacc_demo.tab.c" case 288: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1082,7 +1079,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).dlist); } break; -#line 1086 "btyacc_demo.tab.c" +#line 1083 "btyacc_demo.tab.c" case 289: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1091,7 +1088,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1095 "btyacc_demo.tab.c" +#line 1092 "btyacc_demo.tab.c" case 290: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1100,16 +1097,16 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1104 "btyacc_demo.tab.c" +#line 1101 "btyacc_demo.tab.c" case 291: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", msg, (*loc).first_line, (*loc).first_column, (*loc).last_line, (*loc).last_column); - free((*val).type); } + free((*val).scope); } break; -#line 1113 "btyacc_demo.tab.c" +#line 1110 "btyacc_demo.tab.c" case 292: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1118,17 +1115,26 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1122 "btyacc_demo.tab.c" +#line 1119 "btyacc_demo.tab.c" case 293: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", msg, (*loc).first_line, (*loc).first_column, (*loc).last_line, (*loc).last_column); - free((*val).scope); } + free((*val).type); } break; -#line 1131 "btyacc_demo.tab.c" +#line 1128 "btyacc_demo.tab.c" case 294: +#line 78 "btyacc_demo.y" + { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", + msg, + (*loc).first_line, (*loc).first_column, + (*loc).last_line, (*loc).last_column); + free((*val).scope); } + break; +#line 1137 "btyacc_demo.tab.c" + case 295: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", msg, @@ -1136,8 +1142,8 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1140 "btyacc_demo.tab.c" - case 295: +#line 1146 "btyacc_demo.tab.c" + case 296: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", msg, @@ -1145,16 +1151,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1149 "btyacc_demo.tab.c" - case 296: -#line 78 "btyacc_demo.y" - { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", - msg, - (*loc).first_line, (*loc).first_column, - (*loc).last_line, (*loc).last_column); - free((*val).type); } - break; -#line 1158 "btyacc_demo.tab.c" +#line 1155 "btyacc_demo.tab.c" case 297: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1163,7 +1160,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1167 "btyacc_demo.tab.c" +#line 1164 "btyacc_demo.tab.c" case 298: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", @@ -1172,25 +1169,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1176 "btyacc_demo.tab.c" - case 299: -#line 78 "btyacc_demo.y" - { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", - msg, - (*loc).first_line, (*loc).first_column, - (*loc).last_line, (*loc).last_column); - free((*val).scope); } - break; -#line 1185 "btyacc_demo.tab.c" - case 300: -#line 78 "btyacc_demo.y" - { printf("%s accessed by symbol of any type other than @ position[%d,%d..%d,%d]\n", - msg, - (*loc).first_line, (*loc).first_column, - (*loc).last_line, (*loc).last_column); - free((*val).scope); } - break; -#line 1194 "btyacc_demo.tab.c" +#line 1173 "btyacc_demo.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -1203,18 +1182,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -1228,7 +1207,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; @@ -1292,7 +1271,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; @@ -1352,6 +1331,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; @@ -1425,11 +1406,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 @@ -1488,7 +1468,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) @@ -1569,7 +1549,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; @@ -1615,9 +1595,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) @@ -1642,7 +1631,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) @@ -1658,7 +1647,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) @@ -1693,7 +1682,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) @@ -1715,7 +1704,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1784,7 +1773,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); } @@ -1881,244 +1870,236 @@ yyval.scope = yystack.l_mark[-1].scope; break; case 10: #line 109 "btyacc_demo.y" -yyval.type = yystack.l_mark[-1].type; -break; -case 11: -#line 109 "btyacc_demo.y" {YYVALID;} break; -case 12: +case 11: #line 110 "btyacc_demo.y" -yyval.scope = start_fn_def(yystack.l_mark[-4].scope, yystack.l_mark[0].decl); +yyval.scope = start_fn_def(yystack.l_mark[-2].scope, yystack.l_mark[0].decl); break; -case 13: +case 12: if (!yytrial) #line 111 "btyacc_demo.y" { /* demonstrate use of @$ & @N, although this is just the default computation and so is not necessary */ - yyloc.first_line = yystack.p_mark[-5].first_line; - yyloc.first_column = yystack.p_mark[-5].first_column; + yyloc.first_line = yystack.p_mark[-3].first_line; + yyloc.first_column = yystack.p_mark[-3].first_column; yyloc.last_line = yystack.p_mark[0].last_line; yyloc.last_column = yystack.p_mark[0].last_column; finish_fn_def(yystack.l_mark[-2].decl, yystack.l_mark[0].code); } break; -case 14: +case 13: #line 121 "btyacc_demo.y" { yyval.type = yystack.l_mark[0].type; } break; -case 15: +case 14: #line 122 "btyacc_demo.y" { yyval.type = type_combine(yystack.l_mark[-2].type, yystack.l_mark[0].type); } break; -case 16: +case 15: #line 125 "btyacc_demo.y" { yyval.type = 0; } break; -case 17: +case 16: #line 126 "btyacc_demo.y" { yyval.type = type_combine(yystack.l_mark[-1].type, yystack.l_mark[0].type); } break; -case 18: +case 17: #line 130 "btyacc_demo.y" { yyval.type = yystack.l_mark[0].type; } break; -case 19: +case 18: #line 131 "btyacc_demo.y" { yyval.type = yystack.l_mark[0].type; } break; -case 20: +case 19: #line 132 "btyacc_demo.y" { yyval.type = bare_extern(); } break; -case 21: +case 20: #line 133 "btyacc_demo.y" { yyval.type = bare_register(); } break; -case 22: +case 21: #line 134 "btyacc_demo.y" { yyval.type = bare_static(); } break; -case 23: +case 22: #line 138 "btyacc_demo.y" { yyval.type = bare_const(); } break; -case 24: +case 23: #line 139 "btyacc_demo.y" { yyval.type = bare_volatile(); } break; -case 25: +case 24: #line 143 "btyacc_demo.y" yyval.scope = yystack.l_mark[-3].scope; break; -case 26: +case 25: #line 143 "btyacc_demo.y" yyval.type = yystack.l_mark[-3].type; break; -case 29: +case 28: #line 148 "btyacc_demo.y" { if (!yystack.l_mark[0].type) YYERROR; } if (!yytrial) #line 149 "btyacc_demo.y" { yyval.decl = declare(yystack.l_mark[-1].scope, 0, yystack.l_mark[0].type); } break; -case 30: +case 29: if (!yytrial) #line 150 "btyacc_demo.y" { yyval.decl = declare(yystack.l_mark[-2].scope, yystack.l_mark[0].id, yystack.l_mark[-1].type); } break; -case 31: +case 30: #line 151 "btyacc_demo.y" yyval.scope = yystack.l_mark[-2].scope; break; -case 32: +case 31: #line 151 "btyacc_demo.y" yyval.type = yystack.l_mark[-2].type; break; -case 33: +case 32: if (!yytrial) #line 151 "btyacc_demo.y" { yyval.decl = yystack.l_mark[-1].decl; } break; -case 34: +case 33: if (!yytrial) #line 153 "btyacc_demo.y" { yyval.decl = make_pointer(yystack.l_mark[0].decl, yystack.l_mark[-3].type); } break; -case 35: +case 34: if (!yytrial) #line 155 "btyacc_demo.y" { yyval.decl = make_array(yystack.l_mark[-4].decl->type, yystack.l_mark[-1].expr); } break; -case 36: +case 35: if (!yytrial) #line 157 "btyacc_demo.y" { yyval.decl = build_function(yystack.l_mark[-5].decl, yystack.l_mark[-2].dlist, yystack.l_mark[0].type); } break; -case 37: +case 36: if (!yytrial) #line 160 "btyacc_demo.y" { yyval.dlist = 0; } break; -case 38: +case 37: if (!yytrial) #line 161 "btyacc_demo.y" { yyval.dlist = yystack.l_mark[0].dlist; } break; -case 39: +case 38: if (!yytrial) #line 164 "btyacc_demo.y" { yyval.dlist = append_dlist(yystack.l_mark[-3].dlist, yystack.l_mark[0].decl); } break; -case 40: +case 39: if (!yytrial) #line 165 "btyacc_demo.y" { yyval.dlist = build_dlist(yystack.l_mark[0].decl); } break; -case 41: +case 40: if (!yytrial) #line 168 "btyacc_demo.y" { yyval.decl = yystack.l_mark[0].decl; } break; -case 42: +case 41: if (!yytrial) #line 172 "btyacc_demo.y" { yyval.expr = build_expr(yystack.l_mark[-3].expr, ADD, yystack.l_mark[0].expr); } break; -case 43: +case 42: if (!yytrial) #line 173 "btyacc_demo.y" { yyval.expr = build_expr(yystack.l_mark[-3].expr, SUB, yystack.l_mark[0].expr); } break; -case 44: +case 43: if (!yytrial) #line 174 "btyacc_demo.y" { yyval.expr = build_expr(yystack.l_mark[-3].expr, MUL, yystack.l_mark[0].expr); } break; -case 45: +case 44: if (!yytrial) #line 175 "btyacc_demo.y" { yyval.expr = build_expr(yystack.l_mark[-3].expr, MOD, yystack.l_mark[0].expr); } break; -case 46: +case 45: if (!yytrial) #line 176 "btyacc_demo.y" { yyval.expr = build_expr(yystack.l_mark[-3].expr, DIV, yystack.l_mark[0].expr); } break; -case 47: +case 46: if (!yytrial) #line 177 "btyacc_demo.y" { yyval.expr = build_expr(0, DEREF, yystack.l_mark[0].expr); } break; -case 48: +case 47: if (!yytrial) #line 178 "btyacc_demo.y" { yyval.expr = var_expr(yystack.l_mark[-1].scope, yystack.l_mark[0].id); } break; -case 49: +case 48: if (!yytrial) #line 179 "btyacc_demo.y" { yyval.expr = yystack.l_mark[0].expr; } break; -case 50: +case 49: if (!yytrial) #line 183 "btyacc_demo.y" { yyval.code = 0; } break; -case 51: -#line 184 "btyacc_demo.y" -yyval.scope = yystack.l_mark[0].scope; -break; -case 52: +case 50: #line 184 "btyacc_demo.y" {YYVALID;} if (!yytrial) #line 184 "btyacc_demo.y" { yyval.code = build_expr_code(yystack.l_mark[-1].expr); } break; -case 53: +case 51: #line 185 "btyacc_demo.y" yyval.scope = yystack.l_mark[-6].scope; break; -case 54: +case 52: #line 185 "btyacc_demo.y" yyval.scope = yystack.l_mark[-9].scope; break; -case 55: +case 53: #line 185 "btyacc_demo.y" {YYVALID;} if (!yytrial) #line 186 "btyacc_demo.y" { yyval.code = build_if(yystack.l_mark[-7].expr, yystack.l_mark[-3].code, yystack.l_mark[0].code); } break; -case 56: +case 54: #line 187 "btyacc_demo.y" {YYVALID;} if (!yytrial) #line 188 "btyacc_demo.y" { yyval.code = build_if(yystack.l_mark[-4].expr, yystack.l_mark[0].code, 0); } break; -case 57: +case 55: #line 189 "btyacc_demo.y" yyval.scope = new_scope(yystack.l_mark[0].scope); break; -case 58: +case 56: #line 189 "btyacc_demo.y" {YYVALID;} if (!yytrial) #line 189 "btyacc_demo.y" { yyval.code = yystack.l_mark[0].code; } break; -case 59: +case 57: if (!yytrial) #line 192 "btyacc_demo.y" { yyval.code = 0; } break; -case 60: +case 58: if (!yytrial) #line 193 "btyacc_demo.y" { yyval.code = code_append(yystack.l_mark[-2].code, yystack.l_mark[0].code); } break; -case 61: +case 59: if (!yytrial) #line 197 "btyacc_demo.y" { yyval.code = yystack.l_mark[-1].code; } break; -#line 2122 "btyacc_demo.tab.c" +#line 2103 "btyacc_demo.tab.c" default: break; } @@ -2206,12 +2187,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 @@ -2238,7 +2218,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; @@ -2273,7 +2253,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) diff --git a/test/btyacc/btyacc_destroy1.tab.c b/test/btyacc/btyacc_destroy1.tab.c index 85738e94d281..c598913376cd 100644 --- a/test/btyacc/btyacc_destroy1.tab.c +++ b/test/btyacc/btyacc_destroy1.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 @@ -141,13 +141,13 @@ extern symbol *mksymbol(type t, class c, name id); #define YYLEX_DECL() yylex(void) #define YYERROR_DECL() yyerror(const char *s) #endif -#line 50 "btyacc_destroy1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 50 "btyacc_destroy1.y" typedef union { class cval; @@ -415,9 +415,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) @@ -516,18 +516,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -541,7 +541,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; @@ -605,7 +605,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; @@ -665,6 +665,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; @@ -738,11 +740,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 @@ -801,7 +802,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) @@ -882,7 +883,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; @@ -928,9 +929,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) @@ -955,7 +965,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) @@ -971,7 +981,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) @@ -1006,7 +1016,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) @@ -1028,7 +1038,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1097,7 +1107,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); } @@ -1213,7 +1223,7 @@ case 9: #line 86 "btyacc_destroy1.y" { yyval.nlist = yystack.l_mark[-5].nlist; } break; -#line 1217 "btyacc_destroy1.tab.c" +#line 1227 "btyacc_destroy1.tab.c" default: break; } @@ -1301,12 +1311,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 @@ -1333,7 +1342,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; @@ -1368,7 +1377,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) diff --git a/test/btyacc/btyacc_destroy2.tab.c b/test/btyacc/btyacc_destroy2.tab.c index 2441008b1bfc..04d4d37df092 100644 --- a/test/btyacc/btyacc_destroy2.tab.c +++ b/test/btyacc/btyacc_destroy2.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 @@ -141,13 +141,13 @@ extern symbol *mksymbol(type t, class c, name id); #define YYLEX_DECL() yylex(void) #define YYERROR_DECL() yyerror(const char *s) #endif -#line 50 "btyacc_destroy2.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 50 "btyacc_destroy2.y" typedef union { class cval; @@ -415,9 +415,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) @@ -516,18 +516,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -541,7 +541,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; @@ -605,7 +605,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; @@ -665,6 +665,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; @@ -738,11 +740,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 @@ -801,7 +802,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) @@ -882,7 +883,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; @@ -928,9 +929,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) @@ -955,7 +965,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) @@ -971,7 +981,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) @@ -1006,7 +1016,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) @@ -1028,7 +1038,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1097,7 +1107,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); } @@ -1213,7 +1223,7 @@ case 9: #line 86 "btyacc_destroy2.y" { yyval.nlist = yystack.l_mark[-5].nlist; } break; -#line 1217 "btyacc_destroy2.tab.c" +#line 1227 "btyacc_destroy2.tab.c" default: break; } @@ -1301,12 +1311,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 @@ -1333,7 +1342,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; @@ -1368,7 +1377,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) diff --git a/test/btyacc/btyacc_destroy3.tab.c b/test/btyacc/btyacc_destroy3.tab.c index 9fec7016b9ea..fca98b8d847d 100644 --- a/test/btyacc/btyacc_destroy3.tab.c +++ b/test/btyacc/btyacc_destroy3.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 @@ -141,13 +141,13 @@ extern symbol *mksymbol(type t, class c, name id); #define YYLEX_DECL() yylex(void) #define YYERROR_DECL() yyerror(const char *s) #endif -#line 53 "btyacc_destroy3.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 53 "btyacc_destroy3.y" typedef union { class cval; @@ -415,9 +415,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) @@ -516,18 +516,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -541,7 +541,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; @@ -605,7 +605,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; @@ -665,6 +665,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; @@ -738,11 +740,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 @@ -801,7 +802,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) @@ -882,7 +883,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; @@ -928,9 +929,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) @@ -955,7 +965,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) @@ -971,7 +981,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) @@ -1006,7 +1016,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) @@ -1028,7 +1038,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1097,7 +1107,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); } @@ -1213,7 +1223,7 @@ case 9: #line 89 "btyacc_destroy3.y" { yyval.nlist = yystack.l_mark[-5].nlist; } break; -#line 1217 "btyacc_destroy3.tab.c" +#line 1227 "btyacc_destroy3.tab.c" default: break; } @@ -1301,12 +1311,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 @@ -1333,7 +1342,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; @@ -1368,7 +1377,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) diff --git a/test/btyacc/calc.tab.c b/test/btyacc/calc.tab.c index d0df5609b281..03d52366d437 100644 --- a/test/btyacc/calc.tab.c +++ b/test/btyacc/calc.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 @@ -396,9 +396,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) @@ -511,18 +511,18 @@ yylex(void) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -536,7 +536,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; @@ -600,7 +600,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; @@ -660,6 +660,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; @@ -733,11 +735,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 @@ -796,7 +797,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) @@ -877,7 +878,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; @@ -923,9 +924,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) @@ -950,7 +960,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) @@ -966,7 +976,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) @@ -1001,7 +1011,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) @@ -1023,7 +1033,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1092,7 +1102,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); } @@ -1219,7 +1229,7 @@ case 18: #line 63 "calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1223 "calc.tab.c" +#line 1233 "calc.tab.c" default: break; } @@ -1307,12 +1317,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 @@ -1339,7 +1348,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; @@ -1374,7 +1383,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) diff --git a/test/btyacc/calc1.tab.c b/test/btyacc/calc1.tab.c index 78fb73fcff77..4046fd3c453a 100644 --- a/test/btyacc/calc1.tab.c +++ b/test/btyacc/calc1.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 @@ -143,13 +143,13 @@ int dcheck(INTERVAL); double dreg[26]; INTERVAL vreg[26]; -#line 31 "calc1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 31 "calc1.y" typedef union { int ival; @@ -451,9 +451,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) @@ -655,18 +655,18 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -680,7 +680,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; @@ -744,7 +744,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; @@ -804,6 +804,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; @@ -877,11 +879,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 @@ -940,7 +941,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) @@ -1021,7 +1022,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; @@ -1067,9 +1068,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) @@ -1094,7 +1104,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) @@ -1110,7 +1120,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) @@ -1145,7 +1155,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) @@ -1167,7 +1177,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1236,7 +1246,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); } @@ -1466,7 +1476,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1470 "calc1.tab.c" +#line 1480 "calc1.tab.c" default: break; } @@ -1554,12 +1564,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 @@ -1586,7 +1595,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; @@ -1621,7 +1630,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) diff --git a/test/btyacc/calc2.tab.c b/test/btyacc/calc2.tab.c index 68ffc381d02a..99c381e9aa2b 100644 --- a/test/btyacc/calc2.tab.c +++ b/test/btyacc/calc2.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 @@ -398,9 +398,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) @@ -524,18 +524,18 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -549,7 +549,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; @@ -613,7 +613,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; @@ -673,6 +673,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; @@ -746,11 +748,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 @@ -809,7 +810,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) @@ -890,7 +891,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; @@ -936,9 +937,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) @@ -963,7 +973,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) @@ -979,7 +989,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) @@ -1014,7 +1024,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) @@ -1036,7 +1046,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1105,7 +1115,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); } @@ -1232,7 +1242,7 @@ case 18: #line 70 "calc2.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1236 "calc2.tab.c" +#line 1246 "calc2.tab.c" default: break; } @@ -1320,12 +1330,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 @@ -1352,7 +1361,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; @@ -1387,7 +1396,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) diff --git a/test/btyacc/calc3.tab.c b/test/btyacc/calc3.tab.c index c9ca77fc23a1..b3ba798b7d8d 100644 --- a/test/btyacc/calc3.tab.c +++ b/test/btyacc/calc3.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 @@ -394,9 +394,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) @@ -479,18 +479,18 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -504,7 +504,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; @@ -568,7 +568,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; @@ -678,6 +678,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; @@ -751,11 +753,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 @@ -814,7 +815,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) @@ -895,7 +896,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; @@ -941,9 +942,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) @@ -968,7 +978,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) @@ -984,7 +994,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) @@ -1019,7 +1029,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) @@ -1041,7 +1051,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1110,7 +1120,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); } @@ -1237,7 +1247,7 @@ case 18: #line 73 "calc3.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1241 "calc3.tab.c" +#line 1251 "calc3.tab.c" default: break; } @@ -1325,12 +1335,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 @@ -1357,7 +1366,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; @@ -1392,7 +1401,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) diff --git a/test/btyacc/code_calc.code.c b/test/btyacc/code_calc.code.c index 1c08290acc62..a7d322a9258f 100644 --- a/test/btyacc/code_calc.code.c +++ b/test/btyacc/code_calc.code.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 @@ -117,7 +117,7 @@ #define YYPURE 0 -#line 2 "code_calc.y" +#line 4 "code_calc.y" # include # include @@ -170,6 +170,8 @@ typedef int YYSTYPE; #define LETTER 258 #define UMINUS 259 #define YYERRCODE 256 +#undef yytname +#define yytname yyname #define YYTABLESIZE 220 #define YYFINAL 1 #ifndef YYDEBUG @@ -198,8 +200,10 @@ extern const YYINT yycheck[]; extern const YYINT yyctable[]; #endif /* YYBTYACC */ -#if YYDEBUG +#if YYDEBUG || defined(yytname) extern const char *const yyname[]; +#endif +#if YYDEBUG extern const char *const yyrule[]; #endif @@ -263,9 +267,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) @@ -327,7 +331,7 @@ static short *yylexp = 0; static short *yylexemes = 0; #endif /* YYBTYACC */ -#line 68 "code_calc.y" +#line 70 "code_calc.y" /* start of programs */ #ifdef YYBYACC @@ -373,7 +377,7 @@ yylex(void) } return( c ); } -#line 377 "code_calc.code.c" +#line 381 "code_calc.code.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -382,18 +386,18 @@ yylex(void) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -407,7 +411,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; @@ -471,7 +475,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; @@ -531,6 +535,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; @@ -604,11 +610,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 @@ -667,7 +672,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) @@ -748,7 +753,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; @@ -794,9 +799,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) @@ -821,7 +835,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) @@ -837,7 +851,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) @@ -872,7 +886,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) @@ -894,7 +908,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -963,7 +977,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); } @@ -1031,66 +1045,66 @@ yyreduce: switch (yyn) { case 3: -#line 30 "code_calc.y" +#line 32 "code_calc.y" { yyerrok ; } break; case 4: -#line 34 "code_calc.y" +#line 36 "code_calc.y" { printf("%d\n",yystack.l_mark[0]);} break; case 5: -#line 36 "code_calc.y" +#line 38 "code_calc.y" { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; } break; case 6: -#line 40 "code_calc.y" +#line 42 "code_calc.y" { yyval = yystack.l_mark[-1]; } break; case 7: -#line 42 "code_calc.y" +#line 44 "code_calc.y" { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; } break; case 8: -#line 44 "code_calc.y" +#line 46 "code_calc.y" { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; } break; case 9: -#line 46 "code_calc.y" +#line 48 "code_calc.y" { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; } break; case 10: -#line 48 "code_calc.y" +#line 50 "code_calc.y" { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; } break; case 11: -#line 50 "code_calc.y" +#line 52 "code_calc.y" { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; } break; case 12: -#line 52 "code_calc.y" +#line 54 "code_calc.y" { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; } break; case 13: -#line 54 "code_calc.y" +#line 56 "code_calc.y" { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; } break; case 14: -#line 56 "code_calc.y" +#line 58 "code_calc.y" { yyval = - yystack.l_mark[0]; } break; case 15: -#line 58 "code_calc.y" +#line 60 "code_calc.y" { yyval = regs[yystack.l_mark[0]]; } break; case 17: -#line 63 "code_calc.y" +#line 65 "code_calc.y" { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; } break; case 18: -#line 65 "code_calc.y" +#line 67 "code_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1094 "code_calc.code.c" +#line 1108 "code_calc.code.c" default: break; } @@ -1178,12 +1192,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 @@ -1210,7 +1223,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; @@ -1245,7 +1258,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) diff --git a/test/btyacc/code_calc.tab.c b/test/btyacc/code_calc.tab.c index 876b1dcf6a23..0de2897ccdf7 100644 --- a/test/btyacc/code_calc.tab.c +++ b/test/btyacc/code_calc.tab.c @@ -125,7 +125,6 @@ const YYINT calc_ctable[] = { -1, #ifndef YYDEBUG #define YYDEBUG 0 #endif -#if YYDEBUG const char *const calc_name[] = { "$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -138,6 +137,7 @@ const char *const calc_name[] = { 0,0,"error","DIGIT","LETTER","UMINUS","$accept","list","stat","expr","number", "illegal-symbol", }; +#if YYDEBUG const char *const calc_rule[] = { "$accept : list", "list :", diff --git a/test/btyacc/code_calc.tab.h b/test/btyacc/code_calc.tab.h index 48f8993b83f6..0b129daa6a28 100644 --- a/test/btyacc/code_calc.tab.h +++ b/test/btyacc/code_calc.tab.h @@ -4,5 +4,7 @@ #define DIGIT 257 #define LETTER 258 #define UMINUS 259 +#undef yytname +#define yytname yyname #endif /* _calc__defines_h_ */ diff --git a/test/btyacc/code_error.code.c b/test/btyacc/code_error.code.c index 883e3ab6e774..f9ccb5a93243 100644 --- a/test/btyacc/code_error.code.c +++ b/test/btyacc/code_error.code.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 @@ -190,8 +190,10 @@ extern const YYINT yycheck[]; extern const YYINT yyctable[]; #endif /* YYBTYACC */ -#if YYDEBUG +#if YYDEBUG || defined(yytname) extern const char *const yyname[]; +#endif +#if YYDEBUG extern const char *const yyrule[]; #endif @@ -255,9 +257,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) @@ -345,7 +347,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 349 "code_error.code.c" +#line 351 "code_error.code.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -354,18 +356,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -379,7 +381,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; @@ -443,7 +445,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; @@ -503,6 +505,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; @@ -576,11 +580,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 @@ -639,7 +642,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) @@ -720,7 +723,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; @@ -766,9 +769,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) @@ -793,7 +805,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) @@ -809,7 +821,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) @@ -844,7 +856,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) @@ -866,7 +878,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -935,7 +947,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); } @@ -1089,12 +1101,11 @@ yyreduce: } 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 @@ -1121,7 +1132,7 @@ yyreduce: } #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; @@ -1156,7 +1167,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) diff --git a/test/btyacc/empty.tab.c b/test/btyacc/empty.tab.c index 06ecdccb77a6..da0fbf96b8d0 100644 --- a/test/btyacc/empty.tab.c +++ b/test/btyacc/empty.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 @@ -287,9 +287,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) @@ -373,18 +373,18 @@ YYERROR_DECL() { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -398,7 +398,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; @@ -462,7 +462,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; @@ -522,6 +522,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; @@ -595,11 +597,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 @@ -658,7 +659,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) @@ -739,7 +740,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; @@ -785,9 +786,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) @@ -812,7 +822,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) @@ -828,7 +838,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) @@ -863,7 +873,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) @@ -885,7 +895,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -954,7 +964,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); } @@ -1108,12 +1118,11 @@ yyreduce: } 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 @@ -1140,7 +1149,7 @@ yyreduce: } #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; @@ -1175,7 +1184,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) diff --git a/test/btyacc/err_inherit1.tab.c b/test/btyacc/err_inherit1.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_inherit1.tab.c +++ b/test/btyacc/err_inherit1.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 diff --git a/test/btyacc/err_inherit2.tab.c b/test/btyacc/err_inherit2.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_inherit2.tab.c +++ b/test/btyacc/err_inherit2.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 diff --git a/test/btyacc/err_inherit3.output b/test/btyacc/err_inherit3.output index 16ea531b89db..3a362a96c40d 100644 --- a/test/btyacc/err_inherit3.output +++ b/test/btyacc/err_inherit3.output @@ -5,25 +5,22 @@ 2 $$2 : 3 declaration : class type $$1 $$2 namelist + 4 | type locnamelist - 4 $$3 : + 5 class : GLOBAL + 6 | LOCAL - 5 declaration : type $$3 locnamelist + 7 type : REAL + 8 | INTEGER - 6 class : GLOBAL - 7 | LOCAL + 9 $$3 : - 8 type : REAL - 9 | INTEGER + 10 namelist : $$3 namelist NAME + 11 | NAME - 10 $$4 : + 12 $$4 : - 11 namelist : $$4 namelist NAME - 12 | NAME - - 13 $$5 : - - 14 locnamelist : $$5 $$2 namelist + 13 locnamelist : $$4 $$2 namelist state 0 $accept : . declaration $end (0) @@ -40,29 +37,29 @@ state 0 state 1 - class : GLOBAL . (6) + class : GLOBAL . (5) + + . reduce 5 + + +state 2 + class : LOCAL . (6) . reduce 6 -state 2 - class : LOCAL . (7) +state 3 + type : REAL . (7) . reduce 7 -state 3 - type : REAL . (8) +state 4 + type : INTEGER . (8) . reduce 8 -state 4 - type : INTEGER . (9) - - . reduce 9 - - state 5 $accept : declaration . $end (0) @@ -80,12 +77,13 @@ state 6 state 7 - declaration : type . $$3 locnamelist (5) - $$3 : . (4) + declaration : type . locnamelist (4) + $$4 : . (12) - . reduce 4 + . reduce 12 - $$3 goto 9 + locnamelist goto 9 + $$4 goto 10 state 8 @@ -94,20 +92,25 @@ state 8 . reduce 1 - $$1 goto 10 + $$1 goto 11 state 9 - declaration : type $$3 . locnamelist (5) - $$5 : . (13) + declaration : type locnamelist . (4) - . reduce 13 - - locnamelist goto 11 - $$5 goto 12 + . reduce 4 state 10 + locnamelist : $$4 . $$2 namelist (13) + $$2 : . (2) + + . reduce 2 + + $$2 goto 12 + + +state 11 declaration : class type $$1 . $$2 namelist (3) $$2 : . (2) @@ -116,96 +119,81 @@ state 10 $$2 goto 13 -state 11 - declaration : type $$3 locnamelist . (5) - - . reduce 5 - - +12: shift/reduce conflict (shift 14, reduce 9) on NAME state 12 - locnamelist : $$5 . $$2 namelist (14) - $$2 : . (2) + locnamelist : $$4 $$2 . namelist (13) + $$3 : . (9) - . reduce 2 + NAME shift 14 - $$2 goto 14 + namelist goto 15 + $$3 goto 16 -13: shift/reduce conflict (shift 15, reduce 10) on NAME +13: shift/reduce conflict (shift 14, reduce 9) on NAME state 13 declaration : class type $$1 $$2 . namelist (3) - $$4 : . (10) + $$3 : . (9) - NAME shift 15 + NAME shift 14 - namelist goto 16 - $$4 goto 17 + namelist goto 17 + $$3 goto 16 -14: shift/reduce conflict (shift 15, reduce 10) on NAME state 14 - locnamelist : $$5 $$2 . namelist (14) - $$4 : . (10) + namelist : NAME . (11) - NAME shift 15 - - namelist goto 18 - $$4 goto 17 + . reduce 11 state 15 - namelist : NAME . (12) + locnamelist : $$4 $$2 namelist . (13) - . reduce 12 + . reduce 13 +16: shift/reduce conflict (shift 14, reduce 9) on NAME state 16 + namelist : $$3 . namelist NAME (10) + $$3 : . (9) + + NAME shift 14 + + namelist goto 18 + $$3 goto 16 + + +state 17 declaration : class type $$1 $$2 namelist . (3) . reduce 3 -17: shift/reduce conflict (shift 15, reduce 10) on NAME -state 17 - namelist : $$4 . namelist NAME (11) - $$4 : . (10) - - NAME shift 15 - - namelist goto 19 - $$4 goto 17 - - state 18 - locnamelist : $$5 $$2 namelist . (14) + namelist : $$3 namelist . NAME (10) - . reduce 14 - - -state 19 - namelist : $$4 namelist . NAME (11) - - NAME shift 20 + NAME shift 19 . error -state 20 - namelist : $$4 namelist NAME . (11) +state 19 + namelist : $$3 namelist NAME . (10) - . reduce 11 + . reduce 10 Rules never reduced: - $$4 : (10) + $$3 : (9) +State 12 contains 1 shift/reduce conflict. State 13 contains 1 shift/reduce conflict. -State 14 contains 1 shift/reduce conflict. -State 17 contains 1 shift/reduce conflict. +State 16 contains 1 shift/reduce conflict. -7 terminals, 11 nonterminals -15 grammar rules, 21 states +7 terminals, 10 nonterminals +14 grammar rules, 20 states grammar parser grammar symbol# value# symbol @@ -226,4 +214,3 @@ symbol# value# symbol 14 269 $$2 15 270 $$3 16 271 $$4 - 17 272 $$5 diff --git a/test/btyacc/err_inherit3.tab.c b/test/btyacc/err_inherit3.tab.c index 93b2706c6ea7..6cb563e56e92 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 /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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) diff --git a/test/btyacc/err_inherit4.output b/test/btyacc/err_inherit4.output index f52c287694b5..ef7ccb88d502 100644 --- a/test/btyacc/err_inherit4.output +++ b/test/btyacc/err_inherit4.output @@ -5,21 +5,18 @@ 2 $$2 : 3 declaration : class type $$1 $$2 namelist + 4 | type locnamelist - 4 $$3 : + 5 class : GLOBAL + 6 | LOCAL - 5 declaration : type $$3 locnamelist + 7 type : REAL + 8 | INTEGER - 6 class : GLOBAL - 7 | LOCAL + 9 namelist : namelist NAME + 10 | NAME - 8 type : REAL - 9 | INTEGER - - 10 namelist : namelist NAME - 11 | NAME - - 12 locnamelist : namelist + 11 locnamelist : namelist state 0 $accept : . declaration $end (0) @@ -36,29 +33,29 @@ state 0 state 1 - class : GLOBAL . (6) + class : GLOBAL . (5) + + . reduce 5 + + +state 2 + class : LOCAL . (6) . reduce 6 -state 2 - class : LOCAL . (7) +state 3 + type : REAL . (7) . reduce 7 -state 3 - type : REAL . (8) +state 4 + type : INTEGER . (8) . reduce 8 -state 4 - type : INTEGER . (9) - - . reduce 9 - - state 5 $accept : declaration . $end (0) @@ -76,12 +73,13 @@ state 6 state 7 - declaration : type . $$3 locnamelist (5) - $$3 : . (4) + declaration : type . locnamelist (4) - . reduce 4 + NAME shift 9 + . error - $$3 goto 9 + namelist goto 10 + locnamelist goto 11 state 8 @@ -90,20 +88,30 @@ state 8 . reduce 1 - $$1 goto 10 + $$1 goto 12 state 9 - declaration : type $$3 . locnamelist (5) + namelist : NAME . (10) - NAME shift 11 - . error - - namelist goto 12 - locnamelist goto 13 + . reduce 10 state 10 + namelist : namelist . NAME (9) + locnamelist : namelist . (11) + + NAME shift 13 + $end reduce 11 + + +state 11 + declaration : type locnamelist . (4) + + . reduce 4 + + +state 12 declaration : class type $$1 . $$2 namelist (3) $$2 : . (2) @@ -112,51 +120,31 @@ state 10 $$2 goto 14 -state 11 - namelist : NAME . (11) - - . reduce 11 - - -state 12 - namelist : namelist . NAME (10) - locnamelist : namelist . (12) - - NAME shift 15 - $end reduce 12 - - state 13 - declaration : type $$3 locnamelist . (5) + namelist : namelist NAME . (9) - . reduce 5 + . reduce 9 state 14 declaration : class type $$1 $$2 . namelist (3) - NAME shift 11 + NAME shift 9 . error - namelist goto 16 + namelist goto 15 state 15 - namelist : namelist NAME . (10) - - . reduce 10 - - -state 16 declaration : class type $$1 $$2 namelist . (3) - namelist : namelist . NAME (10) + namelist : namelist . NAME (9) - NAME shift 15 + NAME shift 13 $end reduce 3 -7 terminals, 9 nonterminals -13 grammar rules, 17 states +7 terminals, 8 nonterminals +12 grammar rules, 16 states grammar parser grammar symbol# value# symbol @@ -175,4 +163,3 @@ symbol# value# symbol 12 267 type 13 268 $$1 14 269 $$2 - 15 270 $$3 diff --git a/test/btyacc/err_inherit4.tab.c b/test/btyacc/err_inherit4.tab.c index 7e8e04242eee..daa6881f0f72 100644 --- a/test/btyacc/err_inherit4.tab.c +++ b/test/btyacc/err_inherit4.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 @@ -144,13 +144,13 @@ extern symbol *mksymbol(type t, class c, name id); #define YYLEX_DECL() yylex(void) #define YYERROR_DECL() yyerror(const char *s) #endif -#line 41 "err_inherit4.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 41 "err_inherit4.y" typedef union { class cval; @@ -219,44 +219,44 @@ extern int YYPARSE_DECL(); #define YYERRCODE 256 typedef short YYINT; static const YYINT err_inherit4_lhs[] = { -1, - 5, 6, 0, 7, 0, 3, 3, 4, 4, 1, - 1, 2, + 5, 6, 0, 0, 3, 3, 4, 4, 1, 1, + 2, }; static const YYINT err_inherit4_len[] = { 2, - 0, 0, 5, 0, 3, 1, 1, 1, 1, 2, - 1, 1, + 0, 0, 5, 2, 1, 1, 1, 1, 2, 1, + 1, }; static const YYINT err_inherit4_defred[] = { 0, - 6, 7, 8, 9, 0, 0, 4, 1, 0, 2, - 11, 0, 5, 0, 10, 0, + 5, 6, 7, 8, 0, 0, 0, 1, 10, 0, + 4, 2, 9, 0, 0, }; static const YYINT err_inherit4_stos[] = { 0, - 257, 258, 259, 260, 263, 266, 267, 267, 270, 268, - 261, 264, 265, 269, 261, 264, + 257, 258, 259, 260, 263, 266, 267, 267, 261, 264, + 265, 268, 261, 269, 264, }; static const YYINT err_inherit4_dgoto[] = { 5, - 12, 13, 6, 7, 10, 14, 9, + 10, 11, 6, 7, 12, 14, }; static const YYINT err_inherit4_sindex[] = { -257, - 0, 0, 0, 0, 0, -255, 0, 0, -254, 0, - 0, -253, 0, -254, 0, -253, + 0, 0, 0, 0, 0, -255, -254, 0, 0, -253, + 0, 0, 0, -254, -253, }; static const YYINT err_inherit4_rindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 6, 0, 0, 0, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, + 0, 0, 0, 0, 9, }; #if YYBTYACC static const YYINT err_inherit4_cindex[] = { 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_inherit4_gindex[] = { 0, - -4, 0, 0, 5, 0, 0, 0, + -4, 0, 0, 5, 0, 0, }; #define YYTABLESIZE 11 static const YYINT err_inherit4_table[] = { 1, - 2, 3, 4, 3, 4, 12, 11, 15, 3, 16, + 2, 3, 4, 3, 4, 11, 9, 13, 3, 15, 8, }; static const YYINT err_inherit4_check[] = { 257, @@ -273,7 +273,7 @@ static const YYINT err_inherit4_ctable[] = { -1, #define YYDEBUG 0 #endif #define YYMAXTOKEN 261 -#define YYUNDFTOKEN 271 +#define YYUNDFTOKEN 270 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) #if YYDEBUG static const char *const err_inherit4_name[] = { @@ -286,15 +286,14 @@ static const char *const err_inherit4_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","illegal-symbol", +"$$2","illegal-symbol", }; static const char *const err_inherit4_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", @@ -366,9 +365,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) @@ -434,7 +433,7 @@ static short *yylexemes = 0; extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 438 "err_inherit4.tab.c" +#line 437 "err_inherit4.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -447,17 +446,17 @@ YYDESTRUCT_DECL() #line 28 "err_inherit4.y" { } break; -#line 451 "err_inherit4.tab.c" +#line 450 "err_inherit4.tab.c" case 264: #line 28 "err_inherit4.y" { } break; -#line 456 "err_inherit4.tab.c" +#line 455 "err_inherit4.tab.c" case 265: #line 28 "err_inherit4.y" { } break; -#line 461 "err_inherit4.tab.c" +#line 460 "err_inherit4.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -470,18 +469,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -495,7 +494,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; @@ -559,7 +558,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; @@ -619,6 +618,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; @@ -692,11 +693,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 @@ -755,7 +755,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) @@ -836,7 +836,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; @@ -882,9 +882,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) @@ -909,7 +918,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) @@ -925,7 +934,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) @@ -960,7 +969,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) @@ -982,7 +991,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1051,7 +1060,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); } @@ -1128,49 +1137,45 @@ yyval.tval = yystack.l_mark[-1].tval; break; case 3: #line 53 "err_inherit4.y" - { yyval.nlist = yystack.l_mark[0].nlist; } + { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[0]; } break; case 4: -#line 54 "err_inherit4.y" -yyval.tval = yystack.l_mark[0].tval; +#line 55 "err_inherit4.y" + { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[-3]; } break; case 5: -#line 55 "err_inherit4.y" - { yyval.nlist = yystack.l_mark[0].nlist; } -break; -case 6: #line 58 "err_inherit4.y" { yyval.cval = cGLOBAL; } break; -case 7: +case 6: #line 59 "err_inherit4.y" { yyval.cval = cLOCAL; } break; -case 8: +case 7: #line 62 "err_inherit4.y" { yyval.tval = tREAL; } break; -case 9: +case 8: #line 63 "err_inherit4.y" { yyval.tval = tINTEGER; } break; -case 10: +case 9: #line 67 "err_inherit4.y" { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id); yyval.nlist->next = yystack.l_mark[-1].nlist; } break; -case 11: +case 10: #line 71 "err_inherit4.y" { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id); yyval.nlist->next = NULL; } break; -case 12: +case 11: #line 77 "err_inherit4.y" { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; } break; -#line 1174 "err_inherit4.tab.c" +#line 1179 "err_inherit4.tab.c" default: break; } @@ -1258,12 +1263,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 @@ -1290,7 +1294,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; @@ -1325,7 +1329,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) diff --git a/test/btyacc/err_inherit5.tab.c b/test/btyacc/err_inherit5.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_inherit5.tab.c +++ b/test/btyacc/err_inherit5.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 diff --git a/test/btyacc/err_syntax1.tab.c b/test/btyacc/err_syntax1.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax1.tab.c +++ b/test/btyacc/err_syntax1.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 diff --git a/test/btyacc/err_syntax10.tab.c b/test/btyacc/err_syntax10.tab.c index 4ec0d56e083b..8d1d20f8b090 100644 --- a/test/btyacc/err_syntax10.tab.c +++ b/test/btyacc/err_syntax10.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 @@ -277,9 +277,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) @@ -372,18 +372,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -397,7 +397,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; @@ -461,7 +461,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; @@ -521,6 +521,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; @@ -594,11 +596,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 @@ -657,7 +658,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) @@ -738,7 +739,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; @@ -784,9 +785,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) @@ -811,7 +821,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) @@ -827,7 +837,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) @@ -862,7 +872,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) @@ -884,7 +894,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -953,7 +963,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); } @@ -1107,12 +1117,11 @@ yyreduce: } 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 @@ -1139,7 +1148,7 @@ yyreduce: } #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; @@ -1174,7 +1183,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) diff --git a/test/btyacc/err_syntax11.tab.c b/test/btyacc/err_syntax11.tab.c index d1b51a1a3d33..d94910295b8d 100644 --- a/test/btyacc/err_syntax11.tab.c +++ b/test/btyacc/err_syntax11.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 @@ -283,9 +283,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) @@ -378,18 +378,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -403,7 +403,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; @@ -467,7 +467,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; @@ -527,6 +527,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; @@ -600,11 +602,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 @@ -663,7 +664,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) @@ -744,7 +745,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; @@ -790,9 +791,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) @@ -817,7 +827,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) @@ -833,7 +843,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) @@ -868,7 +878,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) @@ -890,7 +900,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -959,7 +969,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); } @@ -1113,12 +1123,11 @@ yyreduce: } 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 @@ -1145,7 +1154,7 @@ yyreduce: } #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; @@ -1180,7 +1189,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) diff --git a/test/btyacc/err_syntax12.tab.c b/test/btyacc/err_syntax12.tab.c index 6de458639ba9..5a3105eaef49 100644 --- a/test/btyacc/err_syntax12.tab.c +++ b/test/btyacc/err_syntax12.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 @@ -289,9 +289,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) @@ -384,18 +384,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -409,7 +409,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; @@ -473,7 +473,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; @@ -533,6 +533,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; @@ -606,11 +608,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 @@ -669,7 +670,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) @@ -750,7 +751,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; @@ -796,9 +797,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) @@ -823,7 +833,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) @@ -839,7 +849,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) @@ -874,7 +884,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) @@ -896,7 +906,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -965,7 +975,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); } @@ -1119,12 +1129,11 @@ yyreduce: } 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 @@ -1151,7 +1160,7 @@ yyreduce: } #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; @@ -1186,7 +1195,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) diff --git a/test/btyacc/err_syntax13.tab.c b/test/btyacc/err_syntax13.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax13.tab.c +++ b/test/btyacc/err_syntax13.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 diff --git a/test/btyacc/err_syntax14.tab.c b/test/btyacc/err_syntax14.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax14.tab.c +++ b/test/btyacc/err_syntax14.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 diff --git a/test/btyacc/err_syntax15.tab.c b/test/btyacc/err_syntax15.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax15.tab.c +++ b/test/btyacc/err_syntax15.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 diff --git a/test/btyacc/err_syntax16.tab.c b/test/btyacc/err_syntax16.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax16.tab.c +++ b/test/btyacc/err_syntax16.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 diff --git a/test/btyacc/err_syntax17.tab.c b/test/btyacc/err_syntax17.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax17.tab.c +++ b/test/btyacc/err_syntax17.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 diff --git a/test/btyacc/err_syntax18.tab.c b/test/btyacc/err_syntax18.tab.c index 45e8e71b9404..1221906298b2 100644 --- a/test/btyacc/err_syntax18.tab.c +++ b/test/btyacc/err_syntax18.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 @@ -286,9 +286,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) @@ -381,18 +381,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -406,7 +406,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; @@ -470,7 +470,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; @@ -530,6 +530,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; @@ -603,11 +605,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 @@ -666,7 +667,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) @@ -747,7 +748,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; @@ -793,9 +794,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) @@ -820,7 +830,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) @@ -836,7 +846,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) @@ -871,7 +881,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) @@ -893,7 +903,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -962,7 +972,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); } @@ -1033,7 +1043,7 @@ case 1: #line 9 "err_syntax18.y" { yyval = yystack.l_mark[1]; } break; -#line 1037 "err_syntax18.tab.c" +#line 1047 "err_syntax18.tab.c" default: break; } @@ -1121,12 +1131,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 @@ -1153,7 +1162,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; @@ -1188,7 +1197,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) diff --git a/test/btyacc/err_syntax19.tab.c b/test/btyacc/err_syntax19.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax19.tab.c +++ b/test/btyacc/err_syntax19.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 diff --git a/test/btyacc/err_syntax2.tab.c b/test/btyacc/err_syntax2.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax2.tab.c +++ b/test/btyacc/err_syntax2.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 diff --git a/test/btyacc/err_syntax20.tab.c b/test/btyacc/err_syntax20.tab.c index 6505438ac97a..73f2074c5654 100644 --- a/test/btyacc/err_syntax20.tab.c +++ b/test/btyacc/err_syntax20.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 @@ -281,9 +281,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) @@ -376,18 +376,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -401,7 +401,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; @@ -465,7 +465,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; @@ -525,6 +525,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; @@ -598,11 +600,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 @@ -661,7 +662,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) @@ -742,7 +743,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; @@ -788,9 +789,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) @@ -815,7 +825,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) @@ -831,7 +841,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) @@ -866,7 +876,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) @@ -888,7 +898,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -957,7 +967,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); } @@ -1028,7 +1038,7 @@ case 1: #line 12 "err_syntax20.y" { yystack.l_mark[-1].rechk = 3; } break; -#line 1032 "err_syntax20.tab.c" +#line 1042 "err_syntax20.tab.c" default: break; } @@ -1116,12 +1126,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 @@ -1148,7 +1157,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; @@ -1183,7 +1192,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) diff --git a/test/btyacc/err_syntax21.tab.c b/test/btyacc/err_syntax21.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax21.tab.c +++ b/test/btyacc/err_syntax21.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 diff --git a/test/btyacc/err_syntax22.tab.c b/test/btyacc/err_syntax22.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax22.tab.c +++ b/test/btyacc/err_syntax22.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 diff --git a/test/btyacc/err_syntax23.tab.c b/test/btyacc/err_syntax23.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax23.tab.c +++ b/test/btyacc/err_syntax23.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 diff --git a/test/btyacc/err_syntax24.error b/test/btyacc/err_syntax24.error index c1538898ce0b..e8bbfeca35f3 100644 --- a/test/btyacc/err_syntax24.error +++ b/test/btyacc/err_syntax24.error @@ -1,2 +1,2 @@ -YACC: w - line 21 of "./err_syntax24.y", the default action assigns an undefined value to $$ +YACC: w - line 21 of "./err_syntax24.y", the default action for expr assigns an undefined value to $$ YACC: e - line 22 of "./err_syntax24.y", $$ is untyped diff --git a/test/btyacc/err_syntax24.tab.c b/test/btyacc/err_syntax24.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax24.tab.c +++ b/test/btyacc/err_syntax24.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 diff --git a/test/btyacc/err_syntax25.tab.c b/test/btyacc/err_syntax25.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax25.tab.c +++ b/test/btyacc/err_syntax25.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 diff --git a/test/btyacc/err_syntax26.tab.c b/test/btyacc/err_syntax26.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax26.tab.c +++ b/test/btyacc/err_syntax26.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 diff --git a/test/btyacc/err_syntax27.tab.c b/test/btyacc/err_syntax27.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax27.tab.c +++ b/test/btyacc/err_syntax27.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 diff --git a/test/btyacc/err_syntax3.tab.c b/test/btyacc/err_syntax3.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax3.tab.c +++ b/test/btyacc/err_syntax3.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 diff --git a/test/btyacc/err_syntax4.tab.c b/test/btyacc/err_syntax4.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax4.tab.c +++ b/test/btyacc/err_syntax4.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 diff --git a/test/btyacc/err_syntax5.tab.c b/test/btyacc/err_syntax5.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax5.tab.c +++ b/test/btyacc/err_syntax5.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 diff --git a/test/btyacc/err_syntax6.tab.c b/test/btyacc/err_syntax6.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax6.tab.c +++ b/test/btyacc/err_syntax6.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 diff --git a/test/btyacc/err_syntax7.tab.c b/test/btyacc/err_syntax7.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax7.tab.c +++ b/test/btyacc/err_syntax7.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 diff --git a/test/btyacc/err_syntax7a.tab.c b/test/btyacc/err_syntax7a.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax7a.tab.c +++ b/test/btyacc/err_syntax7a.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 diff --git a/test/btyacc/err_syntax7b.tab.c b/test/btyacc/err_syntax7b.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax7b.tab.c +++ b/test/btyacc/err_syntax7b.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 diff --git a/test/btyacc/err_syntax8.tab.c b/test/btyacc/err_syntax8.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax8.tab.c +++ b/test/btyacc/err_syntax8.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 diff --git a/test/btyacc/err_syntax8a.tab.c b/test/btyacc/err_syntax8a.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax8a.tab.c +++ b/test/btyacc/err_syntax8a.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 diff --git a/test/btyacc/err_syntax9.tab.c b/test/btyacc/err_syntax9.tab.c index ac0ad3aadf97..6c35f23329b5 100644 --- a/test/btyacc/err_syntax9.tab.c +++ b/test/btyacc/err_syntax9.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 diff --git a/test/btyacc/error.tab.c b/test/btyacc/error.tab.c index d5c10ebb644f..493690de2709 100644 --- a/test/btyacc/error.tab.c +++ b/test/btyacc/error.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 @@ -282,9 +282,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) @@ -377,18 +377,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -402,7 +402,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; @@ -466,7 +466,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; @@ -526,6 +526,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; @@ -599,11 +601,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 @@ -662,7 +663,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) @@ -743,7 +744,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; @@ -789,9 +790,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) @@ -816,7 +826,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) @@ -832,7 +842,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) @@ -867,7 +877,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) @@ -889,7 +899,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -958,7 +968,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); } @@ -1112,12 +1122,11 @@ yyreduce: } 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 @@ -1144,7 +1153,7 @@ yyreduce: } #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; @@ -1179,7 +1188,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) diff --git a/test/btyacc/grammar.tab.c b/test/btyacc/grammar.tab.c index 238bcaa32711..2d3e4ec00d3f 100644 --- a/test/btyacc/grammar.tab.c +++ b/test/btyacc/grammar.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 @@ -1106,9 +1106,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) @@ -1350,18 +1350,18 @@ free_parser(void) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -1375,7 +1375,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; @@ -1439,7 +1439,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; @@ -1499,6 +1499,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; @@ -1572,11 +1574,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 @@ -1635,7 +1636,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) @@ -1716,7 +1717,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; @@ -1762,9 +1763,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) @@ -1789,7 +1799,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) @@ -1805,7 +1815,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) @@ -1840,7 +1850,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) @@ -1862,7 +1872,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1931,7 +1941,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); } @@ -2672,7 +2682,7 @@ case 114: yyval.declarator->func_def = FUNC_ANSI; } break; -#line 2676 "grammar.tab.c" +#line 2686 "grammar.tab.c" default: break; } @@ -2760,12 +2770,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 @@ -2792,7 +2801,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; @@ -2827,7 +2836,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) diff --git a/test/btyacc/inherit0.tab.c b/test/btyacc/inherit0.tab.c index 7308584c9755..1c75db5b8ae9 100644 --- a/test/btyacc/inherit0.tab.c +++ b/test/btyacc/inherit0.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 @@ -319,9 +319,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) @@ -396,18 +396,18 @@ extern void YYERROR_DECL(); #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -421,7 +421,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; @@ -485,7 +485,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; @@ -545,6 +545,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; @@ -618,11 +620,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 @@ -681,7 +682,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) @@ -762,7 +763,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; @@ -808,9 +809,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) @@ -835,7 +845,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) @@ -851,7 +861,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) @@ -886,7 +896,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) @@ -908,7 +918,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -977,7 +987,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); } @@ -1088,7 +1098,7 @@ case 11: #line 43 "inherit0.y" { yyval = yystack.l_mark[0]; } break; -#line 1092 "inherit0.tab.c" +#line 1102 "inherit0.tab.c" default: break; } @@ -1176,12 +1186,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 @@ -1208,7 +1217,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; @@ -1243,7 +1252,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) diff --git a/test/btyacc/inherit1.tab.c b/test/btyacc/inherit1.tab.c index 2c0f958e01f9..99bbddb28386 100644 --- a/test/btyacc/inherit1.tab.c +++ b/test/btyacc/inherit1.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 @@ -138,13 +138,13 @@ extern symbol *mksymbol(type t, class c, name id); extern int YYLEX_DECL(); extern void YYERROR_DECL(); #endif -#line 32 "inherit1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 32 "inherit1.y" typedef union { class cval; @@ -340,9 +340,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) @@ -417,18 +417,18 @@ extern void YYERROR_DECL(); #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -442,7 +442,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; @@ -506,7 +506,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; @@ -566,6 +566,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; @@ -639,11 +641,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 @@ -702,7 +703,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) @@ -783,7 +784,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; @@ -829,9 +830,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) @@ -856,7 +866,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) @@ -872,7 +882,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) @@ -907,7 +917,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) @@ -929,7 +939,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -998,7 +1008,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); } @@ -1113,7 +1123,7 @@ case 11: #line 71 "inherit1.y" { yyval.nlist = yystack.l_mark[0].nlist; } break; -#line 1117 "inherit1.tab.c" +#line 1127 "inherit1.tab.c" default: break; } @@ -1201,12 +1211,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 @@ -1233,7 +1242,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; @@ -1268,7 +1277,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) diff --git a/test/btyacc/inherit2.output b/test/btyacc/inherit2.output index 70ffb0592f6f..b5df0008ddb0 100644 --- a/test/btyacc/inherit2.output +++ b/test/btyacc/inherit2.output @@ -5,23 +5,20 @@ 2 $$2 : 3 declaration : class type $$1 $$2 namelist + 4 | type locnamelist - 4 $$3 : + 5 class : GLOBAL + 6 | LOCAL - 5 declaration : type $$3 locnamelist + 7 type : REAL + 8 | INTEGER - 6 class : GLOBAL - 7 | LOCAL + 9 namelist : namelist NAME + 10 | NAME - 8 type : REAL - 9 | INTEGER + 11 $$3 : - 10 namelist : namelist NAME - 11 | NAME - - 12 $$4 : - - 13 locnamelist : $$4 $$2 namelist + 12 locnamelist : $$3 $$2 namelist state 0 $accept : . declaration $end (0) @@ -38,29 +35,29 @@ state 0 state 1 - class : GLOBAL . (6) + class : GLOBAL . (5) + + . reduce 5 + + +state 2 + class : LOCAL . (6) . reduce 6 -state 2 - class : LOCAL . (7) +state 3 + type : REAL . (7) . reduce 7 -state 3 - type : REAL . (8) +state 4 + type : INTEGER . (8) . reduce 8 -state 4 - type : INTEGER . (9) - - . reduce 9 - - state 5 $accept : declaration . $end (0) @@ -78,12 +75,13 @@ state 6 state 7 - declaration : type . $$3 locnamelist (5) - $$3 : . (4) + declaration : type . locnamelist (4) + $$3 : . (11) - . reduce 4 + . reduce 11 - $$3 goto 9 + locnamelist goto 9 + $$3 goto 10 state 8 @@ -92,20 +90,25 @@ state 8 . reduce 1 - $$1 goto 10 + $$1 goto 11 state 9 - declaration : type $$3 . locnamelist (5) - $$4 : . (12) + declaration : type locnamelist . (4) - . reduce 12 - - locnamelist goto 11 - $$4 goto 12 + . reduce 4 state 10 + locnamelist : $$3 . $$2 namelist (12) + $$2 : . (2) + + . reduce 2 + + $$2 goto 12 + + +state 11 declaration : class type $$1 . $$2 namelist (3) $$2 : . (2) @@ -114,69 +117,54 @@ state 10 $$2 goto 13 -state 11 - declaration : type $$3 locnamelist . (5) - - . reduce 5 - - state 12 - locnamelist : $$4 . $$2 namelist (13) - $$2 : . (2) + locnamelist : $$3 $$2 . namelist (12) - . reduce 2 + NAME shift 14 + . error - $$2 goto 14 + namelist goto 15 state 13 declaration : class type $$1 $$2 . namelist (3) - NAME shift 15 + NAME shift 14 . error namelist goto 16 state 14 - locnamelist : $$4 $$2 . namelist (13) - - NAME shift 15 - . error - - namelist goto 17 - - -state 15 - namelist : NAME . (11) - - . reduce 11 - - -state 16 - declaration : class type $$1 $$2 namelist . (3) - namelist : namelist . NAME (10) - - NAME shift 18 - $end reduce 3 - - -state 17 - namelist : namelist . NAME (10) - locnamelist : $$4 $$2 namelist . (13) - - NAME shift 18 - $end reduce 13 - - -state 18 - namelist : namelist NAME . (10) + namelist : NAME . (10) . reduce 10 -7 terminals, 10 nonterminals -14 grammar rules, 19 states +state 15 + namelist : namelist . NAME (9) + locnamelist : $$3 $$2 namelist . (12) + + NAME shift 17 + $end reduce 12 + + +state 16 + declaration : class type $$1 $$2 namelist . (3) + namelist : namelist . NAME (9) + + NAME shift 17 + $end reduce 3 + + +state 17 + namelist : namelist NAME . (9) + + . reduce 9 + + +7 terminals, 9 nonterminals +13 grammar rules, 18 states grammar parser grammar symbol# value# symbol @@ -196,4 +184,3 @@ symbol# value# symbol 13 268 $$1 14 269 $$2 15 270 $$3 - 16 271 $$4 diff --git a/test/btyacc/inherit2.tab.c b/test/btyacc/inherit2.tab.c index 67eb0bdf0164..e14f6015b6db 100644 --- a/test/btyacc/inherit2.tab.c +++ b/test/btyacc/inherit2.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 "inherit2.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 39 "inherit2.y" typedef union { class cval; @@ -199,54 +199,54 @@ extern int YYPARSE_DECL(); #define YYERRCODE 256 typedef short YYINT; static const YYINT inherit2_lhs[] = { -1, - 5, 6, 0, 7, 0, 3, 3, 4, 4, 1, - 1, 8, 2, + 5, 6, 0, 0, 3, 3, 4, 4, 1, 1, + 7, 2, }; static const YYINT inherit2_len[] = { 2, - 0, 0, 5, 0, 3, 1, 1, 1, 1, 2, - 1, 0, 3, + 0, 0, 5, 2, 1, 1, 1, 1, 2, 1, + 0, 3, }; static const YYINT inherit2_defred[] = { 0, - 6, 7, 8, 9, 0, 0, 4, 1, 12, 2, - 5, 2, 0, 0, 11, 0, 0, 10, + 5, 6, 7, 8, 0, 0, 11, 1, 4, 2, + 2, 0, 0, 10, 0, 0, 9, }; static const YYINT inherit2_stos[] = { 0, - 257, 258, 259, 260, 263, 266, 267, 267, 270, 268, - 265, 271, 269, 269, 261, 264, 264, 261, + 257, 258, 259, 260, 263, 266, 267, 267, 265, 270, + 268, 269, 269, 261, 264, 264, 261, }; static const YYINT inherit2_dgoto[] = { 5, - 16, 11, 6, 7, 10, 13, 9, 12, + 15, 9, 6, 7, 11, 12, 10, }; static const YYINT inherit2_sindex[] = { -257, 0, 0, 0, 0, 0, -255, 0, 0, 0, 0, - 0, 0, -254, -254, 0, -253, -253, 0, + 0, -254, -254, 0, -253, -253, 0, }; static const YYINT inherit2_rindex[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 6, 9, 0, + 0, 0, 0, 0, 6, 9, 0, }; #if YYBTYACC static const YYINT inherit2_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, }; #endif static const YYINT inherit2_gindex[] = { 0, - -4, 0, 0, 5, 0, 1, 0, 0, + -3, 0, 0, 5, 0, 1, 0, }; -#define YYTABLESIZE 13 +#define YYTABLESIZE 12 static const YYINT inherit2_table[] = { 1, - 2, 3, 4, 3, 4, 3, 15, 18, 13, 17, - 8, 0, 14, + 2, 3, 4, 3, 4, 12, 14, 17, 3, 16, + 8, 13, }; static const YYINT inherit2_check[] = { 257, - 258, 259, 260, 259, 260, 0, 261, 261, 0, 14, - 6, -1, 12, + 258, 259, 260, 259, 260, 0, 261, 261, 0, 13, + 6, 11, }; #if YYBTYACC static const YYINT inherit2_ctable[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, + -1, }; #endif #define YYFINAL 5 @@ -254,7 +254,7 @@ static const YYINT inherit2_ctable[] = { -1, #define YYDEBUG 0 #endif #define YYMAXTOKEN 261 -#define YYUNDFTOKEN 272 +#define YYUNDFTOKEN 271 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) #if YYDEBUG static const char *const inherit2_name[] = { @@ -267,23 +267,22 @@ static const char *const inherit2_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","illegal-symbol", +"$$2","$$3","illegal-symbol", }; static const char *const inherit2_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", "namelist : namelist NAME", "namelist : NAME", -"$$4 :", -"locnamelist : $$4 $$2 namelist", +"$$3 :", +"locnamelist : $$3 $$2 namelist", }; #endif @@ -348,9 +347,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) @@ -416,7 +415,7 @@ static short *yylexemes = 0; extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 420 "inherit2.tab.c" +#line 419 "inherit2.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -436,7 +435,7 @@ YYDESTRUCT_DECL() } } break; -#line 440 "inherit2.tab.c" +#line 439 "inherit2.tab.c" case 264: #line 30 "inherit2.y" { @@ -448,7 +447,7 @@ YYDESTRUCT_DECL() } } break; -#line 452 "inherit2.tab.c" +#line 451 "inherit2.tab.c" case 265: #line 30 "inherit2.y" { @@ -460,7 +459,7 @@ YYDESTRUCT_DECL() } } break; -#line 464 "inherit2.tab.c" +#line 463 "inherit2.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -473,18 +472,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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 +497,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 +561,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 +621,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 +696,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 +758,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 +839,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 +885,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 +921,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 +937,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 +972,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 +994,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1054,7 +1063,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,50 +1143,46 @@ case 3: { yyval.nlist = yystack.l_mark[0].nlist; } break; case 4: -#line 52 "inherit2.y" -yyval.tval = yystack.l_mark[0].tval; -break; -case 5: #line 53 "inherit2.y" { yyval.nlist = yystack.l_mark[0].nlist; } break; -case 6: +case 5: #line 56 "inherit2.y" { yyval.cval = cGLOBAL; } break; -case 7: +case 6: #line 57 "inherit2.y" { yyval.cval = cLOCAL; } break; -case 8: +case 7: #line 60 "inherit2.y" { yyval.tval = tREAL; } break; -case 9: +case 8: #line 61 "inherit2.y" { yyval.tval = tINTEGER; } break; -case 10: +case 9: #line 65 "inherit2.y" { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id); yyval.nlist->next = yystack.l_mark[-1].nlist; } break; -case 11: +case 10: #line 69 "inherit2.y" { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id); yyval.nlist->next = NULL; } break; -case 12: +case 11: #line 74 "inherit2.y" yyval.cval = cLOCAL; break; -case 13: +case 12: #line 75 "inherit2.y" { yyval.nlist = yystack.l_mark[0].nlist; } break; -#line 1181 "inherit2.tab.c" +#line 1186 "inherit2.tab.c" default: break; } @@ -1265,12 +1270,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 @@ -1297,7 +1301,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; @@ -1332,7 +1336,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) diff --git a/test/btyacc/ok_syntax1.tab.c b/test/btyacc/ok_syntax1.tab.c index 5ecb9f98bd89..71773748200e 100644 --- a/test/btyacc/ok_syntax1.tab.c +++ b/test/btyacc/ok_syntax1.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 @@ -130,13 +130,13 @@ int YYLEX_DECL(); static void YYERROR_DECL(); #endif -#line 43 "ok_syntax1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 43 "ok_syntax1.y" typedef union { char * cval; @@ -417,9 +417,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) @@ -502,18 +502,18 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -527,7 +527,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; @@ -591,7 +591,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; @@ -701,6 +701,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; @@ -774,11 +776,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 @@ -837,7 +838,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) @@ -918,7 +919,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; @@ -964,9 +965,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) @@ -991,7 +1001,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) @@ -1007,7 +1017,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) @@ -1042,7 +1052,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) @@ -1064,7 +1074,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1133,7 +1143,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); } @@ -1260,7 +1270,7 @@ case 18: #line 101 "ok_syntax1.y" { yyval.ival = (*base) * yystack.l_mark[-1].ival + yystack.l_mark[0].ival; } break; -#line 1264 "ok_syntax1.tab.c" +#line 1274 "ok_syntax1.tab.c" default: break; } @@ -1348,12 +1358,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 @@ -1380,7 +1389,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; @@ -1415,7 +1424,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) diff --git a/test/btyacc/pure_calc.tab.c b/test/btyacc/pure_calc.tab.c index 00dbd7205527..380bccf98548 100644 --- a/test/btyacc/pure_calc.tab.c +++ b/test/btyacc/pure_calc.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 @@ -397,9 +397,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) @@ -475,18 +475,18 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -500,7 +500,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; @@ -564,7 +564,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; @@ -674,6 +674,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; @@ -747,11 +749,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 @@ -810,7 +811,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) @@ -891,7 +892,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; @@ -937,9 +938,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) @@ -964,7 +974,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) @@ -980,7 +990,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) @@ -1015,7 +1025,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) @@ -1037,7 +1047,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1106,7 +1116,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); } @@ -1233,7 +1243,7 @@ case 18: #line 69 "pure_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1237 "pure_calc.tab.c" +#line 1247 "pure_calc.tab.c" default: break; } @@ -1321,12 +1331,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 @@ -1353,7 +1362,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; @@ -1388,7 +1397,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) diff --git a/test/btyacc/pure_error.tab.c b/test/btyacc/pure_error.tab.c index 9fcd3094bc2a..c8953481203e 100644 --- a/test/btyacc/pure_error.tab.c +++ b/test/btyacc/pure_error.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 @@ -285,9 +285,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) @@ -343,18 +343,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -368,7 +368,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; @@ -432,7 +432,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; @@ -542,6 +542,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; @@ -615,11 +617,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 @@ -678,7 +679,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) @@ -759,7 +760,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; @@ -805,9 +806,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) @@ -832,7 +842,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) @@ -848,7 +858,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) @@ -883,7 +893,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) @@ -905,7 +915,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -974,7 +984,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); } @@ -1128,12 +1138,11 @@ yyreduce: } 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 @@ -1160,7 +1169,7 @@ yyreduce: } #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; @@ -1195,7 +1204,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) diff --git a/test/btyacc/quote_calc-s.tab.c b/test/btyacc/quote_calc-s.tab.c index 3462a45a77a5..5860296e8d56 100644 --- a/test/btyacc/quote_calc-s.tab.c +++ b/test/btyacc/quote_calc-s.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 @@ -415,9 +415,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) @@ -529,18 +529,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -554,7 +554,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; @@ -618,7 +618,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; @@ -678,6 +678,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; @@ -751,11 +753,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 @@ -814,7 +815,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) @@ -895,7 +896,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; @@ -941,9 +942,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) @@ -968,7 +978,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) @@ -984,7 +994,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) @@ -1019,7 +1029,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) @@ -1041,7 +1051,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1110,7 +1120,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); } @@ -1237,7 +1247,7 @@ case 18: #line 70 "quote_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1241 "quote_calc-s.tab.c" +#line 1251 "quote_calc-s.tab.c" default: break; } @@ -1325,12 +1335,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 @@ -1357,7 +1366,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; @@ -1392,7 +1401,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) diff --git a/test/btyacc/quote_calc.tab.c b/test/btyacc/quote_calc.tab.c index 350252e122b7..0fa5e60a75d5 100644 --- a/test/btyacc/quote_calc.tab.c +++ b/test/btyacc/quote_calc.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 @@ -421,9 +421,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) @@ -535,18 +535,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -560,7 +560,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; @@ -624,7 +624,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; @@ -684,6 +684,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; @@ -757,11 +759,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 @@ -820,7 +821,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) @@ -901,7 +902,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; @@ -947,9 +948,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) @@ -974,7 +984,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) @@ -990,7 +1000,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) @@ -1025,7 +1035,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) @@ -1047,7 +1057,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1116,7 +1126,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); } @@ -1243,7 +1253,7 @@ case 18: #line 70 "quote_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1247 "quote_calc.tab.c" +#line 1257 "quote_calc.tab.c" default: break; } @@ -1331,12 +1341,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 @@ -1363,7 +1372,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; @@ -1398,7 +1407,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) diff --git a/test/btyacc/quote_calc2-s.tab.c b/test/btyacc/quote_calc2-s.tab.c index c5b4cf96594f..72ea6ec84757 100644 --- a/test/btyacc/quote_calc2-s.tab.c +++ b/test/btyacc/quote_calc2-s.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 @@ -415,9 +415,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) @@ -529,18 +529,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -554,7 +554,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; @@ -618,7 +618,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; @@ -678,6 +678,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; @@ -751,11 +753,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 @@ -814,7 +815,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) @@ -895,7 +896,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; @@ -941,9 +942,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) @@ -968,7 +978,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) @@ -984,7 +994,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) @@ -1019,7 +1029,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) @@ -1041,7 +1051,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1110,7 +1120,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); } @@ -1237,7 +1247,7 @@ case 18: #line 70 "quote_calc2.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1241 "quote_calc2-s.tab.c" +#line 1251 "quote_calc2-s.tab.c" default: break; } @@ -1325,12 +1335,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 @@ -1357,7 +1366,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; @@ -1392,7 +1401,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) diff --git a/test/btyacc/quote_calc2.tab.c b/test/btyacc/quote_calc2.tab.c index 703e60fb4443..c5e2430824a3 100644 --- a/test/btyacc/quote_calc2.tab.c +++ b/test/btyacc/quote_calc2.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 @@ -421,9 +421,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) @@ -535,18 +535,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -560,7 +560,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; @@ -624,7 +624,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; @@ -684,6 +684,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; @@ -757,11 +759,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 @@ -820,7 +821,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) @@ -901,7 +902,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; @@ -947,9 +948,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) @@ -974,7 +984,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) @@ -990,7 +1000,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) @@ -1025,7 +1035,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) @@ -1047,7 +1057,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1116,7 +1126,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); } @@ -1243,7 +1253,7 @@ case 18: #line 70 "quote_calc2.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1247 "quote_calc2.tab.c" +#line 1257 "quote_calc2.tab.c" default: break; } @@ -1331,12 +1341,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 @@ -1363,7 +1372,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; @@ -1398,7 +1407,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) diff --git a/test/btyacc/quote_calc3-s.tab.c b/test/btyacc/quote_calc3-s.tab.c index 080d91704d47..93af811f2bfc 100644 --- a/test/btyacc/quote_calc3-s.tab.c +++ b/test/btyacc/quote_calc3-s.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 @@ -416,9 +416,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) @@ -530,18 +530,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -555,7 +555,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; @@ -619,7 +619,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; @@ -679,6 +679,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; @@ -752,11 +754,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 @@ -815,7 +816,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) @@ -896,7 +897,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; @@ -942,9 +943,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) @@ -969,7 +979,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) @@ -985,7 +995,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) @@ -1020,7 +1030,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) @@ -1042,7 +1052,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1111,7 +1121,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); } @@ -1238,7 +1248,7 @@ case 18: #line 70 "quote_calc3.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1242 "quote_calc3-s.tab.c" +#line 1252 "quote_calc3-s.tab.c" default: break; } @@ -1326,12 +1336,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 @@ -1358,7 +1367,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; @@ -1393,7 +1402,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) diff --git a/test/btyacc/quote_calc3.tab.c b/test/btyacc/quote_calc3.tab.c index 12bfcba1b1ea..2e929c538038 100644 --- a/test/btyacc/quote_calc3.tab.c +++ b/test/btyacc/quote_calc3.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 @@ -416,9 +416,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) @@ -530,18 +530,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -555,7 +555,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; @@ -619,7 +619,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; @@ -679,6 +679,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; @@ -752,11 +754,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 @@ -815,7 +816,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) @@ -896,7 +897,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; @@ -942,9 +943,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) @@ -969,7 +979,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) @@ -985,7 +995,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) @@ -1020,7 +1030,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) @@ -1042,7 +1052,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1111,7 +1121,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); } @@ -1238,7 +1248,7 @@ case 18: #line 70 "quote_calc3.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1242 "quote_calc3.tab.c" +#line 1252 "quote_calc3.tab.c" default: break; } @@ -1326,12 +1336,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 @@ -1358,7 +1367,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; @@ -1393,7 +1402,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) diff --git a/test/btyacc/quote_calc4-s.tab.c b/test/btyacc/quote_calc4-s.tab.c index c7c41f63e051..e95a5997c4e7 100644 --- a/test/btyacc/quote_calc4-s.tab.c +++ b/test/btyacc/quote_calc4-s.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 @@ -416,9 +416,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) @@ -530,18 +530,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -555,7 +555,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; @@ -619,7 +619,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; @@ -679,6 +679,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; @@ -752,11 +754,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 @@ -815,7 +816,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) @@ -896,7 +897,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; @@ -942,9 +943,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) @@ -969,7 +979,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) @@ -985,7 +995,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) @@ -1020,7 +1030,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) @@ -1042,7 +1052,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1111,7 +1121,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); } @@ -1238,7 +1248,7 @@ case 18: #line 70 "quote_calc4.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1242 "quote_calc4-s.tab.c" +#line 1252 "quote_calc4-s.tab.c" default: break; } @@ -1326,12 +1336,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 @@ -1358,7 +1367,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; @@ -1393,7 +1402,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) diff --git a/test/btyacc/quote_calc4.tab.c b/test/btyacc/quote_calc4.tab.c index b28a561824fa..fd5fc8e8ecdf 100644 --- a/test/btyacc/quote_calc4.tab.c +++ b/test/btyacc/quote_calc4.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 @@ -416,9 +416,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) @@ -530,18 +530,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -555,7 +555,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; @@ -619,7 +619,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; @@ -679,6 +679,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; @@ -752,11 +754,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 @@ -815,7 +816,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) @@ -896,7 +897,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; @@ -942,9 +943,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) @@ -969,7 +979,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) @@ -985,7 +995,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) @@ -1020,7 +1030,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) @@ -1042,7 +1052,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1111,7 +1121,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); } @@ -1238,7 +1248,7 @@ case 18: #line 70 "quote_calc4.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1242 "quote_calc4.tab.c" +#line 1252 "quote_calc4.tab.c" default: break; } @@ -1326,12 +1336,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 @@ -1358,7 +1367,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; @@ -1393,7 +1402,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) diff --git a/test/btyacc/rename_debug.c b/test/btyacc/rename_debug.c index 3964bf189d25..ecb122129466 100644 --- a/test/btyacc/rename_debug.c +++ b/test/btyacc/rename_debug.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 @@ -141,9 +141,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) @@ -240,18 +240,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -265,7 +265,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; @@ -329,7 +329,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; @@ -389,6 +389,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; @@ -462,11 +464,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 @@ -525,7 +526,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) @@ -606,7 +607,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; @@ -652,9 +653,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) @@ -679,7 +689,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) @@ -695,7 +705,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) @@ -730,7 +740,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) @@ -752,7 +762,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -821,7 +831,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); } @@ -975,12 +985,11 @@ yyreduce: } 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 @@ -1007,7 +1016,7 @@ yyreduce: } #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; @@ -1042,7 +1051,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) diff --git a/test/btyacc/varsyntax_calc1.tab.c b/test/btyacc/varsyntax_calc1.tab.c index 4a35a06f403c..16422a96f8ae 100644 --- a/test/btyacc/varsyntax_calc1.tab.c +++ b/test/btyacc/varsyntax_calc1.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 @@ -144,13 +144,13 @@ int dcheck(INTERVAL); double dreg[26]; INTERVAL vreg[26]; -#line 32 "varsyntax_calc1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 32 "varsyntax_calc1.y" typedef union { int ival; /* dreg & vreg array index values*/ @@ -452,9 +452,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) @@ -656,18 +656,18 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif -#include /* needed for malloc, etc */ -#include /* needed for memset */ +#include /* needed for malloc, etc */ +#include /* 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; @@ -681,7 +681,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; @@ -745,7 +745,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; @@ -805,6 +805,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; @@ -878,11 +880,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 @@ -941,7 +942,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) @@ -1022,7 +1023,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; @@ -1068,9 +1069,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) @@ -1095,7 +1105,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) @@ -1111,7 +1121,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) @@ -1146,7 +1156,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) @@ -1168,7 +1178,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1237,7 +1247,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); } @@ -1467,7 +1477,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1471 "varsyntax_calc1.tab.c" +#line 1481 "varsyntax_calc1.tab.c" default: break; } @@ -1555,12 +1565,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 @@ -1587,7 +1596,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; @@ -1622,7 +1631,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) diff --git a/test/code_calc.y b/test/code_calc.y index 0a99456e7f89..6947b74e1750 100644 --- a/test/code_calc.y +++ b/test/code_calc.y @@ -1,3 +1,5 @@ +%token-table + %{ # include # include diff --git a/test/err_inherit4.y b/test/err_inherit4.y index ed788d12c83b..8e9aeb9fe6ed 100644 --- a/test/err_inherit4.y +++ b/test/err_inherit4.y @@ -50,9 +50,9 @@ extern symbol *mksymbol(type t, class c, name id); %% declaration: class type namelist($1, $2) - { $$ = $3; } + { $$ = $3; @$ = @3; } | type locnamelist($1) - { $$ = $2; } + { $$ = $2; @$ = @-1; } ; class : GLOBAL { $$ = cGLOBAL; } diff --git a/test/run_make.sh b/test/run_make.sh index 218a7c52cdc4..3035eb4274e6 100755 --- a/test/run_make.sh +++ b/test/run_make.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: run_make.sh,v 1.14 2014/04/06 17:50:57 tom Exp $ +# $Id: run_make.sh,v 1.15 2016/06/01 22:56:37 Tom.Shields Exp $ # vi:ts=4 sw=4: # do a test-compile on each of the ".c" files in the test-directory @@ -43,7 +43,8 @@ echo "** test-files in $REF_DIR" for input in ${REF_DIR}/*.c do case $input in #(vi - ${REF_DIR}/err_*) + ${REF_DIR}/err_*|\ + ${REF_DIR}/test-err_*) continue ;; esac @@ -72,11 +73,17 @@ then do test -f "$input" || continue case $input in - ${TEST_DIR}/err_*) + ${TEST_DIR}/err_*|\ + ${TEST_DIR}/test-err_*) + continue + ;; + ${TEST_DIR}/ok_syntax*|\ + ${TEST_DIR}/varsyntax*) + # Bison does not support all byacc legacy syntax continue ;; ${TEST_DIR}/btyacc_*) - # Bison does not support the btyacc []-action extension. + # Bison does not support the btyacc []-action & inherited attribute extensions. continue ;; esac @@ -99,7 +106,7 @@ then sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y - bison -y run_make.y + bison -Wno-other -Wno-conflicts-sr -Wconflicts-rr -y run_make.y if test -f "y.tab.c" then sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c diff --git a/test/yacc/calc.tab.c b/test/yacc/calc.tab.c index 762dfa182e2d..6ce2cd43b1f7 100644 --- a/test/yacc/calc.tab.c +++ b/test/yacc/calc.tab.c @@ -353,7 +353,7 @@ yylex(void) #line 354 "calc.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -425,6 +425,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -444,28 +446,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -473,18 +473,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -494,18 +493,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -530,7 +526,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -546,10 +542,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -612,7 +609,7 @@ case 18: #line 63 "calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 616 "calc.tab.c" +#line 613 "calc.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -630,11 +627,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -643,8 +641,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -653,10 +651,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/calc1.tab.c b/test/yacc/calc1.tab.c index 7a5f925f9149..0da4fde2944c 100644 --- a/test/yacc/calc1.tab.c +++ b/test/yacc/calc1.tab.c @@ -123,13 +123,13 @@ int dcheck(INTERVAL); double dreg[26]; INTERVAL vreg[26]; -#line 31 "calc1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 31 "calc1.y" typedef union { int ival; @@ -490,7 +490,7 @@ vdiv(double a, double b, INTERVAL v) #line 491 "calc1.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -562,6 +562,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -581,28 +583,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -610,18 +610,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -631,18 +630,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -667,7 +663,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -683,10 +679,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -852,7 +849,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 856 "calc1.tab.c" +#line 853 "calc1.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -870,11 +867,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -883,8 +881,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -893,10 +891,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/calc2.tab.c b/test/yacc/calc2.tab.c index dc82b8e25673..8c82aa830cc6 100644 --- a/test/yacc/calc2.tab.c +++ b/test/yacc/calc2.tab.c @@ -366,7 +366,7 @@ YYLEX_DECL() #line 367 "calc2.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -438,6 +438,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -457,28 +459,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -486,18 +486,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -507,18 +506,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -543,7 +539,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -559,10 +555,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -625,7 +622,7 @@ case 18: #line 70 "calc2.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 629 "calc2.tab.c" +#line 626 "calc2.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -643,11 +640,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -656,8 +654,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -666,10 +664,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/calc3.tab.c b/test/yacc/calc3.tab.c index d13bc1afb68a..839f5700a3a4 100644 --- a/test/yacc/calc3.tab.c +++ b/test/yacc/calc3.tab.c @@ -364,7 +364,7 @@ YYLEX_DECL() #line 365 "calc3.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -443,6 +443,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -462,28 +464,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -491,18 +491,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -512,18 +511,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -548,7 +544,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -564,10 +560,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -630,7 +627,7 @@ case 18: #line 73 "calc3.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 634 "calc3.tab.c" +#line 631 "calc3.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -648,11 +645,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -661,8 +659,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -671,10 +669,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/code_calc.code.c b/test/yacc/code_calc.code.c index 43291db28c4d..2c04715f57b5 100644 --- a/test/yacc/code_calc.code.c +++ b/test/yacc/code_calc.code.c @@ -97,7 +97,7 @@ #define YYPURE 0 -#line 2 "code_calc.y" +#line 4 "code_calc.y" # include # include @@ -150,6 +150,8 @@ typedef int YYSTYPE; #define LETTER 258 #define UMINUS 259 #define YYERRCODE 256 +#undef yytname +#define yytname yyname #define YYTABLESIZE 220 #define YYFINAL 1 #ifndef YYDEBUG @@ -171,8 +173,10 @@ extern YYINT yygindex[]; extern YYINT yytable[]; extern YYINT yycheck[]; -#if YYDEBUG +#if YYDEBUG || defined(yytname) extern char *yyname[]; +#endif +#if YYDEBUG extern char *yyrule[]; #endif @@ -209,7 +213,7 @@ typedef struct { } YYSTACKDATA; /* variables for the parser stack */ static YYSTACKDATA yystack; -#line 68 "code_calc.y" +#line 70 "code_calc.y" /* start of programs */ #ifdef YYBYACC @@ -255,10 +259,10 @@ yylex(void) } return( c ); } -#line 259 "code_calc.code.c" +#line 263 "code_calc.code.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -330,6 +334,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -349,28 +355,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -378,18 +382,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -399,18 +402,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -435,7 +435,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -451,73 +451,74 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: -#line 30 "code_calc.y" +#line 32 "code_calc.y" { yyerrok ; } break; case 4: -#line 34 "code_calc.y" +#line 36 "code_calc.y" { printf("%d\n",yystack.l_mark[0]);} break; case 5: -#line 36 "code_calc.y" +#line 38 "code_calc.y" { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; } break; case 6: -#line 40 "code_calc.y" +#line 42 "code_calc.y" { yyval = yystack.l_mark[-1]; } break; case 7: -#line 42 "code_calc.y" +#line 44 "code_calc.y" { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; } break; case 8: -#line 44 "code_calc.y" +#line 46 "code_calc.y" { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; } break; case 9: -#line 46 "code_calc.y" +#line 48 "code_calc.y" { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; } break; case 10: -#line 48 "code_calc.y" +#line 50 "code_calc.y" { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; } break; case 11: -#line 50 "code_calc.y" +#line 52 "code_calc.y" { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; } break; case 12: -#line 52 "code_calc.y" +#line 54 "code_calc.y" { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; } break; case 13: -#line 54 "code_calc.y" +#line 56 "code_calc.y" { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; } break; case 14: -#line 56 "code_calc.y" +#line 58 "code_calc.y" { yyval = - yystack.l_mark[0]; } break; case 15: -#line 58 "code_calc.y" +#line 60 "code_calc.y" { yyval = regs[yystack.l_mark[0]]; } break; case 17: -#line 63 "code_calc.y" +#line 65 "code_calc.y" { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; } break; case 18: -#line 65 "code_calc.y" +#line 67 "code_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 521 "code_calc.code.c" +#line 522 "code_calc.code.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -535,11 +536,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -548,8 +550,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -558,10 +560,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/code_calc.tab.c b/test/yacc/code_calc.tab.c index e72fa8421c4e..df3b4525c9e6 100644 --- a/test/yacc/code_calc.tab.c +++ b/test/yacc/code_calc.tab.c @@ -82,7 +82,6 @@ const YYINT calc_check[] = { 40, #ifndef YYDEBUG #define YYDEBUG 0 #endif -#if YYDEBUG const char *const calc_name[] = { "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -94,6 +93,7 @@ const char *const calc_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,"DIGIT","LETTER","UMINUS",0,0,0,0,0,"illegal-symbol", }; +#if YYDEBUG const char *const calc_rule[] = { "$accept : list", "list :", diff --git a/test/yacc/code_calc.tab.h b/test/yacc/code_calc.tab.h index 19211182d6b3..b0bcb16dc450 100644 --- a/test/yacc/code_calc.tab.h +++ b/test/yacc/code_calc.tab.h @@ -1,3 +1,5 @@ #define DIGIT 257 #define LETTER 258 #define UMINUS 259 +#undef yytname +#define yytname yyname diff --git a/test/yacc/code_error.code.c b/test/yacc/code_error.code.c index 38d3e5866b38..a22464c403f2 100644 --- a/test/yacc/code_error.code.c +++ b/test/yacc/code_error.code.c @@ -163,8 +163,10 @@ extern YYINT yygindex[]; extern YYINT yytable[]; extern YYINT yycheck[]; -#if YYDEBUG +#if YYDEBUG || defined(yytname) extern char *yyname[]; +#endif +#if YYDEBUG extern char *yyrule[]; #endif @@ -227,10 +229,10 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 231 "code_error.code.c" +#line 233 "code_error.code.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -302,6 +304,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -321,28 +325,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -350,18 +352,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -371,18 +372,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -407,7 +405,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -423,10 +421,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { } @@ -446,11 +445,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -459,8 +459,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -469,10 +469,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/empty.tab.c b/test/yacc/empty.tab.c index da0c4be7a221..465a0a3cd157 100644 --- a/test/yacc/empty.tab.c +++ b/test/yacc/empty.tab.c @@ -243,7 +243,7 @@ YYERROR_DECL() { #line 244 "empty.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -315,6 +315,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -334,28 +336,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -363,18 +363,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -384,18 +383,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -420,7 +416,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -436,10 +432,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { } @@ -459,11 +456,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -472,8 +470,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -482,10 +480,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/err_syntax10.tab.c b/test/yacc/err_syntax10.tab.c index a3b450960efc..bbfe2e652890 100644 --- a/test/yacc/err_syntax10.tab.c +++ b/test/yacc/err_syntax10.tab.c @@ -242,7 +242,7 @@ yyerror(const char* s) #line 243 "err_syntax10.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -314,6 +314,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -333,28 +335,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -362,18 +362,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -383,18 +382,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -419,7 +415,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -435,10 +431,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { } @@ -458,11 +455,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -471,8 +469,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -481,10 +479,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/err_syntax11.tab.c b/test/yacc/err_syntax11.tab.c index ebb065f4589a..4da7c62ac9e0 100644 --- a/test/yacc/err_syntax11.tab.c +++ b/test/yacc/err_syntax11.tab.c @@ -248,7 +248,7 @@ yyerror(const char* s) #line 249 "err_syntax11.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -320,6 +320,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -339,28 +341,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -368,18 +368,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -389,18 +388,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -425,7 +421,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -441,10 +437,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { } @@ -464,11 +461,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -477,8 +475,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -487,10 +485,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/err_syntax12.tab.c b/test/yacc/err_syntax12.tab.c index 784a45ffe908..af33ee2be1b5 100644 --- a/test/yacc/err_syntax12.tab.c +++ b/test/yacc/err_syntax12.tab.c @@ -254,7 +254,7 @@ yyerror(const char* s) #line 255 "err_syntax12.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -326,6 +326,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -345,28 +347,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -374,18 +374,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -395,18 +394,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -431,7 +427,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -447,10 +443,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { } @@ -470,11 +467,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -483,8 +481,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -493,10 +491,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/err_syntax18.tab.c b/test/yacc/err_syntax18.tab.c index fb7b06c40cf3..15f7a7a083a2 100644 --- a/test/yacc/err_syntax18.tab.c +++ b/test/yacc/err_syntax18.tab.c @@ -250,7 +250,7 @@ yyerror(const char* s) #line 251 "err_syntax18.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -322,6 +322,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -341,28 +343,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -370,18 +370,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -391,18 +390,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -427,7 +423,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -443,17 +439,18 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 1: #line 9 "err_syntax18.y" { yyval = yystack.l_mark[1]; } break; -#line 457 "err_syntax18.tab.c" +#line 454 "err_syntax18.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -471,11 +468,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -484,8 +482,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -494,10 +492,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/err_syntax20.tab.c b/test/yacc/err_syntax20.tab.c index 85ea1ba908e1..526addee8c69 100644 --- a/test/yacc/err_syntax20.tab.c +++ b/test/yacc/err_syntax20.tab.c @@ -246,7 +246,7 @@ yyerror(const char* s) #line 247 "err_syntax20.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -318,6 +318,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -337,28 +339,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -366,18 +366,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -387,18 +386,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -423,7 +419,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -439,17 +435,18 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 1: #line 12 "err_syntax20.y" { yystack.l_mark[-1].rechk = 3; } break; -#line 453 "err_syntax20.tab.c" +#line 450 "err_syntax20.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -467,11 +464,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -480,8 +478,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -490,10 +488,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/err_syntax24.error b/test/yacc/err_syntax24.error index c1538898ce0b..e8bbfeca35f3 100644 --- a/test/yacc/err_syntax24.error +++ b/test/yacc/err_syntax24.error @@ -1,2 +1,2 @@ -YACC: w - line 21 of "./err_syntax24.y", the default action assigns an undefined value to $$ +YACC: w - line 21 of "./err_syntax24.y", the default action for expr assigns an undefined value to $$ YACC: e - line 22 of "./err_syntax24.y", $$ is untyped diff --git a/test/yacc/error.tab.c b/test/yacc/error.tab.c index e7aa39508c42..47a39d8c1313 100644 --- a/test/yacc/error.tab.c +++ b/test/yacc/error.tab.c @@ -248,7 +248,7 @@ yyerror(const char* s) #line 249 "error.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -320,6 +320,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -339,28 +341,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -368,18 +368,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -389,18 +388,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -425,7 +421,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -441,10 +437,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { } @@ -464,11 +461,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -477,8 +475,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -487,10 +485,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/grammar.tab.c b/test/yacc/grammar.tab.c index e78f1881512c..c4aee12618f2 100644 --- a/test/yacc/grammar.tab.c +++ b/test/yacc/grammar.tab.c @@ -1091,7 +1091,7 @@ free_parser(void) #line 1092 "grammar.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -1163,6 +1163,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -1182,28 +1184,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -1211,18 +1211,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -1232,18 +1231,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -1268,7 +1264,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -1284,10 +1280,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 10: @@ -1964,7 +1961,7 @@ case 114: yyval.declarator->func_def = FUNC_ANSI; } break; -#line 1968 "grammar.tab.c" +#line 1965 "grammar.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -1982,11 +1979,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -1995,8 +1993,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -2005,10 +2003,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/ok_syntax1.tab.c b/test/yacc/ok_syntax1.tab.c index 94d67d93bd93..d338dc101303 100644 --- a/test/yacc/ok_syntax1.tab.c +++ b/test/yacc/ok_syntax1.tab.c @@ -110,13 +110,13 @@ int YYLEX_DECL(); static void YYERROR_DECL(); #endif -#line 43 "ok_syntax1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 43 "ok_syntax1.y" typedef union { char * cval; @@ -388,7 +388,7 @@ YYLEX_DECL() #line 389 "ok_syntax1.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -467,6 +467,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -486,28 +488,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -515,18 +515,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -536,18 +535,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -572,7 +568,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -588,10 +584,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -654,7 +651,7 @@ case 18: #line 101 "ok_syntax1.y" { yyval.ival = (*base) * yystack.l_mark[-1].ival + yystack.l_mark[0].ival; } break; -#line 658 "ok_syntax1.tab.c" +#line 655 "ok_syntax1.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -672,11 +669,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -685,8 +683,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -695,10 +693,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/pure_calc.tab.c b/test/yacc/pure_calc.tab.c index 911db408e31a..7a5356df1ae0 100644 --- a/test/yacc/pure_calc.tab.c +++ b/test/yacc/pure_calc.tab.c @@ -360,7 +360,7 @@ YYLEX_DECL() #line 361 "pure_calc.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -439,6 +439,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -458,28 +460,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -487,18 +487,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -508,18 +507,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -544,7 +540,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -560,10 +556,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -626,7 +623,7 @@ case 18: #line 69 "pure_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 630 "pure_calc.tab.c" +#line 627 "pure_calc.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -644,11 +641,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -657,8 +655,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -667,10 +665,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/pure_error.tab.c b/test/yacc/pure_error.tab.c index 0184e924fabd..6c6ed424a2f5 100644 --- a/test/yacc/pure_error.tab.c +++ b/test/yacc/pure_error.tab.c @@ -257,7 +257,7 @@ yyerror(const char* s) #line 258 "pure_error.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -336,6 +336,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -355,28 +357,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -384,18 +384,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -405,18 +404,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -441,7 +437,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -457,10 +453,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { } @@ -480,11 +477,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -493,8 +491,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -503,10 +501,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/quote_calc-s.tab.c b/test/yacc/quote_calc-s.tab.c index 9d4d7bd5835d..fa8fd00bb4f8 100644 --- a/test/yacc/quote_calc-s.tab.c +++ b/test/yacc/quote_calc-s.tab.c @@ -368,7 +368,7 @@ yylex(void) { #line 369 "quote_calc-s.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -440,6 +440,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -459,28 +461,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -488,18 +488,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -509,18 +508,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -545,7 +541,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -561,10 +557,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -627,7 +624,7 @@ case 18: #line 70 "quote_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 631 "quote_calc-s.tab.c" +#line 628 "quote_calc-s.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -645,11 +642,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -658,8 +656,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -668,10 +666,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/quote_calc.tab.c b/test/yacc/quote_calc.tab.c index affdbe56db35..c6a1220140a0 100644 --- a/test/yacc/quote_calc.tab.c +++ b/test/yacc/quote_calc.tab.c @@ -374,7 +374,7 @@ yylex(void) { #line 375 "quote_calc.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -446,6 +446,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -465,28 +467,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -494,18 +494,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -515,18 +514,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -551,7 +547,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -567,10 +563,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -633,7 +630,7 @@ case 18: #line 70 "quote_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 637 "quote_calc.tab.c" +#line 634 "quote_calc.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -651,11 +648,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -664,8 +662,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -674,10 +672,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/quote_calc2-s.tab.c b/test/yacc/quote_calc2-s.tab.c index 47b8fd0d3b15..505200e99fc0 100644 --- a/test/yacc/quote_calc2-s.tab.c +++ b/test/yacc/quote_calc2-s.tab.c @@ -368,7 +368,7 @@ yylex(void) { #line 369 "quote_calc2-s.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -440,6 +440,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -459,28 +461,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -488,18 +488,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -509,18 +508,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -545,7 +541,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -561,10 +557,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -627,7 +624,7 @@ case 18: #line 70 "quote_calc2.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 631 "quote_calc2-s.tab.c" +#line 628 "quote_calc2-s.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -645,11 +642,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -658,8 +656,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -668,10 +666,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/quote_calc2.tab.c b/test/yacc/quote_calc2.tab.c index cdf8171f02e4..3ff3dd19aedc 100644 --- a/test/yacc/quote_calc2.tab.c +++ b/test/yacc/quote_calc2.tab.c @@ -374,7 +374,7 @@ yylex(void) { #line 375 "quote_calc2.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -446,6 +446,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -465,28 +467,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -494,18 +494,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -515,18 +514,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -551,7 +547,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -567,10 +563,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -633,7 +630,7 @@ case 18: #line 70 "quote_calc2.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 637 "quote_calc2.tab.c" +#line 634 "quote_calc2.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -651,11 +648,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -664,8 +662,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -674,10 +672,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/quote_calc3-s.tab.c b/test/yacc/quote_calc3-s.tab.c index b91c1a14a022..1132ea37ea24 100644 --- a/test/yacc/quote_calc3-s.tab.c +++ b/test/yacc/quote_calc3-s.tab.c @@ -369,7 +369,7 @@ yylex(void) { #line 370 "quote_calc3-s.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -441,6 +441,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -460,28 +462,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -489,18 +489,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -510,18 +509,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -546,7 +542,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -562,10 +558,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -628,7 +625,7 @@ case 18: #line 70 "quote_calc3.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 632 "quote_calc3-s.tab.c" +#line 629 "quote_calc3-s.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -646,11 +643,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -659,8 +657,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -669,10 +667,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/quote_calc3.tab.c b/test/yacc/quote_calc3.tab.c index ad4fe1ae6bf3..aff287b97af5 100644 --- a/test/yacc/quote_calc3.tab.c +++ b/test/yacc/quote_calc3.tab.c @@ -369,7 +369,7 @@ yylex(void) { #line 370 "quote_calc3.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -441,6 +441,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -460,28 +462,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -489,18 +489,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -510,18 +509,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -546,7 +542,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -562,10 +558,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -628,7 +625,7 @@ case 18: #line 70 "quote_calc3.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 632 "quote_calc3.tab.c" +#line 629 "quote_calc3.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -646,11 +643,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -659,8 +657,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -669,10 +667,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/quote_calc4-s.tab.c b/test/yacc/quote_calc4-s.tab.c index 4d1e3d4376f3..16a0ebe14707 100644 --- a/test/yacc/quote_calc4-s.tab.c +++ b/test/yacc/quote_calc4-s.tab.c @@ -369,7 +369,7 @@ yylex(void) { #line 370 "quote_calc4-s.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -441,6 +441,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -460,28 +462,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -489,18 +489,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -510,18 +509,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -546,7 +542,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -562,10 +558,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -628,7 +625,7 @@ case 18: #line 70 "quote_calc4.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 632 "quote_calc4-s.tab.c" +#line 629 "quote_calc4-s.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -646,11 +643,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -659,8 +657,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -669,10 +667,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/quote_calc4.tab.c b/test/yacc/quote_calc4.tab.c index a5f047ec8d3e..e442e1b6c50f 100644 --- a/test/yacc/quote_calc4.tab.c +++ b/test/yacc/quote_calc4.tab.c @@ -369,7 +369,7 @@ yylex(void) { #line 370 "quote_calc4.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -441,6 +441,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -460,28 +462,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -489,18 +489,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -510,18 +509,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -546,7 +542,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -562,10 +558,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -628,7 +625,7 @@ case 18: #line 70 "quote_calc4.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 632 "quote_calc4.tab.c" +#line 629 "quote_calc4.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -646,11 +643,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -659,8 +657,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -669,10 +667,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/rename_debug.c b/test/yacc/rename_debug.c index 5202074113c3..e94d21619b6b 100644 --- a/test/yacc/rename_debug.c +++ b/test/yacc/rename_debug.c @@ -128,7 +128,7 @@ yyerror(const char* s) #line 130 "rename_debug.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -200,6 +200,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -219,28 +221,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -248,18 +248,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -269,18 +268,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -305,7 +301,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -321,10 +317,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { } @@ -344,11 +341,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -357,8 +355,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -367,10 +365,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/test/yacc/varsyntax_calc1.tab.c b/test/yacc/varsyntax_calc1.tab.c index 49a1527817c7..fe78c83d0327 100644 --- a/test/yacc/varsyntax_calc1.tab.c +++ b/test/yacc/varsyntax_calc1.tab.c @@ -124,13 +124,13 @@ int dcheck(INTERVAL); double dreg[26]; INTERVAL vreg[26]; -#line 32 "varsyntax_calc1.y" #ifdef YYSTYPE #undef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYSTYPE_IS_DECLARED #define YYSTYPE_IS_DECLARED 1 +#line 32 "varsyntax_calc1.y" typedef union { int ival; /* dreg & vreg array index values*/ @@ -491,7 +491,7 @@ vdiv(double a, double b, INTERVAL v) #line 492 "varsyntax_calc1.tab.c" #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -563,6 +563,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -582,28 +584,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -611,18 +611,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -632,18 +631,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -668,7 +664,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -684,10 +680,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { case 3: @@ -853,7 +850,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 857 "varsyntax_calc1.tab.c" +#line 854 "varsyntax_calc1.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -871,11 +868,12 @@ break; *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -884,8 +882,8 @@ break; if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -894,10 +892,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop; diff --git a/verbose.c b/verbose.c index b4e110212abf..1135e8f17421 100644 --- a/verbose.c +++ b/verbose.c @@ -1,4 +1,4 @@ -/* $Id: verbose.c,v 1.11 2014/04/01 23:15:59 Tom.Shields Exp $ */ +/* $Id: verbose.c,v 1.12 2016/06/07 00:22:05 tom Exp $ */ #include "defs.h" @@ -230,7 +230,7 @@ print_nulls(int state) else if (i != null_rules[j]) { ++nnulls; - for (k = (Value_t) (nnulls - 1); k > j; --k) + for (k = (Value_t)(nnulls - 1); k > j; --k) null_rules[k] = null_rules[k - 1]; null_rules[j] = i; } diff --git a/yaccpar.c b/yaccpar.c index 717d735defc4..a77a5394a78a 100644 --- a/yaccpar.c +++ b/yaccpar.c @@ -2,7 +2,7 @@ * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @ */ -/* @Id: yaccpar.skel,v 1.5 2014/04/07 21:51:00 tom Exp @ */ +/* @Id: yaccpar.skel,v 1.7 2016/06/06 23:35:55 Tom.Shields Exp @ */ #include "defs.h" @@ -55,8 +55,10 @@ const char *const tables[] = "extern YYINT yytable[];", "extern YYINT yycheck[];", "", - "#if YYDEBUG", + "#if YYDEBUG || defined(yytname)", "extern char *yyname[];", + "#endif", + "#if YYDEBUG", "extern char *yyrule[];", "#endif", 0 @@ -132,7 +134,7 @@ const char *const body_1[] = { "", "#if YYDEBUG", - "#include /* needed for printf */", + "#include /* needed for printf */", "#endif", "", "#include /* needed for malloc, etc */", @@ -209,6 +211,8 @@ const char *const body_2[] = " }", "#endif", "", + " yym = 0;", + " yyn = 0;", " yynerrs = 0;", " yyerrflag = 0;", " yychar = YYEMPTY;", @@ -228,28 +232,26 @@ const char *const body_2[] = " if ((yyn = yydefred[yystate]) != 0) goto yyreduce;", " if (yychar < 0)", " {", - " if ((yychar = YYLEX) < 0) yychar = YYEOF;", + " yychar = YYLEX;", + " if (yychar < 0) yychar = YYEOF;", "#if YYDEBUG", " if (yydebug)", " {", - " yys = yyname[YYTRANSLATE(yychar)];", + " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", " 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", " {", "#if YYDEBUG", " if (yydebug)", " printf(\"%sdebug: state %d, shifting to state %d\\n\",", " YYPREFIX, yystate, yytable[yyn]);", "#endif", - " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)", - " {", - " goto yyoverflow;", - " }", + " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", " yystate = yytable[yyn];", " *++yystack.s_mark = yytable[yyn];", " *++yystack.l_mark = yylval;", @@ -257,18 +259,17 @@ const char *const body_2[] = " if (yyerrflag > 0) --yyerrflag;", " goto yyloop;", " }", - " if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&", - " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)", + " if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", " {", " yyn = yytable[yyn];", " goto yyreduce;", " }", - " if (yyerrflag) goto yyinrecovery;", + " if (yyerrflag != 0) goto yyinrecovery;", "", " YYERROR_CALL(\"syntax error\");", "", - " goto yyerrlab;", - "", + " goto yyerrlab; /* redundant goto avoids 'unused label' warning */", "yyerrlab:", " ++yynerrs;", "", @@ -278,18 +279,15 @@ const char *const body_2[] = " yyerrflag = 3;", " for (;;)", " {", - " if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&", - " yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)", + " if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)", " {", "#if YYDEBUG", " if (yydebug)", " printf(\"%sdebug: state %d, error recovery shifting\\", " to state %d\\n\", YYPREFIX, *yystack.s_mark, yytable[yyn]);", "#endif", - " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)", - " {", - " goto yyoverflow;", - " }", + " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", " yystate = yytable[yyn];", " *++yystack.s_mark = yytable[yyn];", " *++yystack.l_mark = yylval;", @@ -314,7 +312,7 @@ const char *const body_2[] = "#if YYDEBUG", " if (yydebug)", " {", - " yys = yyname[YYTRANSLATE(yychar)];", + " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", " printf(\"%sdebug: state %d, error recovery discards token %d (%s)\\n\",", " YYPREFIX, yystate, yychar, yys);", " }", @@ -330,10 +328,11 @@ const char *const body_2[] = " YYPREFIX, yystate, yyn, yyrule[yyn]);", "#endif", " yym = yylen[yyn];", - " if (yym)", + " if (yym > 0)", " yyval = yystack.l_mark[1-yym];", " else", " memset(&yyval, 0, sizeof yyval);", + "", " switch (yyn)", " {", 0 @@ -358,11 +357,12 @@ const char *const trailer[] = " *++yystack.l_mark = yyval;", " if (yychar < 0)", " {", - " if ((yychar = YYLEX) < 0) yychar = YYEOF;", + " yychar = YYLEX;", + " if (yychar < 0) yychar = YYEOF;", "#if YYDEBUG", " if (yydebug)", " {", - " yys = yyname[YYTRANSLATE(yychar)];", + " if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];", " printf(\"%sdebug: state %d, reading %d (%s)\\n\",", " YYPREFIX, YYFINAL, yychar, yys);", " }", @@ -371,8 +371,8 @@ const char *const trailer[] = " if (yychar == YYEOF) goto yyaccept;", " goto yyloop;", " }", - " if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&", - " yyn <= YYTABLESIZE && yycheck[yyn] == yystate)", + " if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)", " yystate = yytable[yyn];", " else", " yystate = yydgoto[yym];", @@ -381,10 +381,7 @@ const char *const trailer[] = " printf(\"%sdebug: after reduction, shifting from state %d \\", "to state %d\\n\", YYPREFIX, *yystack.s_mark, yystate);", "#endif", - " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)", - " {", - " goto yyoverflow;", - " }", + " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", " *++yystack.s_mark = (YYINT) yystate;", " *++yystack.l_mark = yyval;", " goto yyloop;", diff --git a/yaccpar.skel b/yaccpar.skel index 030cfa262d41..3148ef58850d 100644 --- a/yaccpar.skel +++ b/yaccpar.skel @@ -1,4 +1,4 @@ -/* $Id: yaccpar.skel,v 1.5 2014/04/07 21:51:00 tom Exp $ */ +/* $Id: yaccpar.skel,v 1.7 2016/06/06 23:35:55 Tom.Shields Exp $ */ #include "defs.h" @@ -38,8 +38,10 @@ extern YYINT yygindex[]; extern YYINT yytable[]; extern YYINT yycheck[]; -#if YYDEBUG +#if YYDEBUG || defined(yytname) extern char *yyname[]; +#endif +#if YYDEBUG extern char *yyrule[]; #endif %% global_vars @@ -91,7 +93,7 @@ static YYSTACKDATA yystack; %% body_1 #if YYDEBUG -#include /* needed for printf */ +#include /* needed for printf */ #endif #include /* needed for malloc, etc */ @@ -164,6 +166,8 @@ YYPARSE_DECL() } #endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -183,28 +187,26 @@ yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 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 (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -212,18 +214,17 @@ yyloop: if (yyerrflag > 0) --yyerrflag; goto yyloop; } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) { yyn = yytable[yyn]; goto yyreduce; } - if (yyerrflag) goto yyinrecovery; + if (yyerrflag != 0) goto yyinrecovery; YYERROR_CALL("syntax error"); - goto yyerrlab; - + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: ++yynerrs; @@ -233,18 +234,15 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; yystate = yytable[yyn]; *++yystack.s_mark = yytable[yyn]; *++yystack.l_mark = yylval; @@ -269,7 +267,7 @@ yyinrecovery: #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -285,10 +283,11 @@ yyreduce: YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; - if (yym) + if (yym > 0) yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); + switch (yyn) { %% trailer @@ -309,11 +308,12 @@ yyreduce: *++yystack.l_mark = yyval; if (yychar < 0) { - if ((yychar = YYLEX) < 0) yychar = YYEOF; + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; #if YYDEBUG if (yydebug) { - yys = yyname[YYTRANSLATE(yychar)]; + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } @@ -322,8 +322,8 @@ yyreduce: if (yychar == YYEOF) goto yyaccept; goto yyloop; } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; @@ -332,10 +332,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) - { - goto yyoverflow; - } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; *++yystack.s_mark = (YYINT) yystate; *++yystack.l_mark = yyval; goto yyloop;