diff options
author | delphij <delphij@FreeBSD.org> | 2017-05-31 08:21:16 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2017-05-31 08:21:16 +0000 |
commit | ebde5e121d6228ad0236e234d952228d9651156e (patch) | |
tree | dc7631750a28ff8213ead124c7db594beffb34d4 /contrib/byacc | |
parent | 63ce6c6ed7ded8474151f6fc6ebaf88434cc06bd (diff) | |
download | FreeBSD-src-ebde5e121d6228ad0236e234d952228d9651156e.zip FreeBSD-src-ebde5e121d6228ad0236e234d952228d9651156e.tar.gz |
MFC r306691,310036:
Merge byacc 20161202.
Diffstat (limited to 'contrib/byacc')
135 files changed, 5441 insertions, 4656 deletions
diff --git a/contrib/byacc/CHANGES b/contrib/byacc/CHANGES index 1c3f442..cef17ea 100644 --- a/contrib/byacc/CHANGES +++ b/contrib/byacc/CHANGES @@ -1,4 +1,202 @@ -2016-03-24 Thomas E. Dickey <tom@invisible-island.net> +2016-12-02 Thomas E. Dickey <dickey@invisible-island.net> + + * test/btyacc/quote_calc4-s.tab.c, test/btyacc/varsyntax_calc1.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.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.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/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/rename_debug.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, btyaccpar.c: + regen + + * btyaccpar.skel: changes from NetBSD + + use YYINT rather than short in btyaccpar.skel + (some of this had already been done by Tom Shields) + + remove some casts of malloc/realloc + + * yaccpar.c, yaccpar.skel, output.c: changes from NetBSD + - Add some more bison stuff to make the mesa/gallium parser work: + %initial-action (add missing source struct member in location) + %debug (unimplemented) + %error-verbose (unimplemented) + + This changes some existing code: + + yylloc is now a pointer, so + + the first parameter to YYERROR_DECL() is a pointer + + struct YYLTYPE now has a "source" field + + * test/btyacc/btyacc_demo.tab.h, test/btyacc/code_calc.tab.c, test/btyacc/code_error.tab.c, test/btyacc/err_inherit4.tab.h: + regen + + * btyaccpar.c, btyaccpar.skel, reader.c: changes from NetBSD + - Add some more bison stuff to make the mesa/gallium parser work: + %initial-action (add missing source struct member in location) + %debug (unimplemented) + %error-verbose (unimplemented) + + This changes some existing code: + + yylloc is now a pointer, so + + the first parameter to YYERROR_DECL() is a pointer + + struct YYLTYPE now has a "source" field + + * reader.c: + fix from NetBSD: correct off-by-one when adding a null in copy_param() + + * reader.c: adapted from NetBSD + - Convert *most* error fingerprints to: + -unterminated_arglist(int a_lineno, char *a_line, char *a_cptr) + +unterminated_arglist(const struct ainfo *a) + - Cast new <ctype.h> args to unsigned char + + * defs.h: changes from NetBSD + - Add some more bison stuff to make the mesa/gallium parser work: + %initial-action (add missing source struct member in location) + %debug (unimplemented) + %error-verbose (unimplemented) + + This changes some existing code: + + yylloc is now a pointer, so + + the first parameter to YYERROR_DECL() is a pointer + + struct YYLTYPE now has a "source" field + + * defs.h: adapted from NetBSD + - Convert *most* error fingerprints to: + -unterminated_arglist(int a_lineno, char *a_line, char *a_cptr) + +unterminated_arglist(const struct ainfo *a) + - Cast new <ctype.h> args to unsigned char + + * main.c: changes from NetBSD + - Add some more bison stuff to make the mesa/gallium parser work: + %initial-action (add missing source struct member in location) + %debug (unimplemented) + %error-verbose (unimplemented) + + This changes some existing code: + + yylloc is now a pointer, so + + the first parameter to YYERROR_DECL() is a pointer + + struct YYLTYPE now has a "source" field + + * error.c: adapted from NetBSD + - Convert *most* error fingerprints to: + -unterminated_arglist(int a_lineno, char *a_line, char *a_cptr) + +unterminated_arglist(const struct ainfo *a) + - Cast new <ctype.h> args to unsigned char + + * mstring.c: adapted change from NetBSD to add casts for ctype macros + + * test/btyacc/btyacc_demo.tab.h, test/btyacc/err_inherit4.tab.h: regen + + * output.c: reorder to eliminate a forward-reference + +2016-12-02 Tom.Shields + + * output.c: + modify output to enable compilation of a lexer generated by flex (using + "%option bison-bridge" and "%option bison-locations") to be used with a parser + generated by b(t)yacc (using directives "%locations" and "%pure-parser"). + +2016-12-02 Thomas E. Dickey <dickey@invisible-island.net> + + * configure: regen + + * aclocal.m4: Improved autoconf macros + CF_CC_ENV_FLAGS + + improve split between compiler and options, prompted by report where user + had "ccache" before the compiler + + leave non-preprocessor options in "$CC" (but still copy them to "$CFLAGS" + since that's where they should be) + CF_GNU_SOURCE,v + + recent glibc (Debian 2.23-4 for example) has misordered ifdef/checks for new + symbol _DEFAULT_SOURCE, producing warning messages when only _GNU_SOURCE is + defined. Add a followup check to define _DEFAULT_SOURCE. + CF_XOPEN_SOURCE + + add "uclinux" to list of Linux's (patch by Yann E. Morin) + + use _GNU_SOURCE for cygwin headers + + build-fixes for OS/2 + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + +2016-11-20 Thomas E. Dickey <dickey@invisible-island.net> + + * config.sub: 2016-11-19 + + * config.guess: 2016-10-02 + +2016-06-06 Thomas E. Dickey <dickey@invisible-island.net> + + * 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 <dickey@invisible-island.net> + + * 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 <dickey@invisible-island.net> + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + +2016-03-24 Thomas E. Dickey <dickey@invisible-island.net> * reader.c: unused variable @@ -11,7 +209,7 @@ the first occurrence of ".c" in the name in 2005-08-13 changes rather than at the end of the filename (patch by Jung-uk Kim) -2016-03-24 Thomas E. Dickey <tom@invisible-island.net> +2016-03-24 Thomas E. Dickey <dickey@invisible-island.net> * aclocal.m4: update CF_WITH_MAN2HTML to use configured shell rather than /bin/sh @@ -19,11 +217,11 @@ * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: bump -2016-01-25 Thomas E. Dickey <tom@invisible-island.net> +2016-01-25 Thomas E. Dickey <dickey@invisible-island.net> * config.guess, config.sub: 2016-01-01 -2015-07-10 Thomas E. Dickey <tom@invisible-island.net> +2015-07-10 Thomas E. Dickey <dickey@invisible-island.net> * lr0.c: fix a duplicate-free in the leak-checking @@ -38,7 +236,7 @@ make relationship with format/size clearer (prompted by discussion with Pedro Giffuni, Oliver Pinter) -2015-07-05 Thomas E. Dickey <tom@invisible-island.net> +2015-07-05 Thomas E. Dickey <dickey@invisible-island.net> * configure: regen @@ -52,13 +250,13 @@ * configure.in: add configure option --with-man2html -2015-05-02 Thomas E. Dickey <tom@invisible-island.net> +2015-05-02 Thomas E. Dickey <dickey@invisible-island.net> * config.guess: 2015-03-04 * config.sub: 2015-03-08 -2014-11-28 Thomas E. Dickey <tom@invisible-island.net> +2014-11-28 Thomas E. Dickey <dickey@invisible-island.net> * lr0.c: coverity #39181: memory leak @@ -80,7 +278,7 @@ Regards Jouk. -2014-10-06 Thomas E. Dickey <tom@invisible-island.net> +2014-10-06 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/source/format: change to native format to work around regression in Debian packaging. @@ -100,7 +298,7 @@ better fix for get_line, by ensuring there is enough space to null-terminate its result (prompted by discussion with Craig Rodrigues). -2014-10-05 Thomas E. Dickey <tom@invisible-island.net> +2014-10-05 Thomas E. Dickey <dickey@invisible-island.net> * main.c: make change to umask before calling mkstemp, as suggested in Coverity #56902 @@ -171,7 +369,7 @@ modify copy_param() to handle resulting comma-separated list. Before, it only expected a single parameter. -2014-10-04 Thomas E. Dickey <tom@invisible-island.net> +2014-10-04 Thomas E. Dickey <dickey@invisible-island.net> * reader.c: split-out save_param() from copy_param() @@ -192,28 +390,28 @@ * test/btyacc/btyacc_destroy3.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.error, test/btyacc/btyacc_destroy3.output, test/btyacc/btyacc_destroy3.tab.h, test/btyacc/btyacc_destroy2.error, test/btyacc/btyacc_destroy2.output, test/btyacc/btyacc_destroy2.tab.h: RCS_BASE -2014-10-03 Thomas E. Dickey <tom@invisible-island.net> +2014-10-03 Thomas E. Dickey <dickey@invisible-island.net> * test/btyacc/btyacc_demo2.error, test/btyacc/btyacc_demo2.output, test/btyacc/btyacc_demo2.tab.c, test/btyacc/btyacc_demo2.tab.h, test/btyacc/btyacc_destroy1.error, test/btyacc/btyacc_destroy1.output, test/btyacc/btyacc_destroy1.tab.h, test/btyacc_destroy3.y, test/btyacc_destroy1.y, test/btyacc_destroy2.y: RCS_BASE -2014-10-02 Thomas E. Dickey <tom@invisible-island.net> +2014-10-02 Thomas E. Dickey <dickey@invisible-island.net> * main.c, reader.c, defs.h: use calloc in get_line() when allocating line to ensure it is fully initialized, fixes a later uninitialized value in copy_param() (FreeBSD #193499). -2014-09-17 Thomas E. Dickey <tom@invisible-island.net> +2014-09-17 Thomas E. Dickey <dickey@invisible-island.net> * closure.c, lalr.c, output.c, defs.h: rephrase odd addressing to fix Coverity #48848, #38950, #38860, not actually a bug. -2014-09-01 Thomas E. Dickey <tom@invisible-island.net> +2014-09-01 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: update to 2014-07-28 -2014-07-27 Thomas E. Dickey <tom@invisible-island.net> +2014-07-27 Thomas E. Dickey <dickey@invisible-island.net> * configure: regen @@ -222,7 +420,7 @@ * package/pkgsrc/Makefile, VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec: bump -2014-07-15 Thomas E. Dickey <tom@invisible-island.net> +2014-07-15 Thomas E. Dickey <dickey@invisible-island.net> * aclocal.m4: resync with my-autoconf (no change to configure script) @@ -233,7 +431,7 @@ make top-level "make check" work again, by adding another step to filtering the test results. -2014-07-14 Thomas E. Dickey <tom@invisible-island.net> +2014-07-14 Thomas E. Dickey <dickey@invisible-island.net> * test/run_test.sh: changes from Garrett Cooper's patch: a) ensure that the script returns an error-code if there are differences @@ -252,12 +450,12 @@ * main.c: remove obsolete -D option from usage message -2014-05-27 Thomas E. Dickey <tom@invisible-island.net> +2014-05-27 Thomas E. Dickey <dickey@invisible-island.net> * VERSION, package/byacc.spec, package/debian/changelog, test/yacc/big_b.output, test/yacc/big_l.output, test/yacc/help.output, test/yacc/no_b_opt.output, test/yacc/no_output2.output, test/yacc/no_p_opt.output, test/yacc/nostdin.output: bump -2014-04-22 Thomas E. Dickey <tom@invisible-island.net> +2014-04-22 Thomas E. Dickey <dickey@invisible-island.net> * mstring.c: use vsnprintf() to ensure that msprintf's buffer is large enough. @@ -285,12 +483,12 @@ drop "NOTES-btyacc-Changes" and "NOTES-btyacc-Disposition", merging relevant content into README.BTYACC -2014-04-22 Thomas E. Dickey <tom@invisible-island.net> +2014-04-22 Thomas E. Dickey <dickey@invisible-island.net> * package/pkgsrc/Makefile, VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec: bump -2014-04-19 Thomas E. Dickey <tom@invisible-island.net> +2014-04-19 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: 2014-04-03 @@ -300,7 +498,7 @@ * main.c, defs.h: patch to allow DEBUG build with WIN32 system -2014-04-09 Thomas E. Dickey <tom@invisible-island.net> +2014-04-09 Thomas E. Dickey <dickey@invisible-island.net> * output.c, reader.c: gcc warnings @@ -341,7 +539,7 @@ * yacc.1: clarify relationship of btyacc features to default configuration. -2014-04-08 Thomas E. Dickey <tom@invisible-island.net> +2014-04-08 Thomas E. Dickey <dickey@invisible-island.net> * test/yacc/ok_syntax1.output, test/yacc/ok_syntax1.tab.c, test/yacc/ok_syntax1.tab.h, test/btyacc/ok_syntax1.output, test/btyacc/ok_syntax1.tab.c, test/btyacc/ok_syntax1.tab.h: reference output for testing @@ -364,7 +562,7 @@ * mstring.c: minor reformatting to make coverage analysis simpler -2014-04-07 Thomas E. Dickey <tom@invisible-island.net> +2014-04-07 Thomas E. Dickey <dickey@invisible-island.net> * test/run_test.sh: tidy @@ -399,7 +597,7 @@ YYPATCH #define's to make test-outputs easier to compare #line's (report by Tom Shields) -2014-04-06 Thomas E. Dickey <tom@invisible-island.net> +2014-04-06 Thomas E. Dickey <dickey@invisible-island.net> * reader.c: fix for valgrind (the calloc's are intentional - valgrind reported use of uninitialized memory) @@ -503,7 +701,7 @@ * test/run_make.sh: modify to avoid use of VPATH, which has no standard implementation -2014-04-05 Thomas E. Dickey <tom@invisible-island.net> +2014-04-05 Thomas E. Dickey <dickey@invisible-island.net> * test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.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/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.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/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/error.tab.c: discard a change which merged CountLines() with explicit comparisons against @@ -534,13 +732,13 @@ * test/btyacc_demo.y: fix prototypes -2014-04-04 Thomas E. Dickey <tom@invisible-island.net> +2014-04-04 Thomas E. Dickey <dickey@invisible-island.net> * reader.c, defs.h, main.c: more merging of Tom Shield's btyacc changes. In the merge, I moved the symbol_pval inside the btyacc ifdef's and added some more btyacc ifdefs -2014-04-03 Thomas E. Dickey <tom@invisible-island.net> +2014-04-03 Thomas E. Dickey <dickey@invisible-island.net> * reader.c: merge-in 3/4 of btyacc's changes, deferring those which change test-outputs. @@ -554,7 +752,7 @@ Some of the merge uses ifdef-changes which I applied to ongoing resync, e.g., the introduction of PER_STATE. -2014-04-02 Thomas E. Dickey <tom@invisible-island.net> +2014-04-02 Thomas E. Dickey <dickey@invisible-island.net> * test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c: regen @@ -589,7 +787,7 @@ * main.c: changes for btyacc -2014-04-01 Thomas E. Dickey <tom@invisible-island.net> +2014-04-01 Thomas E. Dickey <dickey@invisible-island.net> * reader.c: integrate change by Tom Shields to use bsearch rather than successive @@ -604,7 +802,7 @@ * verbose.c: changes for btyacc, ifdef'd -2014-04-01 Thomas E. Dickey <tom@invisible-island.net> +2014-04-01 Thomas E. Dickey <dickey@invisible-island.net> * mkpar.c: eliminate most of the ifdef's using macros @@ -616,7 +814,7 @@ new functions used for reporting errors from the btyacc configuration (I reordered some, and ifdef'd the new ones -TD) -2014-03-31 Thomas E. Dickey <tom@invisible-island.net> +2014-03-31 Thomas E. Dickey <dickey@invisible-island.net> * test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c: omit the GCC_UNUSED, as noted by Tom Shields not really essential @@ -624,7 +822,7 @@ * test/btyacc/empty.tab.c, test/btyacc/err_inherit1.tab.c, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_inherit5.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.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_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.tab.c: regen -2014-03-29 Thomas E. Dickey <tom@invisible-island.net> +2014-03-29 Thomas E. Dickey <dickey@invisible-island.net> * test/yacc/err_syntax22.tab.c, test/yacc/err_syntax23.tab.c, test/yacc/err_syntax24.tab.c, test/yacc/err_syntax25.tab.c, test/yacc/err_syntax26.tab.c, test/yacc/err_syntax3.tab.c, test/yacc/err_syntax4.tab.c, test/yacc/err_syntax5.tab.c, test/yacc/err_syntax6.tab.c, test/yacc/err_syntax7.tab.c, test/yacc/err_syntax7a.tab.c, test/yacc/err_syntax7b.tab.c, test/yacc/err_syntax8.tab.c, test/yacc/err_syntax8a.tab.c, test/yacc/err_syntax9.tab.c, test/yacc/error.tab.c, test/yacc/grammar.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-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/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_syntax1.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax13.tab.c, test/yacc/err_syntax14.tab.c, test/yacc/err_syntax15.tab.c, test/yacc/err_syntax16.tab.c, test/yacc/err_syntax17.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax19.tab.c, test/yacc/err_syntax2.tab.c, test/yacc/err_syntax20.tab.c, test/yacc/err_syntax21.tab.c, skeleton.c: comment-out yysccsid in the banner because it produces unnecessary compiler @@ -634,7 +832,7 @@ * test/run_test.sh: for yacc, ignore the inherit testcases, since they are btyacc-specific -2014-03-28 Thomas E. Dickey <tom@invisible-island.net> +2014-03-28 Thomas E. Dickey <dickey@invisible-island.net> * test/yacc/varsyntax_calc1.error, test/yacc/varsyntax_calc1.output, test/yacc/varsyntax_calc1.tab.c, test/yacc/varsyntax_calc1.tab.h, test/yacc/err_inherit3.error, test/yacc/err_inherit3.output, test/yacc/err_inherit3.tab.c, test/yacc/err_inherit3.tab.h, test/yacc/err_inherit4.error, test/yacc/err_inherit4.output, test/yacc/err_inherit4.tab.c, test/yacc/err_inherit4.tab.h, test/yacc/err_inherit5.error, test/yacc/err_inherit5.output, test/yacc/err_inherit5.tab.c, test/yacc/err_inherit5.tab.h, test/yacc/inherit0.error, test/yacc/inherit0.output, test/yacc/inherit0.tab.c, test/yacc/inherit0.tab.h, test/yacc/inherit1.error, test/yacc/inherit1.output, test/yacc/inherit1.tab.c, test/yacc/inherit1.tab.h, test/yacc/inherit2.error, test/yacc/inherit2.output, test/yacc/inherit2.tab.c, test/yacc/inherit2.tab.h, test/yacc/empty.error, test/yacc/empty.output, test/yacc/empty.tab.c, test/yacc/empty.tab.h, test/yacc/err_inherit1.error, test/yacc/err_inherit1.output, test/yacc/err_inherit1.tab.c, test/yacc/err_inherit1.tab.h, test/yacc/err_inherit2.error, test/yacc/err_inherit2.output, test/yacc/err_inherit2.tab.c, test/yacc/err_inherit2.tab.h: reference output for testing @@ -664,7 +862,7 @@ * yacc.1: document -L/-B features from btyacc -2014-03-25 Thomas E. Dickey <tom@invisible-island.net> +2014-03-25 Thomas E. Dickey <dickey@invisible-island.net> * yacc.1: typo @@ -683,7 +881,7 @@ * mstring.c: byacc-btyacc-20140323 -2014-03-25 Thomas E. Dickey <tom@invisible-island.net> +2014-03-25 Thomas E. Dickey <dickey@invisible-island.net> * test/btyacc/RCS, test/yacc/RCS: PERMIT FILE @@ -698,7 +896,7 @@ * test/btyacc/err_syntax1.output, test/btyacc/err_syntax1.tab.c, test/btyacc/err_syntax1.tab.h, test/btyacc/err_syntax10.error, test/btyacc/err_syntax10.output, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax10.tab.h, test/btyacc/err_syntax11.error, test/btyacc/err_syntax11.output, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax11.tab.h, test/btyacc/err_syntax12.error, test/btyacc/err_syntax12.output, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax12.tab.h, test/btyacc/err_syntax13.error, test/btyacc/err_syntax13.output, test/btyacc/err_syntax13.tab.c, test/btyacc/err_syntax13.tab.h, test/btyacc/err_syntax14.error, test/btyacc/err_syntax14.output, test/btyacc/err_syntax14.tab.c, test/btyacc/err_syntax14.tab.h, test/btyacc/err_syntax15.error, test/btyacc/err_syntax15.output, test/btyacc/err_syntax15.tab.c, test/btyacc/err_syntax15.tab.h, test/btyacc/err_syntax16.error, test/btyacc/err_syntax16.output, test/btyacc/err_syntax16.tab.c, test/btyacc/err_syntax16.tab.h, test/btyacc/err_syntax17.error, test/btyacc/err_syntax17.output, test/btyacc/err_syntax17.tab.c, test/btyacc/err_syntax17.tab.h, test/btyacc/err_syntax18.error, test/btyacc/err_syntax18.output, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax18.tab.h, test/btyacc/err_syntax19.error, test/btyacc/err_syntax19.output, test/btyacc/err_syntax19.tab.c, test/btyacc/err_syntax19.tab.h, test/btyacc/err_syntax2.output, test/btyacc/err_syntax2.tab.c, test/btyacc/err_syntax2.tab.h, test/btyacc/err_syntax20.error, test/btyacc/err_syntax20.output, test/btyacc/err_syntax20.tab.c, test/btyacc/err_syntax20.tab.h, test/btyacc/err_syntax21.error, test/btyacc/err_syntax21.output, test/btyacc/err_syntax21.tab.c, test/btyacc/err_syntax21.tab.h, test/btyacc/err_syntax22.error, test/btyacc/err_syntax22.output, test/btyacc/err_syntax22.tab.c, test/btyacc/err_syntax22.tab.h, test/btyacc/err_syntax23.error, test/btyacc/err_syntax23.output, test/btyacc/err_syntax23.tab.c, test/btyacc/err_syntax23.tab.h, test/btyacc/err_syntax24.error, test/btyacc/err_syntax24.output, test/btyacc/err_syntax24.tab.c, test/btyacc/err_syntax24.tab.h, test/btyacc/err_syntax25.error, test/btyacc/err_syntax25.output, test/btyacc/err_syntax25.tab.c, test/btyacc/err_syntax25.tab.h, test/btyacc/err_syntax26.error, test/btyacc/err_syntax26.output, test/btyacc/err_syntax26.tab.c, test/btyacc/err_syntax26.tab.h, test/btyacc/err_syntax3.output, test/btyacc/err_syntax3.tab.c, test/btyacc/err_syntax3.tab.h, test/btyacc/err_syntax4.output, test/btyacc/err_syntax4.tab.c, test/btyacc/err_syntax4.tab.h, test/btyacc/err_syntax5.output, test/btyacc/err_syntax5.tab.c, test/btyacc/err_syntax5.tab.h, test/btyacc/err_syntax6.output, test/btyacc/err_syntax6.tab.c, test/btyacc/err_syntax6.tab.h, test/btyacc/err_syntax7.output, test/btyacc/err_syntax7.tab.c, test/btyacc/err_syntax7.tab.h, test/btyacc/err_syntax7a.output, test/btyacc/err_syntax7a.tab.c, test/btyacc/err_syntax7a.tab.h, test/btyacc/err_syntax7b.output, test/btyacc/err_syntax7b.tab.c, test/btyacc/err_syntax7b.tab.h, test/btyacc/err_syntax8.output, test/btyacc/err_syntax8.tab.c, test/btyacc/err_syntax8.tab.h, test/btyacc/err_syntax8a.output, test/btyacc/err_syntax8a.tab.c, test/btyacc/err_syntax8a.tab.h, test/btyacc/err_syntax9.output, test/btyacc/err_syntax9.tab.c, test/btyacc/err_syntax9.tab.h: reference output for testing -2014-03-24 Thomas E. Dickey <tom@invisible-island.net> +2014-03-24 Thomas E. Dickey <dickey@invisible-island.net> * defs.h: fix compiler warnings due to mputc() @@ -711,7 +909,7 @@ * test/varsyntax_calc1.y, test/btyacc_calc1.y: testcase for btyacc -2014-03-23 Thomas E. Dickey <tom@invisible-island.net> +2014-03-23 Thomas E. Dickey <dickey@invisible-island.net> * test/err_syntax26.error, test/err_syntax26.output, test/err_syntax26.tab.c, test/err_syntax26.tab.h, test/yacc/err_syntax26.error, test/yacc/err_syntax26.output, test/yacc/err_syntax26.tab.c, test/yacc/err_syntax26.tab.h: reference output for testing @@ -733,7 +931,7 @@ * test/btyacc/quote_calc3-s.error, test/btyacc/quote_calc4-s.error, test/btyacc/quote_calc4.error, test/btyacc/grammar.dot, test/btyacc/grammar.error, test/btyacc/pure_calc.error, test/btyacc/pure_error.error, test/btyacc/quote_calc-s.error, test/btyacc/quote_calc.error, test/btyacc/quote_calc2-s.error, test/btyacc/quote_calc2.error, test/btyacc/quote_calc3.error, test/btyacc/err_syntax2.error, test/btyacc/err_syntax3.error, test/btyacc/err_syntax4.error, test/btyacc/err_syntax5.error, test/btyacc/err_syntax6.error, test/btyacc/err_syntax7.error, test/btyacc/err_syntax7a.error, test/btyacc/err_syntax7b.error, test/btyacc/err_syntax8.error, test/btyacc/err_syntax8a.error, test/btyacc/err_syntax9.error, test/btyacc/error.error, test/btyacc/calc1.error, test/btyacc/calc2.error, test/btyacc/calc3.error, test/btyacc/code_calc.error, test/btyacc/code_error.error, test/btyacc/empty.error, test/btyacc/err_syntax1.error, test/btyacc/btyacc_calc1.error, test/btyacc/btyacc_demo.error: reference output for testing -2014-03-23 Thomas E. Dickey <tom@invisible-island.net> +2014-03-23 Thomas E. Dickey <dickey@invisible-island.net> * test/err_syntax23.error, test/err_syntax23.output, test/err_syntax23.tab.c, test/err_syntax23.tab.h, test/yacc/err_syntax23.error, test/yacc/err_syntax23.output, test/yacc/err_syntax23.tab.c, test/yacc/err_syntax23.tab.h: reference output for testing @@ -745,7 +943,7 @@ * test/run_test.sh: move test-outputs into subdirectories to keep btyacc/yacc results separate -2014-03-23 Thomas E. Dickey <tom@invisible-island.net> +2014-03-23 Thomas E. Dickey <dickey@invisible-island.net> * test/err_syntax22.error, test/err_syntax22.output, test/err_syntax22.tab.c, test/err_syntax22.tab.h, test/yacc/err_syntax22.error, test/yacc/err_syntax22.output, test/yacc/err_syntax22.tab.c, test/yacc/err_syntax22.tab.h: reference output for testing @@ -774,7 +972,7 @@ * test/err_syntax17.y: testcase for unterminated_action() -2014-03-22 Thomas E. Dickey <tom@invisible-island.net> +2014-03-22 Thomas E. Dickey <dickey@invisible-island.net> * test/err_syntax16.error, test/err_syntax16.output, test/err_syntax16.tab.c, test/err_syntax16.tab.h, test/yacc/err_syntax16.error, test/yacc/err_syntax16.output, test/yacc/err_syntax16.tab.c, test/yacc/err_syntax16.tab.h: reference output for testing @@ -812,7 +1010,7 @@ * test/err_syntax10.y: testcase for retyped_warning() -2014-03-21 Thomas E. Dickey <tom@invisible-island.net> +2014-03-21 Thomas E. Dickey <dickey@invisible-island.net> * test/err_syntax9.error, test/err_syntax9.output, test/err_syntax9.tab.c, test/err_syntax9.tab.h, test/yacc/err_syntax9.error, test/yacc/err_syntax9.output, test/yacc/err_syntax9.tab.c, test/yacc/err_syntax9.tab.h: reference output for testing @@ -932,7 +1130,7 @@ * lalr.c: rename MAXSHORT to MAXYYINT -2014-01-01 Thomas E. Dickey <tom@invisible-island.net> +2014-01-01 Thomas E. Dickey <dickey@invisible-island.net> * yacc.1: document %token-table, improve presentation of double-quotes @@ -956,7 +1154,7 @@ - add YYTRANSLATE() macro - recognize bison's %token-table declaration -2014-01-01 Thomas E. Dickey <tom@invisible-island.net> +2014-01-01 Thomas E. Dickey <dickey@invisible-island.net> * configure: regen @@ -968,19 +1166,19 @@ * configure.in: use CF_MAKE_DOCS -2013-12-26 Thomas E. Dickey <tom@invisible-island.net> +2013-12-26 Thomas E. Dickey <dickey@invisible-island.net> * config.guess: 2013-11-29 -2013-11-19 Thomas E. Dickey <tom@invisible-island.net> +2013-11-19 Thomas E. Dickey <dickey@invisible-island.net> * aclocal.m4: resync with my-autoconf (fixes for clang and mingw) -2013-10-25 Thomas E. Dickey <tom@invisible-island.net> +2013-10-25 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: 2013-10-01 -2013-09-25 Thomas E. Dickey <tom@invisible-island.net> +2013-09-25 Thomas E. Dickey <dickey@invisible-island.net> * reader.c: fix two loop-limits found by clang 3.3 --analyze @@ -1015,13 +1213,13 @@ * package/debian/changelog, VERSION, package/byacc.spec: bump -2013-09-07 Thomas E. Dickey <tom@invisible-island.net> +2013-09-07 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: update to 2013-09-15 * config.guess: update to 2013-06-10 -2013-03-04 Thomas E. Dickey <tom@invisible-island.net> +2013-03-04 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/changelog, VERSION, package/byacc.spec: bump @@ -1051,11 +1249,11 @@ * aclocal.m4: another fix for CF_GCC_VERSION to handle Debian's modification of gcc message. -2013-02-10 Thomas E. Dickey <tom@invisible-island.net> +2013-02-10 Thomas E. Dickey <dickey@invisible-island.net> * config.sub, config.guess: update to 2013-02-04 -2012-10-03 Thomas E. Dickey <tom@invisible-island.net> +2012-10-03 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/changelog, package/byacc.spec, VERSION: bump @@ -1077,7 +1275,7 @@ suggested patch: drop CF_ANSI_CC_REQD, CF_ANSI_CC_CHECK, CF_PROG_EXT since they are not needed. -2012-10-03 Thomas E. Dickey <tom@invisible-island.net> +2012-10-03 Thomas E. Dickey <dickey@invisible-island.net> * aclocal.m4: split-out CF_CC_ENV_FLAGS from CF_ANSI_CC_CHECK to avoid losing it in @@ -1111,13 +1309,13 @@ CF_MIXEDCASE_FILENAMES CF_NO_LEAKS_OPTION -2012-10-03 Thomas E. Dickey <tom@invisible-island.net> +2012-10-03 Thomas E. Dickey <dickey@invisible-island.net> * aclocal.m4: move existence-check for mkstemp out of the AC_TRY_RUN, to help with cross-compiles -2012-10-02 Thomas E. Dickey <tom@invisible-island.net> +2012-10-02 Thomas E. Dickey <dickey@invisible-island.net> * config_h.in: Adrian Bunk request - replace this with the output from autoheader @@ -1135,7 +1333,7 @@ * makefile.in: add assignment for datarootdir variable. -2012-05-26 Thomas E. Dickey <tom@invisible-island.net> +2012-05-26 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/changelog, package/byacc.spec, VERSION: bump @@ -1163,13 +1361,13 @@ use TMALLOC() and TREALLOC() macros to simplify allocation/reallocation (no object change) -2012-05-25 Thomas E. Dickey <tom@invisible-island.net> +2012-05-25 Thomas E. Dickey <dickey@invisible-island.net> * output.c, main.c, verbose.c, mkpar.c, lr0.c: use TMALLOC() and TREALLOC() macros to simplify allocation/reallocation (no object change) -2012-01-15 Thomas E. Dickey <tom@invisible-island.net> +2012-01-15 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/copyright: bump @@ -1274,7 +1472,7 @@ * test/quote_calc2-s.tab.c, test/quote_calc3-s.tab.c, test/quote_calc4-s.tab.c, test/quote_calc-s.tab.c, test/quote_calc.tab.c, test/quote_calc2.tab.c, test/quote_calc3.tab.c, test/quote_calc4.tab.c: regen -2012-01-14 Thomas E. Dickey <tom@invisible-island.net> +2012-01-14 Thomas E. Dickey <dickey@invisible-island.net> * test/calc2.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c, test/calc.tab.c, test/calc1.tab.c: regen @@ -1305,7 +1503,7 @@ * test/run_test.sh: generate/test with "-s" option applied. -2012-01-13 Thomas E. Dickey <tom@invisible-island.net> +2012-01-13 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/changelog, package/byacc.spec, VERSION: bump @@ -1337,7 +1535,7 @@ * aclocal.m4: resync with my-autoconf, i.e., fixes for CF_XOPEN_SOURCE -2011-12-19 Thomas E. Dickey <tom@invisible-island.net> +2011-12-19 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/changelog, package/byacc.spec, VERSION: bump @@ -1351,7 +1549,7 @@ Simply suppressing the second #define makes the behavior closer to yacc. (report by Paulo Andrade). -2011-09-08 Thomas E. Dickey <tom@invisible-island.net> +2011-09-08 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/changelog, package/byacc.spec, VERSION: bump @@ -1359,7 +1557,7 @@ fix some more interaction between -i and -d flags to ensure YYERRCODE and YYSTYPE are declared, tested with cproto. -2011-09-07 Thomas E. Dickey <tom@invisible-island.net> +2011-09-07 Thomas E. Dickey <dickey@invisible-island.net> * yacc.1: document "-i" option. @@ -1373,14 +1571,14 @@ * skeleton.c, output.c, defs.h: changes to support "-i" option. -2011-09-06 Thomas E. Dickey <tom@invisible-island.net> +2011-09-06 Thomas E. Dickey <dickey@invisible-island.net> * reader.c: pass explicit file-pointer to write_section() * main.c: add "-i" option, to generate interface-file (suggested by Denis M. Wilson) -2011-09-05 Thomas E. Dickey <tom@invisible-island.net> +2011-09-05 Thomas E. Dickey <dickey@invisible-island.net> * configure: regen @@ -1391,15 +1589,15 @@ * defs.h, error.c, reader.c: add check for missing "}" on %parse-param and %lex-param lines (report by Denis M Wilson) -2011-04-01 Thomas E. Dickey <tom@invisible-island.net> +2011-04-01 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: update to 2011-04-01 -2011-02-02 Thomas E. Dickey <tom@invisible-island.net> +2011-02-02 Thomas E. Dickey <dickey@invisible-island.net> * config.guess: update to 2011-01-01 -2010-12-29 Thomas E. Dickey <tom@invisible-island.net> +2010-12-29 Thomas E. Dickey <dickey@invisible-island.net> * defs.h, skeleton.c: add const qualifier to skeleton data, per NetBSD changes (report by Christos Zoulas) @@ -1421,7 +1619,7 @@ * test/ftp.y: improve example, which was stuck in 19XX and assumed file sizes were longs. -2010-12-29 Thomas E. Dickey <tom@invisible-island.net> +2010-12-29 Thomas E. Dickey <dickey@invisible-island.net> * test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c: regen @@ -1439,11 +1637,11 @@ * output.c: correct definition for YYERROR_DECL() -2010-12-29 Thomas E. Dickey <tom@invisible-island.net> +2010-12-29 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/changelog, package/byacc.spec, VERSION: bump -2010-12-26 Thomas E. Dickey <tom@invisible-island.net> +2010-12-26 Thomas E. Dickey <dickey@invisible-island.net> * defs.h, main.c: change return-type of allocate() to avoid warnings of alignment problems @@ -1463,7 +1661,7 @@ * aclocal.m4: improve quoting, deprecate ${name-value} in favor of standard ${name:-value} -2010-12-25 Thomas E. Dickey <tom@invisible-island.net> +2010-12-25 Thomas E. Dickey <dickey@invisible-island.net> * main.c: start revising use of tmpfile(), to make this work with MinGW. Start by @@ -1472,7 +1670,7 @@ * package/debian/changelog, package/byacc.spec, VERSION: bump -2010-11-27 Thomas E. Dickey <tom@invisible-island.net> +2010-11-27 Thomas E. Dickey <dickey@invisible-island.net> * package/byacc.spec, package/debian/changelog, VERSION: bump @@ -1482,7 +1680,7 @@ corrected use of %parse-param value in yyerror(); it doesn't use &yylval (report by Clifford Yapp) -2010-11-26 Thomas E. Dickey <tom@invisible-island.net> +2010-11-26 Thomas E. Dickey <dickey@invisible-island.net> * skeleton.c: typo @@ -1533,7 +1731,7 @@ * package/debian/changelog, package/byacc.spec, VERSION: bump -2010-11-24 Thomas E. Dickey <tom@invisible-island.net> +2010-11-24 Thomas E. Dickey <dickey@invisible-island.net> * main.c, defs.h, symtab.c, error.c: reduce global variables @@ -1543,7 +1741,7 @@ amend fix for Redhat #112617 to still call default_action_warning() for empty rules (report by Bruce Cran). -2010-11-22 Thomas E. Dickey <tom@invisible-island.net> +2010-11-22 Thomas E. Dickey <dickey@invisible-island.net> * output.c: add ifdef to guard against redefinition of YYSTYPE union (request by Clifford Yapp). @@ -1575,20 +1773,20 @@ * package/debian/changelog, package/byacc.spec, VERSION: bump -2010-09-28 Thomas E. Dickey <tom@invisible-island.net> +2010-09-28 Thomas E. Dickey <dickey@invisible-island.net> * config.guess: update to 2010-09-24 -2010-09-10 Thomas E. Dickey <tom@invisible-island.net> +2010-09-10 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: update to 2010-09-11 -2010-06-10 Thomas E. Dickey <tom@invisible-island.net> +2010-06-10 Thomas E. Dickey <dickey@invisible-island.net> * yacc.1, package/debian/changelog, package/byacc.spec, VERSION: bump to 2010/06/10 -2010-06-09 Thomas E. Dickey <tom@invisible-island.net> +2010-06-09 Thomas E. Dickey <dickey@invisible-island.net> * reader.c: free declarations in leak-testing code. @@ -1631,7 +1829,7 @@ * test/ftp.tab.c, test/ftp.y, reader.c, symtab.c, verbose.c, lr0.c, main.c, mkpar.c, output.c, defs.h, closure.c: fix warnings from clang --analyze -2010-06-08 Thomas E. Dickey <tom@invisible-island.net> +2010-06-08 Thomas E. Dickey <dickey@invisible-island.net> * output.c: fix to build with c89, etc. @@ -1663,7 +1861,7 @@ add check_make and check_lint rules to help validate the generated files in the test-directory -2010-06-07 Thomas E. Dickey <tom@invisible-island.net> +2010-06-07 Thomas E. Dickey <dickey@invisible-island.net> * test/pure_calc.tab.c, test/pure_error.tab.c: RCS_BASE @@ -1728,11 +1926,11 @@ anyway. This allows for better compatibility with yacc sources written for bison. -2010-06-07 Thomas E. Dickey <tom@invisible-island.net> +2010-06-07 Thomas E. Dickey <dickey@invisible-island.net> * VERSION: bump to 2010/06/07 -2010-06-06 Thomas E. Dickey <tom@invisible-island.net> +2010-06-06 Thomas E. Dickey <dickey@invisible-island.net> * test/calc.tab.c, configure: regen @@ -1783,12 +1981,12 @@ c) CF_GCC_VERSION, ignore stderr d) CF_GCC_WARNINGS, adjust options to work with c89 wrapper of gcc -2010-04-20 Thomas E. Dickey <tom@invisible-island.net> +2010-04-20 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/changelog, package/debian/compat, package/debian/control, package/debian/copyright, package/debian/docs, package/debian/postinst, package/debian/prerm, package/debian/rules, package/debian/watch: scripts from Debian package -2010-02-16 Thomas E. Dickey <tom@invisible-island.net> +2010-02-16 Thomas E. Dickey <dickey@invisible-island.net> * yacc.1: document -P and bison-extensions @@ -1840,24 +2038,24 @@ * skeleton.c: fix a memory leak in the generated skeleton -2010-01-01 Thomas E. Dickey <tom@invisible-island.net> +2010-01-01 Thomas E. Dickey <dickey@invisible-island.net> * package/debian/source/format: scripts from Debian package -2009-12-31 Thomas E. Dickey <tom@invisible-island.net> +2009-12-31 Thomas E. Dickey <dickey@invisible-island.net> * config.guess: update to 2009-12-30 * config.sub: update to 2009-12-31 -2009-10-27 Thomas E. Dickey <tom@invisible-island.net> +2009-10-27 Thomas E. Dickey <dickey@invisible-island.net> * VERSION: 20091027 * output.c, mkpar.c, defs.h, lalr.c, closure.c, graph.c, lr0.c, verbose.c, main.c, reader.c: strict compiler warnings -2009-10-26 Thomas E. Dickey <tom@invisible-island.net> +2009-10-26 Thomas E. Dickey <dickey@invisible-island.net> * test/ftp.tab.c, test/grammar.tab.c, test/calc.tab.c, test/error.tab.c: resync @@ -1872,44 +2070,44 @@ * aclocal.m4: resync with my-autoconf -2009-08-25 Thomas E. Dickey <tom@invisible-island.net> +2009-08-25 Thomas E. Dickey <dickey@invisible-island.net> * config.guess, config.sub: update to 2009-08-19 -2009-02-21 Thomas E. Dickey <tom@invisible-island.net> +2009-02-21 Thomas E. Dickey <dickey@invisible-island.net> * VERSION: bump * output.c: restore "yylval" symbol, omitted in cleanup on 2008/8/25 -2008-12-26 Thomas E. Dickey <tom@invisible-island.net> +2008-12-26 Thomas E. Dickey <dickey@invisible-island.net> * configure: regen with autoconf-2.52 (patched) -2008-12-25 Thomas E. Dickey <tom@invisible-island.net> +2008-12-25 Thomas E. Dickey <dickey@invisible-island.net> * test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c, test/calc.tab.c: regenerated -2008-12-24 Thomas E. Dickey <tom@invisible-island.net> +2008-12-24 Thomas E. Dickey <dickey@invisible-island.net> * VERSION: bump * skeleton.c: remove ifdef-lint from goto yyerrlab, to quiet gcc warning -2008-11-26 Thomas E. Dickey <tom@invisible-island.net> +2008-11-26 Thomas E. Dickey <dickey@invisible-island.net> * verbose.c, main.c, defs.h, mkpar.c, reader.c: completed implementation of "%expect" (report by Perry E. Metzger). add "%expect-rr", which is (unlike bison) allowable in LALR parsers. -2008-11-24 Thomas E. Dickey <tom@invisible-island.net> +2008-11-24 Thomas E. Dickey <dickey@invisible-island.net> * closure.c, defs.h, error.c, graph.c, lalr.c, lr0.c, main.c, mkpar.c, output.c, reader.c, skeleton.c, symtab.c, verbose.c, warshall.c: change indent-style (request by Perry E. Metzger) -2008-08-27 Thomas E. Dickey <tom@invisible-island.net> +2008-08-27 Thomas E. Dickey <dickey@invisible-island.net> * test/calc.tab.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c: better implementation of YYPARSE_PARAM, using YYPARSE_DECL() macro @@ -1948,12 +2146,12 @@ * test/calc.tab.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c: remove 'register' keywords -2008-08-26 Thomas E. Dickey <tom@invisible-island.net> +2008-08-26 Thomas E. Dickey <dickey@invisible-island.net> * warshall.c, verbose.c, symtab.c, skeleton.c, reader.c, output.c, mkpar.c, main.c, lr0.c, lalr.c, graph.c, error.c, closure.c: remove 'register' keywords -2008-08-25 Thomas E. Dickey <tom@invisible-island.net> +2008-08-25 Thomas E. Dickey <dickey@invisible-island.net> * test/ftp.tab.c: regen'd @@ -1993,7 +2191,7 @@ * makefile.in: add dependency on VERSION file. -2008-08-24 Thomas E. Dickey <tom@invisible-island.net> +2008-08-24 Thomas E. Dickey <dickey@invisible-island.net> * VERSION: bump @@ -2011,18 +2209,18 @@ * aclocal.m4: resync with my-autoconf (no major changes) -2008-07-24 Thomas E. Dickey <tom@invisible-island.net> +2008-07-24 Thomas E. Dickey <dickey@invisible-island.net> * package/pkgsrc/Makefile, package/pkgsrc/distinfo: scripts from NetBSD pkgsrc, for test-builds -2008-03-14 Thomas E. Dickey <tom@invisible-island.net> +2008-03-14 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: update to 2008-03-08 * config.guess: update to 2008-03-12 -2007-05-09 Thomas E. Dickey <tom@invisible-island.net> +2007-05-09 Thomas E. Dickey <dickey@invisible-island.net> * main.c: close graph, verbose files if opened, on exit. @@ -2049,19 +2247,19 @@ * main.c: file_prefix did not always have a trailing null. -2007-03-25 Thomas E. Dickey <tom@invisible-island.net> +2007-03-25 Thomas E. Dickey <dickey@invisible-island.net> * mkdirs.sh: improved version for "make -j" -2006-12-22 Thomas E. Dickey <tom@invisible-island.net> +2006-12-22 Thomas E. Dickey <dickey@invisible-island.net> * config.guess: update to 2006/12/22 -2006-12-08 Thomas E. Dickey <tom@invisible-island.net> +2006-12-08 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: update to 2006/12/08 -2005-08-13 Thomas E. Dickey <tom@invisible-island.net> +2005-08-13 Thomas E. Dickey <dickey@invisible-island.net> * main.c: add -V to usage message @@ -2080,23 +2278,23 @@ Debian #322858 (don't close union_file, which contained data). This feature is used in groff. -2005-08-13 Thomas E. Dickey <tom@invisible-island.net> +2005-08-13 Thomas E. Dickey <dickey@invisible-island.net> * configure: regenerated * aclocal.m4: improve checks for Intel compiler warnings -2005-06-25 Thomas E. Dickey <tom@invisible-island.net> +2005-06-25 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: update to 2005/6/2 * config.guess: update to 2005/5/27 -2005-05-05 Thomas E. Dickey <tom@invisible-island.net> +2005-05-05 Thomas E. Dickey <dickey@invisible-island.net> * defs.h: add a fallback for GCC_UNUSED -2005-05-04 Thomas E. Dickey <tom@invisible-island.net> +2005-05-04 Thomas E. Dickey <dickey@invisible-island.net> * makefile.in: add "." to include-path to pickup config.h @@ -2151,7 +2349,7 @@ add "-o" to usage message. It is too long for a single line; rewrite usage() to show one option per line. -2005-05-03 Thomas E. Dickey <tom@invisible-island.net> +2005-05-03 Thomas E. Dickey <dickey@invisible-island.net> * main.c: add -o option, to work with scripts that assume bison. simplify create_file_names() with a macro. @@ -2182,21 +2380,21 @@ add graphical output of the LALR(1) automaton for graphviz, associated with command-line option `-g' -2005-04-16 Thomas E. Dickey <tom@invisible-island.net> +2005-04-16 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: update to 2005/2/10 * config.guess: update to 2005/3/24 -2005-04-13 Thomas E. Dickey <tom@invisible-island.net> +2005-04-13 Thomas E. Dickey <dickey@invisible-island.net> * package/pkgsrc/PLIST: scripts from NetBSD pkgsrc, for test-builds -2005-03-21 Thomas E. Dickey <tom@invisible-island.net> +2005-03-21 Thomas E. Dickey <dickey@invisible-island.net> * package/pkgsrc/DESCR: scripts from NetBSD pkgsrc, for test-builds -2004-03-28 Thomas E. Dickey <tom@invisible-island.net> +2004-03-28 Thomas E. Dickey <dickey@invisible-island.net> * test/calc.tab.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c: updates due to adding yyparse() prototype @@ -2267,32 +2465,32 @@ * README: updated to note that this is not the original -2004-03-24 Thomas E. Dickey <tom@invisible-island.net> +2004-03-24 Thomas E. Dickey <dickey@invisible-island.net> * test/grammar.y: RCS_BASE -2004-02-23 Thomas E. Dickey <tom@invisible-island.net> +2004-02-23 Thomas E. Dickey <dickey@invisible-island.net> * config.sub: RCS_BASE -2004-02-17 Thomas E. Dickey <tom@invisible-island.net> +2004-02-17 Thomas E. Dickey <dickey@invisible-island.net> * config.guess: RCS_BASE -2003-11-29 Thomas E. Dickey <tom@invisible-island.net> +2003-11-29 Thomas E. Dickey <dickey@invisible-island.net> * install-sh: improved quoting -2002-06-29 Thomas E. Dickey <tom@invisible-island.net> +2002-06-29 Thomas E. Dickey <dickey@invisible-island.net> * mkdirs.sh: don't use character range, since some locales don't work as expected -2001-06-22 Thomas E. Dickey <tom@invisible-island.net> +2001-06-22 Thomas E. Dickey <dickey@clark.net> * install-sh: RCS_BASE -2000-11-20 Thomas E. Dickey <tom@invisible-island.net> +2000-11-20 Thomas E. Dickey <dickey@clark.net> * test/calc.y: RCS_BASE @@ -2300,26 +2498,26 @@ * vmsbuild.com: original version -2000-02-23 dickey +2000-02-23 dickey@clark.net * test/RCS, RCS: PERMIT FILE -2000-02-14 Thomas E. Dickey <tom@invisible-island.net> +2000-02-14 Thomas E. Dickey <dickey@clark.net> * main.c: fix for VMS port - making pathname for temp-file * descrip.mms: original version -2000-02-13 Thomas E. Dickey <tom@invisible-island.net> +2000-02-13 Thomas E. Dickey <dickey@clark.net> * defs.h, verbose.c, reader.c, main.c, skeleton.c, warshall.c, symtab.c, closure.c, mkpar.c, lalr.c, lr0.c, output.c, error.c: ansify -1999-11-30 Thomas E. Dickey <tom@invisible-island.net> +1999-11-30 Thomas E. Dickey <dickey@clark.net> * mkdirs.sh: RCS_BASE -1995-01-01 Thomas E. Dickey <tom@invisible-island.net> +1995-01-01 Thomas E. Dickey <dickey@clark.net> * config_h.in: RCS_BASE @@ -2339,7 +2537,7 @@ * test/ftp.output, test/ftp.tab.c, test/ftp.tab.h: RCS_BASE -1993-02-22 Thomas E. Dickey <tom@invisible-island.net> +1993-02-22 Thomas E. Dickey <dickey@software.org> * test/yacc/error.output, test/yacc/error.tab.h: reference output for testing @@ -2379,7 +2577,7 @@ * symtab.c, lalr.c, error.c: original version -1990-01-16 Thomas E. Dickey <tom@invisible-island.net> +1990-01-16 Thomas E. Dickey <dickey@software.org> * test/code_error.y, test/pure_error.y: RCS_BASE diff --git a/contrib/byacc/MANIFEST b/contrib/byacc/MANIFEST index 7d7e534..7426e2f 100644 --- a/contrib/byacc/MANIFEST +++ b/contrib/byacc/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for byacc-20160324, version t20160324 +MANIFEST for byacc-20161202, version t20161202 -------------------------------------------------------------------------------- MANIFEST this file ACKNOWLEDGEMENTS original version of byacc - 1993 diff --git a/contrib/byacc/VERSION b/contrib/byacc/VERSION index 9be4062..b720a20 100644 --- a/contrib/byacc/VERSION +++ b/contrib/byacc/VERSION @@ -1 +1 @@ -20160324 +20161202 diff --git a/contrib/byacc/aclocal.m4 b/contrib/byacc/aclocal.m4 index f98d089..917a848 100644 --- a/contrib/byacc/aclocal.m4 +++ b/contrib/byacc/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.41 2016/12/02 13:03:06 tom Exp $ dnl Macros for byacc configure script (Thomas E. Dickey) dnl --------------------------------------------------------------------------- dnl Copyright 2004-2015,2016 Thomas E. Dickey @@ -171,11 +171,18 @@ 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: 6 updated: 2016/08/29 20:57:00 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 into CC. This will not help with broken scripts that wrap the compiler +dnl with options, but eliminates a more common category of user confusion. +dnl +dnl In particular, it addresses the problem of being able to run the C +dnl preprocessor in a consistent manner. +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 +190,26 @@ 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/^[[^ ]]*[[ ]]//'` - CC=`echo "$CC" | sed -e 's/[[ ]].*//'` - CF_ADD_CFLAGS($cf_flags) + cf_flags=`echo "$CC" | sed -e 's/^.*[[ ]]\(-[[^ ]]\)/\1/'` + CC=`echo "$CC " | sed -e 's/[[ ]]-[[^ ]].*$//' -e 's/[[ ]]*$//'` + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[[IUDfgOW]]*) + CF_ADD_CFLAGS($cf_flags) + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done + CF_VERBOSE(resulting CC: '$CC') + CF_VERBOSE(resulting CFLAGS: '$CFLAGS') + CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') ;; (*) AC_MSG_RESULT(ok) @@ -570,7 +590,7 @@ rm -rf conftest* AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 +dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37 dnl ------------- dnl Check if we must define _GNU_SOURCE to get a reasonable value for dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect @@ -597,7 +617,20 @@ make an error CPPFLAGS="$cf_save" ]) ]) -test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + +if test "$cf_cv_gnu_source" = yes +then +AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ +CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + AC_TRY_COMPILE([#include <sys/types.h>],[ +#ifdef _DEFAULT_SOURCE +make an error +#endif], + [cf_cv_default_source=no], + [cf_cv_default_source=yes]) + ]) +test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" +fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 @@ -1010,11 +1043,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 --------------------------------------------------------------------------- @@ -1287,7 +1320,7 @@ fi fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 50 updated: 2015/10/17 19:03:33 +dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -1307,7 +1340,7 @@ case $host_os in (aix[[4-7]]*) cf_xopen_source="-D_ALL_SOURCE" ;; -(cygwin|msys) +(msys) cf_XOPEN_SOURCE=600 ;; (darwin[[0-8]].*) @@ -1335,7 +1368,7 @@ case $host_os in cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -(linux*|gnu*|mint*|k*bsd*-gnu) +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) CF_GNU_SOURCE ;; (minix*) @@ -1357,9 +1390,6 @@ case $host_os in (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" ;; diff --git a/contrib/byacc/btyaccpar.c b/contrib/byacc/btyaccpar.c index d195b50..f8ef414 100644 --- a/contrib/byacc/btyaccpar.c +++ b/contrib/byacc/btyaccpar.c @@ -1,8 +1,8 @@ /* This file generated automatically using - * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @ + * @Id: skel2c,v 1.4 2016/06/07 00:26:09 tom Exp @ */ -/* @Id: btyaccpar.skel,v 1.1 2014/04/02 22:44:41 tom Exp @ */ +/* @Id: btyaccpar.skel,v 1.5 2016/12/02 22:02:28 tom 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)", @@ -216,9 +218,9 @@ const char *const hdr_vars[] = "#endif", "", "/* Current position at lexical token queue */", - "static short *yylexp = 0;", + "static YYINT *yylexp = 0;", "", - "static short *yylexemes = 0;", + "static YYINT *yylexemes = 0;", "#endif /* YYBTYACC */", #endif /* defined(YYBTYACC) */ 0 @@ -273,9 +275,9 @@ const char *const body_vars[] = "#endif", "", " /* Current position at lexical token queue */", - " static short *yylexp = 0;", + " static YYINT *yylexp = 0;", "", - " static short *yylexemes = 0;", + " static YYINT *yylexemes = 0;", "#endif /* YYBTYACC */", #endif /* defined(YYBTYACC) */ 0 @@ -293,18 +295,18 @@ const char *const body_1[] = #endif /* defined(YYBTYACC) */ "", "#if YYDEBUG", - "#include <stdio.h> /* needed for printf */", + "#include <stdio.h> /* needed for printf */", "#endif", "", - "#include <stdlib.h> /* needed for malloc, etc */", - "#include <string.h> /* needed for memset */", + "#include <stdlib.h> /* needed for malloc, etc */", + "#include <string.h> /* needed for memset */", "", "/* allocate initial stack or double stack size, up to YYMAXDEPTH */", "static int yygrowstack(YYSTACKDATA *data)", "{", " int i;", " unsigned newsize;", - " short *newss;", + " YYINT *newss;", " YYSTYPE *newvs;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " YYLTYPE *newps;", @@ -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;", @@ -449,12 +451,19 @@ const char *const body_2[] = " fprintf(stderr, \"%sdebug[<# of symbols on state stack>]\\n\", YYPREFIX);", "#endif", "", + 0 +}; + +const char *const body_3[] = +{ #if defined(YYBTYACC) "#if YYBTYACC", " yyps = yyNewState(0); if (yyps == 0) goto yyenomem;", " yyps->save = 0;", "#endif /* YYBTYACC */", #endif /* defined(YYBTYACC) */ + " yym = 0;", + " yyn = 0;", " yynerrs = 0;", " yyerrflag = 0;", " yychar = YYEMPTY;", @@ -499,10 +508,10 @@ const char *const body_2[] = " size_t s = (size_t) (yylvlim - yylvals);", "", " s += YYLVQUEUEGROWTH;", - " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;", - " if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;", + " if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;", + " if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", - " if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;", + " if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;", "#endif", " yylvp = yylve = yylvals + p;", " yylvlim = yylvals + s;", @@ -512,7 +521,7 @@ const char *const body_2[] = "#endif", " yylexp = yylexemes + p;", " }", - " *yylexp = (short) YYLEX;", + " *yylexp = (YYINT) YYLEX;", " *yylvp++ = yylval;", " yylve++;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", @@ -532,11 +541,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 +606,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)", @@ -620,7 +628,7 @@ const char *const body_2[] = " /* If this is a first conflict in the stack, start saving lexemes */", " if (!yylexemes)", " {", - " yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));", + " yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));", " if (yylexemes == NULL) goto yyenomem;", " yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));", " if (yylvals == NULL) goto yyenomem;", @@ -644,7 +652,7 @@ const char *const body_2[] = "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " *yylpe++ = yylloc;", "#endif", - " *yylexp = (short) yychar;", + " *yylexp = (YYINT) yychar;", " yychar = YYEMPTY;", " }", " }", @@ -679,7 +687,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 +735,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 +771,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 +787,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 +822,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 +845,7 @@ const char *const body_2[] = "#endif", "", "#if !YYBTYACC", - " goto yyerrlab;", + " goto yyerrlab; /* redundant goto avoids 'unused label' warning */", "yyerrlab:", "#endif", " ++yynerrs;", @@ -899,7 +916,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);", " }", @@ -1034,12 +1051,12 @@ const char *const trailer[] = " size_t s = (size_t) (yylvlim - yylvals);", "", " s += YYLVQUEUEGROWTH;", - " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)", + " if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)", " goto yyenomem;", - " if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)", + " if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)", " goto yyenomem;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", - " if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)", + " if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)", " goto yyenomem;", "#endif", " yylvp = yylve = yylvals + p;", @@ -1050,7 +1067,7 @@ const char *const trailer[] = "#endif", " yylexp = yylexemes + p;", " }", - " *yylexp = (short) YYLEX;", + " *yylexp = (YYINT) YYLEX;", " *yylvp++ = yylval;", " yylve++;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", @@ -1070,12 +1087,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 +1120,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 +1156,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/contrib/byacc/btyaccpar.skel b/contrib/byacc/btyaccpar.skel index 265be42..6b21254 100644 --- a/contrib/byacc/btyaccpar.skel +++ b/contrib/byacc/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.5 2016/12/02 22:02:28 tom 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) @@ -174,9 +176,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; %%endif YYBTYACC %% body_vars int yyerrflag; @@ -225,9 +227,9 @@ static short *yylexemes = 0; #endif /* Current position at lexical token queue */ - static short *yylexp = 0; + static YYINT *yylexp = 0; - static short *yylexemes = 0; + static YYINT *yylexemes = 0; %%endif YYBTYACC %% body_1 @@ -238,7 +240,7 @@ static short *yylexemes = 0; %%endif #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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; @@ -384,10 +386,13 @@ YYPARSE_DECL() fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); #endif +%% body_3 %%ifdef YYBTYACC yyps = yyNewState(0); if (yyps == 0) goto yyenomem; yyps->save = 0; %%endif + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -427,14 +432,14 @@ 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; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -444,7 +449,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -461,11 +466,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 +528,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) @@ -546,7 +550,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -570,7 +574,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -584,7 +588,7 @@ yyloop: yylexp--; yychar = YYEMPTY; } - save->lexeme = yylvp - yylvals; + save->lexeme = (int) (yylvp - yylvals); yyps->save = save; } if (yytable[yyn] == ctry) @@ -605,7 +609,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 +655,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 +691,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 +707,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 +742,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 +764,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -820,7 +833,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,16 +951,16 @@ 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) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -958,7 +971,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -975,12 +988,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 +1019,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 +1054,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/contrib/byacc/config.guess b/contrib/byacc/config.guess index dcd5149..2e9ad7f 100755 --- a/contrib/byacc/config.guess +++ b/contrib/byacc/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2016-01-01' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -186,9 +186,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in - arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -237,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -268,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -376,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -410,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -635,13 +642,13 @@ EOF sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -680,11 +687,11 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -697,12 +704,12 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -807,14 +814,14 @@ EOF echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -896,7 +903,7 @@ EOF exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -919,7 +926,7 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -993,6 +1000,9 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1025,6 +1035,9 @@ EOF ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1272,6 +1285,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1285,9 +1301,9 @@ EOF UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1309,7 +1325,7 @@ EOF exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1340,7 +1356,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1382,7 +1398,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1401,18 +1417,17 @@ esac cat >&2 <<EOF $0: unable to guess system type -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from +This script (version $timestamp), has failed to recognize the +operating system you are using. If your script is old, overwrite +config.guess and config.sub with the latest versions from: http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess and http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/contrib/byacc/config.sub b/contrib/byacc/config.sub index da6d1b6..3478c1f 100755 --- a/contrib/byacc/config.sub +++ b/contrib/byacc/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2016-01-01' +timestamp='2016-11-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -117,7 +117,7 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -301,6 +301,7 @@ case $basic_machine in | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ @@ -428,6 +429,7 @@ case $basic_machine in | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ @@ -643,6 +645,14 @@ case $basic_machine in basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -1022,7 +1032,7 @@ case $basic_machine in ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1032,7 +1042,7 @@ case $basic_machine in ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1382,14 +1392,14 @@ case $os in | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ @@ -1399,7 +1409,7 @@ case $os in | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos*) + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1531,6 +1541,8 @@ case $os in ;; -nacl*) ;; + -ios) + ;; -none) ;; *) diff --git a/contrib/byacc/configure b/contrib/byacc/configure index b793edf..9707e50 100755 --- a/contrib/byacc/configure +++ b/contrib/byacc/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,14 +1949,18 @@ 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/^[^ ]*[ ]//'` - CC=`echo "$CC" | sed -e 's/[ ].*//'` + cf_flags=`echo "$CC" | sed -e 's/^.*[ ]\(-[^ ]\)/\1/'` + CC=`echo "$CC " | sed -e 's/[ ]-[^ ].*$//' -e 's/[ ]*$//'` + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[IUDfgOW]*) cf_fix_cppflags=no cf_new_cflags= @@ -2036,14 +2040,32 @@ if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done + test -n "$verbose" && echo " resulting CC: '$CC'" 1>&6 + +echo "${as_me:-configure}:2051: testing resulting CC: '$CC' ..." 1>&5 + + test -n "$verbose" && echo " resulting CFLAGS: '$CFLAGS'" 1>&6 + +echo "${as_me:-configure}:2055: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5 + + test -n "$verbose" && echo " resulting CPPFLAGS: '$CPPFLAGS'" 1>&6 + +echo "${as_me:-configure}:2059: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5 + ;; (*) - echo "$as_me:2041: result: ok" >&5 + echo "$as_me:2063: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac -echo "$as_me:2046: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:2068: 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 +2085,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:2088: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:2070: result: no" >&5 + echo "$as_me:2092: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -2084,7 +2106,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:2109: 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 +2155,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:2136: result: $INSTALL" >&5 +echo "$as_me:2158: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -2144,7 +2166,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:2169: 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 +2193,7 @@ else fi fi -echo "$as_me:2174: result: $cf_cv_mixedcase" >&5 +echo "$as_me:2196: result: $cf_cv_mixedcase" >&5 echo "${ECHO_T}$cf_cv_mixedcase" >&6 test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF @@ -2182,7 +2204,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:2207: 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 +2219,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:2222: found $ac_dir/$ac_word" >&5 break done @@ -2205,10 +2227,10 @@ fi fi CTAGS=$ac_cv_prog_CTAGS if test -n "$CTAGS"; then - echo "$as_me:2208: result: $CTAGS" >&5 + echo "$as_me:2230: result: $CTAGS" >&5 echo "${ECHO_T}$CTAGS" >&6 else - echo "$as_me:2211: result: no" >&5 + echo "$as_me:2233: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2219,7 +2241,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:2244: 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 +2256,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:2259: found $ac_dir/$ac_word" >&5 break done @@ -2242,10 +2264,10 @@ fi fi ETAGS=$ac_cv_prog_ETAGS if test -n "$ETAGS"; then - echo "$as_me:2245: result: $ETAGS" >&5 + echo "$as_me:2267: result: $ETAGS" >&5 echo "${ECHO_T}$ETAGS" >&6 else - echo "$as_me:2248: result: no" >&5 + echo "$as_me:2270: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2254,7 +2276,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:2279: 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 +2291,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:2294: found $ac_dir/$ac_word" >&5 break done @@ -2278,17 +2300,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:2303: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else - echo "$as_me:2284: result: no" >&5 + echo "$as_me:2306: 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:2313: 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 +2325,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:2328: found $ac_dir/$ac_word" >&5 break done @@ -2312,10 +2334,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:2337: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else - echo "$as_me:2318: result: no" >&5 + echo "$as_me:2340: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2339,7 +2361,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:2364: 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 +2376,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:2379: found $ac_dir/$ac_word" >&5 break done @@ -2362,25 +2384,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$as_me:2365: result: $AWK" >&5 + echo "$as_me:2387: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else - echo "$as_me:2368: result: no" >&5 + echo "$as_me:2390: 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:2397: 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:2405: 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 +2417,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:2420: found $ac_dir/$ac_word" >&5 break done @@ -2403,10 +2425,10 @@ fi fi LINT=$ac_cv_prog_LINT if test -n "$LINT"; then - echo "$as_me:2406: result: $LINT" >&5 + echo "$as_me:2428: result: $LINT" >&5 echo "${ECHO_T}$LINT" >&6 else - echo "$as_me:2409: result: no" >&5 + echo "$as_me:2431: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2421,7 +2443,7 @@ case $host_os in (aix[4-7]*) cf_xopen_source="-D_ALL_SOURCE" ;; -(cygwin|msys) +(msys) cf_XOPEN_SOURCE=600 ;; (darwin[0-8].*) @@ -2449,16 +2471,16 @@ case $host_os in cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -(linux*|gnu*|mint*|k*bsd*-gnu) +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) -echo "$as_me:2454: checking if we must define _GNU_SOURCE" >&5 +echo "$as_me:2476: 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 2483 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2473,16 +2495,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2476: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2498: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2479: \$? = $ac_status" >&5 + echo "$as_me:2501: \$? = $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:2504: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2485: \$? = $ac_status" >&5 + echo "$as_me:2507: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else @@ -2491,7 +2513,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 2494 "configure" +#line 2516 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2506,16 +2528,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2509: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2531: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2512: \$? = $ac_status" >&5 + echo "$as_me:2534: \$? = $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:2537: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2518: \$? = $ac_status" >&5 + echo "$as_me:2540: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else @@ -2530,9 +2552,58 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2533: result: $cf_cv_gnu_source" >&5 +echo "$as_me:2555: 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" + +if test "$cf_cv_gnu_source" = yes +then +echo "$as_me:2560: checking if we should also define _DEFAULT_SOURCE" >&5 +echo $ECHO_N "checking if we should also define _DEFAULT_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_default_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 2568 "configure" +#include "confdefs.h" +#include <sys/types.h> +int +main () +{ + +#ifdef _DEFAULT_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2583: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2586: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2589: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2592: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_default_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_default_source=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:2603: result: $cf_cv_default_source" >&5 +echo "${ECHO_T}$cf_cv_default_source" >&6 +test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" +fi ;; (minix*) @@ -2555,16 +2626,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:2629: 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}:2635: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2567 "configure" +#line 2638 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2579,16 +2650,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2582: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2653: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2585: \$? = $ac_status" >&5 + echo "$as_me:2656: \$? = $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:2659: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2591: \$? = $ac_status" >&5 + echo "$as_me:2662: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -2609,7 +2680,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 2612 "configure" +#line 2683 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2624,16 +2695,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2627: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2698: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2630: \$? = $ac_status" >&5 + echo "$as_me:2701: \$? = $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:2704: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2636: \$? = $ac_status" >&5 + echo "$as_me:2707: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2644,15 +2715,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}:2718: 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}:2723: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2655 "configure" +#line 2726 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2667,16 +2738,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2670: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2741: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2673: \$? = $ac_status" >&5 + echo "$as_me:2744: \$? = $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:2747: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2679: \$? = $ac_status" >&5 + echo "$as_me:2750: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2692,7 +2763,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:2766: 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 @@ -2810,14 +2881,14 @@ fi ;; (*) -echo "$as_me:2813: checking if we should define _XOPEN_SOURCE" >&5 +echo "$as_me:2884: 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 2891 "configure" #include "confdefs.h" #include <stdlib.h> @@ -2836,16 +2907,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2839: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2910: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2842: \$? = $ac_status" >&5 + echo "$as_me:2913: \$? = $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:2916: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2848: \$? = $ac_status" >&5 + echo "$as_me:2919: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2854,7 +2925,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 2928 "configure" #include "confdefs.h" #include <stdlib.h> @@ -2873,16 +2944,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2876: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2947: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2879: \$? = $ac_status" >&5 + echo "$as_me:2950: \$? = $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:2953: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2885: \$? = $ac_status" >&5 + echo "$as_me:2956: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2897,7 +2968,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2900: result: $cf_cv_xopen_source" >&5 +echo "$as_me:2971: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -3005,16 +3076,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:3079: 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}:3085: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3017 "configure" +#line 3088 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -3029,16 +3100,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3032: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3103: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3035: \$? = $ac_status" >&5 + echo "$as_me:3106: \$? = $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:3109: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3041: \$? = $ac_status" >&5 + echo "$as_me:3112: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -3059,7 +3130,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 3062 "configure" +#line 3133 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -3074,16 +3145,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3077: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3148: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3080: \$? = $ac_status" >&5 + echo "$as_me:3151: \$? = $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:3154: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3086: \$? = $ac_status" >&5 + echo "$as_me:3157: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3094,15 +3165,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}:3168: 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}:3173: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3105 "configure" +#line 3176 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -3117,16 +3188,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3120: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3191: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3123: \$? = $ac_status" >&5 + echo "$as_me:3194: \$? = $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:3197: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3129: \$? = $ac_status" >&5 + echo "$as_me:3200: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3142,7 +3213,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:3216: 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 +3371,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}:3374: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 CFLAGS="$CFLAGS $cf_new_cflags" fi @@ -3308,7 +3379,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}:3382: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi @@ -3316,7 +3387,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}:3390: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi @@ -3324,10 +3395,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:3398: 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 3401 "configure" #include "confdefs.h" #include <stdlib.h> int @@ -3342,16 +3413,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3345: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3416: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3348: \$? = $ac_status" >&5 + echo "$as_me:3419: \$? = $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:3422: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3354: \$? = $ac_status" >&5 + echo "$as_me:3425: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set=yes else @@ -3360,12 +3431,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:3434: 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 3439 "configure" #include "confdefs.h" #include <stdlib.h> int @@ -3380,16 +3451,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3383: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3454: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3386: \$? = $ac_status" >&5 + echo "$as_me:3457: \$? = $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:3460: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3392: \$? = $ac_status" >&5 + echo "$as_me:3463: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set_ok=yes else @@ -3400,19 +3471,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:3474: 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:3479: 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 3486 "configure" #include "confdefs.h" #include <stdlib.h> @@ -3431,16 +3502,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3434: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3505: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3437: \$? = $ac_status" >&5 + echo "$as_me:3508: \$? = $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:3511: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3443: \$? = $ac_status" >&5 + echo "$as_me:3514: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3449,7 +3520,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 3523 "configure" #include "confdefs.h" #include <stdlib.h> @@ -3468,16 +3539,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3471: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3542: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3474: \$? = $ac_status" >&5 + echo "$as_me:3545: \$? = $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:3548: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3480: \$? = $ac_status" >&5 + echo "$as_me:3551: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3492,7 +3563,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3495: result: $cf_cv_xopen_source" >&5 +echo "$as_me:3566: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -3596,7 +3667,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:3670: 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 +3688,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 3691 "configure" #include "confdefs.h" #include <assert.h> Syntax error _ACEOF -if { (eval echo "$as_me:3625: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3696: \"$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:3702: \$? = $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 +3722,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 3725 "configure" #include "confdefs.h" #include <ac_nonexistent.h> _ACEOF -if { (eval echo "$as_me:3658: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3729: \"$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:3735: \$? = $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 +3769,7 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:3701: result: $CPP" >&5 +echo "$as_me:3772: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -3708,18 +3779,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 3782 "configure" #include "confdefs.h" #include <assert.h> Syntax error _ACEOF -if { (eval echo "$as_me:3716: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3787: \"$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:3793: \$? = $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 +3813,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 3816 "configure" #include "confdefs.h" #include <ac_nonexistent.h> _ACEOF -if { (eval echo "$as_me:3749: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3820: \"$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:3826: \$? = $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 +3851,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:3854: 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 +3866,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:3869: 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 3875 "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:3879: \"$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:3885: \$? = $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 +3901,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:3904: 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 <<EOF @@ -3840,7 +3911,7 @@ EOF fi done -echo "$as_me:3843: checking for working mkstemp" >&5 +echo "$as_me:3914: 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 +3922,7 @@ if test "$cross_compiling" = yes; then cf_cv_func_mkstemp=maybe else cat >conftest.$ac_ext <<_ACEOF -#line 3854 "configure" +#line 3925 "configure" #include "confdefs.h" #include <sys/types.h> @@ -3889,15 +3960,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:3892: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3963: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3895: \$? = $ac_status" >&5 + echo "$as_me:3966: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:3897: \"$ac_try\"") >&5 + { (eval echo "$as_me:3968: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3900: \$? = $ac_status" >&5 + echo "$as_me:3971: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_mkstemp=yes @@ -3912,16 +3983,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:3986: 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:3989: 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 3995 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mkstemp (); below. */ @@ -3952,16 +4023,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:4026: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3958: \$? = $ac_status" >&5 + echo "$as_me:4029: \$? = $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:4032: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3964: \$? = $ac_status" >&5 + echo "$as_me:4035: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mkstemp=yes else @@ -3971,7 +4042,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:4045: result: $ac_cv_func_mkstemp" >&5 echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 fi @@ -3986,13 +4057,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:4060: 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 4066 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -4023,16 +4094,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:4097: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4029: \$? = $ac_status" >&5 + echo "$as_me:4100: \$? = $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:4103: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4035: \$? = $ac_status" >&5 + echo "$as_me:4106: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -4042,7 +4113,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:4116: 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 <<EOF @@ -4052,7 +4123,7 @@ EOF fi done -echo "$as_me:4055: checking for maximum table size" >&5 +echo "$as_me:4126: 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 +4133,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:4136: 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:4141: 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 +4148,11 @@ cat >>confdefs.h <<EOF EOF else - echo "$as_me:4080: result: default" >&5 + echo "$as_me:4151: result: default" >&5 echo "${ECHO_T}default" >&6 fi -echo "$as_me:4084: checking if backtracking extension is wanted" >&5 +echo "$as_me:4155: 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 +4160,7 @@ if test "${enable_btyacc+set}" = set; then enableval="$enable_btyacc" fi; -echo "$as_me:4092: result: $enable_btyacc" >&5 +echo "$as_me:4163: result: $enable_btyacc" >&5 echo "${ECHO_T}$enable_btyacc" >&6 if test "$enable_btyacc" = "yes"; then @@ -4104,7 +4175,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:4178: 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 +4185,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:4188: result: $cf_opt_with_warnings" >&5 echo "${ECHO_T}$cf_opt_with_warnings" >&6 if test "$cf_opt_with_warnings" != no ; then @@ -4136,10 +4207,10 @@ cat > conftest.i <<EOF EOF if test "$GCC" = yes then - { echo "$as_me:4139: checking for $CC __attribute__ directives..." >&5 + { echo "$as_me:4210: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <<EOF -#line 4142 "${as_me:-configure}" +#line 4213 "${as_me:-configure}" #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -4188,12 +4259,12 @@ EOF ;; esac - if { (eval echo "$as_me:4191: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4262: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4194: \$? = $ac_status" >&5 + echo "$as_me:4265: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4196: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:4267: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case $cf_attribute in @@ -4257,12 +4328,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:4331: 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 4336 "configure" #include "confdefs.h" int @@ -4279,16 +4350,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4282: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4353: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4285: \$? = $ac_status" >&5 + echo "$as_me:4356: \$? = $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:4359: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4291: \$? = $ac_status" >&5 + echo "$as_me:4362: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" @@ -4299,7 +4370,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:4373: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac @@ -4308,12 +4379,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:4382: 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 4387 "configure" #include "confdefs.h" int @@ -4330,16 +4401,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4333: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4404: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4336: \$? = $ac_status" >&5 + echo "$as_me:4407: \$? = $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:4410: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4342: \$? = $ac_status" >&5 + echo "$as_me:4413: \$? = $ac_status" >&5 (exit $ac_status); }; }; then CLANG_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" @@ -4350,12 +4421,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:4424: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi cat > conftest.$ac_ext <<EOF -#line 4358 "${as_me:-configure}" +#line 4429 "${as_me:-configure}" int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } EOF @@ -4372,7 +4443,7 @@ then # remark #981: operands are evaluated in unspecified order # warning #279: controlling expression is constant - { echo "$as_me:4375: checking for $CC warning options..." >&5 + { echo "$as_me:4446: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" @@ -4388,12 +4459,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:4462: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4394: \$? = $ac_status" >&5 + echo "$as_me:4465: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4396: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4467: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi @@ -4402,7 +4473,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:4476: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= @@ -4426,12 +4497,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:4500: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4432: \$? = $ac_status" >&5 + echo "$as_me:4503: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4434: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4505: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in (Wcast-qual) @@ -4442,7 +4513,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}:4516: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4452,7 +4523,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}:4526: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4468,7 +4539,7 @@ rm -rf conftest* fi fi -echo "$as_me:4471: checking if you want to see long compiling messages" >&5 +echo "$as_me:4542: 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 +4573,10 @@ else ECHO_CC='' fi; -echo "$as_me:4505: result: $enableval" >&5 +echo "$as_me:4576: 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:4579: 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 +4593,7 @@ EOF else with_dmalloc= fi; -echo "$as_me:4525: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:4596: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case .$with_cflags in @@ -4616,23 +4687,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:4619: checking for dmalloc.h" >&5 + echo "$as_me:4690: 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 4696 "configure" #include "confdefs.h" #include <dmalloc.h> _ACEOF -if { (eval echo "$as_me:4629: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4700: \"$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:4706: \$? = $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 +4722,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:4725: 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:4729: 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 +4734,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4666 "configure" +#line 4737 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4682,16 +4753,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:4756: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4688: \$? = $ac_status" >&5 + echo "$as_me:4759: \$? = $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:4762: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4694: \$? = $ac_status" >&5 + echo "$as_me:4765: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -4702,7 +4773,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:4776: 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 <<EOF @@ -4717,7 +4788,7 @@ fi fi -echo "$as_me:4720: checking if you want to use dbmalloc for testing" >&5 +echo "$as_me:4791: 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 +4805,7 @@ EOF else with_dbmalloc= fi; -echo "$as_me:4737: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:4808: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case .$with_cflags in @@ -4828,23 +4899,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:4831: checking for dbmalloc.h" >&5 + echo "$as_me:4902: 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 4908 "configure" #include "confdefs.h" #include <dbmalloc.h> _ACEOF -if { (eval echo "$as_me:4841: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4912: \"$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:4918: \$? = $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 +4934,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:4937: 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:4941: 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 +4946,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4878 "configure" +#line 4949 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4894,16 +4965,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:4968: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4900: \$? = $ac_status" >&5 + echo "$as_me:4971: \$? = $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:4974: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4906: \$? = $ac_status" >&5 + echo "$as_me:4977: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -4914,7 +4985,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:4988: 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 <<EOF @@ -4929,7 +5000,7 @@ fi fi -echo "$as_me:4932: checking if you want to use valgrind for testing" >&5 +echo "$as_me:5003: 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 +5017,7 @@ EOF else with_valgrind= fi; -echo "$as_me:4949: result: ${with_valgrind:-no}" >&5 +echo "$as_me:5020: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case .$with_cflags in @@ -5039,7 +5110,7 @@ fi ;; esac -echo "$as_me:5042: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:5113: 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 +5120,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:5123: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$with_no_leaks" = yes ; then @@ -5066,7 +5137,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:5140: 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 +5154,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:5157: found $ac_dir/$ac_word" >&5 break fi done @@ -5095,16 +5166,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:5169: result: $GROFF_PATH" >&5 echo "${ECHO_T}$GROFF_PATH" >&6 else - echo "$as_me:5101: result: no" >&5 + echo "$as_me:5172: 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:5178: 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 +5192,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:5195: found $ac_dir/$ac_word" >&5 break fi done @@ -5133,10 +5204,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:5207: result: $NROFF_PATH" >&5 echo "${ECHO_T}$NROFF_PATH" >&6 else - echo "$as_me:5139: result: no" >&5 + echo "$as_me:5210: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -5149,7 +5220,7 @@ else GROFF_NOTE= fi -echo "$as_me:5152: checking for program to convert manpage to html" >&5 +echo "$as_me:5223: 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 +5235,11 @@ cf_with_groff=no case $cf_man2html in (yes) - echo "$as_me:5167: result: man2html" >&5 + echo "$as_me:5238: 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:5242: 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 +5256,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:5259: found $ac_dir/$ac_word" >&5 break fi done @@ -5197,10 +5268,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:5271: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 else - echo "$as_me:5203: result: no" >&5 + echo "$as_me:5274: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -5208,18 +5279,18 @@ fi (no|groff|*/groff*) cf_with_groff=yes cf_man2html=$GROFF_PATH - echo "$as_me:5211: result: $cf_man2html" >&5 + echo "$as_me:5282: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; (*) - echo "$as_me:5215: result: $cf_man2html" >&5 + echo "$as_me:5286: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; esac MAN2HTML_TEMP="man2html.tmp" cat >$MAN2HTML_TEMP <<CF_EOF -#!/bin/sh +#!$SHELL # Temporary script generated by CF_WITH_MAN2HTML # Convert inputs to html, sending result to standard output. # @@ -5246,7 +5317,7 @@ then MAN2HTML_NOTE="$GROFF_NOTE" MAN2HTML_PATH="$GROFF_PATH" cat >>$MAN2HTML_TEMP <<CF_EOF -/bin/sh -c "tbl \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}" +$SHELL -c "tbl \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}" CF_EOF else MAN2HTML_NOTE="" @@ -5276,14 +5347,14 @@ case ".$cf_man2html" in cf_man2html=`echo $cf_man2html | sed -e s%NONE%$cf_path_syntax%` ;; (*) - { { echo "$as_me:5279: error: expected a pathname, not \"$cf_man2html\"" >&5 + { { echo "$as_me:5350: 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:5357: 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 +5372,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:5375: 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:5378: 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 +5400,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:5403: result: $cf_man2html_page" >&5 echo "${ECHO_T}$cf_man2html_page" >&6 cat >>$MAN2HTML_TEMP <<CF_EOF @@ -5348,13 +5419,13 @@ fi chmod 700 $MAN2HTML_TEMP -echo "$as_me:5351: checking for ANSI C header files" >&5 +echo "$as_me:5422: 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 5428 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -5362,13 +5433,13 @@ else #include <float.h> _ACEOF -if { (eval echo "$as_me:5365: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:5436: \"$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:5442: \$? = $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 +5461,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 5464 "configure" #include "confdefs.h" #include <string.h> @@ -5408,7 +5479,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 5482 "configure" #include "confdefs.h" #include <stdlib.h> @@ -5429,7 +5500,7 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line 5432 "configure" +#line 5503 "configure" #include "confdefs.h" #include <ctype.h> #if ((' ' & 0x0FF) == 0x020) @@ -5455,15 +5526,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5458: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5529: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5461: \$? = $ac_status" >&5 + echo "$as_me:5532: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5463: \"$ac_try\"") >&5 + { (eval echo "$as_me:5534: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5466: \$? = $ac_status" >&5 + echo "$as_me:5537: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -5476,7 +5547,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:5550: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then @@ -5492,28 +5563,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:5566: 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 5572 "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:5578: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5510: \$? = $ac_status" >&5 + echo "$as_me:5581: \$? = $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:5584: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5516: \$? = $ac_status" >&5 + echo "$as_me:5587: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else @@ -5523,7 +5594,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:5597: 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 <<EOF @@ -5533,13 +5604,13 @@ EOF fi done -echo "$as_me:5536: checking for mode_t" >&5 +echo "$as_me:5607: 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 5613 "configure" #include "confdefs.h" $ac_includes_default int @@ -5554,16 +5625,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:5628: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5560: \$? = $ac_status" >&5 + echo "$as_me:5631: \$? = $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:5634: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5566: \$? = $ac_status" >&5 + echo "$as_me:5637: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_mode_t=yes else @@ -5573,7 +5644,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:5647: 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 +5737,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:5740: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -5795,7 +5866,7 @@ EOF cat >>$CONFIG_STATUS <<EOF ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.52.20141204, +configured by $0, generated by GNU Autoconf 2.52.20150926, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 @@ -5839,7 +5910,7 @@ cat >>$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:5913: 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 +5929,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:5932: 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 +5948,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 +5966,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:5969: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -6052,10 +6123,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 +6227,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:6141: creating $ac_file" >&5 + { echo "$as_me:6230: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -6156,7 +6245,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:6248: 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 +6258,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:6261: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -6185,7 +6274,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:6277: 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 +6283,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:6286: 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 +6320,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:6323: 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 +6331,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:6334: 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 +6380,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:6383: 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 +6391,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:6394: 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 +6404,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:6407: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -6433,7 +6522,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:6525: $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/contrib/byacc/defs.h b/contrib/byacc/defs.h index 0124a84..1fbd672 100644 --- a/contrib/byacc/defs.h +++ b/contrib/byacc/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.54 2016/12/02 19:27:56 tom Exp $ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -118,10 +118,13 @@ #define LEX_PARAM 14 #define POSIX_YACC 15 #define TOKEN_TABLE 16 +#define ERROR_VERBOSE 17 +#define XXXDEBUG 18 #if defined(YYBTYACC) -#define LOCATIONS 17 -#define DESTRUCTOR 18 +#define LOCATIONS 19 +#define DESTRUCTOR 20 +#define INITIAL_ACTION 21 #endif /* symbol classes */ @@ -198,7 +201,7 @@ struct bucket #if defined(YYBTYACC) char **argnames; char **argtags; - int args; + int args; char *destructor; #endif Value_t value; @@ -287,10 +290,12 @@ extern int outline; extern int exit_code; extern int pure_parser; extern int token_table; +extern int error_verbose; #if defined(YYBTYACC) extern int locations; extern int backtrack; extern int destructor; +extern char *initial_action; #endif extern const char *const banner[]; @@ -303,6 +308,7 @@ extern const char *const hdr_vars[]; extern const char *const body_1[]; extern const char *const body_vars[]; extern const char *const body_2[]; +extern const char *const body_3[]; extern const char *const trailer[]; extern char *code_file_name; @@ -412,22 +418,29 @@ extern param *parse_param; #endif #ifndef GCC_PRINTFLIKE -#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#define GCC_PRINTFLIKE(fmt,var) /*nothing */ #endif /* closure.c */ -extern void closure(Value_t * nucleus, int n); +extern void closure(Value_t *nucleus, int n); extern void finalize_closure(void); extern void set_first_derives(void); /* error.c */ +struct ainfo +{ + int a_lineno; + char *a_line; + char *a_cptr; +}; + extern void arg_number_disagree_warning(int a_lineno, char *a_name); 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 destructor_redeclared_warning(int a_lineno, char *a_line, char *a_cptr); +extern void default_action_warning(char *s); +extern void destructor_redeclared_warning(const struct ainfo *); extern void dollar_error(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN; extern void dollar_warning(int a_lineno, int i); extern void fatal(const char *msg) GCC_NORETURN; @@ -454,16 +467,16 @@ extern void unexpected_EOF(void) GCC_NORETURN; extern void unknown_arg_warning(int d_lineno, const char *dlr_opt, const char *d_arg, const char *d_line, const char *d_cptr); extern void unknown_rhs(int i) GCC_NORETURN; extern void unsupported_flag_warning(const char *flag, const char *details); -extern void unterminated_action(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN; -extern void unterminated_comment(int c_lineno, char *c_line, char *c_cptr) GCC_NORETURN; -extern void unterminated_string(int s_lineno, char *s_line, char *s_cptr) GCC_NORETURN; -extern void unterminated_text(int t_lineno, char *t_line, char *t_cptr) GCC_NORETURN; -extern void unterminated_union(int u_lineno, char *u_line, char *u_cptr) GCC_NORETURN; +extern void unterminated_action(const struct ainfo *) GCC_NORETURN; +extern void unterminated_comment(const struct ainfo *) GCC_NORETURN; +extern void unterminated_string(const struct ainfo *) GCC_NORETURN; +extern void unterminated_text(const struct ainfo *) GCC_NORETURN; +extern void unterminated_union(const struct ainfo *) GCC_NORETURN; extern void untyped_arg_warning(int a_lineno, const char *dlr_opt, const char *a_name); extern void untyped_lhs(void) GCC_NORETURN; extern void untyped_rhs(int i, char *s) GCC_NORETURN; extern void used_reserved(char *s) GCC_NORETURN; -extern void unterminated_arglist(int a_lineno, char *a_line, char *a_cptr) GCC_NORETURN; +extern void unterminated_arglist(const struct ainfo *) GCC_NORETURN; extern void wrong_number_args_warning(const char *which, const char *a_name); extern void wrong_type_for_arg_warning(int i, char *a_name); diff --git a/contrib/byacc/error.c b/contrib/byacc/error.c index a042aec..07dc894 100644 --- a/contrib/byacc/error.c +++ b/contrib/byacc/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.14 2016/12/02 18:35:55 tom Exp $ */ /* routines for printing error messages */ @@ -77,38 +77,38 @@ syntax_error(int st_lineno, char *st_line, char *st_cptr) } void -unterminated_comment(int c_lineno, char *c_line, char *c_cptr) +unterminated_comment(const struct ainfo *a) { fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n", - myname, c_lineno, input_file_name); - print_pos(c_line, c_cptr); + myname, a->a_lineno, input_file_name); + print_pos(a->a_line, a->a_cptr); done(1); } void -unterminated_string(int s_lineno, char *s_line, char *s_cptr) +unterminated_string(const struct ainfo *a) { fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n", - myname, s_lineno, input_file_name); - print_pos(s_line, s_cptr); + myname, a->a_lineno, input_file_name); + print_pos(a->a_line, a->a_cptr); done(1); } void -unterminated_text(int t_lineno, char *t_line, char *t_cptr) +unterminated_text(const struct ainfo *a) { fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n", - myname, t_lineno, input_file_name); - print_pos(t_line, t_cptr); + myname, a->a_lineno, input_file_name); + print_pos(a->a_line, a->a_cptr); done(1); } void -unterminated_union(int u_lineno, char *u_line, char *u_cptr) +unterminated_union(const struct ainfo *a) { fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \ -declaration\n", myname, u_lineno, input_file_name); - print_pos(u_line, u_cptr); +declaration\n", myname, a->a_lineno, input_file_name); + print_pos(a->a_line, a->a_cptr); done(1); } @@ -218,11 +218,11 @@ specifiers\n", myname, lineno, input_file_name); } void -unterminated_action(int a_lineno, char *a_line, char *a_cptr) +unterminated_action(const struct ainfo *a) { fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n", - myname, a_lineno, input_file_name); - print_pos(a_line, a_cptr); + myname, a->a_lineno, input_file_name); + print_pos(a->a_line, a->a_cptr); done(1); } @@ -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 @@ -315,12 +316,12 @@ at_error(int a_lineno, char *a_line, char *a_cptr) } void -unterminated_arglist(int a_lineno, char *a_line, char *a_cptr) +unterminated_arglist(const struct ainfo *a) { fprintf(stderr, "%s: e - line %d of \"%s\", unterminated argument list\n", - myname, a_lineno, input_file_name); - print_pos(a_line, a_cptr); + myname, a->a_lineno, input_file_name); + print_pos(a->a_line, a->a_cptr); done(1); } @@ -393,10 +394,10 @@ start_requires_args(char *a_name) } void -destructor_redeclared_warning(int a_lineno, char *a_line, char *a_cptr) +destructor_redeclared_warning(const struct ainfo *a) { fprintf(stderr, "%s: w - line %d of \"%s\", destructor redeclared\n", - myname, a_lineno, input_file_name); - print_pos(a_line, a_cptr); + myname, a->a_lineno, input_file_name); + print_pos(a->a_line, a->a_cptr); } #endif diff --git a/contrib/byacc/lalr.c b/contrib/byacc/lalr.c index bf7e6a8..8d19b1a 100644 --- a/contrib/byacc/lalr.c +++ b/contrib/byacc/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/contrib/byacc/lr0.c b/contrib/byacc/lr0.c index cf0e95d..0ac211f 100644 --- a/contrib/byacc/lr0.c +++ b/contrib/byacc/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/contrib/byacc/main.c b/contrib/byacc/main.c index 37889c3..137df20 100644 --- a/contrib/byacc/main.c +++ b/contrib/byacc/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.56 2016/03/25 00:16:28 Jung-uk.Kim Exp $ */ +/* $Id: main.c,v 1.57 2016/12/02 18:44:44 tom Exp $ */ #include <signal.h> #ifndef _WIN32 @@ -92,6 +92,7 @@ char *symbol_assoc; int pure_parser; int token_table; +int error_verbose; #if defined(YYBTYACC) Value_t *symbol_pval; @@ -99,6 +100,7 @@ char **symbol_destructor; char **symbol_type_tag; int locations = 0; /* default to no position processing */ int backtrack = 0; /* default is no backtracking */ +char *initial_action = NULL; #endif int exit_code; diff --git a/contrib/byacc/mkpar.c b/contrib/byacc/mkpar.c index 653c202..759cb7e 100644 --- a/contrib/byacc/mkpar.c +++ b/contrib/byacc/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/contrib/byacc/mstring.c b/contrib/byacc/mstring.c index dc384e5..3bdb122 100644 --- a/contrib/byacc/mstring.c +++ b/contrib/byacc/mstring.c @@ -1,4 +1,4 @@ -/* $Id: mstring.c,v 1.6 2014/04/22 23:36:31 tom Exp $ */ +/* $Id: mstring.c,v 1.7 2016/12/02 17:57:21 tom Exp $ */ #include <stdlib.h> #include <stdio.h> @@ -157,20 +157,20 @@ strnscmp(const char *a, const char *b) { while (1) { - while (isspace(*a)) + while (isspace(UCH(*a))) a++; - while (isspace(*b)) + while (isspace(UCH(*b))) b++; while (*a && *a == *b) a++, b++; - if (isspace(*a)) + if (isspace(UCH(*a))) { - if (isalnum(a[-1]) && isalnum(*b)) + if (isalnum(UCH(a[-1])) && isalnum(UCH(*b))) break; } - else if (isspace(*b)) + else if (isspace(UCH(*b))) { - if (isalnum(b[-1]) && isalnum(*a)) + if (isalnum(UCH(b[-1])) && isalnum(UCH(*a))) break; } else @@ -186,7 +186,7 @@ strnshash(const char *s) while (*s) { - if (!isspace(*s)) + if (!isspace(UCH(*s))) h = (h << 5) - h + (unsigned char)*s; s++; } diff --git a/contrib/byacc/output.c b/contrib/byacc/output.c index ecd9494..0f5194a 100644 --- a/contrib/byacc/output.c +++ b/contrib/byacc/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.79 2016/12/02 20:42:38 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; @@ -235,6 +235,43 @@ end_table(void) } static void +output_stype(FILE * fp) +{ + if (!unionized && ntags == 0) + { + putc_code(fp, '\n'); + putl_code(fp, "#if " + "! defined(YYSTYPE) && " + "! defined(YYSTYPE_IS_DECLARED)\n"); + putl_code(fp, "/* Default: YYSTYPE is the semantic value type. */\n"); + putl_code(fp, "typedef int YYSTYPE;\n"); + putl_code(fp, "# define YYSTYPE_IS_DECLARED 1\n"); + putl_code(fp, "#endif\n"); + } +} + +#if defined(YYBTYACC) +static void +output_ltype(FILE * fp) +{ + putc_code(fp, '\n'); + putl_code(fp, "#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED\n"); + putl_code(fp, "/* Default: YYLTYPE is the text position type. */\n"); + putl_code(fp, "typedef struct YYLTYPE\n"); + putl_code(fp, "{\n"); + putl_code(fp, " int first_line;\n"); + putl_code(fp, " int first_column;\n"); + putl_code(fp, " int last_line;\n"); + putl_code(fp, " int last_column;\n"); + putl_code(fp, " unsigned source;\n"); + putl_code(fp, "} YYLTYPE;\n"); + putl_code(fp, "#define YYLTYPE_IS_DECLARED 1\n"); + putl_code(fp, "#endif\n"); + putl_code(fp, "#define YYRHSLOC(rhs, k) ((rhs)[k])\n"); +} +#endif + +static void output_YYINT_typedef(FILE * fp) { /* generate the type used to index the various parser tables */ @@ -329,6 +366,8 @@ output_accessing_symbols(void) translate[i] = symbol_pval[gsymb]; } + putl_code(output_file, + "#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)\n"); /* yystos[] may be unused, depending on compile-time defines */ start_int_table("stos", translate[0]); @@ -348,6 +387,8 @@ output_accessing_symbols(void) end_table(); FREE(translate); + putl_code(output_file, + "#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */\n"); } } @@ -366,7 +407,7 @@ find_conflict_base(int cbase) if (j + cbase >= nconflicts) break; } - return (Value_t) i; + return (Value_t)i; } #endif @@ -412,7 +453,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 +498,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 +509,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 +553,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 +570,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 +591,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 +676,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 +912,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 +1239,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) @@ -1210,6 +1261,10 @@ output_defines(FILE * fp) } fprintf(fp, "extern YYSTYPE %slval;\n", symbol_prefix); } +#if defined(YYBTYACC) + if (locations) + output_ltype(fp); +#endif } } @@ -1307,8 +1362,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 { @@ -1527,41 +1585,6 @@ output_pure_parser(FILE * fp) } static void -output_stype(FILE * fp) -{ - if (!unionized && ntags == 0) - { - putc_code(fp, '\n'); - putl_code(fp, "#if " - "! defined(YYSTYPE) && " - "! defined(YYSTYPE_IS_DECLARED)\n"); - putl_code(fp, "/* Default: YYSTYPE is the semantic value type. */\n"); - putl_code(fp, "typedef int YYSTYPE;\n"); - putl_code(fp, "# define YYSTYPE_IS_DECLARED 1\n"); - putl_code(fp, "#endif\n"); - } -} - -#if defined(YYBTYACC) -static void -output_ltype(FILE * fp) -{ - putc_code(fp, '\n'); - putl_code(fp, "#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED\n"); - putl_code(fp, "/* Default: YYLTYPE is the text position type. */\n"); - putl_code(fp, "typedef struct YYLTYPE\n"); - putl_code(fp, "{\n"); - putl_code(fp, " int first_line;\n"); - putl_code(fp, " int first_column;\n"); - putl_code(fp, " int last_line;\n"); - putl_code(fp, " int last_column;\n"); - putl_code(fp, "} YYLTYPE;\n"); - putl_code(fp, "#define YYLTYPE_IS_DECLARED 1\n"); - putl_code(fp, "#endif\n"); -} -#endif - -static void output_trailing_text(void) { int c, last; @@ -1768,7 +1791,7 @@ output_error_decl(FILE * fp) puts_code(fp, "#define YYERROR_DECL() yyerror("); #if defined(YYBTYACC) if (locations) - puts_code(fp, "YYLTYPE loc, "); + puts_code(fp, "YYLTYPE *loc, "); #endif puts_param_types(fp, parse_param, 1); putl_code(fp, "const char *s)\n"); @@ -1779,7 +1802,7 @@ output_error_decl(FILE * fp) puts_code(fp, "#define YYERROR_CALL(msg) yyerror("); #if defined(YYBTYACC) if (locations) - puts_code(fp, "yylloc, "); + puts_code(fp, "&yylloc, "); #endif puts_param_names(fp, parse_param, 1); putl_code(fp, "msg)\n"); @@ -1833,6 +1856,13 @@ output_yydestruct_decl(FILE * fp) } static void +output_initial_action(void) +{ + if (initial_action) + fprintf(code_file, "%s\n", initial_action); +} + +static void output_yydestruct_impl(void) { int i; @@ -2038,6 +2068,11 @@ output(void) write_section(code_file, body_vars); } write_section(code_file, body_2); +#if defined(YYBTYACC) + if (initial_action) + output_initial_action(); +#endif + write_section(code_file, body_3); output_semantic_actions(); write_section(code_file, trailer); } diff --git a/contrib/byacc/package/byacc.spec b/contrib/byacc/package/byacc.spec index c18affa..2106a35 100644 --- a/contrib/byacc/package/byacc.spec +++ b/contrib/byacc/package/byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20160324 +%define AppVersion 20161202 %define UseProgram yacc -# $XTermId: byacc.spec,v 1.29 2016/03/24 23:55:52 tom Exp $ +# $XTermId: byacc.spec,v 1.32 2016/12/02 12:58:46 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/contrib/byacc/package/debian/changelog b/contrib/byacc/package/debian/changelog index 91b9c18..b30984d 100644 --- a/contrib/byacc/package/debian/changelog +++ b/contrib/byacc/package/debian/changelog @@ -1,3 +1,21 @@ +byacc (20161202) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Fri, 02 Dec 2016 07:58:46 -0500 + +byacc (20160606) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Mon, 06 Jun 2016 20:44:26 -0400 + +byacc (20160601) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Mon, 06 Jun 2016 05:21:18 -0400 + byacc (20160324) unstable; urgency=low * maintenance updates diff --git a/contrib/byacc/package/mingw-byacc.spec b/contrib/byacc/package/mingw-byacc.spec index 6ec6649..6ea04c1 100644 --- a/contrib/byacc/package/mingw-byacc.spec +++ b/contrib/byacc/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 20161202 %define UseProgram yacc -# $XTermId: mingw-byacc.spec,v 1.11 2016/03/24 23:55:52 tom Exp $ +# $XTermId: mingw-byacc.spec,v 1.14 2016/12/02 12:58:46 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/contrib/byacc/package/pkgsrc/Makefile b/contrib/byacc/package/pkgsrc/Makefile index bb568d1..877117d 100644 --- a/contrib/byacc/package/pkgsrc/Makefile +++ b/contrib/byacc/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-20161202 PKGREVISION= 1 CATEGORIES= devel MASTER_SITES= ftp://invisible-island.net/byacc/ diff --git a/contrib/byacc/reader.c b/contrib/byacc/reader.c index 502e4a2..333ee0c 100644 --- a/contrib/byacc/reader.c +++ b/contrib/byacc/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.66 2016/12/02 20:14:34 tom Exp $ */ #include "defs.h" @@ -22,6 +22,7 @@ static void start_rule(bucket *bp, int s_lineno); #if defined(YYBTYACC) +static void copy_initial_action(void); static void copy_destructor(void); static char *process_destructor_XX(char *code, char *tag); #endif @@ -43,6 +44,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 +127,7 @@ get_line(void) return; } - if (line == 0 || linesize != (LINESIZE + 1)) + if (line == NULL || linesize != (LINESIZE + 1)) { if (line) FREE(line); @@ -163,8 +167,8 @@ dup_line(void) { char *p, *s, *t; - if (line == 0) - return (0); + if (line == NULL) + return (NULL); s = line; while (*s != '\n') ++s; @@ -182,10 +186,10 @@ static void skip_comment(void) { char *s; - - int st_lineno = lineno; - char *st_line = dup_line(); - char *st_cptr = st_line + (cptr - line); + struct ainfo a; + a.a_lineno = lineno; + a.a_line = dup_line(); + a.a_cptr = a.a_line + (cptr - line); s = cptr + 2; for (;;) @@ -193,14 +197,14 @@ skip_comment(void) if (*s == '*' && s[1] == '/') { cptr = s + 2; - FREE(st_line); + FREE(a.a_line); return; } if (*s == '\n') { get_line(); - if (line == 0) - unterminated_comment(st_lineno, st_line, st_cptr); + if (line == NULL) + unterminated_comment(&a); s = cptr; } else @@ -213,10 +217,10 @@ next_inline(void) { char *s; - if (line == 0) + if (line == NULL) { get_line(); - if (line == 0) + if (line == NULL) return (EOF); } @@ -236,7 +240,7 @@ next_inline(void) else if (s[1] == '/') { get_line(); - if (line == 0) + if (line == NULL) return (EOF); s = cptr; break; @@ -287,17 +291,22 @@ nextc(void) /* *INDENT-OFF* */ static struct keyword { - char name[13]; + char name[14]; int token; } keywords[] = { { "binary", NONASSOC }, + { "debug", XXXDEBUG }, #if defined(YYBTYACC) { "destructor", DESTRUCTOR }, #endif + { "error-verbose",ERROR_VERBOSE }, { "expect", EXPECT }, { "expect-rr", EXPECT_RR }, { "ident", IDENT }, +#if defined(YYBTYACC) + { "initial-action", INITIAL_ACTION }, +#endif { "left", LEFT }, { "lex-param", LEX_PARAM }, #if defined(YYBTYACC) @@ -308,8 +317,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,7 +395,7 @@ keyword(void) return (NONASSOC); } syntax_error(lineno, line, t_cptr); - return (-1); + /*NOTREACHED */ } static void @@ -425,9 +434,10 @@ copy_string(int quote) { struct mstring *temp = msnew(); int c; - int s_lineno = lineno; - char *s_line = dup_line(); - char *s_cptr = s_line + (cptr - line - 1); + struct ainfo a; + a.a_lineno = lineno; + a.a_line = dup_line(); + a.a_cptr = a.a_line + (cptr - line - 1); for (;;) { @@ -435,11 +445,11 @@ copy_string(int quote) mputc(temp, c); if (c == quote) { - FREE(s_line); + FREE(a.a_line); return msdone(temp); } if (c == '\n') - unterminated_string(s_lineno, s_line, s_cptr); + unterminated_string(&a); if (c == '\\') { c = *cptr++; @@ -447,8 +457,8 @@ copy_string(int quote) if (c == '\n') { get_line(); - if (line == 0) - unterminated_string(s_lineno, s_line, s_cptr); + if (line == NULL) + unterminated_string(&a); } } } @@ -475,9 +485,10 @@ copy_comment(void) } else if (c == '*') { - int c_lineno = lineno; - char *c_line = dup_line(); - char *c_cptr = c_line + (cptr - line - 1); + struct ainfo a; + a.a_lineno = lineno; + a.a_line = dup_line(); + a.a_cptr = a.a_line + (cptr - line - 1); mputc(temp, c); ++cptr; @@ -489,14 +500,14 @@ copy_comment(void) { mputc(temp, '/'); ++cptr; - FREE(c_line); + FREE(a.a_line); return msdone(temp); } if (c == '\n') { get_line(); - if (line == 0) - unterminated_comment(c_lineno, c_line, c_cptr); + if (line == NULL) + unterminated_comment(&a); } } } @@ -509,15 +520,16 @@ copy_text(void) int c; FILE *f = text_file; int need_newline = 0; - int t_lineno = lineno; - char *t_line = dup_line(); - char *t_cptr = t_line + (cptr - line - 2); + struct ainfo a; + a.a_lineno = lineno; + a.a_line = dup_line(); + a.a_cptr = a.a_line + (cptr - line - 2); if (*cptr == '\n') { get_line(); - if (line == 0) - unterminated_text(t_lineno, t_line, t_cptr); + if (line == NULL) + unterminated_text(&a); } if (!lflag) fprintf(f, line_format, lineno, input_file_name); @@ -532,7 +544,7 @@ copy_text(void) get_line(); if (line) goto loop; - unterminated_text(t_lineno, t_line, t_cptr); + unterminated_text(&a); case '\'': case '"': @@ -562,7 +574,7 @@ copy_text(void) if (need_newline) putc('\n', f); ++cptr; - FREE(t_line); + FREE(a.a_line); return; } /* FALLTHRU */ @@ -595,23 +607,24 @@ copy_union(void) { int c; int depth; - int u_lineno = lineno; - char *u_line = dup_line(); - char *u_cptr = u_line + (cptr - line - 6); + struct ainfo a; + a.a_lineno = lineno; + a.a_line = dup_line(); + a.a_cptr = a.a_line + (cptr - line - 6); if (unionized) 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; @@ -622,8 +635,8 @@ copy_union(void) { case '\n': get_line(); - if (line == 0) - unterminated_union(u_lineno, u_line, u_cptr); + if (line == NULL) + unterminated_union(&a); goto loop; case L_CURL: @@ -635,7 +648,7 @@ copy_union(void) { puts_both(" YYSTYPE;\n"); puts_both("#endif /* !YYSTYPE_IS_DECLARED */\n"); - FREE(u_line); + FREE(a.a_line); return; } goto loop; @@ -858,7 +871,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; @@ -894,7 +907,7 @@ copy_param(int k) goto oops; } - buf[i--] = '\0'; + buf[++i] = '\0'; (void)trim_blanks(buf); comma = buf - 1; @@ -971,9 +984,10 @@ get_literal(void) int n; char *s; bucket *bp; - int s_lineno = lineno; - char *s_line = dup_line(); - char *s_cptr = s_line + (cptr - line); + struct ainfo a; + a.a_lineno = lineno; + a.a_line = dup_line(); + a.a_cptr = a.a_line + (cptr - line); quote = *cptr++; cinc = 0; @@ -983,7 +997,7 @@ get_literal(void) if (c == quote) break; if (c == '\n') - unterminated_string(s_lineno, s_line, s_cptr); + unterminated_string(&a); if (c == '\\') { char *c_cptr = cptr - 1; @@ -993,8 +1007,8 @@ get_literal(void) { case '\n': get_line(); - if (line == 0) - unterminated_string(s_lineno, s_line, s_cptr); + if (line == NULL) + unterminated_string(&a); continue; case '0': @@ -1066,7 +1080,7 @@ get_literal(void) } cachec(c); } - FREE(s_line); + FREE(a.a_line); n = cinc; s = TMALLOC(char, n); @@ -1187,7 +1201,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); } @@ -1266,7 +1280,7 @@ scan_id(void) { char *b = cptr; - while (isalnum(*cptr) || *cptr == '_' || *cptr == '$') + while (isalnum(UCH(*cptr)) || *cptr == '_' || *cptr == '$') cptr++; return cache_tag(b, (size_t) (cptr - b)); } @@ -1318,7 +1332,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; } @@ -1326,6 +1340,7 @@ declare_tokens(int assoc) if (c == EOF) unexpected_EOF(); + value = UNDEFINED; if (isdigit(c)) { value = get_number(); @@ -1430,7 +1445,7 @@ static void declare_types(void) { int c; - bucket *bp; + bucket *bp = NULL; char *tag = NULL; c = nextc(); @@ -1558,6 +1573,10 @@ read_declarations(void) token_table = 1; break; + case ERROR_VERBOSE: + error_verbose = 1; + break; + #if defined(YYBTYACC) case LOCATIONS: locations = 1; @@ -1567,8 +1586,15 @@ read_declarations(void) destructor = 1; copy_destructor(); break; + case INITIAL_ACTION: + copy_initial_action(); + break; #endif + case XXXDEBUG: + /* XXX: FIXME */ + break; + case POSIX_YACC: /* noop for bison compatibility. byacc is already designed to be posix * yacc compatible. */ @@ -1650,9 +1676,11 @@ copy_args(int *alen) struct mstring *s = msnew(); int depth = 0, len = 1; char c, quote = 0; - int a_lineno = lineno; - char *a_line = dup_line(); - char *a_cptr = a_line + (cptr - line - 1); + struct ainfo a; + + a.a_lineno = lineno; + a.a_line = dup_line(); + a.a_cptr = a.a_line + (cptr - line - 1); while ((c = *cptr++) != R_PAREN || depth || quote) { @@ -1669,9 +1697,9 @@ copy_args(int *alen) if (!line) { if (quote) - unterminated_string(a_lineno, a_line, a_cptr); + unterminated_string(&a); else - unterminated_arglist(a_lineno, a_line, a_cptr); + unterminated_arglist(&a); } } else if (quote) @@ -1696,7 +1724,7 @@ copy_args(int *alen) } if (alen) *alen = len; - FREE(a_line); + FREE(a.a_line); return msdone(s); } @@ -1705,13 +1733,13 @@ parse_id(char *p, char **save) { char *b; - while (isspace(*p)) + while (isspace(UCH(*p))) if (*p++ == '\n') rescan_lineno++; - if (!isalpha(*p) && *p != '_') + if (!isalpha(UCH(*p)) && *p != '_') return NULL; b = p; - while (isalnum(*p) || *p == '_' || *p == '$') + while (isalnum(UCH(*p)) || *p == '_' || *p == '$') p++; if (save) { @@ -1725,7 +1753,7 @@ parse_int(char *p, int *save) { int neg = 0, val = 0; - while (isspace(*p)) + while (isspace(UCH(*p))) if (*p++ == '\n') rescan_lineno++; if (*p == '-') @@ -1733,9 +1761,9 @@ parse_int(char *p, int *save) neg = 1; p++; } - if (!isdigit(*p)) + if (!isdigit(UCH(*p))) return NULL; - while (isdigit(*p)) + while (isdigit(UCH(*p))) val = val * 10 + *p++ - '0'; if (neg) val = -val; @@ -1750,7 +1778,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); @@ -1769,12 +1797,12 @@ parse_arginfo(bucket *a, char *args, int argslen) return; for (i = 0; i < argslen; i++) { - while (isspace(*p)) + while (isspace(UCH(*p))) if (*p++ == '\n') rescan_lineno++; if (*p++ != '$') bad_formals(); - while (isspace(*p)) + while (isspace(UCH(*p))) if (*p++ == '\n') rescan_lineno++; if (*p == '<') @@ -1782,7 +1810,7 @@ parse_arginfo(bucket *a, char *args, int argslen) havetags = 1; if (!(p = parse_id(p + 1, &tmp))) bad_formals(); - while (isspace(*p)) + while (isspace(UCH(*p))) if (*p++ == '\n') rescan_lineno++; if (*p++ != '>') @@ -1799,7 +1827,7 @@ parse_arginfo(bucket *a, char *args, int argslen) a->argtags[i] = NULL; if (!(p = parse_id(p, &a->argnames[i]))) bad_formals(); - while (isspace(*p)) + while (isspace(UCH(*p))) if (*p++ == '\n') rescan_lineno++; if (*p++) @@ -1832,7 +1860,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; @@ -1848,7 +1876,7 @@ compile_arg(char **theptr, char *yyvaltag) if (*++p == '<') if (!(p = parse_id(++p, &tag)) || *p++ != '>') illegal_tag(rescan_lineno, NULL, NULL); - if (isdigit(*p) || *p == '-') + if (isdigit(UCH(*p)) || *p == '-') { int val; if (!(p = parse_int(p, &val))) @@ -1872,7 +1900,7 @@ compile_arg(char **theptr, char *yyvaltag) else if (havetags) unknown_rhs(val); } - else if (isalpha(*p) || *p == '_') + else if (isalpha(UCH(*p)) || *p == '_') { char *arg; if (!(p = parse_id(p, &arg))) @@ -1884,8 +1912,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) @@ -1911,6 +1939,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(UCH(*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(UCH(*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 { @@ -1962,7 +2074,7 @@ clean_arg_cache(void) arg_cache[i] = NULL; } } -#endif +#endif /* defined(YYBTYACC) */ static void advance_to_start(void) @@ -2061,12 +2173,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; @@ -2094,7 +2204,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; @@ -2125,13 +2235,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 @@ -2202,11 +2313,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); } @@ -2224,29 +2357,31 @@ copy_action(void) int i, j, n; int depth; #if defined(YYBTYACC) - int trialaction = 0; int haveyyval = 0; #endif char *tag; FILE *f = action_file; - int a_lineno = lineno; - char *a_line = dup_line(); - char *a_cptr = a_line + (cptr - line); + struct ainfo a; Value_t *offsets = NULL, maxoffset; bucket **rhs; + a.a_lineno = lineno; + a.a_line = dup_line(); + a.a_cptr = a.a_line + (cptr - line); + 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) @@ -2278,7 +2413,7 @@ copy_action(void) { if (pitem[i]->class != ARGUMENT) { - offsets[++j] = (Value_t) (i - nitems + 1); + offsets[++j] = (Value_t)(i - nitems + 1); } } } @@ -2337,8 +2472,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; } @@ -2400,7 +2535,7 @@ copy_action(void) goto loop; } #if defined(YYBTYACC) - else if (isalpha(cptr[1]) || cptr[1] == '_') + else if (isalpha(UCH(cptr[1])) || cptr[1] == '_') { char *arg; ++cptr; @@ -2451,6 +2586,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 == '$') @@ -2491,7 +2633,7 @@ copy_action(void) goto loop; } fprintf(f, "\nbreak;\n"); - FREE(a_line); + FREE(a.a_line); if (maxoffset > 0) FREE(offsets); return; @@ -2505,13 +2647,13 @@ copy_action(void) get_line(); if (line) goto loop; - unterminated_action(a_lineno, a_line, a_cptr); + unterminated_action(&a); case ';': if (depth > 0) goto loop; fprintf(f, "\nbreak;\n"); - free(a_line); + free(a.a_line); if (maxoffset > 0) FREE(offsets); return; @@ -2554,7 +2696,7 @@ copy_action(void) } #endif fprintf(f, "\nbreak;\n"); - free(a_line); + free(a.a_line); if (maxoffset > 0) FREE(offsets); return; @@ -2582,32 +2724,27 @@ copy_action(void) } #if defined(YYBTYACC) -static void -copy_destructor(void) +static char * +get_code(struct ainfo *a, const char *loc) { int c; int depth; char *tag; - bucket *bp; - struct mstring *destructor_text = msnew(); - char *code_text; - int a_lineno; - char *a_line; - char *a_cptr; + struct mstring *code_mstr = msnew(); if (!lflag) - msprintf(destructor_text, line_format, lineno, input_file_name); + msprintf(code_mstr, line_format, lineno, input_file_name); cptr = after_blanks(cptr); if (*cptr == L_CURL) /* avoid putting curly-braces in first column, to ease editing */ - mputc(destructor_text, '\t'); + mputc(code_mstr, '\t'); else syntax_error(lineno, line, cptr); - a_lineno = lineno; - a_line = dup_line(); - a_cptr = a_line + (cptr - line); + a->a_lineno = lineno; + a->a_line = dup_line(); + a->a_cptr = a->a_line + (cptr - line); depth = 0; loop: @@ -2625,7 +2762,7 @@ copy_destructor(void) c = *cptr; if (c == '$') { - msprintf(destructor_text, "(*val).%s", tag); + msprintf(code_mstr, "(*val).%s", tag); ++cptr; FREE(d_line); goto loop; @@ -2636,7 +2773,7 @@ copy_destructor(void) else if (cptr[1] == '$') { /* process '$$' later; replacement is context dependent */ - msprintf(destructor_text, "$$"); + msprintf(code_mstr, "$$"); cptr += 2; goto loop; } @@ -2650,7 +2787,7 @@ copy_destructor(void) char *l_cptr = l_line + (cptr - line); syntax_error(l_lineno, l_line, l_cptr); } - msprintf(destructor_text, "(*loc)"); + msprintf(code_mstr, "%s", loc); cptr += 2; goto loop; } @@ -2658,21 +2795,21 @@ copy_destructor(void) { do { - mputc(destructor_text, c); + mputc(code_mstr, c); c = *++cptr; } while (isalnum(c) || c == '_' || c == '$'); goto loop; } ++cptr; - mputc(destructor_text, c); + mputc(code_mstr, c); switch (c) { case '\n': get_line(); if (line) goto loop; - unterminated_action(a_lineno, a_line, a_cptr); + unterminated_action(a); case L_CURL: ++depth; @@ -2681,13 +2818,13 @@ copy_destructor(void) case R_CURL: if (--depth > 0) goto loop; - goto process_symbols; + goto out; case '\'': case '"': { char *s = copy_string(c); - msprintf(destructor_text, "%s", s); + msprintf(code_mstr, "%s", s); free(s); } goto loop; @@ -2695,7 +2832,7 @@ copy_destructor(void) case '/': { char *s = copy_comment(); - msprintf(destructor_text, "%s", s); + msprintf(code_mstr, "%s", s); free(s); } goto loop; @@ -2703,8 +2840,29 @@ copy_destructor(void) default: goto loop; } - process_symbols: - code_text = msdone(destructor_text); + out: + return msdone(code_mstr); +} + +static void +copy_initial_action(void) +{ + struct ainfo a; + + initial_action = get_code(&a, "yyloc"); + free(a.a_line); +} + +static void +copy_destructor(void) +{ + char *code_text; + int c; + struct ainfo a; + bucket *bp; + + code_text = get_code(&a, "(*loc)"); + for (;;) { c = nextc(); @@ -2723,7 +2881,7 @@ copy_destructor(void) default_destructor[UNTYPED_DEFAULT] = bp; } if (bp->destructor != NULL) - destructor_redeclared_warning(a_lineno, a_line, a_cptr); + destructor_redeclared_warning(&a); else /* replace "$$" with "(*val)" in destructor code */ bp->destructor = process_destructor_XX(code_text, NULL); @@ -2739,7 +2897,7 @@ copy_destructor(void) default_destructor[TYPED_DEFAULT] = bp; } if (bp->destructor != NULL) - destructor_redeclared_warning(a_lineno, a_line, a_cptr); + destructor_redeclared_warning(&a); else { /* postpone re-processing destructor $$s until end of grammar spec */ @@ -2750,10 +2908,10 @@ copy_destructor(void) } else { /* "semantic type" default destructor */ - tag = get_tag(); + char *tag = get_tag(); bp = lookup_type_destructor(tag); if (bp->destructor != NULL) - destructor_redeclared_warning(a_lineno, a_line, a_cptr); + destructor_redeclared_warning(&a); else /* replace "$$" with "(*val).tag" in destructor code */ bp->destructor = process_destructor_XX(code_text, tag); @@ -2763,7 +2921,7 @@ copy_destructor(void) { /* "symbol" destructor */ bp = get_name(); if (bp->destructor != NULL) - destructor_redeclared_warning(a_lineno, a_line, a_cptr); + destructor_redeclared_warning(&a); else { /* postpone re-processing destructor $$s until end of grammar spec */ @@ -2775,7 +2933,7 @@ copy_destructor(void) else break; } - free(a_line); + free(a.a_line); free(code_text); } @@ -2897,6 +3055,7 @@ mark_symbol(void) else { syntax_error(lineno, line, cptr); + /*NOTREACHED */ } if (rprec[nrules] != UNDEFINED && bp->prec != rprec[nrules]) @@ -3067,8 +3226,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); @@ -3103,7 +3262,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) @@ -3116,8 +3275,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) { @@ -3127,7 +3286,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) { @@ -3200,7 +3359,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) { @@ -3210,7 +3369,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; @@ -3297,7 +3456,7 @@ pack_grammar(void) } ++j; } - ritem[j] = (Value_t) - i; + ritem[j] = (Value_t)-i; ++j; if (rprec[i] == UNDEFINED) { @@ -3455,7 +3614,7 @@ reader(void) #ifdef NO_LEAKS static param * -free_declarations(param * list) +free_declarations(param *list) { while (list != 0) { diff --git a/contrib/byacc/skel2c b/contrib/byacc/skel2c index d6f9f59..d979359 100644 --- a/contrib/byacc/skel2c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/btyacc_calc1.tab.c b/contrib/byacc/test/btyacc/btyacc_calc1.tab.c index f7e6a30..d646360 100644 --- a/contrib/byacc/test/btyacc/btyacc_calc1.tab.c +++ b/contrib/byacc/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; @@ -215,6 +215,7 @@ static const YYINT calc1_defred[] = { 1, 0, 24, 0, 26, 0, 0, 23, 25, 14, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 17, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT calc1_stos[] = { 0, 262, 256, 257, 258, 259, 45, 40, 263, 264, 265, 10, 61, 61, 257, 258, 263, 264, 263, 264, 43, @@ -223,6 +224,7 @@ static const YYINT calc1_stos[] = { 0, 263, 264, 263, 264, 264, 264, 264, 264, 263, 263, 43, 45, 42, 47, 263, 263, 263, 263, 263, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT calc1_dgoto[] = { 1, 32, 9, 10, }; @@ -438,9 +440,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) @@ -613,7 +615,7 @@ vdiv(double a, double b, INTERVAL v) { return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); } -#line 617 "btyacc_calc1.tab.c" +#line 619 "btyacc_calc1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -622,18 +624,18 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -647,7 +649,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 +713,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; @@ -792,9 +794,9 @@ YYPARSE_DECL() #endif /* Current position at lexical token queue */ - static short *yylexp = 0; + static YYINT *yylexp = 0; - static short *yylexemes = 0; + static YYINT *yylexemes = 0; #endif /* YYBTYACC */ int yym, yyn, yystate, yyresult; #if YYBTYACC @@ -821,6 +823,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; @@ -864,10 +868,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -877,7 +881,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -894,11 +898,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 +960,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) @@ -979,7 +982,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -1003,7 +1006,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -1038,7 +1041,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 +1087,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 +1123,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 +1139,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 +1174,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 +1196,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1253,7 +1265,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 +1525,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1517 "btyacc_calc1.tab.c" +#line 1529 "btyacc_calc1.tab.c" default: break; } @@ -1568,12 +1580,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1584,7 +1596,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1601,12 +1613,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 +1644,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 +1679,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/contrib/byacc/test/btyacc/btyacc_demo.error b/contrib/byacc/test/btyacc/btyacc_demo.error index 4542fbf..c070d88 100644 --- a/contrib/byacc/test/btyacc/btyacc_demo.error +++ b/contrib/byacc/test/btyacc/btyacc_demo.error @@ -1 +1 @@ -YACC: 7 shift/reduce conflicts, 5 reduce/reduce conflicts. +YACC: 12 shift/reduce conflicts. diff --git a/contrib/byacc/test/btyacc/btyacc_demo.output b/contrib/byacc/test/btyacc/btyacc_demo.output index bc64d24..a281c24 100644 --- a/contrib/byacc/test/btyacc/btyacc_demo.output +++ b/contrib/byacc/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,33 +155,33 @@ state 4 state 5 - decl_spec : EXTERN . (20) + decl_spec : EXTERN . (19) - . reduce 20 + . reduce 19 state 6 - decl_spec : REGISTER . (21) + decl_spec : REGISTER . (20) - . reduce 21 + . reduce 20 state 7 - decl_spec : STATIC . (22) + decl_spec : STATIC . (21) - . reduce 22 + . reduce 21 state 8 - cv_qual : CONST . (23) + cv_qual : CONST . (22) - . reduce 23 + . reduce 22 state 9 - cv_qual : VOLATILE . (24) + cv_qual : VOLATILE . (23) - . reduce 24 + . reduce 23 state 10 @@ -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) + + '*' 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 - . reduce 8 - - $$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) - - . reduce 15 - - -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) - - '*' shift 22 - '(' [trial] shift 23 - ID shift 24 - '(' [trial] reduce 29 - '[' reduce 29 - ';' reduce 29 - ',' reduce 29 - '{' reduce 29 - - declarator_list goto 25 - declarator goto 26 - - -state 21 - opt_scope : opt_scope ID CLCL . (3) - - . reduce 3 - - -state 22 - declarator : '*' . cv_quals $$5 $$6 declarator (34) - cv_quals : . (16) +state 24 + cv_quals : cv_quals . cv_qual (16) + declarator : '*' cv_quals . $$4 $$5 declarator (33) + $$4 : . (24) - . reduce 16 + CONST shift 8 + VOLATILE shift 9 + '*' reduce 24 + '(' reduce 24 + '[' reduce 24 + ID reduce 24 + ';' reduce 24 + ',' reduce 24 + ')' reduce 24 + '{' reduce 24 - cv_quals goto 27 + cv_qual goto 33 + $$4 goto 34 -state 23 - declarator : '(' . $$7 $$8 declarator ')' (33) +state 25 + declarator : '(' $$6 . $$7 declarator ')' (32) $$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 + $$7 goto 35 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 + decl : decl_specs declarator_list ';' . (10) - $$4 goto 33 + . reduce 10 state 27 - cv_quals : cv_quals . cv_qual (17) - declarator : '*' cv_quals . $$5 $$6 declarator (34) - $$5 : . (25) + declarator_list : declarator_list ',' . $$4 $$5 declarator (26) + $$4 : . (24) - CONST shift 8 - VOLATILE shift 9 - '*' reduce 25 - '(' reduce 25 - '[' reduce 25 - ID reduce 25 - ';' reduce 25 - ',' reduce 25 - ')' reduce 25 - '{' reduce 25 + . reduce 24 - cv_qual goto 34 - $$5 goto 35 + $$4 goto 36 state 28 - declarator : '(' $$7 . $$8 declarator ')' (33) - $$8 : . (32) + declarator : declarator '(' . $$4 formal_arg_list ')' cv_quals (35) + $$4 : . (24) - . reduce 32 + . reduce 24 - $$8 goto 36 + $$4 goto 37 state 29 - decl : decl_specs $$2 $$3 declarator_list ';' . (11) + declarator : declarator '[' . $$4 expr ']' (34) + $$4 : . (24) + + . reduce 24 - . reduce 11 + $$4 goto 38 state 30 - declarator_list : declarator_list ',' . $$5 $$6 declarator (27) - $$5 : . (25) + decl : decl_specs declarator $$3 . block_statement (12) - . reduce 25 + '{' shift 39 + . error - $$5 goto 37 + block_statement goto 40 state 31 - declarator : declarator '(' . $$5 formal_arg_list ')' cv_quals (36) - $$5 : . (25) - - . reduce 25 + decl_specs : decl_specs $$2 decl_spec . (14) - $$5 goto 38 + . reduce 14 state 32 - declarator : declarator '[' . $$5 expr ']' (35) - $$5 : . (25) - - . reduce 25 + opt_scope : opt_scope ID CLCL . (3) - $$5 goto 39 + . reduce 3 state 33 - decl : decl_specs $$2 $$3 declarator $$4 . block_statement (13) + cv_quals : cv_quals cv_qual . (16) - '{' shift 40 - . error - - block_statement goto 41 + . reduce 16 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 39 - declarator : declarator '[' $$5 . expr ']' (35) +state 38 + declarator : declarator '[' $$4 . expr ']' (34) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 . error - expr goto 52 + expr goto 51 -state 40 - block_statement : '{' . $$2 statement_list '}' (61) +state 39 + block_statement : '{' . $$2 statement_list '}' (59) $$2 : . (8) . reduce 8 - $$2 goto 53 + $$2 goto 52 +state 40 + decl : decl_specs declarator $$3 block_statement . (12) + + . 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) + + '*' shift 17 + '(' [trial] shift 18 + ID shift 19 + '(' [trial] reduce 28 + '[' reduce 28 + ';' reduce 28 + ',' reduce 28 + ')' reduce 28 + '{' reduce 28 - . reduce 13 + 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 + '(' shift 28 + '[' shift 29 + ')' shift 54 + . error +43: shift/reduce conflict (shift 18, reduce 28) on '(' state 43 - declarator : '(' $$7 $$8 declarator . ')' (33) - declarator : declarator . '[' $$5 expr ']' (35) - declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36) + declarator_list : declarator_list ',' $$4 $$5 . declarator (26) + declarator : . (28) + + '*' shift 17 + '(' [trial] shift 18 + ID shift 19 + '(' [trial] reduce 28 + '[' reduce 28 + ';' reduce 28 + ',' reduce 28 - '(' shift 31 - '[' shift 32 - ')' shift 55 - . error + declarator goto 55 -44: shift/reduce conflict (shift 23, reduce 29) on '(' state 44 - declarator_list : declarator_list ',' $$5 $$6 . declarator (27) - declarator : . (29) + nonempty_formal_arg_list : formal_arg . (39) - '*' shift 22 - '(' [trial] shift 23 - ID shift 24 - '(' [trial] reduce 29 - '[' reduce 29 - ';' reduce 29 - ',' reduce 29 - - declarator goto 56 + . reduce 39 +45: shift/reduce conflict (shift 18, reduce 28) on '(' +45: shift/reduce conflict (shift 19, reduce 8) on ID state 45 - nonempty_formal_arg_list : formal_arg . (40) + 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 - . reduce 40 + declarator goto 56 + $$2 goto 22 state 46 - decl_specs : decl_specs . $$2 decl_spec (15) - formal_arg : decl_specs . $$2 $$3 declarator (41) - $$2 : . (8) - - . reduce 8 + declarator : declarator '(' $$4 formal_arg_list . ')' cv_quals (35) - $$2 goto 57 + ')' shift 57 + . error state 47 - declarator : declarator '(' $$5 formal_arg_list . ')' cv_quals (36) + formal_arg_list : nonempty_formal_arg_list . (37) + nonempty_formal_arg_list : nonempty_formal_arg_list . ',' $$6 formal_arg (38) - ')' shift 58 - . error + ',' 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) + expr : '*' . $$2 expr (46) + $$2 : . (8) - ',' shift 59 - ')' reduce 38 + . reduce 8 + $$2 goto 59 -state 49 - expr : '*' . $$2 expr (47) - $$2 : . (8) - . reduce 8 +state 49 + expr : ID . (47) - $$2 goto 60 + . reduce 47 state 50 - expr : ID . (48) + expr : CONSTANT . (48) . reduce 48 state 51 - expr : CONSTANT . (49) - - . reduce 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) + + '+' 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) - - '+' shift 61 - '-' shift 62 - '*' shift 63 - '/' shift 64 - '%' shift 65 - ']' shift 66 - . error + block_statement : '{' $$2 . statement_list '}' (59) + statement_list : . (57) + . reduce 57 -state 53 - block_statement : '{' $$2 . statement_list '}' (61) - statement_list : . (59) + statement_list goto 66 - . reduce 59 - statement_list goto 67 +state 53 + declarator : '*' cv_quals $$4 $$5 declarator . (33) + declarator : declarator . '[' $$4 expr ']' (34) + declarator : declarator . '(' $$4 formal_arg_list ')' cv_quals (35) + + '(' 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 - - -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 + $$2 goto 76 - 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 72 - expr : expr '+' $$7 . expr (42) +state 70 + expr : expr '+' $$6 . expr (41) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 . error - expr goto 81 + expr goto 78 -state 73 - expr : expr '-' $$7 . expr (43) +state 71 + expr : expr '-' $$6 . expr (42) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 . error - expr goto 82 + expr goto 79 -state 74 - expr : expr '*' $$7 . expr (44) +state 72 + expr : expr '*' $$6 . expr (43) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 . error - expr goto 83 + expr goto 80 -state 75 - expr : expr '/' $$7 . expr (46) +state 73 + expr : expr '/' $$6 . expr (45) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 . error - expr goto 84 + expr goto 81 -state 76 - expr : expr '%' $$7 . expr (45) +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 85 + expr goto 82 -state 77 - block_statement : '{' $$2 statement_list '}' . (61) +state 75 + block_statement : '{' $$2 statement_list '}' . (59) - . reduce 61 + . reduce 59 -78: reduce/reduce conflict (reduce 1, reduce 51) on ID -state 78 - statement_list : statement_list $$2 . statement (60) +76: shift/reduce conflict (shift 49, reduce 1) on ID +state 76 + 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 79 - declarator : declarator . '[' $$5 expr ']' (35) - declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36) - formal_arg : decl_specs $$2 $$3 declarator . (41) - - '(' shift 31 - '[' shift 32 - ',' reduce 41 - ')' reduce 41 +state 77 + nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$6 formal_arg . (38) + . reduce 38 -state 80 - nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg . (39) - . reduce 39 +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 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 +state 79 + 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 62 + '/' shift 63 + '%' shift 64 '+' reduce 42 '-' reduce 42 ';' reduce 42 @@ -1002,299 +975,266 @@ state 81 ']' reduce 42 +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) + + . reduce 43 + + +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 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) - - '*' shift 63 - '/' shift 64 - '%' shift 65 - '+' reduce 43 - '-' reduce 43 - ';' reduce 43 - ')' reduce 43 - ']' reduce 43 + 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) + + . reduce 44 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) + statement : IF . '(' $$6 expr ')' THEN $$8 statement ELSE $$9 statement (53) + statement : IF . '(' $$6 expr ')' THEN $$8 statement (54) - . reduce 44 + '(' shift 88 + . error 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 + 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 - 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) + statement : decl . (49) - . reduce 45 + . reduce 49 state 86 - statement : IF . '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement (55) - statement : IF . '(' $$7 expr ')' THEN $$10 statement (56) + statement_list : statement_list $$2 statement . (58) - '(' shift 91 - . error + . reduce 58 state 87 - statement : decl . (50) + statement : $$10 . block_statement (56) - . reduce 50 + '{' shift 39 + . error + + block_statement goto 90 state 88 - statement_list : statement_list $$2 statement . (60) + statement : IF '(' . $$6 expr ')' THEN $$8 statement ELSE $$9 statement (53) + statement : IF '(' . $$6 expr ')' THEN $$8 statement (54) + $$6 : . (30) - . reduce 60 + . reduce 30 + $$6 goto 91 -state 89 - statement : $$9 . expr ';' (52) - '*' shift 49 - ID shift 50 - CONSTANT shift 51 - . error +state 89 + statement : expr ';' . (50) - expr goto 92 + . reduce 50 state 90 - statement : $$12 . block_statement (58) + statement : $$10 block_statement . (56) - '{' shift 40 - . error - - block_statement goto 93 + . reduce 56 state 91 - statement : IF '(' . $$7 expr ')' THEN $$10 statement ELSE $$11 statement (55) - statement : IF '(' . $$7 expr ')' THEN $$10 statement (56) - $$7 : . (31) + statement : IF '(' $$6 . expr ')' THEN $$8 statement ELSE $$9 statement (53) + statement : IF '(' $$6 . expr ')' THEN $$8 statement (54) - . reduce 31 + '*' shift 48 + ID shift 49 + CONSTANT shift 50 + . error - $$7 goto 94 + expr goto 92 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) - - '+' shift 61 - '-' shift 62 - '*' shift 63 - '/' shift 64 - '%' shift 65 - ';' shift 95 + 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 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) - - . reduce 52 - - -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) - - '+' shift 61 - '-' shift 62 - '*' shift 63 - '/' shift 64 - '%' shift 65 - ')' shift 97 - . error - - -state 97 - statement : IF '(' $$7 expr ')' . THEN $$10 statement ELSE $$11 statement (55) - statement : IF '(' $$7 expr ')' . THEN $$10 statement (56) - - THEN shift 98 - . error - - -state 98 - statement : IF '(' $$7 expr ')' THEN . $$10 statement ELSE $$11 statement (55) - statement : IF '(' $$7 expr ')' THEN . $$10 statement (56) - $$10 : . (53) - - . reduce 53 - - $$10 goto 99 - - -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) + statement : IF '(' $$6 expr ')' THEN $$8 . statement ELSE $$9 statement (53) + statement : IF '(' $$6 expr ')' THEN $$8 . statement (54) 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 100 + 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 - $$9 goto 89 - $$12 goto 90 - + $$10 goto 87 -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 +96: shift/reduce conflict (shift 97, reduce 54) on ELSE +state 96 + statement : IF '(' $$6 expr ')' THEN $$8 statement . ELSE $$9 statement (53) + statement : IF '(' $$6 expr ')' THEN $$8 statement . (54) + + 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 101 - statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE . $$11 statement (55) - $$11 : . (54) +state 97 + statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE . $$9 statement (53) + $$9 : . (52) - . reduce 54 + . reduce 52 - $$11 goto 102 + $$9 goto 98 -102: reduce/reduce conflict (reduce 1, reduce 51) on ID -state 102 - statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 . statement (55) +98: shift/reduce conflict (shift 49, reduce 1) on ID +state 98 + statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE $$9 . statement (53) 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 103 + 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 - $$9 goto 89 - $$12 goto 90 + $$10 goto 87 -state 103 - statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement . (55) +state 99 + statement : IF '(' $$6 expr ')' THEN $$8 statement ELSE $$9 statement . (53) - . reduce 55 + . reduce 53 -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. +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. -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/contrib/byacc/test/btyacc/btyacc_demo.tab.c b/contrib/byacc/test/btyacc/btyacc_demo.tab.c index cd7995b..618da35 100644 --- a/contrib/byacc/test/btyacc/btyacc_demo.tab.c +++ b/contrib/byacc/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 <stdlib.h> #include <stdio.h> -#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; @@ -173,9 +173,11 @@ typedef struct YYLTYPE int first_column; int last_line; int last_column; + unsigned source; } YYLTYPE; #define YYLTYPE_IS_DECLARED 1 #endif +#define YYRHSLOC(rhs, k) ((rhs)[k]) /* compatibility with bison */ #ifdef YYPARSE_PARAM @@ -200,10 +202,10 @@ typedef struct YYLTYPE /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(YYLTYPE loc, const char *s) +#define YYERROR_DECL() yyerror(YYLTYPE *loc, const char *s) #endif #ifndef YYERROR_CALL -#define YYERROR_CALL(msg) yyerror(yylloc, msg) +#define YYERROR_CALL(msg) yyerror(&yylloc, msg) #endif #ifndef YYDESTRUCT_DECL @@ -231,163 +233,163 @@ 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, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 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, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 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, 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, 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, -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, 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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -412,7 +414,8 @@ 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, }; #endif #define YYFINAL 1 @@ -420,7 +423,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 +441,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 +454,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 +468,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 +568,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) @@ -627,9 +628,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 200 "btyacc_demo.y" @@ -659,7 +660,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 664 "btyacc_demo.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -676,7 +677,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 681 "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 +686,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 690 "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 +695,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 699 "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 +704,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 708 "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 +713,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 717 "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 +722,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 726 "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 +731,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 735 "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 +740,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 744 "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 +749,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 753 "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 +758,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 762 "btyacc_demo.tab.c" case 259: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -766,7 +767,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).id); } break; -#line 770 "btyacc_demo.tab.c" +#line 771 "btyacc_demo.tab.c" case 260: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -775,7 +776,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).expr); } break; -#line 779 "btyacc_demo.tab.c" +#line 780 "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 +785,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 789 "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 +794,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 798 "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 +803,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 807 "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 +812,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 816 "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 +821,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 825 "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 +830,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 834 "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 +839,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 843 "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 +848,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 852 "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 +857,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 861 "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 +866,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 870 "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 +875,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 879 "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 +884,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 888 "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 +893,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 897 "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 +902,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 906 "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 +911,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 915 "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 +920,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 924 "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 +929,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 933 "btyacc_demo.tab.c" case 272: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -937,7 +938,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).expr); } break; -#line 941 "btyacc_demo.tab.c" +#line 942 "btyacc_demo.tab.c" case 273: #line 67 "btyacc_demo.y" { /* 'msg' is a 'char *' indicating the context of destructor invocation*/ @@ -947,7 +948,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 952 "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 +957,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 961 "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 +966,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 970 "btyacc_demo.tab.c" case 276: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -974,7 +975,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 978 "btyacc_demo.tab.c" +#line 979 "btyacc_demo.tab.c" case 277: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -983,7 +984,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 987 "btyacc_demo.tab.c" +#line 988 "btyacc_demo.tab.c" case 278: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -992,7 +993,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).code); } break; -#line 996 "btyacc_demo.tab.c" +#line 997 "btyacc_demo.tab.c" case 279: #line 73 "btyacc_demo.y" { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n", @@ -1001,7 +1002,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).decl); } break; -#line 1005 "btyacc_demo.tab.c" +#line 1006 "btyacc_demo.tab.c" case 280: #line 73 "btyacc_demo.y" { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n", @@ -1010,7 +1011,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).decl); } break; -#line 1014 "btyacc_demo.tab.c" +#line 1015 "btyacc_demo.tab.c" case 281: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1019,7 +1020,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1023 "btyacc_demo.tab.c" +#line 1024 "btyacc_demo.tab.c" case 282: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1028,7 +1029,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1032 "btyacc_demo.tab.c" +#line 1033 "btyacc_demo.tab.c" case 283: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1037,7 +1038,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1041 "btyacc_demo.tab.c" +#line 1042 "btyacc_demo.tab.c" case 284: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1046,7 +1047,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1050 "btyacc_demo.tab.c" +#line 1051 "btyacc_demo.tab.c" case 285: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1055,7 +1056,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).type); } break; -#line 1059 "btyacc_demo.tab.c" +#line 1060 "btyacc_demo.tab.c" case 286: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1064,7 +1065,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1068 "btyacc_demo.tab.c" +#line 1069 "btyacc_demo.tab.c" case 287: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1073,7 +1074,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).dlist); } break; -#line 1077 "btyacc_demo.tab.c" +#line 1078 "btyacc_demo.tab.c" case 288: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1082,7 +1083,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).dlist); } break; -#line 1086 "btyacc_demo.tab.c" +#line 1087 "btyacc_demo.tab.c" case 289: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1091,7 +1092,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1095 "btyacc_demo.tab.c" +#line 1096 "btyacc_demo.tab.c" case 290: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1100,16 +1101,16 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1104 "btyacc_demo.tab.c" +#line 1105 "btyacc_demo.tab.c" case 291: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ 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 1114 "btyacc_demo.tab.c" case 292: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1118,43 +1119,43 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1122 "btyacc_demo.tab.c" +#line 1123 "btyacc_demo.tab.c" case 293: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ 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 1132 "btyacc_demo.tab.c" case 294: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ 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 1140 "btyacc_demo.tab.c" +#line 1141 "btyacc_demo.tab.c" case 295: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ 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 1149 "btyacc_demo.tab.c" +#line 1150 "btyacc_demo.tab.c" case 296: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ 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 1158 "btyacc_demo.tab.c" +#line 1159 "btyacc_demo.tab.c" case 297: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1163,7 +1164,7 @@ YYDESTRUCT_DECL() (*loc).last_line, (*loc).last_column); free((*val).scope); } break; -#line 1167 "btyacc_demo.tab.c" +#line 1168 "btyacc_demo.tab.c" case 298: #line 78 "btyacc_demo.y" { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n", @@ -1172,25 +1173,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 <decl> @ 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 <decl> @ 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 1177 "btyacc_demo.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -1203,18 +1186,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -1228,7 +1211,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 +1275,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 +1335,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; @@ -1395,10 +1380,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -1408,7 +1393,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1425,11 +1410,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 +1472,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) @@ -1510,7 +1494,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -1534,7 +1518,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -1569,7 +1553,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 +1599,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 +1635,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 +1651,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 +1686,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 +1708,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1784,7 +1777,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 +1874,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 2107 "btyacc_demo.tab.c" default: break; } @@ -2173,12 +2158,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -2189,7 +2174,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -2206,12 +2191,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 +2222,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 +2257,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/contrib/byacc/test/btyacc/btyacc_demo.tab.h b/contrib/byacc/test/btyacc/btyacc_demo.tab.h index 33139eb..c219fb1 100644 --- a/contrib/byacc/test/btyacc/btyacc_demo.tab.h +++ b/contrib/byacc/test/btyacc/btyacc_demo.tab.h @@ -33,4 +33,18 @@ typedef union { #endif /* !YYSTYPE_IS_DECLARED */ extern YYSTYPE demo_lval; +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +/* Default: YYLTYPE is the text position type. */ +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; + unsigned source; +} YYLTYPE; +#define YYLTYPE_IS_DECLARED 1 +#endif +#define YYRHSLOC(rhs, k) ((rhs)[k]) + #endif /* _demo__defines_h_ */ diff --git a/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c b/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c index 85738e9..ae87b3b 100644 --- a/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c +++ b/contrib/byacc/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; @@ -214,11 +214,13 @@ static const YYINT destroy1_defred[] = { 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 9, 1, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT destroy1_stos[] = { 0, 257, 258, 259, 260, 263, 265, 266, 266, 261, 264, 267, 267, 40, 261, 40, 40, 265, 258, 265, 41, 44, 44, 266, 266, 41, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT destroy1_dgoto[] = { 5, 10, 6, 7, 11, }; @@ -415,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) @@ -475,15 +477,15 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 89 "btyacc_destroy1.y" extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 487 "btyacc_destroy1.tab.c" +#line 489 "btyacc_destroy1.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -503,7 +505,7 @@ YYDESTRUCT_DECL() } } break; -#line 507 "btyacc_destroy1.tab.c" +#line 509 "btyacc_destroy1.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -516,18 +518,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -541,7 +543,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 +607,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 +667,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; @@ -708,10 +712,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -721,7 +725,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -738,11 +742,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 +804,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) @@ -823,7 +826,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -847,7 +850,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -882,7 +885,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 +931,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 +967,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 +983,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 +1018,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 +1040,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1097,7 +1109,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 +1225,7 @@ case 9: #line 86 "btyacc_destroy1.y" { yyval.nlist = yystack.l_mark[-5].nlist; } break; -#line 1217 "btyacc_destroy1.tab.c" +#line 1229 "btyacc_destroy1.tab.c" default: break; } @@ -1268,12 +1280,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1284,7 +1296,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1301,12 +1313,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 +1344,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 +1379,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/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c b/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c index 2441008..17621b0 100644 --- a/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c +++ b/contrib/byacc/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; @@ -214,11 +214,13 @@ static const YYINT destroy2_defred[] = { 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 9, 1, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT destroy2_stos[] = { 0, 257, 258, 259, 260, 263, 265, 266, 266, 261, 264, 267, 267, 40, 261, 40, 40, 265, 258, 265, 41, 44, 44, 266, 266, 41, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT destroy2_dgoto[] = { 5, 10, 6, 7, 11, }; @@ -415,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) @@ -475,15 +477,15 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 89 "btyacc_destroy2.y" extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 487 "btyacc_destroy2.tab.c" +#line 489 "btyacc_destroy2.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -503,7 +505,7 @@ YYDESTRUCT_DECL() } } break; -#line 507 "btyacc_destroy2.tab.c" +#line 509 "btyacc_destroy2.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -516,18 +518,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -541,7 +543,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 +607,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 +667,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; @@ -708,10 +712,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -721,7 +725,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -738,11 +742,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 +804,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) @@ -823,7 +826,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -847,7 +850,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -882,7 +885,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 +931,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 +967,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 +983,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 +1018,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 +1040,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1097,7 +1109,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 +1225,7 @@ case 9: #line 86 "btyacc_destroy2.y" { yyval.nlist = yystack.l_mark[-5].nlist; } break; -#line 1217 "btyacc_destroy2.tab.c" +#line 1229 "btyacc_destroy2.tab.c" default: break; } @@ -1268,12 +1280,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1284,7 +1296,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1301,12 +1313,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 +1344,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 +1379,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/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c b/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c index 9fec701..d16181b 100644 --- a/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c +++ b/contrib/byacc/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; @@ -214,11 +214,13 @@ static const YYINT destroy3_defred[] = { 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 9, 1, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT destroy3_stos[] = { 0, 257, 258, 259, 260, 263, 265, 266, 266, 261, 264, 267, 267, 40, 261, 40, 40, 265, 258, 265, 41, 44, 44, 266, 266, 41, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT destroy3_dgoto[] = { 5, 10, 6, 7, 11, }; @@ -415,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) @@ -475,15 +477,15 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 92 "btyacc_destroy3.y" extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 487 "btyacc_destroy3.tab.c" +#line 489 "btyacc_destroy3.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -503,7 +505,7 @@ YYDESTRUCT_DECL() } } break; -#line 507 "btyacc_destroy3.tab.c" +#line 509 "btyacc_destroy3.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -516,18 +518,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -541,7 +543,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 +607,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 +667,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; @@ -708,10 +712,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -721,7 +725,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -738,11 +742,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 +804,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) @@ -823,7 +826,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -847,7 +850,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -882,7 +885,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 +931,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 +967,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 +983,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 +1018,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 +1040,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1097,7 +1109,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 +1225,7 @@ case 9: #line 89 "btyacc_destroy3.y" { yyval.nlist = yystack.l_mark[-5].nlist; } break; -#line 1217 "btyacc_destroy3.tab.c" +#line 1229 "btyacc_destroy3.tab.c" default: break; } @@ -1268,12 +1280,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1284,7 +1296,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1301,12 +1313,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 +1344,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 +1379,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/contrib/byacc/test/btyacc/calc.tab.c b/contrib/byacc/test/btyacc/calc.tab.c index d0df560..82e1f39 100644 --- a/contrib/byacc/test/btyacc/calc.tab.c +++ b/contrib/byacc/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 @@ -185,12 +185,14 @@ static const YYINT calc_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 9, 10, 11, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT calc_stos[] = { 0, 261, 256, 257, 258, 45, 40, 262, 263, 264, 10, 61, 258, 263, 263, 10, 124, 38, 43, 45, 42, 47, 37, 257, 263, 41, 263, 263, 263, 263, 263, 263, 263, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT calc_dgoto[] = { 1, 7, 8, 9, }; @@ -396,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) @@ -456,9 +458,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 66 "calc.y" /* start of programs */ @@ -502,7 +504,7 @@ yylex(void) } return( c ); } -#line 506 "calc.tab.c" +#line 508 "calc.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -511,18 +513,18 @@ yylex(void) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -536,7 +538,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 +602,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 +662,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; @@ -703,10 +707,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -716,7 +720,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -733,11 +737,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 +799,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) @@ -818,7 +821,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -842,7 +845,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -877,7 +880,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 +926,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 +962,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 +978,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 +1013,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 +1035,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1092,7 +1104,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 +1231,7 @@ case 18: #line 63 "calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1223 "calc.tab.c" +#line 1235 "calc.tab.c" default: break; } @@ -1274,12 +1286,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1290,7 +1302,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1307,12 +1319,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 +1350,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 +1385,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/contrib/byacc/test/btyacc/calc1.tab.c b/contrib/byacc/test/btyacc/calc1.tab.c index 78fb73f..48a94a6 100644 --- a/contrib/byacc/test/btyacc/calc1.tab.c +++ b/contrib/byacc/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; @@ -215,6 +215,7 @@ static const YYINT calc1_defred[] = { 0, 0, 0, 0, 0, 5, 6, 0, 0, 0, 12, 13, 17, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT calc1_stos[] = { 0, 256, 257, 258, 259, 45, 40, 262, 263, 264, 10, 61, 61, 257, 258, 263, 264, 263, 264, 43, 45, @@ -224,6 +225,7 @@ static const YYINT calc1_stos[] = { 0, 43, 45, 42, 47, 10, 10, 263, 263, 263, 263, 263, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT calc1_dgoto[] = { 7, 32, 9, 0, }; @@ -451,9 +453,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,9 +513,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 176 "calc1.y" /* beginning of subroutines section */ @@ -646,7 +648,7 @@ vdiv(double a, double b, INTERVAL v) { return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); } -#line 650 "calc1.tab.c" +#line 652 "calc1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -655,18 +657,18 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -680,7 +682,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 +746,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 +806,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; @@ -847,10 +851,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -860,7 +864,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -877,11 +881,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 +943,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) @@ -962,7 +965,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -986,7 +989,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -1021,7 +1024,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 +1070,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 +1106,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 +1122,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 +1157,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 +1179,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1236,7 +1248,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 +1478,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1470 "calc1.tab.c" +#line 1482 "calc1.tab.c" default: break; } @@ -1521,12 +1533,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1537,7 +1549,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1554,12 +1566,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 +1597,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 +1632,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/contrib/byacc/test/btyacc/calc2.tab.c b/contrib/byacc/test/btyacc/calc2.tab.c index 68ffc38..694e797 100644 --- a/contrib/byacc/test/btyacc/calc2.tab.c +++ b/contrib/byacc/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 @@ -187,12 +187,14 @@ static const YYINT calc2_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 9, 10, 11, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT calc2_stos[] = { 0, 261, 256, 257, 258, 45, 40, 262, 263, 264, 10, 61, 258, 263, 263, 10, 124, 38, 43, 45, 42, 47, 37, 257, 263, 41, 263, 263, 263, 263, 263, 263, 263, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT calc2_dgoto[] = { 1, 7, 8, 9, }; @@ -398,9 +400,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) @@ -458,9 +460,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "calc2.y" /* start of programs */ @@ -515,7 +517,7 @@ YYLEX_DECL() } return( c ); } -#line 519 "calc2.tab.c" +#line 521 "calc2.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -524,18 +526,18 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -549,7 +551,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 +615,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 +675,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; @@ -716,10 +720,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -729,7 +733,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -746,11 +750,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 +812,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) @@ -831,7 +834,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -855,7 +858,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -890,7 +893,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 +939,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 +975,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 +991,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 +1026,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 +1048,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1105,7 +1117,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 +1244,7 @@ case 18: #line 70 "calc2.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1236 "calc2.tab.c" +#line 1248 "calc2.tab.c" default: break; } @@ -1287,12 +1299,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1303,7 +1315,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1320,12 +1332,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 +1363,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 +1398,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/contrib/byacc/test/btyacc/calc3.tab.c b/contrib/byacc/test/btyacc/calc3.tab.c index c9ca77f..383d634 100644 --- a/contrib/byacc/test/btyacc/calc3.tab.c +++ b/contrib/byacc/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 @@ -192,12 +192,14 @@ static const YYINT calc3_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 9, 10, 11, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT calc3_stos[] = { 0, 261, 256, 257, 258, 45, 40, 262, 263, 264, 10, 61, 258, 263, 263, 10, 124, 38, 43, 45, 42, 47, 37, 257, 263, 41, 263, 263, 263, 263, 263, 263, 263, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT calc3_dgoto[] = { 1, 7, 8, 9, }; @@ -394,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) @@ -470,7 +472,7 @@ YYLEX_DECL() } return( c ); } -#line 474 "calc3.tab.c" +#line 476 "calc3.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -479,18 +481,18 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -504,7 +506,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 +570,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; @@ -649,9 +651,9 @@ YYPARSE_DECL() #endif /* Current position at lexical token queue */ - static short *yylexp = 0; + static YYINT *yylexp = 0; - static short *yylexemes = 0; + static YYINT *yylexemes = 0; #endif /* YYBTYACC */ int yym, yyn, yystate, yyresult; #if YYBTYACC @@ -678,6 +680,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; @@ -721,10 +725,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -734,7 +738,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -751,11 +755,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 +817,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 +839,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -860,7 +863,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -895,7 +898,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 +944,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 +980,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 +996,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 +1031,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 +1053,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1110,7 +1122,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 +1249,7 @@ case 18: #line 73 "calc3.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 1241 "calc3.tab.c" +#line 1253 "calc3.tab.c" default: break; } @@ -1292,12 +1304,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1308,7 +1320,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1325,12 +1337,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 +1368,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 +1403,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/contrib/byacc/test/btyacc/code_calc.code.c b/contrib/byacc/test/btyacc/code_calc.code.c index 1c08290..1b5cf0f 100644 --- a/contrib/byacc/test/btyacc/code_calc.code.c +++ b/contrib/byacc/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 <stdio.h> # include <ctype.h> @@ -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) @@ -323,11 +327,11 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *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 <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -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; @@ -574,10 +580,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -587,7 +593,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -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) @@ -689,7 +694,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -713,7 +718,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -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; } @@ -1145,12 +1159,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1161,7 +1175,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -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/contrib/byacc/test/btyacc/code_calc.tab.c b/contrib/byacc/test/btyacc/code_calc.tab.c index 876b1dc..6486b83 100644 --- a/contrib/byacc/test/btyacc/code_calc.tab.c +++ b/contrib/byacc/test/btyacc/code_calc.tab.c @@ -16,12 +16,14 @@ const YYINT calc_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 9, 10, 11, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) const YYINT calc_stos[] = { 0, 261, 256, 257, 258, 45, 40, 262, 263, 264, 10, 61, 258, 263, 263, 10, 124, 38, 43, 45, 42, 47, 37, 257, 263, 41, 263, 263, 263, 263, 263, 263, 263, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ const YYINT calc_dgoto[] = { 1, 7, 8, 9, }; @@ -125,7 +127,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 +139,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/contrib/byacc/test/btyacc/code_calc.tab.h b/contrib/byacc/test/btyacc/code_calc.tab.h index 48f8993..0b129da 100644 --- a/contrib/byacc/test/btyacc/code_calc.tab.h +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/code_error.code.c b/contrib/byacc/test/btyacc/code_error.code.c index 883e3ab..f1cd1c6 100644 --- a/contrib/byacc/test/btyacc/code_error.code.c +++ b/contrib/byacc/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) @@ -315,9 +317,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 12 "code_error.y" @@ -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 <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -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; @@ -546,10 +550,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -559,7 +563,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -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) @@ -661,7 +664,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -685,7 +688,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -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); } @@ -1056,12 +1068,12 @@ yyreduce: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1072,7 +1084,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -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/contrib/byacc/test/btyacc/code_error.tab.c b/contrib/byacc/test/btyacc/code_error.tab.c index d5288b2..88cff35 100644 --- a/contrib/byacc/test/btyacc/code_error.tab.c +++ b/contrib/byacc/test/btyacc/code_error.tab.c @@ -11,9 +11,11 @@ const YYINT error_len[] = { 2, const YYINT error_defred[] = { 0, 1, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) const YYINT error_stos[] = { 0, 256, 258, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ const YYINT error_dgoto[] = { 2, }; const YYINT error_sindex[] = { -256, diff --git a/contrib/byacc/test/btyacc/empty.tab.c b/contrib/byacc/test/btyacc/empty.tab.c index 06ecdcc..a2935ef 100644 --- a/contrib/byacc/test/btyacc/empty.tab.c +++ b/contrib/byacc/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 @@ -174,9 +174,11 @@ static const YYINT empty_len[] = { 2, static const YYINT empty_defred[] = { 1, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT empty_stos[] = { 0, 258, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT empty_dgoto[] = { 1, }; static const YYINT empty_sindex[] = { 0, @@ -287,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) @@ -347,9 +349,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 13 "empty.y" @@ -364,7 +366,7 @@ static void YYERROR_DECL() { printf("%s\n",s); } -#line 368 "empty.tab.c" +#line 370 "empty.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -373,18 +375,18 @@ YYERROR_DECL() { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -398,7 +400,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 +464,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 +524,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; @@ -565,10 +569,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -578,7 +582,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -595,11 +599,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 +661,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) @@ -680,7 +683,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -704,7 +707,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -739,7 +742,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 +788,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 +824,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 +840,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 +875,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 +897,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -954,7 +966,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); } @@ -1075,12 +1087,12 @@ yyreduce: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1091,7 +1103,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1108,12 +1120,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 +1151,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 +1186,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/contrib/byacc/test/btyacc/err_inherit1.tab.c b/contrib/byacc/test/btyacc/err_inherit1.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_inherit1.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_inherit2.tab.c b/contrib/byacc/test/btyacc/err_inherit2.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_inherit2.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_inherit3.output b/contrib/byacc/test/btyacc/err_inherit3.output index 16ea531..3a362a9 100644 --- a/contrib/byacc/test/btyacc/err_inherit3.output +++ b/contrib/byacc/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,27 +37,27 @@ state 0 state 1 - class : GLOBAL . (6) + class : GLOBAL . (5) - . reduce 6 + . reduce 5 state 2 - class : LOCAL . (7) + class : LOCAL . (6) - . reduce 7 + . reduce 6 state 3 - type : REAL . (8) + type : REAL . (7) - . reduce 8 + . reduce 7 state 4 - type : INTEGER . (9) + type : INTEGER . (8) - . reduce 9 + . reduce 8 state 5 @@ -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,118 +92,108 @@ 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 - declaration : class type $$1 . $$2 namelist (3) + locnamelist : $$4 . $$2 namelist (13) $$2 : . (2) . reduce 2 - $$2 goto 13 + $$2 goto 12 state 11 - declaration : type $$3 locnamelist . (5) + declaration : class type $$1 . $$2 namelist (3) + $$2 : . (2) - . reduce 5 + . reduce 2 + + $$2 goto 13 +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 - declaration : class type $$1 $$2 namelist . (3) + namelist : $$3 . namelist NAME (10) + $$3 : . (9) - . reduce 3 + NAME shift 14 + namelist goto 18 + $$3 goto 16 -17: shift/reduce conflict (shift 15, reduce 10) on NAME -state 17 - namelist : $$4 . namelist NAME (11) - $$4 : . (10) - NAME shift 15 +state 17 + declaration : class type $$1 $$2 namelist . (3) - namelist goto 19 - $$4 goto 17 + . reduce 3 state 18 - locnamelist : $$5 $$2 namelist . (14) - - . reduce 14 + namelist : $$3 namelist . NAME (10) - -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/contrib/byacc/test/btyacc/err_inherit3.tab.c b/contrib/byacc/test/btyacc/err_inherit3.tab.c index 93b2706..95c1724 100644 --- a/contrib/byacc/test/btyacc/err_inherit3.tab.c +++ b/contrib/byacc/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,56 @@ 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, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 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, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 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 +256,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 +269,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 +350,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) @@ -408,15 +410,15 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 78 "err_inherit3.y" extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 420 "err_inherit3.tab.c" +#line 422 "err_inherit3.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -436,7 +438,7 @@ YYDESTRUCT_DECL() } } break; -#line 440 "err_inherit3.tab.c" +#line 442 "err_inherit3.tab.c" case 264: #line 30 "err_inherit3.y" { @@ -448,7 +450,7 @@ YYDESTRUCT_DECL() } } break; -#line 452 "err_inherit3.tab.c" +#line 454 "err_inherit3.tab.c" case 265: #line 30 "err_inherit3.y" { @@ -460,7 +462,7 @@ YYDESTRUCT_DECL() } } break; -#line 464 "err_inherit3.tab.c" +#line 466 "err_inherit3.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -473,18 +475,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -498,7 +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; @@ -562,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; @@ -622,6 +624,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; @@ -665,10 +669,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -678,7 +682,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -695,11 +699,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 +761,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) @@ -780,7 +783,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -804,7 +807,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -839,7 +842,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 +888,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 +924,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 +940,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 +975,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 +997,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1054,7 +1066,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 +1146,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 1193 "err_inherit3.tab.c" default: break; } @@ -1236,12 +1244,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1252,7 +1260,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1269,12 +1277,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 +1308,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 +1343,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/contrib/byacc/test/btyacc/err_inherit4.output b/contrib/byacc/test/btyacc/err_inherit4.output index f52c287..ef7ccb8 100644 --- a/contrib/byacc/test/btyacc/err_inherit4.output +++ b/contrib/byacc/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,27 +33,27 @@ state 0 state 1 - class : GLOBAL . (6) + class : GLOBAL . (5) - . reduce 6 + . reduce 5 state 2 - class : LOCAL . (7) + class : LOCAL . (6) - . reduce 7 + . reduce 6 state 3 - type : REAL . (8) + type : REAL . (7) - . reduce 8 + . reduce 7 state 4 - type : INTEGER . (9) + type : INTEGER . (8) - . reduce 9 + . reduce 8 state 5 @@ -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,73 +88,63 @@ 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 - declaration : class type $$1 . $$2 namelist (3) - $$2 : . (2) - - . reduce 2 + namelist : namelist . NAME (9) + locnamelist : namelist . (11) - $$2 goto 14 + NAME shift 13 + $end reduce 11 state 11 - namelist : NAME . (11) + declaration : type locnamelist . (4) - . reduce 11 + . reduce 4 state 12 - namelist : namelist . NAME (10) - locnamelist : namelist . (12) + declaration : class type $$1 . $$2 namelist (3) + $$2 : . (2) + + . reduce 2 - NAME shift 15 - $end reduce 12 + $$2 goto 14 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/contrib/byacc/test/btyacc/err_inherit4.tab.c b/contrib/byacc/test/btyacc/err_inherit4.tab.c index 7e8e042..25db455 100644 --- a/contrib/byacc/test/btyacc/err_inherit4.tab.c +++ b/contrib/byacc/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; @@ -169,9 +169,11 @@ typedef struct YYLTYPE int first_column; int last_line; int last_column; + unsigned source; } YYLTYPE; #define YYLTYPE_IS_DECLARED 1 #endif +#define YYRHSLOC(rhs, k) ((rhs)[k]) /* compatibility with bison */ #ifdef YYPARSE_PARAM @@ -196,10 +198,10 @@ typedef struct YYLTYPE /* Parameters sent to yyerror. */ #ifndef YYERROR_DECL -#define YYERROR_DECL() yyerror(YYLTYPE loc, const char *s) +#define YYERROR_DECL() yyerror(YYLTYPE *loc, const char *s) #endif #ifndef YYERROR_CALL -#define YYERROR_CALL(msg) yyerror(yylloc, msg) +#define YYERROR_CALL(msg) yyerror(&yylloc, msg) #endif #ifndef YYDESTRUCT_DECL @@ -219,44 +221,46 @@ 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, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 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, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 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 +277,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 +290,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 +369,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) @@ -426,15 +429,15 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 80 "err_inherit4.y" extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 438 "err_inherit4.tab.c" +#line 441 "err_inherit4.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -447,17 +450,17 @@ YYDESTRUCT_DECL() #line 28 "err_inherit4.y" { } break; -#line 451 "err_inherit4.tab.c" +#line 454 "err_inherit4.tab.c" case 264: #line 28 "err_inherit4.y" { } break; -#line 456 "err_inherit4.tab.c" +#line 459 "err_inherit4.tab.c" case 265: #line 28 "err_inherit4.y" { } break; -#line 461 "err_inherit4.tab.c" +#line 464 "err_inherit4.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -470,18 +473,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -495,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; @@ -559,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; @@ -619,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; @@ -662,10 +667,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -675,7 +680,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -692,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 @@ -755,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) @@ -777,7 +781,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -801,7 +805,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -836,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; @@ -882,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) @@ -909,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) @@ -925,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) @@ -960,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) @@ -982,7 +995,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1051,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); } @@ -1128,49 +1141,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; -break; -case 5: #line 55 "err_inherit4.y" - { yyval.nlist = yystack.l_mark[0].nlist; } + { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[-3]; } break; -case 6: +case 5: #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 1183 "err_inherit4.tab.c" default: break; } @@ -1225,12 +1234,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1241,7 +1250,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1258,12 +1267,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 +1298,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 +1333,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/contrib/byacc/test/btyacc/err_inherit4.tab.h b/contrib/byacc/test/btyacc/err_inherit4.tab.h index 5561fd8..758d426 100644 --- a/contrib/byacc/test/btyacc/err_inherit4.tab.h +++ b/contrib/byacc/test/btyacc/err_inherit4.tab.h @@ -22,4 +22,18 @@ typedef union #endif /* !YYSTYPE_IS_DECLARED */ extern YYSTYPE err_inherit4_lval; +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +/* Default: YYLTYPE is the text position type. */ +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; + unsigned source; +} YYLTYPE; +#define YYLTYPE_IS_DECLARED 1 +#endif +#define YYRHSLOC(rhs, k) ((rhs)[k]) + #endif /* _err_inherit4__defines_h_ */ diff --git a/contrib/byacc/test/btyacc/err_inherit5.tab.c b/contrib/byacc/test/btyacc/err_inherit5.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_inherit5.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax1.tab.c b/contrib/byacc/test/btyacc/err_syntax1.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax1.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax10.tab.c b/contrib/byacc/test/btyacc/err_syntax10.tab.c index 4ec0d56e..bdbc7f7 100644 --- a/contrib/byacc/test/btyacc/err_syntax10.tab.c +++ b/contrib/byacc/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 @@ -164,9 +164,11 @@ static const YYINT err_syntax10_len[] = { 2, static const YYINT err_syntax10_defred[] = { 0, 1, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT err_syntax10_stos[] = { 0, 256, 258, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT err_syntax10_dgoto[] = { 2, }; static const YYINT err_syntax10_sindex[] = { -256, @@ -277,9 +279,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) @@ -337,9 +339,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 12 "err_syntax10.y" @@ -363,7 +365,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 367 "err_syntax10.tab.c" +#line 369 "err_syntax10.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -372,18 +374,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -397,7 +399,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 +463,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 +523,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; @@ -564,10 +568,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -577,7 +581,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -594,11 +598,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 +660,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) @@ -679,7 +682,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -703,7 +706,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -738,7 +741,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 +787,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 +823,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 +839,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 +874,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 +896,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -953,7 +965,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); } @@ -1074,12 +1086,12 @@ yyreduce: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1090,7 +1102,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1107,12 +1119,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 +1150,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 +1185,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/contrib/byacc/test/btyacc/err_syntax11.tab.c b/contrib/byacc/test/btyacc/err_syntax11.tab.c index d1b51a1..f1e09db 100644 --- a/contrib/byacc/test/btyacc/err_syntax11.tab.c +++ b/contrib/byacc/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 @@ -170,9 +170,11 @@ static const YYINT err_syntax11_len[] = { 2, static const YYINT err_syntax11_defred[] = { 0, 1, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT err_syntax11_stos[] = { 0, 256, 258, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT err_syntax11_dgoto[] = { 2, }; static const YYINT err_syntax11_sindex[] = { -256, @@ -283,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,9 +345,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 12 "err_syntax11.y" @@ -369,7 +371,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 373 "err_syntax11.tab.c" +#line 375 "err_syntax11.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -378,18 +380,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -403,7 +405,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 +469,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 +529,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; @@ -570,10 +574,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -583,7 +587,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -600,11 +604,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 +666,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) @@ -685,7 +688,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -709,7 +712,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -744,7 +747,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 +793,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 +829,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 +845,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 +880,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 +902,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -959,7 +971,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); } @@ -1080,12 +1092,12 @@ yyreduce: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1096,7 +1108,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1113,12 +1125,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 +1156,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 +1191,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/contrib/byacc/test/btyacc/err_syntax12.tab.c b/contrib/byacc/test/btyacc/err_syntax12.tab.c index 6de4586..8590cad 100644 --- a/contrib/byacc/test/btyacc/err_syntax12.tab.c +++ b/contrib/byacc/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 @@ -171,9 +171,11 @@ static const YYINT err_syntax12_len[] = { 2, static const YYINT err_syntax12_defred[] = { 0, 1, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT err_syntax12_stos[] = { 0, 256, 458, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT err_syntax12_dgoto[] = { 2, }; static const YYINT err_syntax12_sindex[] = { -256, @@ -289,9 +291,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) @@ -349,9 +351,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 12 "err_syntax12.y" @@ -375,7 +377,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 379 "err_syntax12.tab.c" +#line 381 "err_syntax12.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -384,18 +386,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -409,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; @@ -473,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; @@ -533,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; @@ -576,10 +580,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -589,7 +593,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -606,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 @@ -669,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) @@ -691,7 +694,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -715,7 +718,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -750,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; @@ -796,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) @@ -823,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) @@ -839,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) @@ -874,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) @@ -896,7 +908,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -965,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); } @@ -1086,12 +1098,12 @@ yyreduce: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1102,7 +1114,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1119,12 +1131,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 +1162,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 +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/contrib/byacc/test/btyacc/err_syntax13.tab.c b/contrib/byacc/test/btyacc/err_syntax13.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax13.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax14.tab.c b/contrib/byacc/test/btyacc/err_syntax14.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax14.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax15.tab.c b/contrib/byacc/test/btyacc/err_syntax15.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax15.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax16.tab.c b/contrib/byacc/test/btyacc/err_syntax16.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax16.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax17.tab.c b/contrib/byacc/test/btyacc/err_syntax17.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax17.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax18.tab.c b/contrib/byacc/test/btyacc/err_syntax18.tab.c index 45e8e71..57a0616 100644 --- a/contrib/byacc/test/btyacc/err_syntax18.tab.c +++ b/contrib/byacc/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 @@ -170,9 +170,11 @@ static const YYINT err_syntax18_len[] = { 2, static const YYINT err_syntax18_defred[] = { 0, 0, 0, 0, 1, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT err_syntax18_stos[] = { 0, 40, 258, 258, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT err_syntax18_dgoto[] = { 2, }; static const YYINT err_syntax18_sindex[] = { -40, @@ -286,9 +288,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) @@ -346,9 +348,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 13 "err_syntax18.y" @@ -372,7 +374,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 376 "err_syntax18.tab.c" +#line 378 "err_syntax18.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -381,18 +383,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -406,7 +408,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 +472,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 +532,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; @@ -573,10 +577,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -586,7 +590,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -603,11 +607,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 +669,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) @@ -688,7 +691,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -712,7 +715,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -747,7 +750,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 +796,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 +832,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 +848,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 +883,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 +905,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -962,7 +974,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 +1045,7 @@ case 1: #line 9 "err_syntax18.y" { yyval = yystack.l_mark[1]; } break; -#line 1037 "err_syntax18.tab.c" +#line 1049 "err_syntax18.tab.c" default: break; } @@ -1088,12 +1100,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1104,7 +1116,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1121,12 +1133,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 +1164,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 +1199,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/contrib/byacc/test/btyacc/err_syntax19.tab.c b/contrib/byacc/test/btyacc/err_syntax19.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax19.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax2.tab.c b/contrib/byacc/test/btyacc/err_syntax2.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax2.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax20.tab.c b/contrib/byacc/test/btyacc/err_syntax20.tab.c index 6505438..42ac3e1 100644 --- a/contrib/byacc/test/btyacc/err_syntax20.tab.c +++ b/contrib/byacc/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 @@ -165,9 +165,11 @@ static const YYINT err_syntax20_len[] = { 2, static const YYINT err_syntax20_defred[] = { 0, 0, 0, 0, 1, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT err_syntax20_stos[] = { 0, 40, 259, 257, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT err_syntax20_dgoto[] = { 2, }; static const YYINT err_syntax20_sindex[] = { -40, @@ -281,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) @@ -341,9 +343,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 16 "err_syntax20.y" @@ -367,7 +369,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 371 "err_syntax20.tab.c" +#line 373 "err_syntax20.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -376,18 +378,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -401,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; @@ -465,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; @@ -525,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; @@ -568,10 +572,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -581,7 +585,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -598,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 @@ -661,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) @@ -683,7 +686,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -707,7 +710,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -742,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; @@ -788,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) @@ -815,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) @@ -831,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) @@ -866,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) @@ -888,7 +900,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -957,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); } @@ -1028,7 +1040,7 @@ case 1: #line 12 "err_syntax20.y" { yystack.l_mark[-1].rechk = 3; } break; -#line 1032 "err_syntax20.tab.c" +#line 1044 "err_syntax20.tab.c" default: break; } @@ -1083,12 +1095,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1099,7 +1111,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1116,12 +1128,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 +1159,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 +1194,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/contrib/byacc/test/btyacc/err_syntax21.tab.c b/contrib/byacc/test/btyacc/err_syntax21.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax21.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax22.tab.c b/contrib/byacc/test/btyacc/err_syntax22.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax22.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax23.tab.c b/contrib/byacc/test/btyacc/err_syntax23.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax23.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax24.error b/contrib/byacc/test/btyacc/err_syntax24.error index c153889..e8bbfec 100644 --- a/contrib/byacc/test/btyacc/err_syntax24.error +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax24.tab.c b/contrib/byacc/test/btyacc/err_syntax24.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax24.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax25.tab.c b/contrib/byacc/test/btyacc/err_syntax25.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax25.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax26.tab.c b/contrib/byacc/test/btyacc/err_syntax26.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax26.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax27.tab.c b/contrib/byacc/test/btyacc/err_syntax27.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax27.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax3.tab.c b/contrib/byacc/test/btyacc/err_syntax3.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax3.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax4.tab.c b/contrib/byacc/test/btyacc/err_syntax4.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax4.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax5.tab.c b/contrib/byacc/test/btyacc/err_syntax5.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax5.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax6.tab.c b/contrib/byacc/test/btyacc/err_syntax6.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax6.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax7.tab.c b/contrib/byacc/test/btyacc/err_syntax7.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax7.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax7a.tab.c b/contrib/byacc/test/btyacc/err_syntax7a.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax7a.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax7b.tab.c b/contrib/byacc/test/btyacc/err_syntax7b.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax7b.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax8.tab.c b/contrib/byacc/test/btyacc/err_syntax8.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax8.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax8a.tab.c b/contrib/byacc/test/btyacc/err_syntax8a.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax8a.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/err_syntax9.tab.c b/contrib/byacc/test/btyacc/err_syntax9.tab.c index ac0ad3a..6c35f23 100644 --- a/contrib/byacc/test/btyacc/err_syntax9.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/btyacc/error.tab.c b/contrib/byacc/test/btyacc/error.tab.c index d5c10eb..26de46d 100644 --- a/contrib/byacc/test/btyacc/error.tab.c +++ b/contrib/byacc/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 @@ -170,9 +170,11 @@ static const YYINT error_len[] = { 2, static const YYINT error_defred[] = { 0, 1, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT error_stos[] = { 0, 256, 258, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT error_dgoto[] = { 2, }; static const YYINT error_sindex[] = { -256, @@ -282,9 +284,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) @@ -342,9 +344,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 8 "error.y" @@ -368,7 +370,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 372 "error.tab.c" +#line 374 "error.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -377,18 +379,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -402,7 +404,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 +468,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 +528,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; @@ -569,10 +573,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -582,7 +586,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -599,11 +603,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 +665,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) @@ -684,7 +687,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -708,7 +711,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -743,7 +746,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 +792,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 +828,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 +844,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 +879,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 +901,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -958,7 +970,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); } @@ -1079,12 +1091,12 @@ yyreduce: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1095,7 +1107,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1112,12 +1124,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 +1155,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 +1190,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/contrib/byacc/test/btyacc/grammar.tab.c b/contrib/byacc/test/btyacc/grammar.tab.c index 238bcaa..187d064 100644 --- a/contrib/byacc/test/btyacc/grammar.tab.c +++ b/contrib/byacc/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 @@ -519,6 +519,7 @@ static const YYINT grammar_defred[] = { 0, 29, 114, 0, 0, 0, 109, 0, 93, 95, 102, 18, 0, 0, 108, 113, 112, 0, 24, 27, 111, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT grammar_stos[] = { 0, 256, 40, 42, 38, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, @@ -536,6 +537,7 @@ static const YYINT grammar_stos[] = { 0, 285, 41, 305, 307, 40, 283, 306, 286, 309, 316, 59, 44, 331, 41, 41, 41, 307, 303, 285, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT grammar_dgoto[] = { 33, 87, 35, 36, 37, 38, 39, 40, 69, 70, 41, 42, 119, 120, 100, 101, 102, 103, 104, 43, 44, @@ -1106,9 +1108,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) @@ -1166,9 +1168,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 1014 "grammar.y" @@ -1341,7 +1343,7 @@ free_parser(void) #endif } #endif -#line 1345 "grammar.tab.c" +#line 1347 "grammar.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -1350,18 +1352,18 @@ free_parser(void) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -1375,7 +1377,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 +1441,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 +1501,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; @@ -1542,10 +1546,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -1555,7 +1559,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1572,11 +1576,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 +1638,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) @@ -1657,7 +1660,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -1681,7 +1684,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -1716,7 +1719,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 +1765,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 +1801,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 +1817,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 +1852,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 +1874,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1931,7 +1943,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 +2684,7 @@ case 114: yyval.declarator->func_def = FUNC_ANSI; } break; -#line 2676 "grammar.tab.c" +#line 2688 "grammar.tab.c" default: break; } @@ -2727,12 +2739,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -2743,7 +2755,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -2760,12 +2772,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 +2803,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 +2838,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/contrib/byacc/test/btyacc/inherit0.tab.c b/contrib/byacc/test/btyacc/inherit0.tab.c index 7308584..264aed9 100644 --- a/contrib/byacc/test/btyacc/inherit0.tab.c +++ b/contrib/byacc/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 @@ -184,10 +184,12 @@ static const YYINT inherit0_defred[] = { 0, 3, 4, 5, 6, 0, 0, 9, 0, 2, 10, 8, 0, 0, 7, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT inherit0_stos[] = { 0, 257, 258, 259, 260, 263, 264, 265, 265, 267, 268, 261, 266, 269, 261, 266, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT inherit0_dgoto[] = { 5, 6, 7, 12, 9, 10, 13, }; @@ -319,9 +321,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) @@ -379,15 +381,15 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 46 "inherit0.y" extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 391 "inherit0.tab.c" +#line 393 "inherit0.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -396,18 +398,18 @@ extern void YYERROR_DECL(); #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -421,7 +423,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 +487,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 +547,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; @@ -588,10 +592,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -601,7 +605,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -618,11 +622,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 +684,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) @@ -703,7 +706,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -727,7 +730,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -762,7 +765,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 +811,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 +847,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 +863,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 +898,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 +920,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -977,7 +989,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 +1100,7 @@ case 11: #line 43 "inherit0.y" { yyval = yystack.l_mark[0]; } break; -#line 1092 "inherit0.tab.c" +#line 1104 "inherit0.tab.c" default: break; } @@ -1143,12 +1155,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1159,7 +1171,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1176,12 +1188,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 +1219,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 +1254,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/contrib/byacc/test/btyacc/inherit1.tab.c b/contrib/byacc/test/btyacc/inherit1.tab.c index 2c0f958..f454a81 100644 --- a/contrib/byacc/test/btyacc/inherit1.tab.c +++ b/contrib/byacc/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; @@ -205,10 +205,12 @@ static const YYINT inherit1_defred[] = { 0, 3, 4, 5, 6, 0, 0, 9, 0, 2, 10, 8, 0, 0, 7, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT inherit1_stos[] = { 0, 257, 258, 259, 260, 263, 266, 267, 267, 265, 268, 261, 264, 269, 261, 264, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT inherit1_dgoto[] = { 5, 12, 9, 6, 7, 10, 13, }; @@ -340,9 +342,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) @@ -400,15 +402,15 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 74 "inherit1.y" extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 412 "inherit1.tab.c" +#line 414 "inherit1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -417,18 +419,18 @@ extern void YYERROR_DECL(); #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -442,7 +444,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 +508,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 +568,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; @@ -609,10 +613,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -622,7 +626,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -639,11 +643,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 +705,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) @@ -724,7 +727,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -748,7 +751,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -783,7 +786,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 +832,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 +868,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 +884,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 +919,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 +941,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -998,7 +1010,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 +1125,7 @@ case 11: #line 71 "inherit1.y" { yyval.nlist = yystack.l_mark[0].nlist; } break; -#line 1117 "inherit1.tab.c" +#line 1129 "inherit1.tab.c" default: break; } @@ -1168,12 +1180,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1184,7 +1196,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1201,12 +1213,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 +1244,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 +1279,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/contrib/byacc/test/btyacc/inherit2.output b/contrib/byacc/test/btyacc/inherit2.output index 70ffb05..b5df000 100644 --- a/contrib/byacc/test/btyacc/inherit2.output +++ b/contrib/byacc/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,27 +35,27 @@ state 0 state 1 - class : GLOBAL . (6) + class : GLOBAL . (5) - . reduce 6 + . reduce 5 state 2 - class : LOCAL . (7) + class : LOCAL . (6) - . reduce 7 + . reduce 6 state 3 - type : REAL . (8) + type : REAL . (7) - . reduce 8 + . reduce 7 state 4 - type : INTEGER . (9) + type : INTEGER . (8) - . reduce 9 + . reduce 8 state 5 @@ -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,91 +90,81 @@ state 8 . reduce 1 - $$1 goto 10 + $$1 goto 11 state 9 - declaration : type $$3 . locnamelist (5) - $$4 : . (12) - - . reduce 12 + declaration : type locnamelist . (4) - locnamelist goto 11 - $$4 goto 12 + . reduce 4 state 10 - declaration : class type $$1 . $$2 namelist (3) + locnamelist : $$3 . $$2 namelist (12) $$2 : . (2) . reduce 2 - $$2 goto 13 + $$2 goto 12 state 11 - declaration : type $$3 locnamelist . (5) + declaration : class type $$1 . $$2 namelist (3) + $$2 : . (2) - . reduce 5 + . reduce 2 + + $$2 goto 13 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) + namelist : NAME . (10) - NAME shift 15 - . error - - namelist goto 17 + . reduce 10 state 15 - namelist : NAME . (11) + namelist : namelist . NAME (9) + locnamelist : $$3 $$2 namelist . (12) - . reduce 11 + NAME shift 17 + $end reduce 12 state 16 declaration : class type $$1 $$2 namelist . (3) - namelist : namelist . NAME (10) + namelist : namelist . NAME (9) - NAME shift 18 + NAME shift 17 $end reduce 3 state 17 - namelist : namelist . NAME (10) - locnamelist : $$4 $$2 namelist . (13) - - NAME shift 18 - $end reduce 13 + namelist : namelist NAME . (9) - -state 18 - namelist : namelist NAME . (10) - - . reduce 10 + . reduce 9 -7 terminals, 10 nonterminals -14 grammar rules, 19 states +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/contrib/byacc/test/btyacc/inherit2.tab.c b/contrib/byacc/test/btyacc/inherit2.tab.c index 67eb0bd..821d650 100644 --- a/contrib/byacc/test/btyacc/inherit2.tab.c +++ b/contrib/byacc/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,56 @@ 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, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 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, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 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 +256,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 +269,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 +349,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) @@ -408,15 +409,15 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 78 "inherit2.y" extern int YYLEX_DECL(); extern void YYERROR_DECL(); -#line 420 "inherit2.tab.c" +#line 421 "inherit2.tab.c" /* Release memory associated with symbol. */ #if ! defined YYDESTRUCT_IS_DECLARED @@ -436,7 +437,7 @@ YYDESTRUCT_DECL() } } break; -#line 440 "inherit2.tab.c" +#line 441 "inherit2.tab.c" case 264: #line 30 "inherit2.y" { @@ -448,7 +449,7 @@ YYDESTRUCT_DECL() } } break; -#line 452 "inherit2.tab.c" +#line 453 "inherit2.tab.c" case 265: #line 30 "inherit2.y" { @@ -460,7 +461,7 @@ YYDESTRUCT_DECL() } } break; -#line 464 "inherit2.tab.c" +#line 465 "inherit2.tab.c" } } #define YYDESTRUCT_IS_DECLARED 1 @@ -473,18 +474,18 @@ YYDESTRUCT_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -498,7 +499,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 +563,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 +623,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; @@ -665,10 +668,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -678,7 +681,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -695,11 +698,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 +760,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) @@ -780,7 +782,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -804,7 +806,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -839,7 +841,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 +887,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 +923,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 +939,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 +974,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 +996,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1054,7 +1065,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 +1145,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 1188 "inherit2.tab.c" default: break; } @@ -1232,12 +1239,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1248,7 +1255,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1265,12 +1272,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 +1303,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 +1338,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/contrib/byacc/test/btyacc/ok_syntax1.tab.c b/contrib/byacc/test/btyacc/ok_syntax1.tab.c index 5ecb9f9..85b682c 100644 --- a/contrib/byacc/test/btyacc/ok_syntax1.tab.c +++ b/contrib/byacc/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; @@ -213,12 +213,14 @@ static const YYINT ok_syntax1_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 9, 10, 11, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT ok_syntax1_stos[] = { 0, 275, 256, 257, 258, 45, 40, 276, 277, 278, 10, 61, 258, 277, 277, 10, 124, 38, 43, 45, 42, 47, 37, 257, 277, 41, 277, 277, 277, 277, 277, 277, 277, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT ok_syntax1_dgoto[] = { 1, 7, 8, 9, }; @@ -417,9 +419,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) @@ -493,7 +495,7 @@ YYLEX_DECL() } return( c ); } -#line 497 "ok_syntax1.tab.c" +#line 499 "ok_syntax1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -502,18 +504,18 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -527,7 +529,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 +593,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; @@ -672,9 +674,9 @@ YYPARSE_DECL() #endif /* Current position at lexical token queue */ - static short *yylexp = 0; + static YYINT *yylexp = 0; - static short *yylexemes = 0; + static YYINT *yylexemes = 0; #endif /* YYBTYACC */ int yym, yyn, yystate, yyresult; #if YYBTYACC @@ -701,6 +703,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; @@ -744,10 +748,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -757,7 +761,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -774,11 +778,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 +840,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) @@ -859,7 +862,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -883,7 +886,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -918,7 +921,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 +967,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 +1003,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 +1019,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 +1054,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 +1076,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1133,7 +1145,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 +1272,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 1276 "ok_syntax1.tab.c" default: break; } @@ -1315,12 +1327,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1331,7 +1343,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1348,12 +1360,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 +1391,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 +1426,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/contrib/byacc/test/btyacc/pure_calc.tab.c b/contrib/byacc/test/btyacc/pure_calc.tab.c index 00dbd72..9bb8959 100644 --- a/contrib/byacc/test/btyacc/pure_calc.tab.c +++ b/contrib/byacc/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 @@ -195,12 +195,14 @@ static const YYINT calc_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 9, 10, 11, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT calc_stos[] = { 0, 261, 256, 257, 258, 45, 40, 262, 263, 264, 10, 61, 258, 263, 263, 10, 124, 38, 43, 45, 42, 47, 37, 257, 263, 41, 263, 263, 263, 263, 263, 263, 263, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT calc_dgoto[] = { 1, 7, 8, 9, }; @@ -397,9 +399,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) @@ -466,7 +468,7 @@ YYLEX_DECL() } return( c ); } -#line 470 "pure_calc.tab.c" +#line 472 "pure_calc.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -475,18 +477,18 @@ YYLEX_DECL() #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -500,7 +502,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 +566,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; @@ -645,9 +647,9 @@ YYPARSE_DECL() #endif /* Current position at lexical token queue */ - static short *yylexp = 0; + static YYINT *yylexp = 0; - static short *yylexemes = 0; + static YYINT *yylexemes = 0; #endif /* YYBTYACC */ int yym, yyn, yystate, yyresult; #if YYBTYACC @@ -674,6 +676,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; @@ -717,10 +721,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -730,7 +734,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -747,11 +751,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 +813,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) @@ -832,7 +835,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -856,7 +859,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -891,7 +894,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 +940,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 +976,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 +992,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 +1027,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 +1049,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1106,7 +1118,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 +1245,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 1249 "pure_calc.tab.c" default: break; } @@ -1288,12 +1300,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1304,7 +1316,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1321,12 +1333,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 +1364,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 +1399,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/contrib/byacc/test/btyacc/pure_error.tab.c b/contrib/byacc/test/btyacc/pure_error.tab.c index 9fcd309..07dd116 100644 --- a/contrib/byacc/test/btyacc/pure_error.tab.c +++ b/contrib/byacc/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 @@ -182,9 +182,11 @@ static const YYINT error_len[] = { 2, static const YYINT error_defred[] = { 0, 1, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT error_stos[] = { 0, 256, 258, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT error_dgoto[] = { 2, }; static const YYINT error_sindex[] = { -256, @@ -285,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) @@ -334,7 +336,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 338 "pure_error.tab.c" +#line 340 "pure_error.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -343,18 +345,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -368,7 +370,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 +434,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; @@ -513,9 +515,9 @@ YYPARSE_DECL() #endif /* Current position at lexical token queue */ - static short *yylexp = 0; + static YYINT *yylexp = 0; - static short *yylexemes = 0; + static YYINT *yylexemes = 0; #endif /* YYBTYACC */ int yym, yyn, yystate, yyresult; #if YYBTYACC @@ -542,6 +544,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; @@ -585,10 +589,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -598,7 +602,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -615,11 +619,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 +681,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) @@ -700,7 +703,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -724,7 +727,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -759,7 +762,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 +808,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 +844,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 +860,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 +895,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 +917,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -974,7 +986,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); } @@ -1095,12 +1107,12 @@ yyreduce: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1111,7 +1123,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1128,12 +1140,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 +1171,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 +1206,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/contrib/byacc/test/btyacc/quote_calc-s.tab.c b/contrib/byacc/test/btyacc/quote_calc-s.tab.c index 3462a45..1f84f7d 100644 --- a/contrib/byacc/test/btyacc/quote_calc-s.tab.c +++ b/contrib/byacc/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 @@ -191,12 +191,14 @@ static const YYINT quote_calc_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 0, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT quote_calc_stos[] = { 0, 273, 256, 259, 269, 270, 40, 274, 275, 276, 10, 270, 275, 61, 275, 10, 257, 259, 261, 263, 265, 267, 124, 269, 275, 41, 275, 275, 275, 275, 275, 275, 275, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT quote_calc_dgoto[] = { 1, 7, 8, 9, }; @@ -415,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) @@ -475,9 +477,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "quote_calc.y" /* start of programs */ @@ -520,7 +522,7 @@ yylex(void) { } return( c ); } -#line 524 "quote_calc-s.tab.c" +#line 526 "quote_calc-s.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -529,18 +531,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -554,7 +556,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 +620,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 +680,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; @@ -721,10 +725,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -734,7 +738,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -751,11 +755,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 +817,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 +839,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -860,7 +863,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -895,7 +898,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 +944,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 +980,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 +996,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 +1031,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 +1053,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1110,7 +1122,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 +1249,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 1253 "quote_calc-s.tab.c" default: break; } @@ -1292,12 +1304,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1308,7 +1320,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1325,12 +1337,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 +1368,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 +1403,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/contrib/byacc/test/btyacc/quote_calc.tab.c b/contrib/byacc/test/btyacc/quote_calc.tab.c index 350252e..08661fe 100644 --- a/contrib/byacc/test/btyacc/quote_calc.tab.c +++ b/contrib/byacc/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 @@ -197,12 +197,14 @@ static const YYINT quote_calc_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 0, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT quote_calc_stos[] = { 0, 273, 256, 259, 269, 270, 40, 274, 275, 276, 10, 270, 275, 61, 275, 10, 257, 259, 261, 263, 265, 267, 124, 269, 275, 41, 275, 275, 275, 275, 275, 275, 275, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT quote_calc_dgoto[] = { 1, 7, 8, 9, }; @@ -421,9 +423,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) @@ -481,9 +483,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "quote_calc.y" /* start of programs */ @@ -526,7 +528,7 @@ yylex(void) { } return( c ); } -#line 530 "quote_calc.tab.c" +#line 532 "quote_calc.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -535,18 +537,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -560,7 +562,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 +626,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 +686,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; @@ -727,10 +731,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -740,7 +744,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -757,11 +761,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 +823,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) @@ -842,7 +845,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -866,7 +869,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -901,7 +904,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 +950,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 +986,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 +1002,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 +1037,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 +1059,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1116,7 +1128,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 +1255,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 1259 "quote_calc.tab.c" default: break; } @@ -1298,12 +1310,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1314,7 +1326,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1331,12 +1343,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 +1374,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 +1409,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/contrib/byacc/test/btyacc/quote_calc2-s.tab.c b/contrib/byacc/test/btyacc/quote_calc2-s.tab.c index c5b4cf9..ed86452 100644 --- a/contrib/byacc/test/btyacc/quote_calc2-s.tab.c +++ b/contrib/byacc/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 @@ -191,12 +191,14 @@ static const YYINT quote_calc2_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 0, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT quote_calc2_stos[] = { 0, 273, 256, 260, 269, 270, 40, 274, 275, 276, 10, 270, 275, 61, 275, 10, 258, 260, 262, 264, 266, 268, 124, 269, 275, 41, 275, 275, 275, 275, 275, 275, 275, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT quote_calc2_dgoto[] = { 1, 7, 8, 9, }; @@ -415,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) @@ -475,9 +477,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "quote_calc2.y" /* start of programs */ @@ -520,7 +522,7 @@ yylex(void) { } return( c ); } -#line 524 "quote_calc2-s.tab.c" +#line 526 "quote_calc2-s.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -529,18 +531,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -554,7 +556,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 +620,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 +680,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; @@ -721,10 +725,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -734,7 +738,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -751,11 +755,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 +817,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 +839,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -860,7 +863,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -895,7 +898,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 +944,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 +980,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 +996,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 +1031,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 +1053,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1110,7 +1122,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 +1249,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 1253 "quote_calc2-s.tab.c" default: break; } @@ -1292,12 +1304,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1308,7 +1320,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1325,12 +1337,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 +1368,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 +1403,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/contrib/byacc/test/btyacc/quote_calc2.tab.c b/contrib/byacc/test/btyacc/quote_calc2.tab.c index 703e60f..5378828 100644 --- a/contrib/byacc/test/btyacc/quote_calc2.tab.c +++ b/contrib/byacc/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 @@ -197,12 +197,14 @@ static const YYINT quote_calc2_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 0, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT quote_calc2_stos[] = { 0, 273, 256, 260, 269, 270, 40, 274, 275, 276, 10, 270, 275, 61, 275, 10, 258, 260, 262, 264, 266, 268, 124, 269, 275, 41, 275, 275, 275, 275, 275, 275, 275, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT quote_calc2_dgoto[] = { 1, 7, 8, 9, }; @@ -421,9 +423,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) @@ -481,9 +483,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "quote_calc2.y" /* start of programs */ @@ -526,7 +528,7 @@ yylex(void) { } return( c ); } -#line 530 "quote_calc2.tab.c" +#line 532 "quote_calc2.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -535,18 +537,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -560,7 +562,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 +626,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 +686,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; @@ -727,10 +731,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -740,7 +744,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -757,11 +761,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 +823,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) @@ -842,7 +845,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -866,7 +869,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -901,7 +904,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 +950,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 +986,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 +1002,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 +1037,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 +1059,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1116,7 +1128,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 +1255,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 1259 "quote_calc2.tab.c" default: break; } @@ -1298,12 +1310,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1314,7 +1326,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1331,12 +1343,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 +1374,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 +1409,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/contrib/byacc/test/btyacc/quote_calc3-s.tab.c b/contrib/byacc/test/btyacc/quote_calc3-s.tab.c index 080d917..14caffb 100644 --- a/contrib/byacc/test/btyacc/quote_calc3-s.tab.c +++ b/contrib/byacc/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 @@ -191,12 +191,14 @@ static const YYINT quote_calc3_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 0, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT quote_calc3_stos[] = { 0, 273, 256, 259, 269, 270, 40, 274, 275, 276, 10, 270, 275, 61, 275, 10, 257, 259, 261, 263, 265, 267, 124, 269, 275, 41, 275, 275, 275, 275, 275, 275, 275, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT quote_calc3_dgoto[] = { 1, 7, 8, 9, }; @@ -416,9 +418,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) @@ -476,9 +478,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "quote_calc3.y" /* start of programs */ @@ -521,7 +523,7 @@ yylex(void) { } return( c ); } -#line 525 "quote_calc3-s.tab.c" +#line 527 "quote_calc3-s.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -530,18 +532,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -555,7 +557,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 +621,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 +681,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; @@ -722,10 +726,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -735,7 +739,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -752,11 +756,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 +818,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) @@ -837,7 +840,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -861,7 +864,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -896,7 +899,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 +945,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 +981,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 +997,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 +1032,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 +1054,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1111,7 +1123,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 +1250,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 1254 "quote_calc3-s.tab.c" default: break; } @@ -1293,12 +1305,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1309,7 +1321,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1326,12 +1338,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 +1369,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 +1404,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/contrib/byacc/test/btyacc/quote_calc3.tab.c b/contrib/byacc/test/btyacc/quote_calc3.tab.c index 12bfcba..1e4087d 100644 --- a/contrib/byacc/test/btyacc/quote_calc3.tab.c +++ b/contrib/byacc/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 @@ -191,12 +191,14 @@ static const YYINT quote_calc3_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 0, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT quote_calc3_stos[] = { 0, 273, 256, 259, 269, 270, 40, 274, 275, 276, 10, 270, 275, 61, 275, 10, 257, 259, 261, 263, 265, 267, 124, 269, 275, 41, 275, 275, 275, 275, 275, 275, 275, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT quote_calc3_dgoto[] = { 1, 7, 8, 9, }; @@ -416,9 +418,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) @@ -476,9 +478,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "quote_calc3.y" /* start of programs */ @@ -521,7 +523,7 @@ yylex(void) { } return( c ); } -#line 525 "quote_calc3.tab.c" +#line 527 "quote_calc3.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -530,18 +532,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -555,7 +557,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 +621,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 +681,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; @@ -722,10 +726,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -735,7 +739,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -752,11 +756,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 +818,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) @@ -837,7 +840,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -861,7 +864,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -896,7 +899,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 +945,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 +981,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 +997,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 +1032,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 +1054,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1111,7 +1123,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 +1250,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 1254 "quote_calc3.tab.c" default: break; } @@ -1293,12 +1305,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1309,7 +1321,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1326,12 +1338,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 +1369,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 +1404,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/contrib/byacc/test/btyacc/quote_calc4-s.tab.c b/contrib/byacc/test/btyacc/quote_calc4-s.tab.c index c7c41f6..6f91ab7 100644 --- a/contrib/byacc/test/btyacc/quote_calc4-s.tab.c +++ b/contrib/byacc/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 @@ -191,12 +191,14 @@ static const YYINT quote_calc4_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 0, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT quote_calc4_stos[] = { 0, 273, 256, 260, 269, 270, 40, 274, 275, 276, 10, 270, 275, 61, 275, 10, 258, 260, 262, 264, 266, 268, 124, 269, 275, 41, 275, 275, 275, 275, 275, 275, 275, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT quote_calc4_dgoto[] = { 1, 7, 8, 9, }; @@ -416,9 +418,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) @@ -476,9 +478,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "quote_calc4.y" /* start of programs */ @@ -521,7 +523,7 @@ yylex(void) { } return( c ); } -#line 525 "quote_calc4-s.tab.c" +#line 527 "quote_calc4-s.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -530,18 +532,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -555,7 +557,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 +621,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 +681,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; @@ -722,10 +726,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -735,7 +739,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -752,11 +756,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 +818,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) @@ -837,7 +840,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -861,7 +864,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -896,7 +899,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 +945,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 +981,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 +997,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 +1032,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 +1054,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1111,7 +1123,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 +1250,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 1254 "quote_calc4-s.tab.c" default: break; } @@ -1293,12 +1305,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1309,7 +1321,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1326,12 +1338,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 +1369,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 +1404,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/contrib/byacc/test/btyacc/quote_calc4.tab.c b/contrib/byacc/test/btyacc/quote_calc4.tab.c index b28a561..ab95058 100644 --- a/contrib/byacc/test/btyacc/quote_calc4.tab.c +++ b/contrib/byacc/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 @@ -191,12 +191,14 @@ static const YYINT quote_calc4_defred[] = { 1, 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 0, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT quote_calc4_stos[] = { 0, 273, 256, 260, 269, 270, 40, 274, 275, 276, 10, 270, 275, 61, 275, 10, 258, 260, 262, 264, 266, 268, 124, 269, 275, 41, 275, 275, 275, 275, 275, 275, 275, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT quote_calc4_dgoto[] = { 1, 7, 8, 9, }; @@ -416,9 +418,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) @@ -476,9 +478,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 73 "quote_calc4.y" /* start of programs */ @@ -521,7 +523,7 @@ yylex(void) { } return( c ); } -#line 525 "quote_calc4.tab.c" +#line 527 "quote_calc4.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -530,18 +532,18 @@ yylex(void) { #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -555,7 +557,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 +621,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 +681,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; @@ -722,10 +726,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -735,7 +739,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -752,11 +756,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 +818,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) @@ -837,7 +840,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -861,7 +864,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -896,7 +899,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 +945,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 +981,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 +997,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 +1032,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 +1054,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1111,7 +1123,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 +1250,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 1254 "quote_calc4.tab.c" default: break; } @@ -1293,12 +1305,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1309,7 +1321,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1326,12 +1338,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 +1369,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 +1404,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/contrib/byacc/test/btyacc/rename_debug.c b/contrib/byacc/test/btyacc/rename_debug.c index 3964bf1..ce7cb3d 100644 --- a/contrib/byacc/test/btyacc/rename_debug.c +++ b/contrib/byacc/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 @@ -29,9 +29,11 @@ static const YYINT yylen[] = { 2, static const YYINT yydefred[] = { 0, 1, 0, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT yystos[] = { 0, 256, 258, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT yydgoto[] = { 2, }; static const YYINT yysindex[] = { -256, @@ -141,9 +143,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) @@ -201,9 +203,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 12 "code_debug.y" @@ -231,7 +233,7 @@ yyerror(const char* s) { printf("%s\n", s); } -#line 236 "rename_debug.c" +#line 238 "rename_debug.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -240,18 +242,18 @@ yyerror(const char* s) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -265,7 +267,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 +331,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 +391,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; @@ -432,10 +436,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -445,7 +449,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -462,11 +466,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 +528,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) @@ -547,7 +550,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -571,7 +574,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -606,7 +609,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 +655,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 +691,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 +707,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 +742,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 +764,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -821,7 +833,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); } @@ -942,12 +954,12 @@ yyreduce: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -958,7 +970,7 @@ yyreduce: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -975,12 +987,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 +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,7 +1053,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/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c b/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c index 4a35a06f..48723e1 100644 --- a/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c +++ b/contrib/byacc/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*/ @@ -216,6 +216,7 @@ static const YYINT varsyntax_calc1_defred[] = { 0, 0, 0, 0, 0, 5, 6, 0, 0, 0, 12, 13, 17, }; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) static const YYINT varsyntax_calc1_stos[] = { 0, 256, 257, 258, 259, 45, 40, 262, 263, 264, 10, 61, 61, 257, 258, 263, 264, 263, 264, 43, 45, @@ -225,6 +226,7 @@ static const YYINT varsyntax_calc1_stos[] = { 0, 43, 45, 42, 47, 10, 10, 263, 263, 263, 263, 263, 41, }; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ static const YYINT varsyntax_calc1_dgoto[] = { 7, 32, 9, 0, }; @@ -452,9 +454,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) @@ -512,9 +514,9 @@ static YYLTYPE *yylplim = 0; #endif /* Current position at lexical token queue */ -static short *yylexp = 0; +static YYINT *yylexp = 0; -static short *yylexemes = 0; +static YYINT *yylexemes = 0; #endif /* YYBTYACC */ #line 178 "varsyntax_calc1.y" /* beginning of subroutines section */ @@ -647,7 +649,7 @@ vdiv(double a, double b, INTERVAL v) { return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo)); } -#line 651 "varsyntax_calc1.tab.c" +#line 653 "varsyntax_calc1.tab.c" /* For use in generated program */ #define yydepth (int)(yystack.s_mark - yystack.s_base) @@ -656,18 +658,18 @@ vdiv(double a, double b, INTERVAL v) #endif /* YYBTYACC */ #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif -#include <stdlib.h> /* needed for malloc, etc */ -#include <string.h> /* needed for memset */ +#include <stdlib.h> /* needed for malloc, etc */ +#include <string.h> /* needed for memset */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(YYSTACKDATA *data) { int i; unsigned newsize; - short *newss; + YYINT *newss; YYSTYPE *newvs; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) YYLTYPE *newps; @@ -681,7 +683,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 +747,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 +807,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; @@ -848,10 +852,10 @@ yyloop: size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; yylvlim = yylvals + s; @@ -861,7 +865,7 @@ yyloop: #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -878,11 +882,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 +944,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) @@ -963,7 +966,7 @@ yyloop: /* If this is a first conflict in the stack, start saving lexemes */ if (!yylexemes) { - yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); if (yylexemes == NULL) goto yyenomem; yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); if (yylvals == NULL) goto yyenomem; @@ -987,7 +990,7 @@ yyloop: #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) *yylpe++ = yylloc; #endif - *yylexp = (short) yychar; + *yylexp = (YYINT) yychar; yychar = YYEMPTY; } } @@ -1022,7 +1025,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 +1071,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 +1107,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 +1123,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 +1158,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 +1180,7 @@ yyerrhandler: #endif #if !YYBTYACC - goto yyerrlab; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ yyerrlab: #endif ++yynerrs; @@ -1237,7 +1249,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 +1479,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 1471 "varsyntax_calc1.tab.c" +#line 1483 "varsyntax_calc1.tab.c" default: break; } @@ -1522,12 +1534,12 @@ break; size_t s = (size_t) (yylvlim - yylvals); s += YYLVQUEUEGROWTH; - if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; - if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) - if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; #endif yylvp = yylve = yylvals + p; @@ -1538,7 +1550,7 @@ break; #endif yylexp = yylexemes + p; } - *yylexp = (short) YYLEX; + *yylexp = (YYINT) YYLEX; *yylvp++ = yylval; yylve++; #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) @@ -1555,12 +1567,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 +1598,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 +1633,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/contrib/byacc/test/code_calc.y b/contrib/byacc/test/code_calc.y index 0a99456..6947b74 100644 --- a/contrib/byacc/test/code_calc.y +++ b/contrib/byacc/test/code_calc.y @@ -1,3 +1,5 @@ +%token-table + %{ # include <stdio.h> # include <ctype.h> diff --git a/contrib/byacc/test/err_inherit4.y b/contrib/byacc/test/err_inherit4.y index ed788d1..8e9aeb9 100644 --- a/contrib/byacc/test/err_inherit4.y +++ b/contrib/byacc/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/contrib/byacc/test/run_make.sh b/contrib/byacc/test/run_make.sh index 218a7c5..3035eb4 100755 --- a/contrib/byacc/test/run_make.sh +++ b/contrib/byacc/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/contrib/byacc/test/yacc/calc.tab.c b/contrib/byacc/test/yacc/calc.tab.c index ac7240d..4b8fb4c 100644 --- a/contrib/byacc/test/yacc/calc.tab.c +++ b/contrib/byacc/test/yacc/calc.tab.c @@ -353,7 +353,7 @@ yylex(void) #line 354 "calc.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/calc1.tab.c b/contrib/byacc/test/yacc/calc1.tab.c index 22967c8..fac1c27 100644 --- a/contrib/byacc/test/yacc/calc1.tab.c +++ b/contrib/byacc/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 <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/calc2.tab.c b/contrib/byacc/test/yacc/calc2.tab.c index dbd52a1..ba80946 100644 --- a/contrib/byacc/test/yacc/calc2.tab.c +++ b/contrib/byacc/test/yacc/calc2.tab.c @@ -366,7 +366,7 @@ YYLEX_DECL() #line 367 "calc2.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/calc3.tab.c b/contrib/byacc/test/yacc/calc3.tab.c index db5d367..f7b3ee4 100644 --- a/contrib/byacc/test/yacc/calc3.tab.c +++ b/contrib/byacc/test/yacc/calc3.tab.c @@ -364,7 +364,7 @@ YYLEX_DECL() #line 365 "calc3.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/code_calc.code.c b/contrib/byacc/test/yacc/code_calc.code.c index 94c86b0..9d1cb6a 100644 --- a/contrib/byacc/test/yacc/code_calc.code.c +++ b/contrib/byacc/test/yacc/code_calc.code.c @@ -97,7 +97,7 @@ #define YYPURE 0 -#line 2 "code_calc.y" +#line 4 "code_calc.y" # include <stdio.h> # include <ctype.h> @@ -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 <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/code_calc.tab.c b/contrib/byacc/test/yacc/code_calc.tab.c index 428375d..9242641 100644 --- a/contrib/byacc/test/yacc/code_calc.tab.c +++ b/contrib/byacc/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/contrib/byacc/test/yacc/code_calc.tab.h b/contrib/byacc/test/yacc/code_calc.tab.h index 1921118..b0bcb16 100644 --- a/contrib/byacc/test/yacc/code_calc.tab.h +++ b/contrib/byacc/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/contrib/byacc/test/yacc/code_error.code.c b/contrib/byacc/test/yacc/code_error.code.c index a52d316..379bf2f 100644 --- a/contrib/byacc/test/yacc/code_error.code.c +++ b/contrib/byacc/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 <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/empty.tab.c b/contrib/byacc/test/yacc/empty.tab.c index d211255..1727522 100644 --- a/contrib/byacc/test/yacc/empty.tab.c +++ b/contrib/byacc/test/yacc/empty.tab.c @@ -243,7 +243,7 @@ YYERROR_DECL() { #line 244 "empty.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/err_syntax10.tab.c b/contrib/byacc/test/yacc/err_syntax10.tab.c index ec244c9..8a1d639 100644 --- a/contrib/byacc/test/yacc/err_syntax10.tab.c +++ b/contrib/byacc/test/yacc/err_syntax10.tab.c @@ -242,7 +242,7 @@ yyerror(const char* s) #line 243 "err_syntax10.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/err_syntax11.tab.c b/contrib/byacc/test/yacc/err_syntax11.tab.c index 46e5d2e..1a64f86 100644 --- a/contrib/byacc/test/yacc/err_syntax11.tab.c +++ b/contrib/byacc/test/yacc/err_syntax11.tab.c @@ -248,7 +248,7 @@ yyerror(const char* s) #line 249 "err_syntax11.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/err_syntax12.tab.c b/contrib/byacc/test/yacc/err_syntax12.tab.c index 5afd3d1..6b443a0 100644 --- a/contrib/byacc/test/yacc/err_syntax12.tab.c +++ b/contrib/byacc/test/yacc/err_syntax12.tab.c @@ -254,7 +254,7 @@ yyerror(const char* s) #line 255 "err_syntax12.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/err_syntax18.tab.c b/contrib/byacc/test/yacc/err_syntax18.tab.c index 5b7bef7..416acf0 100644 --- a/contrib/byacc/test/yacc/err_syntax18.tab.c +++ b/contrib/byacc/test/yacc/err_syntax18.tab.c @@ -250,7 +250,7 @@ yyerror(const char* s) #line 251 "err_syntax18.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/err_syntax20.tab.c b/contrib/byacc/test/yacc/err_syntax20.tab.c index 690daef..2c5b590 100644 --- a/contrib/byacc/test/yacc/err_syntax20.tab.c +++ b/contrib/byacc/test/yacc/err_syntax20.tab.c @@ -246,7 +246,7 @@ yyerror(const char* s) #line 247 "err_syntax20.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/err_syntax24.error b/contrib/byacc/test/yacc/err_syntax24.error index c153889..e8bbfec 100644 --- a/contrib/byacc/test/yacc/err_syntax24.error +++ b/contrib/byacc/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/contrib/byacc/test/yacc/error.tab.c b/contrib/byacc/test/yacc/error.tab.c index df36382..f06f181 100644 --- a/contrib/byacc/test/yacc/error.tab.c +++ b/contrib/byacc/test/yacc/error.tab.c @@ -248,7 +248,7 @@ yyerror(const char* s) #line 249 "error.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/grammar.tab.c b/contrib/byacc/test/yacc/grammar.tab.c index 8dc8cf9..2af38b6 100644 --- a/contrib/byacc/test/yacc/grammar.tab.c +++ b/contrib/byacc/test/yacc/grammar.tab.c @@ -1091,7 +1091,7 @@ free_parser(void) #line 1092 "grammar.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/ok_syntax1.tab.c b/contrib/byacc/test/yacc/ok_syntax1.tab.c index 0446ec5..135f6be 100644 --- a/contrib/byacc/test/yacc/ok_syntax1.tab.c +++ b/contrib/byacc/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 <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/pure_calc.tab.c b/contrib/byacc/test/yacc/pure_calc.tab.c index 3505bc4..7a465de 100644 --- a/contrib/byacc/test/yacc/pure_calc.tab.c +++ b/contrib/byacc/test/yacc/pure_calc.tab.c @@ -360,7 +360,7 @@ YYLEX_DECL() #line 361 "pure_calc.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/pure_error.tab.c b/contrib/byacc/test/yacc/pure_error.tab.c index 41effc1..fcd98c7 100644 --- a/contrib/byacc/test/yacc/pure_error.tab.c +++ b/contrib/byacc/test/yacc/pure_error.tab.c @@ -257,7 +257,7 @@ yyerror(const char* s) #line 258 "pure_error.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/quote_calc-s.tab.c b/contrib/byacc/test/yacc/quote_calc-s.tab.c index caab248..9647fbe 100644 --- a/contrib/byacc/test/yacc/quote_calc-s.tab.c +++ b/contrib/byacc/test/yacc/quote_calc-s.tab.c @@ -368,7 +368,7 @@ yylex(void) { #line 369 "quote_calc-s.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/quote_calc.tab.c b/contrib/byacc/test/yacc/quote_calc.tab.c index b016852..4a2c132 100644 --- a/contrib/byacc/test/yacc/quote_calc.tab.c +++ b/contrib/byacc/test/yacc/quote_calc.tab.c @@ -374,7 +374,7 @@ yylex(void) { #line 375 "quote_calc.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/quote_calc2-s.tab.c b/contrib/byacc/test/yacc/quote_calc2-s.tab.c index 16de64b..faf8bb5 100644 --- a/contrib/byacc/test/yacc/quote_calc2-s.tab.c +++ b/contrib/byacc/test/yacc/quote_calc2-s.tab.c @@ -368,7 +368,7 @@ yylex(void) { #line 369 "quote_calc2-s.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/quote_calc2.tab.c b/contrib/byacc/test/yacc/quote_calc2.tab.c index f03cfb6..a5d5800 100644 --- a/contrib/byacc/test/yacc/quote_calc2.tab.c +++ b/contrib/byacc/test/yacc/quote_calc2.tab.c @@ -374,7 +374,7 @@ yylex(void) { #line 375 "quote_calc2.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/quote_calc3-s.tab.c b/contrib/byacc/test/yacc/quote_calc3-s.tab.c index f85e675..f987237 100644 --- a/contrib/byacc/test/yacc/quote_calc3-s.tab.c +++ b/contrib/byacc/test/yacc/quote_calc3-s.tab.c @@ -369,7 +369,7 @@ yylex(void) { #line 370 "quote_calc3-s.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/quote_calc3.tab.c b/contrib/byacc/test/yacc/quote_calc3.tab.c index 5973998..9d1f054 100644 --- a/contrib/byacc/test/yacc/quote_calc3.tab.c +++ b/contrib/byacc/test/yacc/quote_calc3.tab.c @@ -369,7 +369,7 @@ yylex(void) { #line 370 "quote_calc3.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/quote_calc4-s.tab.c b/contrib/byacc/test/yacc/quote_calc4-s.tab.c index 6435676..36c5b97 100644 --- a/contrib/byacc/test/yacc/quote_calc4-s.tab.c +++ b/contrib/byacc/test/yacc/quote_calc4-s.tab.c @@ -369,7 +369,7 @@ yylex(void) { #line 370 "quote_calc4-s.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/quote_calc4.tab.c b/contrib/byacc/test/yacc/quote_calc4.tab.c index b8dff59..c95244d 100644 --- a/contrib/byacc/test/yacc/quote_calc4.tab.c +++ b/contrib/byacc/test/yacc/quote_calc4.tab.c @@ -369,7 +369,7 @@ yylex(void) { #line 370 "quote_calc4.tab.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/rename_debug.c b/contrib/byacc/test/yacc/rename_debug.c index 6bdd4a4..e090fb4 100644 --- a/contrib/byacc/test/yacc/rename_debug.c +++ b/contrib/byacc/test/yacc/rename_debug.c @@ -128,7 +128,7 @@ yyerror(const char* s) #line 130 "rename_debug.c" #if YYDEBUG -#include <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/test/yacc/varsyntax_calc1.tab.c b/contrib/byacc/test/yacc/varsyntax_calc1.tab.c index 6094f8b..a954383 100644 --- a/contrib/byacc/test/yacc/varsyntax_calc1.tab.c +++ b/contrib/byacc/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 <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* 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/contrib/byacc/verbose.c b/contrib/byacc/verbose.c index b4e1102..1135e8f 100644 --- a/contrib/byacc/verbose.c +++ b/contrib/byacc/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/contrib/byacc/yaccpar.c b/contrib/byacc/yaccpar.c index 717d735..53fcbd8 100644 --- a/contrib/byacc/yaccpar.c +++ b/contrib/byacc/yaccpar.c @@ -1,8 +1,8 @@ /* This file generated automatically using - * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @ + * @Id: skel2c,v 1.4 2016/06/07 00:26:09 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 <stdio.h> /* needed for printf */", + "#include <stdio.h> /* needed for printf */", "#endif", "", "#include <stdlib.h> /* needed for malloc, etc */", @@ -209,6 +211,13 @@ const char *const body_2[] = " }", "#endif", "", + 0 +}; + +const char *const body_3[] = +{ + " yym = 0;", + " yyn = 0;", " yynerrs = 0;", " yyerrflag = 0;", " yychar = YYEMPTY;", @@ -228,28 +237,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 +264,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 +284,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 +317,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 +333,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 +362,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 +376,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 +386,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/contrib/byacc/yaccpar.skel b/contrib/byacc/yaccpar.skel index 030cfa2..c303b00 100644 --- a/contrib/byacc/yaccpar.skel +++ b/contrib/byacc/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.8 2016/12/02 21:44:42 tom 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 <stdio.h> /* needed for printf */ +#include <stdio.h> /* needed for printf */ #endif #include <stdlib.h> /* needed for malloc, etc */ @@ -164,6 +166,9 @@ YYPARSE_DECL() } #endif +%% body_3 + yym = 0; + yyn = 0; yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; @@ -183,28 +188,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 +215,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 +235,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 +268,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 +284,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 +309,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 +323,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 +333,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; |