diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-04-22 22:11:22 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-04-22 22:11:22 +0000 |
commit | 4ecea33a988c00caa98cacf934e61e361d94e8af (patch) | |
tree | 7089d85dfa0daa5568799f671cfb9924f1012710 | |
parent | e0ae66db632ac7c7773c8b85754bfc135f5bdbd5 (diff) | |
download | src-4ecea33a988c00caa98cacf934e61e361d94e8af.tar.gz src-4ecea33a988c00caa98cacf934e61e361d94e8af.zip |
Import byacc 20140409vendor/byacc/20140409
Notes
Notes:
svn path=/vendor/byacc/dist/; revision=264790
svn path=/vendor/byacc/20140409/; revision=264791; tag=vendor/byacc/20140409
627 files changed, 89449 insertions, 7051 deletions
@@ -1,9 +1,648 @@ +2014-04-09 Rick.Spates + + * main.c, defs.h: patch to allow DEBUG build with WIN32 system + +2014-04-09 Thomas E. Dickey <tom@invisible-island.net> + + * output.c, reader.c: gcc warnings + + * reader.c: fix const-cast warnings + + * test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.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_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/code_error.tab.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/error.tab.c, test/btyacc/rename_debug.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.tab.c, output.c: + fix a few clang --analyze warnings; one was a case where output_ctable emitted + an empty table (which should be an error). + + * reader.c: appease clang --analyze + + * defs.h: mark two functions as no-return. + + * package/debian/changelog: reason for release + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + + * makefile.in: use $LINT_OPTS from environment via configure script + + * test/btyacc/ok_syntax1.output, test/btyacc/ok_syntax1.tab.c, test/yacc/ok_syntax1.tab.c, test/ok_syntax1.y, test/yacc/ok_syntax1.output: + tweaks to make generated files from ok_syntax1.y compile with check_make rule + + * test/btyacc/rename_debug.c, test/btyacc/rename_debug.error, test/btyacc/rename_debug.h, test/btyacc/rename_debug.i, test/btyacc/rename_debug.output, test/yacc/rename_debug.c: + reference output for testing + + * test/run_test.sh: + retain the renaming done for code_debug.y so that check_make will work. + + * test/yacc/rename_debug.error, test/yacc/rename_debug.h, test/yacc/rename_debug.i, test/yacc/rename_debug.output: + reference output for testing + + * test/btyacc/ok_syntax1.error: RCS_BASE + + * test/yacc/quote_calc4-s.tab.c, test/yacc/varsyntax_calc1.tab.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/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/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.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, yaccpar.c: + regen + + * yacc.1: + clarify relationship of btyacc features to default configuration. + +2014-04-08 Thomas E. Dickey <tom@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 + + * test/ok_syntax1.y: RCS_BASE + + * test/yacc/ok_syntax1.error: reference output for testing + + * test/yacc/big_b.error, test/yacc/big_b.output, test/yacc/big_l.error, test/yacc/big_l.output, test/btyacc/big_b.error, test/btyacc/big_b.output, test/btyacc/big_l.error, test/btyacc/big_l.output, test/run_test.sh: + exercise -L/-B options + + * test/yacc/code_debug.c, test/btyacc/code_debug.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, 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_syntax27.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/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.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.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/btyacc_demo.tab.c, 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.tab.c, 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/pure_calc.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/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/run_test.sh, test/yacc/no_b_opt1.output: + use a better renaming of the YYPATCH definition (none of the test-cases rely + upon it, but redefinition in the "make check_make" rule is a problem). + + * test/btyacc/err_syntax1.tab.c, test/btyacc/err_syntax13.tab.c, test/btyacc/err_syntax2.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/varsyntax_calc1.tab.c: + undid temporary reordering in reader() by Tom Shields to align with byacc outputs + + * test/run_test.sh: remove a repeated test-case + + * mstring.c: minor reformatting to make coverage analysis simpler + +2014-04-07 Thomas E. Dickey <tom@invisible-island.net> + + * test/run_test.sh: tidy + + * test/yacc/help.error, test/yacc/help.output, test/yacc/no_b_opt.error, test/yacc/no_b_opt.output, test/yacc/no_b_opt1.error, test/yacc/no_b_opt1.output, test/yacc/no_code_c.error, test/yacc/no_code_c.output, test/yacc/no_defines.error, test/yacc/no_defines.output, test/yacc/no_graph.error, test/yacc/no_graph.output, test/yacc/no_include.error, test/yacc/no_include.output, test/yacc/no_opts.error, test/yacc/no_opts.output, test/yacc/no_output.error, test/yacc/no_output.output, test/yacc/no_output1.error, test/yacc/no_output1.output, test/yacc/no_output2.error, test/yacc/no_output2.output, test/yacc/no_p_opt.error, test/yacc/no_p_opt.output, test/yacc/no_p_opt1.error, test/yacc/no_p_opt1.output, test/yacc/no_verbose.error, test/yacc/no_verbose.output, test/yacc/nostdin.error, test/yacc/nostdin.output, test/yacc/test-no_b_opt1.output: + reference output for testing + + * test/run_test.sh: + add special checks for flags which depend on writable/existing files + + * test/btyacc/no_b_opt1.output, test/btyacc/no_p_opt1.output, test/btyacc/no_b_opt.error, test/btyacc/no_b_opt.output, test/btyacc/no_b_opt1.error, test/btyacc/no_code_c.output, test/btyacc/no_p_opt.error, test/btyacc/no_p_opt.output, test/btyacc/no_p_opt1.error, test/btyacc/no_output2.output, test/btyacc/no_code_c.error, test/btyacc/no_output2.error, test/btyacc/no_include.error, test/btyacc/no_include.output, test/btyacc/no_defines.output, test/btyacc/no_defines.error, test/btyacc/no_verbose.output, test/btyacc/no_graph.output, test/btyacc/no_graph.error, test/btyacc/no_opts.error, test/btyacc/no_opts.output, test/btyacc/no_verbose.error, test/btyacc/nostdin.error, test/btyacc/nostdin.output, test/btyacc/no_output.error, test/btyacc/no_output.output, test/btyacc/no_output1.error, test/btyacc/no_output1.output: + reference output for testing + + * main.c: + change CREATE_FILE_NAMES() to use local function rather than inline code, + to simplify coverage analysis. + + * test/btyacc/err_syntax27.error, test/btyacc/err_syntax27.output, test/btyacc/err_syntax27.tab.c, test/btyacc/err_syntax27.tab.h, test/btyacc/help.error, test/btyacc/help.output, test/yacc/err_syntax27.error, test/yacc/err_syntax27.output, test/yacc/err_syntax27.tab.c, test/yacc/err_syntax27.tab.h: + reference output for testing + + * test/err_syntax27.y: testcase for missing_brace() + + * error.c: ifdef'd non-btyacc function + + * lr0.c: ifdef'd debug-code + + * yaccpar.skel: use YYINT's to replace short's as in btyaccpar.skel + + * test/btyacc/code_debug.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, 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/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_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/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax20.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_debug.c, test/yacc/code_error.code.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, output.c, test/yacc/err_syntax1.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_syntax19.tab.c, test/yacc/err_syntax2.tab.c, test/yacc/err_syntax21.tab.c, 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/run_test.sh: + 2010/11/26 simplification of output.c using putc_code() and putl_code() + omitted an adjustment of the #line value used for code-file. Fix that. + Also, amend 2005/05/04 change to run_test.sh to retain a dummy line for + 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> + + * reader.c: fix for valgrind + (the calloc's are intentional - valgrind reported use of uninitialized memory) + + * lr0.c, output.c: fix for valgrind + + * test/btyacc/code_debug.c, test/btyacc/code_debug.error, test/btyacc/code_debug.h, test/btyacc/code_debug.i, test/btyacc/code_debug.output: + RCS_BASE + + * test/yacc/code_debug.c, test/yacc/code_debug.h: + exercise the -i option + + * test/yacc/code_debug.i: reference output for testing + + * test/run_test.sh: exercise the -i option + + * test/yacc/code_debug.c: reference output for testing + + * test/run_test.sh: exercise the "-o" option + + * test/yacc/code_debug.error, test/yacc/code_debug.h, test/yacc/code_debug.output: + reference output for testing + + * output.c: don't call exit() without giving a chance to cleanup. + + * mstring.c: ifdef'd functions not used in byacc + + * btyaccpar.c: generated from btyaccpar.skel + + * yaccpar.c: generated from yaccpar.skel + + * skel2c: + change the generated-by comment to show which version of this script (and + which version of the given skeleton file) were used to produce the C-file. + + * configure: regen + + * makefile.in: + add rules to generate byacc and btyacc parser skeleton files independently + + * aclocal.m4: CF_PROG_AWK - add to byacc's configure script + CF_INTEL_COMPILER + cleanup the -no-gcc option which was leftover from testing - prcs does + not build with this option. + CF_MAKE_DOCS + protect $2 from substitution, for luit's "$(manext)" + CF_XOPEN_SOURCE + for Solaris (tested with gcc/g++ 3.4.3 on Solaris 10 and gcc/g++ 4.5.2 + on Solaris 11), suppress the followup check for defining _XOPEN_SOURCE + because it is not needed, as well as because g++ 4.7.3 (no package, + used in Sage for Solaris 10) has some unspecified header breakage which + is triggered by the duplicate definition. + + * configure.in: + modify so skeleton-source is determined by configure options rather than by + having developer rename yaccpar.skel.old to yaccpar.skel + + * descrip.mms: rename skeleton + + * vmsbuild.com: + fwiw, renamed the skeleton for consistency with makefile + + * skel2c, skeleton.c: resync skeleton and its generating files + + * yaccpar.skel: + renamed yaccpar.skel.old to yaccpar.skel, to allow using makefile suffix rules + + * yaccpar.skel.old: resync skeleton and its generating files + + * test/run_make.sh: improve cleanup after error recovery + + * 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/err_syntax20.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, output.c, skeleton.c, defs.h: + use improvement from Tom Shield's btyacc changes, getting rid of special cases for generating two yyerror calls in skeleton + + * output.c: simplify output_yyerror_decl() + + * 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.tab.c, test/yacc/code_error.tab.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/err_syntax20.tab.c, test/yacc/error.tab.c, test/yacc/grammar.tab.c, test/yacc/pure_calc.tab.c, output.c: + add second "const" to string-table declarations, from Tom Shield's btyacc changes + + * 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/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/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: + discard unnecessary call on write_code_lineno() from Tom Shield's changes + + * 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_calc.tab.c, test/yacc/code_error.code.c, test/yacc/code_error.tab.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/err_syntax20.tab.c, output.c: + use YYINT typedef from Tom Shield's btyacc changes to replace explicit "short" + + * test/yacc/code_calc.code.c, test/yacc/code_error.code.c, output.c: + use fix from Tom Shield's btyacc changes: remove redundant extern-declaration for YYPARSE_DECL() + + * 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/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: + discard unnecessary call on write_code_lineno() from Tom Shield's changes + + * output.c, test/yacc/code_calc.code.c, test/yacc/code_error.code.c, test/yacc/code_calc.tab.c, test/yacc/code_error.tab.c: + use fix from Tom Shield's btyacc changes: prefix-definitions went to the + output (.tab.c) file in a case where they should have gone to the code + (.code.c) file. Remove now-redundant call to output_prefix(). + + * main.c: do the same for help-message + + * main.c: use OUTPUT_SUFFIX symbol in an overlooked case + + * 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> + + * 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 + code_file because that adds extra to the #line values + + * 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/calc.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_syntax11.tab.c, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax18.tab.c, test/yacc/error.tab.c, output.c: + add Tom Shield's change to allow definition of YYSTYPE_IS_DECLARED symbol to + override fallback typedef for YYSTYPE when that symbol is undefined + + * test/btyacc/error.tab.c, test/btyacc/inherit0.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/calc.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_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c: + minor tweak to coding style - use parenthesis for "defined" operator's parameter + + * 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, 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: + regen to make YYMAXTOKEN and YYUNDFTOKEN adjacent + + * test/yacc/err_syntax20.tab.c, test/yacc/grammar.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_calc.tab.c, test/yacc/code_error.code.c, test/yacc/code_error.tab.c, test/yacc/empty.tab.c, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax12.tab.c: + regen after adding the YYUNDFTOKEN symbol + + * output.c: + integrate Tom Shield's btyacc changes which introduce the YYUNDFTOKEN symbol + (I changed order of output to keep this adjacent to YYMAXTOKEN) + + * reader.c: + merge all but one small change from Tom Shield's btyacc changes - that + changes the order of code-file in the tests. + + * test/btyacc/btyacc_demo.tab.c: regen + + * test/btyacc_demo.y: fix prototypes + +2014-04-04 Thomas E. Dickey <tom@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> + + * reader.c: + merge-in 3/4 of btyacc's changes, deferring those which change test-outputs. + Tom Shield's changes split-out copy_string() and copy_comment() functions + to simplify some logic, as well as adding btyacc-only chunks + + * makefile.in: build mstring.o, needed for changes in reader.c + + * output.c: + merge-in all of btyacc's changes which do not change byacc's test-output. + 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> + + * test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c: regen + + * output.c: fix typo + + * output.c, reader.c: + merge in some chunks of reader and output files which do not affect byacc tests + + * test/yacc/calc2.tab.c, test/yacc/calc3.tab.c: regen + + * 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, 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, skeleton.c: + incorporate YYENOMEM and YYEOF symbols from btyacc + + * output.c: merge chunk from btyacc changes for header-guards + + * btyaccpar.skel: RCS_BASE + + * yaccpar.skel: comment-out yysccsid[], for FreeBSD build-issues + remove GCC_UNUSED to reduce name-pollution as well as being simpler + + * main.c: + move a btyacc symbol outside ifdef to work around current state of merge + + * defs.h: + add USE_HEADER_GUARDS to defer whether to modify byacc's header-output + + * test/run_make.sh: + do not try to compile files used for testing syntax-errors, since they are + likely to be incomplete + +2014-04-02 Tom.Shields + + * main.c: changes for btyacc + +2014-04-01 Thomas E. Dickey <tom@invisible-island.net> + + * reader.c: + integrate change by Tom Shields to use bsearch rather than successive + calls to matchec() + + * defs.h: typedef __compar_fn_t is unnecessary + + * 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/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: + omit the GCC_UNUSED, as noted by Tom Shields not really essential + +2014-04-01 Tom.Shields + + * verbose.c: changes for btyacc, ifdef'd + +2014-04-01 Thomas E. Dickey <tom@invisible-island.net> + + * mkpar.c: eliminate most of the ifdef's using macros + +2014-04-01 Tom.Shields + + * mkpar.c: merge btyacc changes (ifdef'd - no change to byacc) + + * error.c: + 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> + + * test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c: + omit the GCC_UNUSED, as noted by Tom Shields not really essential + + * 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> + + * 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 + warnings. The suggested alternative (using #pragma ident) in the preceding + comment is also obsolete; remove that comment (request by Gleb Smirnoff). + + * 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> + + * 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 + + * test/run_lint.sh, test/run_make.sh, test/run_test.sh: + moving #define's out of makefile broke check for yacc vs btyacc (fix) + +2014-03-28 Tom.Shields + + * test/btyacc/btyacc_demo.tab.c, test/btyacc/err_inherit3.error, test/btyacc/err_inherit3.output, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit3.tab.h, test/btyacc/err_inherit2.error, test/btyacc/err_inherit2.output, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit2.tab.h, test/btyacc/err_inherit4.error, test/btyacc/err_inherit4.output, test/btyacc/err_inherit4.tab.c, test/btyacc/err_inherit4.tab.h, test/btyacc/err_inherit5.error, test/btyacc/err_inherit5.output, test/btyacc/err_inherit5.tab.c, test/btyacc/err_inherit5.tab.h, test/btyacc/inherit0.error, test/btyacc/inherit0.output, test/btyacc/inherit0.tab.c, test/btyacc/inherit0.tab.h, test/btyacc/inherit1.error, test/btyacc/inherit1.output, test/btyacc/inherit1.tab.c, test/btyacc/inherit1.tab.h, test/btyacc/inherit2.error, test/btyacc/inherit2.output, test/btyacc/inherit2.tab.c, test/btyacc/inherit2.tab.h, test/btyacc/calc.error, test/btyacc/err_inherit1.error, test/btyacc/err_inherit1.output, test/btyacc/err_inherit1.tab.c, test/btyacc/err_inherit1.tab.h: + reference output for testing + + * defs.h: new functions/variables for btyacc + (I reordered and ifdef'd -TD) + + * test/inherit0.y, test/inherit1.y: testcase for btyacc + +2014-03-27 Tom.Shields + + * test/err_inherit5.y, test/err_inherit4.y, test/err_inherit3.y, test/err_inherit2.y, test/err_inherit1.y, test/inherit2.y: + testcase for btyacc + +2014-03-25 Tom.Shields + + * symtab.c: extra initialization needed for btyacc + (I ifdef'd -TD) + + * yacc.1: document -L/-B features from btyacc + +2014-03-25 Thomas E. Dickey <tom@invisible-island.net> + + * yacc.1: typo + + * configure: regen + + * configure.in: + modified new options to act like those in my other configure-scripts, e.g., + showing what option is being tested, and the resulting value. Put the + definitions in config.h rather than in the makefile. + +2014-03-25 Tom.Shields + + * makefile.in: add/use LINTFLAGS variable + make all of the objects (not just skeleton) rebuild if makefile changes + modify check-rule to reflect updates to run_test.sh vs subdirectory + + * mstring.c: byacc-btyacc-20140323 + +2014-03-25 Thomas E. Dickey <tom@invisible-island.net> + + * test/btyacc/RCS, test/yacc/RCS: PERMIT FILE + + * config_h.in: updated with autoheader-252 + +2014-03-25 Tom.Shields + + * README.BTYACC: byacc-btyacc-20140323 + +2014-03-24 Tom.Shields + + * 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> + + * defs.h: fix compiler warnings due to mputc() + +2014-03-23 Tom.Shields + + * test/btyacc_demo.y: testcase for btyacc + + * test/btyacc/varsyntax_calc1.error, test/btyacc/varsyntax_calc1.output, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/varsyntax_calc1.tab.h: + reference output for testing + + * test/varsyntax_calc1.y, test/btyacc_calc1.y: testcase for btyacc + +2014-03-23 Thomas E. Dickey <tom@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 + + * test/err_syntax26.y: testcase for missing_brace() + + * test/err_syntax25.error, test/err_syntax25.output, test/err_syntax25.tab.c, test/err_syntax25.tab.h, test/yacc/err_syntax25.error, test/yacc/err_syntax25.output, test/yacc/err_syntax25.tab.c, test/yacc/err_syntax25.tab.h: + reference output for testing + + * test/err_syntax25.y: testcase for over_unionized() + + * test/err_syntax24.error, test/err_syntax24.output, test/err_syntax24.tab.c, test/err_syntax24.tab.h, test/yacc/err_syntax24.error, test/yacc/err_syntax24.output, test/yacc/err_syntax24.tab.c, test/yacc/err_syntax24.tab.h: + reference output for testing + + * test/err_syntax24.y: testcase for default_action_warning() + +2014-03-23 Tom.Shields + + * 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> + + * 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 + + * test/err_syntax23.y: testcase for untyped_lhs() + +2014-03-23 Tom.Shields + + * 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> + + * 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 + + * test/err_syntax22.y: testcase for untyped_rhs() + + * test/err_syntax21.error, test/err_syntax21.output, test/err_syntax21.tab.c, test/err_syntax21.tab.h, test/yacc/err_syntax21.error, test/yacc/err_syntax21.output, test/yacc/err_syntax21.tab.c, test/yacc/err_syntax21.tab.h, test/err_syntax20.error, test/err_syntax20.output, test/err_syntax20.tab.c, test/err_syntax20.tab.h, test/yacc/err_syntax20.error, test/yacc/err_syntax20.output, test/yacc/err_syntax20.tab.c, test/yacc/err_syntax20.tab.h: + reference output for testing + + * test/err_syntax20.y: testcase for undefined_symbol_warning() + + * test/err_syntax21.y: testcase for unknown_rhs() + + * test/err_syntax19.error, test/err_syntax19.output, test/err_syntax19.tab.c, test/err_syntax19.tab.h, test/yacc/err_syntax19.error, test/yacc/err_syntax19.output, test/yacc/err_syntax19.tab.c, test/yacc/err_syntax19.tab.h: + reference output for testing + + * test/err_syntax19.y: testcase for dollar_error() + + * test/err_syntax18.error, test/err_syntax18.output, test/err_syntax18.tab.c, test/err_syntax18.tab.h, test/yacc/err_syntax18.error, test/yacc/err_syntax18.output, test/yacc/err_syntax18.tab.c, test/yacc/err_syntax18.tab.h: + reference output for testing + + * test/err_syntax18.y: testcase for dollar_warning() + + * test/err_syntax17.error, test/err_syntax17.output, test/err_syntax17.tab.c, test/err_syntax17.tab.h, test/yacc/err_syntax17.error, test/yacc/err_syntax17.output, test/yacc/err_syntax17.tab.c, test/yacc/err_syntax17.tab.h: + reference output for testing + + * test/err_syntax17.y: testcase for unterminated_action() + +2014-03-22 Thomas E. Dickey <tom@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 + + * test/err_syntax16.y: testcase for terminal_lhs() + + * test/err_syntax15.error, test/err_syntax15.output, test/err_syntax15.tab.c, test/err_syntax15.tab.h, test/yacc/err_syntax15.error, test/yacc/err_syntax15.output, test/yacc/err_syntax15.tab.c, test/yacc/err_syntax15.tab.h: + reference output for testing + + * test/err_syntax15.y: testcase for no_grammar() + + * test/err_syntax14.error, test/err_syntax14.output, test/err_syntax14.tab.c, test/err_syntax14.tab.h, test/yacc/err_syntax14.error, test/yacc/err_syntax14.output, test/yacc/err_syntax14.tab.c, test/yacc/err_syntax14.tab.h: + reference output for testing + + * test/err_syntax14.y: + testcase for restarted_warning() and undefined_goal() + + * test/err_syntax13.error, test/err_syntax13.output, test/err_syntax13.tab.c, test/err_syntax13.tab.h, test/yacc/err_syntax13.error, test/yacc/err_syntax13.output, test/yacc/err_syntax13.tab.c, test/yacc/err_syntax13.tab.h: + reference output for testing + + * test/err_syntax13.y: testcase for terminal_start() + + * test/err_syntax12.error, test/err_syntax12.output, test/err_syntax12.tab.c, test/err_syntax12.tab.h, test/yacc/err_syntax12.error, test/yacc/err_syntax12.output, test/yacc/err_syntax12.tab.c, test/yacc/err_syntax12.tab.h: + reference output for testing + + * test/err_syntax12.y: testcase for revalued_warning() + + * test/err_syntax11.error, test/err_syntax11.output, test/err_syntax11.tab.c, test/err_syntax11.tab.h, test/yacc/err_syntax11.error, test/yacc/err_syntax11.output, test/yacc/err_syntax11.tab.c, test/yacc/err_syntax11.tab.h: + reference output for testing + + * test/err_syntax11.y: testcase for reprec_warning() + + * test/err_syntax10.error, test/err_syntax10.output, test/err_syntax10.tab.c, test/err_syntax10.tab.h, test/yacc/err_syntax10.error, test/yacc/err_syntax10.output, test/yacc/err_syntax10.tab.c, test/yacc/err_syntax10.tab.h: + reference output for testing + + * test/err_syntax10.y: testcase for retyped_warning() + +2014-03-21 Thomas E. Dickey <tom@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 + + * test/err_syntax9.y: testcase for tokenized_start() + + * test/err_syntax8.error, test/err_syntax8.output, test/err_syntax8.tab.c, test/err_syntax8.tab.h, test/err_syntax8a.error, test/err_syntax8a.output, test/err_syntax8a.tab.c, test/err_syntax8a.tab.h, test/yacc/err_syntax8.error, test/yacc/err_syntax8.output, test/yacc/err_syntax8.tab.c, test/yacc/err_syntax8.tab.h, test/yacc/err_syntax8a.error, test/yacc/err_syntax8a.output, test/yacc/err_syntax8a.tab.c, test/yacc/err_syntax8a.tab.h: + reference output for testing + + * test/err_syntax8a.y, test/err_syntax8.y: testcase for used_reserved() + + * test/err_syntax7.error, test/err_syntax7.output, test/err_syntax7.tab.c, test/err_syntax7.tab.h, test/err_syntax7a.error, test/err_syntax7a.output, test/err_syntax7a.tab.c, test/err_syntax7a.tab.h, test/err_syntax7b.error, test/err_syntax7b.output, test/err_syntax7b.tab.c, test/err_syntax7b.tab.h, test/yacc/err_syntax7.error, test/yacc/err_syntax7.output, test/yacc/err_syntax7.tab.c, test/yacc/err_syntax7.tab.h, test/yacc/err_syntax7a.error, test/yacc/err_syntax7a.output, test/yacc/err_syntax7a.tab.c, test/yacc/err_syntax7a.tab.h, test/yacc/err_syntax7b.error, test/yacc/err_syntax7b.output, test/yacc/err_syntax7b.tab.c, test/yacc/err_syntax7b.tab.h: + reference output for testing + + * test/err_syntax7b.y, test/err_syntax7a.y, test/err_syntax7.y: + testcase for illegal_character() + + * test/err_syntax6.error, test/err_syntax6.output, test/err_syntax6.tab.c, test/err_syntax6.tab.h, test/yacc/err_syntax6.error, test/yacc/err_syntax6.output, test/yacc/err_syntax6.tab.c, test/yacc/err_syntax6.tab.h: + reference output for testing + + * test/err_syntax6.y: testcase for illegal_tag() + + * test/err_syntax5.error, test/err_syntax5.output, test/err_syntax5.tab.c, test/err_syntax5.tab.h, test/yacc/err_syntax5.error, test/yacc/err_syntax5.output, test/yacc/err_syntax5.tab.c, test/yacc/err_syntax5.tab.h: + reference output for testing + + * test/err_syntax5.y: testcase for unterminated_union() + + * test/err_syntax4.error, test/err_syntax4.output, test/err_syntax4.tab.c, test/err_syntax4.tab.h, test/yacc/err_syntax4.error, test/yacc/err_syntax4.output, test/yacc/err_syntax4.tab.c, test/yacc/err_syntax4.tab.h: + reference output for testing + + * test/err_syntax4.y: testcase for unterminated_text() + + * test/err_syntax3.error, test/err_syntax3.output, test/err_syntax3.tab.c, test/err_syntax3.tab.h, test/yacc/err_syntax3.error, test/yacc/err_syntax3.output, test/yacc/err_syntax3.tab.c, test/yacc/err_syntax3.tab.h: + reference output for testing + + * test/err_syntax3.y: testcase for unterminated_string() + + * test/err_syntax2.error, test/err_syntax2.output, test/err_syntax2.tab.c, test/err_syntax2.tab.h, test/yacc/err_syntax2.error, test/yacc/err_syntax2.output, test/yacc/err_syntax2.tab.c, test/yacc/err_syntax2.tab.h: + reference output for testing + + * test/err_syntax2.y: testcase for unterminated_comment() + + * test/err_syntax1.error, test/yacc/err_syntax1.error: + reference output for testing + + * test/err_syntax1.y: + test-case with syntax error (and nonprinting character) + + * test/calc.error, test/calc1.error, test/calc2.error, test/calc3.error, test/code_calc.error, test/code_error.error, test/err_syntax1.error, test/error.error, test/grammar.error, test/pure_calc.error, test/pure_error.error, test/quote_calc-s.error, test/quote_calc.error, test/quote_calc2-s.error, test/quote_calc2.error, test/quote_calc3-s.error, test/quote_calc3.error, test/quote_calc4-s.error, test/quote_calc4.error, test/yacc/calc.error, test/yacc/calc1.error, test/yacc/calc2.error, test/yacc/calc3.error, test/yacc/code_calc.error, test/yacc/code_error.error, test/yacc/error.error, test/yacc/grammar.error, test/yacc/pure_calc.error, test/yacc/pure_error.error, test/yacc/quote_calc-s.error, test/yacc/quote_calc.error, test/yacc/quote_calc2-s.error, test/yacc/quote_calc2.error, test/yacc/quote_calc3-s.error, test/yacc/quote_calc3.error, test/yacc/quote_calc4-s.error, test/yacc/quote_calc4.error: + reference output for testing + + * test/run_test.sh: + save stderr to reference files, to capture shift/reduce messages as well + as syntax-error messages + + * test/err_syntax1.output, test/err_syntax1.tab.c, test/err_syntax1.tab.h, test/yacc/err_syntax1.output, test/yacc/err_syntax1.tab.c, test/yacc/err_syntax1.tab.h: + reference output for testing + + * test/run_test.sh: generate a ".dot" file for the grammar file + + * test/grammar.dot: RCS_BASE + + * test/yacc/grammar.dot: reference output for testing + +2014-03-19 Tom.Shields + + * output.c: rename MAXSHORT to MAXYYINT + +2014-03-18 Tom.Shields + + * yaccpar.skel: skeleton with btyacc additions + + * NOTES-btyacc-Changes: byacc-btyacc-20140323 + + * test/btyacc/btyacc_calc1.output, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_calc1.tab.h: + reference output for testing + + * test/run_make.sh: + move test-outputs into subdirectories to keep btyacc/yacc results separate + + * test/btyacc/pure_calc.tab.c, test/btyacc/pure_calc.tab.h, test/btyacc/pure_error.output, test/btyacc/pure_error.tab.c, test/btyacc/pure_error.tab.h, test/btyacc/quote_calc-s.output, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc-s.tab.h, test/btyacc/quote_calc.output, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc.tab.h, test/btyacc/quote_calc2-s.output, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2-s.tab.h, test/btyacc/quote_calc2.output, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc2.tab.h, test/btyacc/quote_calc3-s.output, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3-s.tab.h, test/btyacc/quote_calc3.output, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc3.tab.h, test/btyacc/quote_calc4-s.output, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4-s.tab.h, test/btyacc/quote_calc4.output, test/btyacc/quote_calc4.tab.c, test/btyacc/quote_calc4.tab.h, test/btyacc/calc1.output, test/btyacc/calc1.tab.c, test/btyacc/calc1.tab.h, test/btyacc/calc2.output, test/btyacc/calc2.tab.c, test/btyacc/calc2.tab.h, test/btyacc/calc3.output, test/btyacc/calc3.tab.c, test/btyacc/calc3.tab.h, test/btyacc/code_calc.code.c, test/btyacc/code_calc.output, test/btyacc/code_calc.tab.c, test/btyacc/code_calc.tab.h, test/btyacc/code_error.code.c, test/btyacc/code_error.output, test/btyacc/code_error.tab.c, test/btyacc/code_error.tab.h, test/btyacc/empty.output, test/btyacc/empty.tab.c, test/btyacc/empty.tab.h, test/btyacc/error.output, test/btyacc/error.tab.c, test/btyacc/error.tab.h, test/btyacc/grammar.output, test/btyacc/grammar.tab.c, test/btyacc/grammar.tab.h, test/btyacc/pure_calc.output, test/btyacc/btyacc_demo.output, test/btyacc/btyacc_demo.tab.h, test/btyacc/calc.output, test/btyacc/calc.tab.c, test/btyacc/calc.tab.h: + reference output for testing + + * defs.h: + several changes to help decouple the use of 'short' as the type of value + used in yacc parsers. + + * NOTES-btyacc-Disposition: byacc-btyacc-20140323 + +2014-03-17 Tom.Shields + + * skel2c, yaccpar.skel, yaccpar.skel.old: RCS_BASE + + * test/run_lint.sh: + move test-outputs into subdirectories to keep btyacc/yacc results separate + + * configure.in: add --with-max-table-size and --enable-btyacc options + +2014-03-16 Tom.Shields + + * main.c: use Value_t rather than short + +2014-03-11 Tom.Shields + + * test/empty.y: testcase for btyacc + +2014-03-10 Tom.Shields + + * test/calc3.y, test/calc2.y: fix unused-variable warning + +2014-02-18 Tom.Shields + + * lr0.c, graph.c: use Value_t rather than short + + * closure.c: use Value_t rather than short + ifdef'd forward-reference prototypes to match ifdef'ing of the actual functions + + * lalr.c: rename MAXSHORT to MAXYYINT + 2014-01-01 Thomas E. Dickey <tom@invisible-island.net> * yacc.1: document %token-table, improve presentation of double-quotes * VERSION, package/byacc.spec, package/debian/changelog: bump + * 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_error.code.c, test/yacc/code_error.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: + reference output for testing + * test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_calc.tab.c, test/code_error.code.c, test/code_error.tab.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/quote_calc-s.tab.c, test/quote_calc.tab.c, test/quote_calc2-s.tab.c, test/quote_calc2.tab.c, test/quote_calc3-s.tab.c, test/quote_calc3.tab.c, test/quote_calc4-s.tab.c, test/quote_calc4.tab.c: regen @@ -248,6 +887,8 @@ * VERSION, package/debian/changelog, package/byacc.spec: bump + * test/yacc/calc1.output: reference output for testing + * test/calc1.output, test/calc1.tab.c: regen * test/calc1.y: @@ -267,6 +908,8 @@ * test/calc2.tab.c, test/calc3.tab.c, test/code_error.code.c, test/ftp.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c: regen + * test/code_debug.y: RCS_BASE + * test/calc2.y, test/calc3.y, test/code_error.y, test/ftp.y: byacc already declares yyerror @@ -359,6 +1002,9 @@ * test/quote_calc-s.output, test/quote_calc-s.tab.c, test/quote_calc-s.tab.h, test/quote_calc2-s.output, test/quote_calc2-s.tab.c, test/quote_calc2-s.tab.h, test/quote_calc3-s.output, test/quote_calc3-s.tab.c, test/quote_calc3-s.tab.h, test/quote_calc4-s.output, test/quote_calc4-s.tab.c, test/quote_calc4-s.tab.h: RCS_BASE + * test/yacc/quote_calc-s.output, test/yacc/quote_calc-s.tab.h, test/yacc/quote_calc2-s.output, test/yacc/quote_calc2-s.tab.h, test/yacc/quote_calc3-s.output, test/yacc/quote_calc3-s.tab.h, test/yacc/quote_calc4-s.output, test/yacc/quote_calc4-s.tab.h: + reference output for testing + * test/run_test.sh: generate/test with "-s" option applied. 2012-01-13 Thomas E. Dickey <tom@invisible-island.net> @@ -371,9 +1017,24 @@ * main.c: add -s option to usage message. - * test/quote_calc3.output, test/quote_calc3.tab.c, test/quote_calc4.output, test/quote_calc4.tab.c, test/quote_calc4.tab.h, test/quote_calc3.y, test/quote_calc.tab.h, test/quote_calc.output, test/quote_calc.tab.c, test/quote_calc2.output, test/quote_calc2.tab.c, test/quote_calc2.tab.h, test/quote_calc3.tab.h, test/quote_calc4.y, test/quote_calc.y, test/quote_calc2.y: + * test/quote_calc3.output, test/quote_calc3.tab.c, test/quote_calc4.output, test/quote_calc4.tab.c, test/quote_calc4.tab.h: RCS_BASE + * test/yacc/quote_calc3.output, test/yacc/quote_calc4.output, test/yacc/quote_calc4.tab.h: + reference output for testing + + * test/quote_calc3.y, test/quote_calc.tab.h: RCS_BASE + + * test/yacc/quote_calc.tab.h: reference output for testing + + * test/quote_calc.output, test/quote_calc.tab.c, test/quote_calc2.output, test/quote_calc2.tab.c, test/quote_calc2.tab.h, test/quote_calc3.tab.h: + RCS_BASE + + * test/yacc/quote_calc.output, test/yacc/quote_calc2.output, test/yacc/quote_calc2.tab.h, test/yacc/quote_calc3.tab.h: + reference output for testing + + * test/quote_calc4.y, test/quote_calc.y, test/quote_calc2.y: RCS_BASE + * configure: regen * aclocal.m4: resync with my-autoconf, i.e., fixes for CF_XOPEN_SOURCE @@ -556,6 +1217,8 @@ * output.c: simplified a little, using putc_code() and putl_code() + * test/yacc/calc1.tab.h: reference output for testing + * test/calc1.tab.h: regen * reader.c: @@ -637,9 +1300,20 @@ improve %lex-param / %parse-param implementation by allowing for arrays to be passed as parameters, e.g., "int regs[26]". - * test/calc3.tab.c, test/calc3.y, test/calc3.output, test/calc3.tab.h, test/calc2.tab.c, test/calc2.y, test/calc2.tab.h, test/calc2.output: + * test/calc3.tab.c, test/calc3.y, test/calc3.output, test/calc3.tab.h: RCS_BASE + * test/yacc/calc3.output, test/yacc/calc3.tab.h: + reference output for testing + + * test/calc2.tab.c, test/calc2.y, test/calc2.tab.h: RCS_BASE + + * test/yacc/calc2.tab.h: reference output for testing + + * test/calc2.output: RCS_BASE + + * test/yacc/calc2.output: reference output for testing + * output.c: improve %lex-param / %parse-param implementation by allowing for arrays to be passed as parameters, e.g., "int regs[26]". @@ -699,9 +1373,27 @@ provide for testing -r and -P options by checking if the ".y" filename begins with "code_" or "pure_", respectively. - * test/code_error.code.c, test/code_error.tab.c, test/code_error.tab.h, test/code_calc.code.c, test/code_calc.tab.c, test/code_calc.tab.h, test/pure_calc.output, test/pure_calc.tab.h, test/pure_error.output, test/pure_error.tab.h, test/code_calc.output, test/code_error.output: + * test/code_error.code.c, test/code_error.tab.c, test/code_error.tab.h: RCS_BASE + * test/yacc/code_error.tab.h: reference output for testing + + * test/code_calc.code.c, test/code_calc.tab.c, test/code_calc.tab.h: + RCS_BASE + + * test/yacc/code_calc.tab.h: reference output for testing + + * test/pure_calc.output, test/pure_calc.tab.h, test/pure_error.output, test/pure_error.tab.h: + RCS_BASE + + * test/yacc/pure_calc.output, test/yacc/pure_calc.tab.h, test/yacc/pure_error.output, test/yacc/pure_error.tab.h: + reference output for testing + + * test/code_calc.output, test/code_error.output: RCS_BASE + + * test/yacc/code_calc.output, test/yacc/code_error.output: + reference output for testing + * test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c: regen * test/run_test.sh: @@ -1250,9 +1942,18 @@ * test/grammar.output, test/grammar.tab.c, test/grammar.tab.h: RCS_BASE + * test/yacc/grammar.output, test/yacc/grammar.tab.h: + reference output for testing + * makefile.in: turn on "make check" rule - * test/calc.output, test/run_test.sh, test/calc.tab.h: RCS_BASE + * test/calc.output: RCS_BASE + + * test/yacc/calc.output: reference output for testing + + * test/run_test.sh, test/calc.tab.h: RCS_BASE + + * test/yacc/calc.tab.h: reference output for testing * test/ftp.tab.c: yyparse() is now yyparse(void) @@ -1338,8 +2039,16 @@ 1993-02-22 unknown - * test/ftp.output, test/ftp.tab.c, test/ftp.tab.h, test/error.output, test/error.tab.c, test/error.tab.h: - RCS_BASE + * test/ftp.output, test/ftp.tab.c, test/ftp.tab.h: RCS_BASE + +1993-02-22 Thomas E. Dickey <tom@invisible-island.net> + + * test/yacc/error.output, test/yacc/error.tab.h: + reference output for testing + +1993-02-22 unknown + + * test/error.output, test/error.tab.c, test/error.tab.h: RCS_BASE * skeleton.c, warshall.c, main.c, output.c, reader.c, closure.c, NOTES: original version diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 000000000000..405dec684a1a --- /dev/null +++ b/MANIFEST @@ -0,0 +1,669 @@ +MANIFEST for byacc-20140409, version t20140409 +-------------------------------------------------------------------------------- +MANIFEST this file +ACKNOWLEDGEMENTS original version of byacc - 1993 +AUTHORS nicknames for some contributors (see CHANGES for details) +Makefile.old renamed from Makefile +NEW_FEATURES original version of byacc - 1993 +NOTES original version of byacc - 1993 +NOTES-btyacc-Changes byacc-btyacc-20140323 +NOTES-btyacc-Disposition byacc-btyacc-20140323 +NO_WARRANTY original version of byacc - 1993 +README original version of byacc - 1993 +README.BTYACC byacc-btyacc-20140323 +VERSION patch-level +aclocal.m4 macros for configure-script +btyaccpar.c generated from btyaccpar.skel +btyaccpar.skel bytacc's parser skeleton (renamed from yaccpar.skel) +closure.c original version of byacc - 1993 +config.guess configure-script utility +config.sub configure-script utility +config_h.in template for config.h +configure snapshot 2004/3/28 +configure.in template for configure-script +defs.h original version of byacc - 1993 +descrip.mms build-script for VMS +error.c original version of byacc - 1993 +graph.c write the file y.dot in graphviz format +install-sh install-script +lalr.c original version of byacc - 1993 +lr0.c original version of byacc - 1993 +main.c original version of byacc - 1993 +makefile.in template for makefile +mkpar.c original version of byacc - 1993 +mstring.c string-utilities +output.c original version of byacc - 1993 +reader.c original version of byacc - 1993 +skel2c awk script to transform yaccpar.skel into skeleton.c +symtab.c original version of byacc - 1993 +verbose.c original version of byacc - 1993 +vmsbuild.com build-script for VMS +warshall.c original version of byacc - 1993 +yacc.1 original version of byacc - 1993 +yaccpar.c generated from yaccpar.skel +yaccpar.skel data which can be transformed into skeleton.c +package subdirectory +package/byacc.spec RPM file for byacc +package/debian subdirectory +package/debian/changelog scripts from Debian package +package/debian/compat scripts from Debian package +package/debian/control scripts from Debian package +package/debian/copyright scripts from Debian package +package/debian/docs scripts from Debian package +package/debian/postinst scripts from Debian package +package/debian/prerm scripts from Debian package +package/debian/rules scripts from Debian package +package/debian/source subdirectory +package/debian/source/format scripts from Debian package +package/debian subdirectory +package/debian/watch scripts from Debian package +package subdirectory +package/mingw-byacc.spec mingw spec-file, for cross-compiles +package/pkgsrc subdirectory +package/pkgsrc/DESCR scripts from NetBSD pkgsrc, for test-builds +package/pkgsrc/Makefile scripts from NetBSD pkgsrc, for test-builds +package/pkgsrc/PLIST scripts from NetBSD pkgsrc, for test-builds +package/pkgsrc/distinfo scripts from NetBSD pkgsrc, for test-builds +test subdirectory +test/README describe contents of "test" subdirectory +test/btyacc subdirectory +test/btyacc/big_b.error exercise -L/-B options +test/btyacc/big_b.output exercise -L/-B options +test/btyacc/big_l.error exercise -L/-B options +test/btyacc/big_l.output exercise -L/-B options +test/btyacc/btyacc_calc1.error reference output for testing +test/btyacc/btyacc_calc1.output reference output for testing +test/btyacc/btyacc_calc1.tab.c reference output for testing +test/btyacc/btyacc_calc1.tab.h reference output for testing +test/btyacc/btyacc_demo.error reference output for testing +test/btyacc/btyacc_demo.output reference output for testing +test/btyacc/btyacc_demo.tab.c reference output for testing +test/btyacc/btyacc_demo.tab.h reference output for testing +test/btyacc/calc.error reference output for testing +test/btyacc/calc.output reference output for testing +test/btyacc/calc.tab.c reference output for testing +test/btyacc/calc.tab.h reference output for testing +test/btyacc/calc1.error reference output for testing +test/btyacc/calc1.output reference output for testing +test/btyacc/calc1.tab.c reference output for testing +test/btyacc/calc1.tab.h reference output for testing +test/btyacc/calc2.error reference output for testing +test/btyacc/calc2.output reference output for testing +test/btyacc/calc2.tab.c reference output for testing +test/btyacc/calc2.tab.h reference output for testing +test/btyacc/calc3.error reference output for testing +test/btyacc/calc3.output reference output for testing +test/btyacc/calc3.tab.c reference output for testing +test/btyacc/calc3.tab.h reference output for testing +test/btyacc/code_calc.code.c reference output for testing +test/btyacc/code_calc.error reference output for testing +test/btyacc/code_calc.output reference output for testing +test/btyacc/code_calc.tab.c reference output for testing +test/btyacc/code_calc.tab.h reference output for testing +test/btyacc/code_debug.c reference for test-output +test/btyacc/code_debug.error reference for test-output +test/btyacc/code_debug.h reference for test-output +test/btyacc/code_debug.i reference for test-output +test/btyacc/code_debug.output reference for test-output +test/btyacc/code_error.code.c reference output for testing +test/btyacc/code_error.error reference output for testing +test/btyacc/code_error.output reference output for testing +test/btyacc/code_error.tab.c reference output for testing +test/btyacc/code_error.tab.h reference output for testing +test/btyacc/empty.error reference output for testing +test/btyacc/empty.output reference output for testing +test/btyacc/empty.tab.c reference output for testing +test/btyacc/empty.tab.h reference output for testing +test/btyacc/err_inherit1.error reference output for testing +test/btyacc/err_inherit1.output reference output for testing +test/btyacc/err_inherit1.tab.c reference output for testing +test/btyacc/err_inherit1.tab.h reference output for testing +test/btyacc/err_inherit2.error reference output for testing +test/btyacc/err_inherit2.output reference output for testing +test/btyacc/err_inherit2.tab.c reference output for testing +test/btyacc/err_inherit2.tab.h reference output for testing +test/btyacc/err_inherit3.error reference output for testing +test/btyacc/err_inherit3.output reference output for testing +test/btyacc/err_inherit3.tab.c reference output for testing +test/btyacc/err_inherit3.tab.h reference output for testing +test/btyacc/err_inherit4.error reference output for testing +test/btyacc/err_inherit4.output reference output for testing +test/btyacc/err_inherit4.tab.c reference output for testing +test/btyacc/err_inherit4.tab.h reference output for testing +test/btyacc/err_inherit5.error reference output for testing +test/btyacc/err_inherit5.output reference output for testing +test/btyacc/err_inherit5.tab.c reference output for testing +test/btyacc/err_inherit5.tab.h reference output for testing +test/btyacc/err_syntax1.error reference output for testing +test/btyacc/err_syntax1.output reference output for testing +test/btyacc/err_syntax1.tab.c reference output for testing +test/btyacc/err_syntax1.tab.h reference output for testing +test/btyacc/err_syntax10.error reference output for testing +test/btyacc/err_syntax10.output reference output for testing +test/btyacc/err_syntax10.tab.c reference output for testing +test/btyacc/err_syntax10.tab.h reference output for testing +test/btyacc/err_syntax11.error reference output for testing +test/btyacc/err_syntax11.output reference output for testing +test/btyacc/err_syntax11.tab.c reference output for testing +test/btyacc/err_syntax11.tab.h reference output for testing +test/btyacc/err_syntax12.error reference output for testing +test/btyacc/err_syntax12.output reference output for testing +test/btyacc/err_syntax12.tab.c reference output for testing +test/btyacc/err_syntax12.tab.h reference output for testing +test/btyacc/err_syntax13.error reference output for testing +test/btyacc/err_syntax13.output reference output for testing +test/btyacc/err_syntax13.tab.c reference output for testing +test/btyacc/err_syntax13.tab.h reference output for testing +test/btyacc/err_syntax14.error reference output for testing +test/btyacc/err_syntax14.output reference output for testing +test/btyacc/err_syntax14.tab.c reference output for testing +test/btyacc/err_syntax14.tab.h reference output for testing +test/btyacc/err_syntax15.error reference output for testing +test/btyacc/err_syntax15.output reference output for testing +test/btyacc/err_syntax15.tab.c reference output for testing +test/btyacc/err_syntax15.tab.h reference output for testing +test/btyacc/err_syntax16.error reference output for testing +test/btyacc/err_syntax16.output reference output for testing +test/btyacc/err_syntax16.tab.c reference output for testing +test/btyacc/err_syntax16.tab.h reference output for testing +test/btyacc/err_syntax17.error reference output for testing +test/btyacc/err_syntax17.output reference output for testing +test/btyacc/err_syntax17.tab.c reference output for testing +test/btyacc/err_syntax17.tab.h reference output for testing +test/btyacc/err_syntax18.error reference output for testing +test/btyacc/err_syntax18.output reference output for testing +test/btyacc/err_syntax18.tab.c reference output for testing +test/btyacc/err_syntax18.tab.h reference output for testing +test/btyacc/err_syntax19.error reference output for testing +test/btyacc/err_syntax19.output reference output for testing +test/btyacc/err_syntax19.tab.c reference output for testing +test/btyacc/err_syntax19.tab.h reference output for testing +test/btyacc/err_syntax2.error reference output for testing +test/btyacc/err_syntax2.output reference output for testing +test/btyacc/err_syntax2.tab.c reference output for testing +test/btyacc/err_syntax2.tab.h reference output for testing +test/btyacc/err_syntax20.error reference output for testing +test/btyacc/err_syntax20.output reference output for testing +test/btyacc/err_syntax20.tab.c reference output for testing +test/btyacc/err_syntax20.tab.h reference output for testing +test/btyacc/err_syntax21.error reference output for testing +test/btyacc/err_syntax21.output reference output for testing +test/btyacc/err_syntax21.tab.c reference output for testing +test/btyacc/err_syntax21.tab.h reference output for testing +test/btyacc/err_syntax22.error reference output for testing +test/btyacc/err_syntax22.output reference output for testing +test/btyacc/err_syntax22.tab.c reference output for testing +test/btyacc/err_syntax22.tab.h reference output for testing +test/btyacc/err_syntax23.error reference output for testing +test/btyacc/err_syntax23.output reference output for testing +test/btyacc/err_syntax23.tab.c reference output for testing +test/btyacc/err_syntax23.tab.h reference output for testing +test/btyacc/err_syntax24.error reference output for testing +test/btyacc/err_syntax24.output reference output for testing +test/btyacc/err_syntax24.tab.c reference output for testing +test/btyacc/err_syntax24.tab.h reference output for testing +test/btyacc/err_syntax25.error reference output for testing +test/btyacc/err_syntax25.output reference output for testing +test/btyacc/err_syntax25.tab.c reference output for testing +test/btyacc/err_syntax25.tab.h reference output for testing +test/btyacc/err_syntax26.error reference output for testing +test/btyacc/err_syntax26.output reference output for testing +test/btyacc/err_syntax26.tab.c reference output for testing +test/btyacc/err_syntax26.tab.h reference output for testing +test/btyacc/err_syntax27.error reference output for testing +test/btyacc/err_syntax27.output reference output for testing +test/btyacc/err_syntax27.tab.c reference output for testing +test/btyacc/err_syntax27.tab.h reference output for testing +test/btyacc/err_syntax3.error reference output for testing +test/btyacc/err_syntax3.output reference output for testing +test/btyacc/err_syntax3.tab.c reference output for testing +test/btyacc/err_syntax3.tab.h reference output for testing +test/btyacc/err_syntax4.error reference output for testing +test/btyacc/err_syntax4.output reference output for testing +test/btyacc/err_syntax4.tab.c reference output for testing +test/btyacc/err_syntax4.tab.h reference output for testing +test/btyacc/err_syntax5.error reference output for testing +test/btyacc/err_syntax5.output reference output for testing +test/btyacc/err_syntax5.tab.c reference output for testing +test/btyacc/err_syntax5.tab.h reference output for testing +test/btyacc/err_syntax6.error reference output for testing +test/btyacc/err_syntax6.output reference output for testing +test/btyacc/err_syntax6.tab.c reference output for testing +test/btyacc/err_syntax6.tab.h reference output for testing +test/btyacc/err_syntax7.error reference output for testing +test/btyacc/err_syntax7.output reference output for testing +test/btyacc/err_syntax7.tab.c reference output for testing +test/btyacc/err_syntax7.tab.h reference output for testing +test/btyacc/err_syntax7a.error reference output for testing +test/btyacc/err_syntax7a.output reference output for testing +test/btyacc/err_syntax7a.tab.c reference output for testing +test/btyacc/err_syntax7a.tab.h reference output for testing +test/btyacc/err_syntax7b.error reference output for testing +test/btyacc/err_syntax7b.output reference output for testing +test/btyacc/err_syntax7b.tab.c reference output for testing +test/btyacc/err_syntax7b.tab.h reference output for testing +test/btyacc/err_syntax8.error reference output for testing +test/btyacc/err_syntax8.output reference output for testing +test/btyacc/err_syntax8.tab.c reference output for testing +test/btyacc/err_syntax8.tab.h reference output for testing +test/btyacc/err_syntax8a.error reference output for testing +test/btyacc/err_syntax8a.output reference output for testing +test/btyacc/err_syntax8a.tab.c reference output for testing +test/btyacc/err_syntax8a.tab.h reference output for testing +test/btyacc/err_syntax9.error reference output for testing +test/btyacc/err_syntax9.output reference output for testing +test/btyacc/err_syntax9.tab.c reference output for testing +test/btyacc/err_syntax9.tab.h reference output for testing +test/btyacc/error.error reference output for testing +test/btyacc/error.output reference output for testing +test/btyacc/error.tab.c reference output for testing +test/btyacc/error.tab.h reference output for testing +test/btyacc/grammar.dot reference output for testing +test/btyacc/grammar.error reference output for testing +test/btyacc/grammar.output reference output for testing +test/btyacc/grammar.tab.c reference output for testing +test/btyacc/grammar.tab.h reference output for testing +test/btyacc/help.error reference output for testing +test/btyacc/help.output reference output for testing +test/btyacc/inherit0.error reference output for testing +test/btyacc/inherit0.output reference output for testing +test/btyacc/inherit0.tab.c reference output for testing +test/btyacc/inherit0.tab.h reference output for testing +test/btyacc/inherit1.error reference output for testing +test/btyacc/inherit1.output reference output for testing +test/btyacc/inherit1.tab.c reference output for testing +test/btyacc/inherit1.tab.h reference output for testing +test/btyacc/inherit2.error reference output for testing +test/btyacc/inherit2.output reference output for testing +test/btyacc/inherit2.tab.c reference output for testing +test/btyacc/inherit2.tab.h reference output for testing +test/btyacc/no_b_opt.error reference output for testing +test/btyacc/no_b_opt.output reference output for testing +test/btyacc/no_b_opt1.error reference output for testing +test/btyacc/no_b_opt1.output reference output for testing +test/btyacc/no_code_c.error reference output for testing +test/btyacc/no_code_c.output reference output for testing +test/btyacc/no_defines.error reference output for testing +test/btyacc/no_defines.output reference output for testing +test/btyacc/no_graph.error reference output for testing +test/btyacc/no_graph.output reference output for testing +test/btyacc/no_include.error reference output for testing +test/btyacc/no_include.output reference output for testing +test/btyacc/no_opts.error reference output for testing +test/btyacc/no_opts.output reference output for testing +test/btyacc/no_output.error reference output for testing +test/btyacc/no_output.output reference output for testing +test/btyacc/no_output1.error reference output for testing +test/btyacc/no_output1.output reference output for testing +test/btyacc/no_output2.error reference output for testing +test/btyacc/no_output2.output reference output for testing +test/btyacc/no_p_opt.error reference output for testing +test/btyacc/no_p_opt.output reference output for testing +test/btyacc/no_p_opt1.error reference output for testing +test/btyacc/no_p_opt1.output reference output for testing +test/btyacc/no_verbose.error reference output for testing +test/btyacc/no_verbose.output reference output for testing +test/btyacc/nostdin.error reference output for testing +test/btyacc/nostdin.output reference output for testing +test/btyacc/ok_syntax1.error reference output for testing +test/btyacc/ok_syntax1.output reference output for testing +test/btyacc/ok_syntax1.tab.c reference output for testing +test/btyacc/ok_syntax1.tab.h reference output for testing +test/btyacc/pure_calc.error reference output for testing +test/btyacc/pure_calc.output reference output for testing +test/btyacc/pure_calc.tab.c reference output for testing +test/btyacc/pure_calc.tab.h reference output for testing +test/btyacc/pure_error.error reference output for testing +test/btyacc/pure_error.output reference output for testing +test/btyacc/pure_error.tab.c reference output for testing +test/btyacc/pure_error.tab.h reference output for testing +test/btyacc/quote_calc-s.error reference output for testing +test/btyacc/quote_calc-s.output reference output for testing +test/btyacc/quote_calc-s.tab.c reference output for testing +test/btyacc/quote_calc-s.tab.h reference output for testing +test/btyacc/quote_calc.error reference output for testing +test/btyacc/quote_calc.output reference output for testing +test/btyacc/quote_calc.tab.c reference output for testing +test/btyacc/quote_calc.tab.h reference output for testing +test/btyacc/quote_calc2-s.error reference output for testing +test/btyacc/quote_calc2-s.output reference output for testing +test/btyacc/quote_calc2-s.tab.c reference output for testing +test/btyacc/quote_calc2-s.tab.h reference output for testing +test/btyacc/quote_calc2.error reference output for testing +test/btyacc/quote_calc2.output reference output for testing +test/btyacc/quote_calc2.tab.c reference output for testing +test/btyacc/quote_calc2.tab.h reference output for testing +test/btyacc/quote_calc3-s.error reference output for testing +test/btyacc/quote_calc3-s.output reference output for testing +test/btyacc/quote_calc3-s.tab.c reference output for testing +test/btyacc/quote_calc3-s.tab.h reference output for testing +test/btyacc/quote_calc3.error reference output for testing +test/btyacc/quote_calc3.output reference output for testing +test/btyacc/quote_calc3.tab.c reference output for testing +test/btyacc/quote_calc3.tab.h reference output for testing +test/btyacc/quote_calc4-s.error reference output for testing +test/btyacc/quote_calc4-s.output reference output for testing +test/btyacc/quote_calc4-s.tab.c reference output for testing +test/btyacc/quote_calc4-s.tab.h reference output for testing +test/btyacc/quote_calc4.error reference output for testing +test/btyacc/quote_calc4.output reference output for testing +test/btyacc/quote_calc4.tab.c reference output for testing +test/btyacc/quote_calc4.tab.h reference output for testing +test/btyacc/rename_debug.c reference output for testing +test/btyacc/rename_debug.error reference output for testing +test/btyacc/rename_debug.h reference output for testing +test/btyacc/rename_debug.i reference output for testing +test/btyacc/rename_debug.output reference output for testing +test/btyacc/varsyntax_calc1.error reference output for testing +test/btyacc/varsyntax_calc1.output reference output for testing +test/btyacc/varsyntax_calc1.tab.c reference output for testing +test/btyacc/varsyntax_calc1.tab.h reference output for testing +test subdirectory +test/btyacc_calc1.y testcase for btyacc +test/btyacc_demo.y testcase for btyacc +test/calc.y example from VMS freeware version of byacc +test/calc1.y advanced example from Steve Johnson's paper. +test/calc2.y test-cases and reference files for %lex-param / %parse-param +test/calc3.y test-cases and reference files for %lex-param / %parse-param +test/code_calc.y reference input for testing +test/code_debug.y test-input, for -i, -o, -d options +test/code_error.y reference input for testing +test/empty.y testcase for btyacc +test/err_inherit1.y testcase for btyacc +test/err_inherit2.y testcase for btyacc +test/err_inherit3.y testcase for btyacc +test/err_inherit4.y testcase for btyacc +test/err_inherit5.y testcase for btyacc +test/err_syntax1.y test-case with syntax error (and nonprinting character) +test/err_syntax10.y testcase for retyped_warning() +test/err_syntax11.y testcase for reprec_warning() +test/err_syntax12.y testcase for revalued_warning() +test/err_syntax13.y testcase for terminal_start() +test/err_syntax14.y testcase for restarted_warning() and undefined_goal() +test/err_syntax15.y testcase for no_grammar() +test/err_syntax16.y testcase for terminal_lhs() +test/err_syntax17.y testcase for unterminated_action() +test/err_syntax18.y testcase for dollar_warning() +test/err_syntax19.y testcase for dollar_error() +test/err_syntax2.y testcase for unterminated_comment() +test/err_syntax20.y testcase for undefined_symbol_warning() +test/err_syntax21.y testcase for unknown_rhs() +test/err_syntax22.y testcase for untyped_rhs() +test/err_syntax23.y testcase for untyped_lhs() +test/err_syntax24.y testcase for default_action_warning() +test/err_syntax25.y testcase for over_unionized() +test/err_syntax26.y testcase for unexpected_EOF() +test/err_syntax27.y testcase for missing_brace() +test/err_syntax3.y testcase for unterminated_string() +test/err_syntax4.y testcase for unterminated_text() +test/err_syntax5.y testcase for unterminated_union() +test/err_syntax6.y testcase for illegal_tag() +test/err_syntax7.y testcase for illegal_character() +test/err_syntax7a.y testcase for illegal_character() +test/err_syntax7b.y testcase for illegal_character() +test/err_syntax8.y testcase for used_reserved() +test/err_syntax8a.y testcase for used_reserved() +test/err_syntax9.y testcase for tokenized_start() +test/error.y original version of byacc - 1993 +test/grammar.y grammar from cproto +test/inherit0.y testcase for btyacc +test/inherit1.y testcase for btyacc +test/inherit2.y testcase for btyacc +test/ok_syntax1.y testcase for valid literal syntax +test/pure_calc.y reference input for testing +test/pure_error.y reference input for testing +test/quote_calc.y test-case for %token using quoted name +test/quote_calc2.y test-case for %token using quoted name +test/quote_calc3.y test-case for %token using quoted name +test/quote_calc4.y test-case for %token using quoted name +test/run_lint.sh run lint, using the build-directory's makefile, on each ".c" file in test-directory +test/run_make.sh do a test-compile of each ".c" file in the test-directory +test/run_test.sh test-script for byacc +test/varsyntax_calc1.y testcase for btyacc +test/yacc subdirectory +test/yacc/big_b.error exercise -L/-B options +test/yacc/big_b.output exercise -L/-B options +test/yacc/big_l.error exercise -L/-B options +test/yacc/big_l.output exercise -L/-B options +test/yacc/calc.error reference output for testing +test/yacc/calc.output reference output for testing +test/yacc/calc.tab.c reference output for testing +test/yacc/calc.tab.h reference output for testing +test/yacc/calc1.error reference output for testing +test/yacc/calc1.output reference output for testing +test/yacc/calc1.tab.c reference output for testing +test/yacc/calc1.tab.h reference output for testing +test/yacc/calc2.error reference output for testing +test/yacc/calc2.output reference output for testing +test/yacc/calc2.tab.c reference output for testing +test/yacc/calc2.tab.h reference output for testing +test/yacc/calc3.error reference output for testing +test/yacc/calc3.output reference output for testing +test/yacc/calc3.tab.c reference output for testing +test/yacc/calc3.tab.h reference output for testing +test/yacc/code_calc.code.c reference output for testing +test/yacc/code_calc.error reference output for testing +test/yacc/code_calc.output reference output for testing +test/yacc/code_calc.tab.c reference output for testing +test/yacc/code_calc.tab.h reference output for testing +test/yacc/code_error.code.c reference output for testing +test/yacc/code_error.error reference output for testing +test/yacc/code_error.output reference output for testing +test/yacc/code_error.tab.c reference output for testing +test/yacc/code_error.tab.h reference output for testing +test/yacc/empty.error reference output for testing +test/yacc/empty.output reference output for testing +test/yacc/empty.tab.c reference output for testing +test/yacc/empty.tab.h reference output for testing +test/yacc/err_syntax1.error reference output for testing +test/yacc/err_syntax1.output reference output for testing +test/yacc/err_syntax1.tab.c reference output for testing +test/yacc/err_syntax1.tab.h reference output for testing +test/yacc/err_syntax10.error reference output for testing +test/yacc/err_syntax10.output reference output for testing +test/yacc/err_syntax10.tab.c reference output for testing +test/yacc/err_syntax10.tab.h reference output for testing +test/yacc/err_syntax11.error reference output for testing +test/yacc/err_syntax11.output reference output for testing +test/yacc/err_syntax11.tab.c reference output for testing +test/yacc/err_syntax11.tab.h reference output for testing +test/yacc/err_syntax12.error reference output for testing +test/yacc/err_syntax12.output reference output for testing +test/yacc/err_syntax12.tab.c reference output for testing +test/yacc/err_syntax12.tab.h reference output for testing +test/yacc/err_syntax13.error reference output for testing +test/yacc/err_syntax13.output reference output for testing +test/yacc/err_syntax13.tab.c reference output for testing +test/yacc/err_syntax13.tab.h reference output for testing +test/yacc/err_syntax14.error reference output for testing +test/yacc/err_syntax14.output reference output for testing +test/yacc/err_syntax14.tab.c reference output for testing +test/yacc/err_syntax14.tab.h reference output for testing +test/yacc/err_syntax15.error reference output for testing +test/yacc/err_syntax15.output reference output for testing +test/yacc/err_syntax15.tab.c reference output for testing +test/yacc/err_syntax15.tab.h reference output for testing +test/yacc/err_syntax16.error reference output for testing +test/yacc/err_syntax16.output reference output for testing +test/yacc/err_syntax16.tab.c reference output for testing +test/yacc/err_syntax16.tab.h reference output for testing +test/yacc/err_syntax17.error reference output for testing +test/yacc/err_syntax17.output reference output for testing +test/yacc/err_syntax17.tab.c reference output for testing +test/yacc/err_syntax17.tab.h reference output for testing +test/yacc/err_syntax18.error reference output for testing +test/yacc/err_syntax18.output reference output for testing +test/yacc/err_syntax18.tab.c reference output for testing +test/yacc/err_syntax18.tab.h reference output for testing +test/yacc/err_syntax19.error reference output for testing +test/yacc/err_syntax19.output reference output for testing +test/yacc/err_syntax19.tab.c reference output for testing +test/yacc/err_syntax19.tab.h reference output for testing +test/yacc/err_syntax2.error reference output for testing +test/yacc/err_syntax2.output reference output for testing +test/yacc/err_syntax2.tab.c reference output for testing +test/yacc/err_syntax2.tab.h reference output for testing +test/yacc/err_syntax20.error reference output for testing +test/yacc/err_syntax20.output reference output for testing +test/yacc/err_syntax20.tab.c reference output for testing +test/yacc/err_syntax20.tab.h reference output for testing +test/yacc/err_syntax21.error reference output for testing +test/yacc/err_syntax21.output reference output for testing +test/yacc/err_syntax21.tab.c reference output for testing +test/yacc/err_syntax21.tab.h reference output for testing +test/yacc/err_syntax22.error reference output for testing +test/yacc/err_syntax22.output reference output for testing +test/yacc/err_syntax22.tab.c reference output for testing +test/yacc/err_syntax22.tab.h reference output for testing +test/yacc/err_syntax23.error reference output for testing +test/yacc/err_syntax23.output reference output for testing +test/yacc/err_syntax23.tab.c reference output for testing +test/yacc/err_syntax23.tab.h reference output for testing +test/yacc/err_syntax24.error reference output for testing +test/yacc/err_syntax24.output reference output for testing +test/yacc/err_syntax24.tab.c reference output for testing +test/yacc/err_syntax24.tab.h reference output for testing +test/yacc/err_syntax25.error reference output for testing +test/yacc/err_syntax25.output reference output for testing +test/yacc/err_syntax25.tab.c reference output for testing +test/yacc/err_syntax25.tab.h reference output for testing +test/yacc/err_syntax26.error reference output for testing +test/yacc/err_syntax26.output reference output for testing +test/yacc/err_syntax26.tab.c reference output for testing +test/yacc/err_syntax26.tab.h reference output for testing +test/yacc/err_syntax27.error reference output for testing +test/yacc/err_syntax27.output reference output for testing +test/yacc/err_syntax27.tab.c reference output for testing +test/yacc/err_syntax27.tab.h reference output for testing +test/yacc/err_syntax3.error reference output for testing +test/yacc/err_syntax3.output reference output for testing +test/yacc/err_syntax3.tab.c reference output for testing +test/yacc/err_syntax3.tab.h reference output for testing +test/yacc/err_syntax4.error reference output for testing +test/yacc/err_syntax4.output reference output for testing +test/yacc/err_syntax4.tab.c reference output for testing +test/yacc/err_syntax4.tab.h reference output for testing +test/yacc/err_syntax5.error reference output for testing +test/yacc/err_syntax5.output reference output for testing +test/yacc/err_syntax5.tab.c reference output for testing +test/yacc/err_syntax5.tab.h reference output for testing +test/yacc/err_syntax6.error reference output for testing +test/yacc/err_syntax6.output reference output for testing +test/yacc/err_syntax6.tab.c reference output for testing +test/yacc/err_syntax6.tab.h reference output for testing +test/yacc/err_syntax7.error reference output for testing +test/yacc/err_syntax7.output reference output for testing +test/yacc/err_syntax7.tab.c reference output for testing +test/yacc/err_syntax7.tab.h reference output for testing +test/yacc/err_syntax7a.error reference output for testing +test/yacc/err_syntax7a.output reference output for testing +test/yacc/err_syntax7a.tab.c reference output for testing +test/yacc/err_syntax7a.tab.h reference output for testing +test/yacc/err_syntax7b.error reference output for testing +test/yacc/err_syntax7b.output reference output for testing +test/yacc/err_syntax7b.tab.c reference output for testing +test/yacc/err_syntax7b.tab.h reference output for testing +test/yacc/err_syntax8.error reference output for testing +test/yacc/err_syntax8.output reference output for testing +test/yacc/err_syntax8.tab.c reference output for testing +test/yacc/err_syntax8.tab.h reference output for testing +test/yacc/err_syntax8a.error reference output for testing +test/yacc/err_syntax8a.output reference output for testing +test/yacc/err_syntax8a.tab.c reference output for testing +test/yacc/err_syntax8a.tab.h reference output for testing +test/yacc/err_syntax9.error reference output for testing +test/yacc/err_syntax9.output reference output for testing +test/yacc/err_syntax9.tab.c reference output for testing +test/yacc/err_syntax9.tab.h reference output for testing +test/yacc/error.error reference output for testing +test/yacc/error.output reference output for testing +test/yacc/error.tab.c reference output for testing +test/yacc/error.tab.h reference output for testing +test/yacc/grammar.dot reference output for testing +test/yacc/grammar.error reference output for testing +test/yacc/grammar.output reference output for testing +test/yacc/grammar.tab.c reference output for testing +test/yacc/grammar.tab.h reference output for testing +test/yacc/help.error reference output for testing +test/yacc/help.output reference output for testing +test/yacc/no_b_opt.error reference output for testing +test/yacc/no_b_opt.output reference output for testing +test/yacc/no_b_opt1.error reference output for testing +test/yacc/no_b_opt1.output reference output for testing +test/yacc/no_code_c.error reference output for testing +test/yacc/no_code_c.output reference output for testing +test/yacc/no_defines.error reference output for testing +test/yacc/no_defines.output reference output for testing +test/yacc/no_graph.error reference output for testing +test/yacc/no_graph.output reference output for testing +test/yacc/no_include.error reference output for testing +test/yacc/no_include.output reference output for testing +test/yacc/no_opts.error reference output for testing +test/yacc/no_opts.output reference output for testing +test/yacc/no_output.error reference output for testing +test/yacc/no_output.output reference output for testing +test/yacc/no_output1.error reference output for testing +test/yacc/no_output1.output reference output for testing +test/yacc/no_output2.error reference output for testing +test/yacc/no_output2.output reference output for testing +test/yacc/no_p_opt.error reference output for testing +test/yacc/no_p_opt.output reference output for testing +test/yacc/no_p_opt1.error reference output for testing +test/yacc/no_p_opt1.output reference output for testing +test/yacc/no_verbose.error reference output for testing +test/yacc/no_verbose.output reference output for testing +test/yacc/nostdin.error reference output for testing +test/yacc/nostdin.output reference output for testing +test/yacc/ok_syntax1.error reference output for testing +test/yacc/ok_syntax1.output reference output for testing +test/yacc/ok_syntax1.tab.c reference output for testing +test/yacc/ok_syntax1.tab.h reference output for testing +test/yacc/pure_calc.error reference output for testing +test/yacc/pure_calc.output reference output for testing +test/yacc/pure_calc.tab.c reference output for testing +test/yacc/pure_calc.tab.h reference output for testing +test/yacc/pure_error.error reference output for testing +test/yacc/pure_error.output reference output for testing +test/yacc/pure_error.tab.c reference output for testing +test/yacc/pure_error.tab.h reference output for testing +test/yacc/quote_calc-s.error reference output for testing +test/yacc/quote_calc-s.output reference output for testing +test/yacc/quote_calc-s.tab.c reference output for testing +test/yacc/quote_calc-s.tab.h reference output for testing +test/yacc/quote_calc.error reference output for testing +test/yacc/quote_calc.output reference output for testing +test/yacc/quote_calc.tab.c reference output for testing +test/yacc/quote_calc.tab.h reference output for testing +test/yacc/quote_calc2-s.error reference output for testing +test/yacc/quote_calc2-s.output reference output for testing +test/yacc/quote_calc2-s.tab.c reference output for testing +test/yacc/quote_calc2-s.tab.h reference output for testing +test/yacc/quote_calc2.error reference output for testing +test/yacc/quote_calc2.output reference output for testing +test/yacc/quote_calc2.tab.c reference output for testing +test/yacc/quote_calc2.tab.h reference output for testing +test/yacc/quote_calc3-s.error reference output for testing +test/yacc/quote_calc3-s.output reference output for testing +test/yacc/quote_calc3-s.tab.c reference output for testing +test/yacc/quote_calc3-s.tab.h reference output for testing +test/yacc/quote_calc3.error reference output for testing +test/yacc/quote_calc3.output reference output for testing +test/yacc/quote_calc3.tab.c reference output for testing +test/yacc/quote_calc3.tab.h reference output for testing +test/yacc/quote_calc4-s.error reference output for testing +test/yacc/quote_calc4-s.output reference output for testing +test/yacc/quote_calc4-s.tab.c reference output for testing +test/yacc/quote_calc4-s.tab.h reference output for testing +test/yacc/quote_calc4.error reference output for testing +test/yacc/quote_calc4.output reference output for testing +test/yacc/quote_calc4.tab.c reference output for testing +test/yacc/quote_calc4.tab.h reference output for testing +test/yacc/rename_debug.c reference output for testing +test/yacc/rename_debug.error reference output for testing +test/yacc/rename_debug.h reference output for testing +test/yacc/rename_debug.i reference output for testing +test/yacc/rename_debug.output reference output for testing +test/yacc/varsyntax_calc1.error reference output for testing +test/yacc/varsyntax_calc1.output reference output for testing +test/yacc/varsyntax_calc1.tab.c reference output for testing +test/yacc/varsyntax_calc1.tab.h reference output for testing diff --git a/NOTES-btyacc-Changes b/NOTES-btyacc-Changes new file mode 100644 index 000000000000..f074907ee0c9 --- /dev/null +++ b/NOTES-btyacc-Changes @@ -0,0 +1,385 @@ +Tom Shields, March 17, 2014 + +PARKING LOT ISSUES: +------------------- +- verify debian packaging still works? + +- there are no #line directives in y.tab.i, other than those that come + from the input file and the skeleton file; to fix this, would need to + count output lines in externs_file and add 'write_externs_lineno()' + similar to 'write_code_lineno()' +- if there are no defined symbols, the .tab.h file isn't empty (weird case, + may not be worth fixing) +- consider: treat []-actions identical to {}-actions if not processing a + backtracking parser (avoids test case error)? + + +BTYACC CHANGES CURRENTLY DEFERRED, BY FILE: +------------------------------------------- + +push.skel +- skeleton for a 'push' parser +- needs to be upgraded match the structure of yaccpar.skel + +defs.h +- adopt '%include' changes +- adopt '%define'/'%ifdef'/'%endif' +- adopt -E flag to print preprocessed grammar to stdout + +error.c +- adopt '%include' changes +- NOTE: there is a btyacc change that might be worth adopting in byacc + [FileError() refactoring to eliminate duplicated code in most of the + error message functions] + +main.c +- adopt '%define' changes +- adopt '-DNAME' command line option to define preprocessor variable NAME +- adopt -E flag to print preprocessed grammar to stdout +- adopt '-S skeleton_file' command line option to select an alternate parser + skeleton file +- the skeleton file named by the -S flag is used as provided to open the + file; consider a change to this behavior to check whether the named file + has a path prefix, and if not, look in 'installation' directory if the + file is not found in the working directory + +output.c +- adopt '%include' changes + +reader.c +- adopt '%include' changes +- adopt '%define'/'%ifdef'/'%endif' changes +- adopt -E flag to print preprocessed grammar to stdout +- NOTE: there is a btyacc change that might be worth adopting in byacc + [copy_string() & copy_comment() refactoring to eliminate duplicated + code in copy_text() and copy_union()] + +warshall.c +- NOTE: there is a btyacc change that might be worth adopting in byacc + [shifting 'mask' incrementally rather than literal '1' by a variable + amount each time thru the loop] + + +================================================================================ + + +new files: +---------- + +skel2c +- modified from btyacc distribution: don't generate #include defs.h +- extended syntax recognized to include '%% insert VERSION here', generating + the defines for YYMAJOR, YYMINOR and YYPATCH at that point +- made generated tables type 'const char *const' to match skelton.c from + byacc-20130925 baseline +- added code to append text for write_section() to end of generated skeleton.c +- remove conversion of tab to \t in generated skeleton.c +- extended syntax recognized to include '%%ifdef', '%%ifndef', '%%else' and + '%%endif'; used in yaccpar.skel to bracket code that is specific to + backtracking + +yaccpar.skel.old +- created from skeleton.c in byacc-20140101 baseline; use of this skeleton + will create a version of skeleton.c that is close to that in the + byacc-20140101 baseline +- eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate + yyerror() invocation dynamically; YYERROR_CALL() is already generated + earlier, and so can be used in the skeleton to simplify +- added 'const' to types in '%% tables' section to match what skel2c, + start_int_table() and state_str_table() generate +- added a few cosmetic changes (e.g., added some additional comments, + reworded debugging output to match yaccpar.skel, changed yygrowstack() + to return YYENOMEM for 'out of memory' error, rather than -1, to match + yaccpar.skel; changed yyparse() return value from 1 to 2 for the + 'out of memory' error to match yaccpar.skel) +- added '#ifndef'/'#endif' around '#define YYINITSTACKSIZE 200' to allow + the value to be changed at compile time +- changed 'printf(' to 'fprintf(stderr, '; added stack depth (yydepth) to + debugging output from yaccpar.skel +- use 'YYINT' rather than 'short' for integer table types + +yaccpar.skel +- renamed from btyaccpa.ske, merged with btyacc-c.ske +- modified from btyacc distribution to match the latest byacc-20140101 + skeleton structure & data structures +- make local functions static +- change "virtual memory exceeded" to "memory exhausted" for bison + compatibility +- change debug output generation from printf/puts/putc onto stdout to use + fprintf/fputs/fputc onto stderr; include + stack depth and whether or not in trial parsing +- changed types of generated string tables to be 'const pointer to const char' +- check all malloc()/realloc() return values, ensure return value of + yyparse() = 2 if parsing failed due to memory exhaustion +- change YYDBPR() macro to YYSTYPE_TOSTRING(); define semantics as delivering + a char* value representing a semantic value (e.g., yylval or yyval, or the + contents of an entry on the semantic stack); additional parameter passed: + grammar symbol # (to assist interpretation of semantic value) +- change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to + yylval) for bison compatibility; add yyloc (corresponding to yyval) +- move default definition of YYLTYPE into output.c, generating a typedef +- add '#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)'/'#endif' around + all lines specific to position processing +- add '#if defined(YYDESTRUCT_CALL)'/'#endif' around all lines specific to + semantic & position stack processing to reclaim memory associated with + discarded symbols +- add '%%ifdef YYBTYACC'/'%%endif' around all lines specific to backtrack + parsing; converted by skel2c into '#if defined(YYBTYACC)'/'#endif' +- distinguish between "yacc stack overflow" and "memory exhausted" situations +- consolidated termination cleanup code; introduced yyreturn, set to 2 after + labels yyoverflow/yyenomem, set to 1 after label yyabort, set to 0 after + label yyaccept; all termination cases jump to label yyreturn, which does + any cleanup then returns yyreturn value +- replaced YYDELETEVAL & YYDELETEPOSN user-supplied macro capability by + implementation of byacc-generated yydestruct() as defined by bison + compatible %destructor mechanism +- moved invocation of 'YYREDUCEPOSNFUNC' macro to immediately prior to, rather + than after, execution of final rule action (so that, at some future + date, implementation extensions can be added to enable custom calculation + of locations associated with non-terminals within rule actions); deleted + unnecessary flag 'reduce_posn'; deleted 'YYCALLREDUCEPOSN' macro; deleted + C++ variant of 'YYREDUCEPOSNFUNC' invocation +- adopt approach similar to bison for default computation of yyloc; change + macro 'YYREDUCEPOSNFUNC' name to 'YYLLOC_DEFAULT' for bison compatibility; + added 'yyerror_loc_range[2]' to hold start & end locations for error + situations that pop the stack +- use 'YYINT' rather than 'short' for integer table types, and for indexing + parser tables + +readskel.c +http://www.verisign.com/index.html- replaced error() with fprintf() + +mstring.h +- moved contents of mstring.h to defs.h - mstring.h is obsolete + +mstring.c +- replaced include of mstring.h with defs.h +- changed 'START' to 'HEAD' to remove conflict with 'START' used for + the start symbol defined in defs.h + +modified byacc files: +--------------------- + +skeleton.c +- skeleton.c is now generated from the appropriate skeleton file by 'skel2c' + +configure.in +- added configuration for --enable-btyacc option; if 'yes' add '-DYYBTYACC' + to DEFINES in makefile.in; --enable-btyacc defaults to 'no' +- added configuration for --with-max-table-size option; if present, + overrides the value of MAXTABLE defined in defs.h +- regenerate configure using autoconf + +makefile.in +- added mstring.c to C_FILES +- added mstring$o to OBJS +- added @DEFINES@ as value of DEFINES make variable +- added new make variable SKELETON with value 'yaccpar.skel' +- added rule to generate skeleton.c from $(SKELETON), depending on skel2c + and makefile +- added rm -f skeleton.c distclean rule +- moved dependency on makefile from only main$o & skeleton$o to $(OBJS), + since if ./configure is run changing, for example, from --enable-btyacc + to --disable-btyacc, all files must be recompiled to ensure a clean + executable +- add @MAXTABLE@ for optional '-DMAXTABLE=nnn' if configured using + --with-max-table-size=nnn +- changed 'cd test && rn 0f test-*'to 'rm -f $(testdir)/test-*' + +test/run_test.sh +- ??? + +test/run_make.sh +- ??? + +defs.h +- moved contents of mstring.h to defs.h - mstring.h is obsolete +- added <limits.h> to get the various system defined machine limits; + changed definitions of MAXCHAR, MAXSHORT, MINSHORT & BITS_PER_WORD to use + defines from <limits.h>; changed definitions of BIT and SETBIT to use + value of BITS_PER_WORD +- added typedef for __compar_fn_t, conditioned on _COMPAR_FN_T being + undefined (at least for Mac OSX environment) +- adopt new symbol class values ACTION and ARGUMENT +- adopt changes/additions used by inherited attribute processing +- clean up locations of extern function definitions to match where they + actually live in source files +- adopt error functions from inherited attribute processing; added new error + functions +- added keyword code LOCATIONS for %locations +- added keyword code DESTRUCTOR for %destructor +- added extern decl for 'int locations'; true if %locations present +- added extern decl for 'int backtrack'; initialized to 0 (= false), set to + 1 (= true) if -B flag is present +- added extern decl for 'int destructor'; true if at least one %destructor + present in grammar spec file +- define 'YYINT' as the smallest C type that can be used to address a + table of size 'MAXTABLE'; define 'YYINT' based on the value of + 'MAXTABLE' using the standard system type size definitions from <limits.h>; + define 'MAXYYINT' and 'MINYYINT' accordingly +- change 'Value_t' and 'Index_t' to 'YYINT' from 'short' +- allow 'MAXTABLE' to be defined by '-DMAXTABLE=nnn' at compile-time + +closure.c +- changed print_closure(), print_EFF() and print_first_derives() to 'static'; + added fwd declarations +- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already + used for variables/parameters that were related to variables/parameters + declared as 'short' + +error.c +- adopt error functions from inherited attribute processing; added a few + additional inherited attribute error functions + +graph.c +- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already + used for variables/parameters that were related to variables/parameters + declared as 'short' + +lalr.c +- changed MAXSHORT to MAXYYINT + +lr0.c +- changed MAXSHORT to MAXYYINT +- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already + used for variables/parameters that were related to variables/parameters + declared as 'short' + +main.c +- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already + used for variables/parameters that were related to variables/parameters + declared as 'short' + +mkpar.c +- backtracking attempts to resolve shift/reduce and reduce/reduce conflicts + +output.c +- generate prefix & YYPREFIX defines into externs file (-i, .tab.i) and + code file (-r, .code.c); generate into output file (.tab.c) only if not + using -r option; eliminates doubled output of prefix aliases if -r with + no -i in y.tab.c and y.code.c or if -r & -i in y.tab.i and y.code.c +- changed types of generated string tables to be 'const pointer to const char' +- adopt backtracking as an alternative in cases where otherwise we have a + conflict in the parsing actions (3, rather than 2, choices) +- wrap defines file with (where "yy" is value of 'symbol_prefix') + #ifndef __yy_defines_h_ + #define _yy_defines_h_ + + <defines> + + #endif +- avoid writing %%xdecls skeleton section twice if -r used +- eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate + yyerror() invocation dynamically; YYERROR_CALL() is already generated + earlier, and can be used in the pareser skeleton +- if -P flag (pure_parser), add yylloc as 2nd parameter to yylex() + (declaration & call) +- change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to + yylval) for bison compatibility; add yyloc (corresponding to yyval) +- generate yylloc parameters for yylex & yyerror if %locations present +- add location as 1st parameter to declaraion & invocation of yyerror() if + %locations present +- output backtrack parsing tables if -B flag is present +- added generation of yystos[] with output_accessing_symbols() to allow + translation from a parser internal state number to the corresponding + grammar symbol number [0 .. nsyms) of the accessing symbol of that parser + state; used in the generated code for YYDESTRUCT_CALL() & + YYSTYPE_TOSTRING() to enable the correct semantic value union tag to be + determined when executing the implementation of YYDESTRUCT_CALL() or + YYSTYPE_TOSTRING() (similar to yystos[] in bison) +- added to output_prefix(): yystos; yycindex & yyctable if compiling + backtracking; yyloc & yylloc if %locations used +- extended yyname[] to include all grammar symbols, not just the terminal + symbols: '$end', 'error', '$accept', all non-terminals, including internally + generated non-terminals for embedded actions in rules, and 'illegal-symbol' + (which bison spells '$undefined'); '$end' already defined as a symbol 0, + rathern than adding 'end-of-file' as the name of symbol 0; added + 'illegal-symbol' from byacc-20140101 (NOTE: the comment in the code that + says byacc does not predefine '$end' and '$error' is incorrect; however, + both bison and byacc spell '$error' as 'error') +- added generation of #define YYTRANSLATE() from byacc-20140101, but changed + the definition for the undefined symbol case because it is no longer in + yyname[YYMAXTOKEN+1] but rather occurs after the last non-terminal symbol; + added #define YYUNDFTOKEN to contain the index in yyname of 'illegal-symbol' +- generate YYLTYPE in output_ltype() as a struct like for bison rather than + using #define in yaccpar.skel +- added 'write_code_lineno' invocation at start of 'output_prefix' +- added 'write_code_lineno' invocation at start of 'output_pure_parser' +- added 'write_code_lineno' invocation prior to generation of #include + for externs file +- added 'write_code_lineno' invocation after 1st 'write_section(fp, xdecls)' +- added '++outline;' prior to output of '#define YYTRANSLATE' - this was + actually causing almost all of the invocations of 'write_code_lineno' to + put out the correct #line directive +- corrected 'write_code_lineno' - the line number in a #line directive is + the number of the next line, not the number of the #line line +- changed MAXSHORT to MAXYYINT; changed 'high' local static from 'int' to + 'long' so that it can get higher than 'MAXYYINT' without machine-dependent + behavior; changed related formats from '%d' to '%ld' +- generate 'YYINT' rather than 'short' for integer table types +- generate YYDESTRUCT_DECL & YYDESTRUCT_CALL macros, similar to YYERROR_DECL + and YYERROR_CALL macros, that can be redefined by user, if desired, to add + additional parameters to yydestruct() (and even change the 'yydestruct' + function name) +- if at least one %destructor present, generate yydestruct(); 1st parameter + is a string indicating the context in which yydestruct() is invoked + (e.g., discarding input token, discarding state on stack, cleanup when + aborting); 2nd parameter is the internal grammar symbol number [0..nsyms) + of the accessing symbol of the parser state on the top of the stack; 3rd + parameter is a pointer to the semantic value to be reclaimed associated + with the grammar symbol in the 2nd parameter; if %locations is defined, + the 4th parameter is a pointer to the position value to be reclaimed + associated with the grammar symbol in the 2nd parameter + +reader.c +- adopt []-actions, similar to {}-actions; {}-actions are only executed when + not in trial mode, but []-actions are executed regardless of mode +- adopt new symbol class values ACTION and ARGUMENT +- adopt inherited attributes (syntax resembles arguments to non-terminal + symbols) +- adopt keyword table lookup from btyacc, modified to handle equivalence + of '-' and '_' in spelling of keywords +- adopt refactoring of tag table creation into cache_tag() for use in + multiple locations +- added new error functions in place of btyacc's generic error() function +- changed '0' to 'NULL' for pointer initialization +- reworked for-loop at end of get_line (part of DEFERRED '%ifdef/%endif' change) +- added %locations directive for bison compatibility to enable position + processing +- added decl for 'int locations'; true if %locations present +- added decl 'int backtrack'; initialized to 0 (= false), set to + 1 (= true) if -B flag is present +- process %locations if present, set location = 1 +- only process []-actions and only generate 'if (!yytrial)' prefix for + {}-actions if backtracking is enabled +- add decl for 'int destructor'; true if at least one %destructor is present +- add %destructor directive to enable semantic & position stack processing to + reclaim memory associated with discarded symbols +- process bison compatible %destructor (set destructor = 1); support @$ in + %destructor code to reference the position value if %locations is defined +- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already + used for variables/parameters that were related to variables/parameters + declared as 'short' +- if %locations present, support @N and @$ syntax as for bison to reference + the locations associated with the N-th rhs symbol and the lhs symbol, + respectively + +symtab.c +- initialize fields added to 'struct bucket' for non-terminal symbol + inherited attributes + +verbose.c +- for parse states with conflicts, the contents of the y.output file include + the trial shift and/or trial reduce actions +- added output to the end of the verbose report showing the correspondance + between grammar symbol #, internal parser symbol #, and grammar symbol name +- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already + used for variables/parameters that were related to variables/parameters + declared as 'short' + +yacc.1 +- added options 'P', 'V', 'y' and '-o output_file' to the yacc command + synopsis (already covered in the description section) +- added options 'B', 'D' and 'L' to the yacc command synopsis; added text in + the description section +- added %locations description to the extensions section diff --git a/NOTES-btyacc-Disposition b/NOTES-btyacc-Disposition new file mode 100644 index 000000000000..98e527bccab0 --- /dev/null +++ b/NOTES-btyacc-Disposition @@ -0,0 +1,80 @@ +Tom Shields, March 17, 2014 + +NOTE: README.BTYACC needs to be re-written (or another README file created) +to explain how the extensions were adopted into the byacc-20140101 baseline. + +bytacc changes adopted; see README.BTYACC for details. +------------------------------------------------------ + + Changes to the skeleton to send debugging output to stderr. + + Changes to the types of the grammar tables from 'short' to 'int' if +MAXTABLE is defined to be > MAXSHORT for generation of large grammar tables +for large grammars. This can be set with the invocation of configure +using the --with-max-table-size=N option + + Changes to add syntactic sugaring for definition and semantic processing +of inherited attributes associated with non-terminal symbols on the rhs of +rules. Inherited attributes are implemented as {}-actions, and as such may +introduce reduce/reduce conflicts. The advantage over manual {}-actions is +that checking is performed on the number and types of inherited attributes, +and the positions on the semantic stack are automatically calculated. +Identical actions produced by the inherited attribute syntax are collapsed +into a single action, reducing reduce/reduce conflicts. + + The %type specification is extended to define the types of inherited +attributes associated with non-terminal symbols on the lhs of rules, in +addition to its original purpose in yacc for specifying the type of the +symbol itself on the parser's value stack. In order to permit the two + aspects to be used independently, the <type> specification following +%type is optional. + + Added a mechanism to the parser skeleton for computing and propagating +the text position of grammar symbols if %locations directive is present in +the grammar specificaion, or if yacc is invoked with the -L flag. Includes +support for "@$" and "@N" (for N an integer) in actions to refer to symbol +locations. + + Added a bison compatible %destructor directive to define a memory +management mechanism to the parser skeleton that enables cleanup of semantic +values and text positions associated with the parsing stack that are +automatically discarded during error processing. + +The following is only available if configure is invoked with the +--enable-btyacc=yes: + + Changes to enable backtracking with semantic disambiguation, if yacc is +invoked with the -B flag. A yacc parser disambiguates shift/reduce conflicts +by choosing to shift, and reduce/reduce conflicts by reducing using the +earliest grammar rule (in the grammar specification). A btyacc parser handles +a conflict by remembering the current parse point and entering into trial parse +mode. In trial parse mode, the parser tries each of the conflicting options +until the first successs or until all options are exhausted. If the parser +runs into an error while in trial parse mode, it backtracks to the most recent +conflict point and tries the next alternative. If the parser finds a +successful parse, it backtracks to the point where it first entered trial parse +mode and continues with normal parsing, using the action at the start of the +successful trial path. Success in trial parse mode is achieved either by +successfully reducing the start symbol at the end of input or by invocation of +YYVALID (or YYVALID_NESTED). Semantic disambiguation is supported within +[]-actions, which are always executed, with invocation of YYERROR to terminate +a trial path or YYVALID (and YYVALID_NESTED). Yacc {}-actions are only +executed during normal parsing. + + +btyacc changes deferred: +------------------------ + + The -S command line flag to enable use of an alternate parser skeleton, +read from an external file. + + Preprocessor statements: %define, %ifdef/%endif, %include. + + +btyacc changes rejected: +------------------------ + + The yyerror_detailed() option for error messages is replaced by the +byacc feature for specifying options paramters to yyerror(). + + C++-specific features in the parser skeleton. diff --git a/README.BTYACC b/README.BTYACC new file mode 100644 index 000000000000..705481f82685 --- /dev/null +++ b/README.BTYACC @@ -0,0 +1,603 @@ +-- $Id: README.BTYACC,v 1.1 2014/03/25 19:21:31 Tom.Shields Exp $ + +The original README from btyacc is below. + +The backtracking enhancements to byacc have been merged into Thomas Dickey's +byacc baseline. + +The %include and %define/%ifdef enhancements described below are not currently +incorporated. + +------------------------------------------------------------------------------- + BTYACC -- backtracking yacc + =========================== + +BTYACC was created by Chris Dodd using ideas from many +places and lots of code from the Berkeley Yacc +distribution, which is a public domain yacc clone put +together by the good folks at Berkeley. This code is +distributed with NO WARRANTY and is public domain. +It is certain to contain bugs, which you should +report to: chrisd@collins.com. + +Vadim Maslov of Siber Systems <vadik@siber.com> +considerably modified BTYACC to make it suitable +for production environment. + +Several people have suggested bug fixes that +were incorporated into BtYacc. + +See the README.BYACC files for more about +Berkeley Yacc and other sources of info. + +http://www.siber.com/btyacc/ is the current home of BtYacc. +It is provided courtesy of Siber Systems http://www.siber.com/. + + + Version 3.0 changes + ------------------- + by Vadim Maslov + +Changes mostly occurred in btyaccpa.ske file that +contains the parsing shift/reduce/backtrack algorithm. + +Version 3.0 innovations focus on: +- text position computation and propagation, +- industrial-strength error processing and recovery. + + +** Added mechanism for computing and propagating +text position of tokens and non-terminals. + +Compilers often need to build AST trees such that every node +in a tree can relate to the parsed program source it came from. +The following applications are very likely to need this: +- debuggers that show actual source of the debugged program, +- source-to-source translators that want + unchanged parts of the tree to generate the unchanged code. + +The new YYPOSN mechanism added in this version of BtYacc +helps you in automating the text position computation +and in assigning the computed text positions to the AST. +This mechanism is successfully used in commercial +parsers and source-to-source translators. + +In standard Yaccs every token and every non-terminal +has an YYSTYPE semantic value attached to it. +In this new version every token and every non-terminal +also has an YYPOSN text position attached to it. +YYPOSN is a user-defined type that can be anything and +that has a meaning of text position attached to +token or non-terminal. + +In addition to semantic value stack BtYacc now maintains +text position stack. Behavior of the text position stack +is similar to the behavior of the semantic value stack. + +If using text position mechanism, +you need to define the following: + +YYPOSN Preprocessor variable that contains C/C++ type of + the text position attached to + every token and non-terminal. + +yyposn Global variable of type YYPOSN. + The lexer must assign text position of + the returned token to yyposn, just like it assigns + semantic value of the returned token to yylval. + +YYREDUCEPOSNFUNC + Preprocessor variable that points to function that + is called after the grammar rule reduction + to reduce text positions located on the stack. + + This function is called by BtYacc to reduce text + positions. The function is called immediately after + the regular rule reduction occurs. + + The function has the following prototype: + void ReducePosn(YYPOSN &ret, + YYPOSN *terms, + YYSTYPE *term_vals, + int term_no, + int stk_pos, + int yychar, + YYPOSN &yyposn, + UserType extra); + + The function arguments are: + - ret + Reference to the text position returned by + the rule. The function must write the computed + text position returned by the rule to ret. + This is analogue of the $$ semantic value. + + - term_posns + Array of the right-hand side rule components + YYPOSN text positions. These are analogues of + $1, $2, ..., $N in the text position world. + + - term_vals + Array of the right-hand side (RHS) rule components + YYSTYPE values. These are the $1,...,$N themselves. + + - term_no + Number of the components in RHS of the reduced rule. + Equal to size of arrays term_posns and term_vals. + Also equal to N in $1,...,$N in the reduced rule. + + - stk_pos + YYSTYPE/YYPOSN stack position before the reduction. + + - yychar + Lookahead token that immediately follows + the reduced RHS components. + + - yyposn + YYPOSN of the token that immediately follows + the reduced RHS components. + + - extra + User-defined extra argument passed to ReducePosn. + + Typically this function extracts text positions from + the right-hand side rule components and either + assigns them to the returned $$ structure/tree or + if no $$ value is returned, puts them into + the ret text position from where + it will be picked up by the later reduced rules. + +YYREDUCEPOSNFUNCARG + Extra user-defined argument passed to + the ReducePosn function. This argument can use + any variables defined in btyaccpa.ske. + + +** Added code to btyaccpa.ske that automatically cleans up +semantic semantic values and text positions of tokens +and non-terminals that are discarded and deleted as +a result of error processing. + +In the previous versions the discarded token and non-terminal +semantic values were not cleaned that caused quite severe +leaks. The only way to fix it was to add garbage collection +to YYSTYPE class. + +Now BtYacc skeleton calls delete functions for semantic +values and positions of the discarded tokens and +non-terminals. + +You need to define the following functions that BtYacc +calls when it needs to delete semantic value or text position. + +YYDELETEVAL + User-defined function that is called by BtYacc + to delete semantic value of the token or non-terminal. + + The user-defined function must have the prototype: + void DeleteYYval(YYSTYPE v, int type); + v is semantic value to delete, + type is one of the following: + 0 discarding token + 1 discarding state + 2 cleaning up stack when aborting + +YYDELETEPOSN + User-defined function that is called by BtYacc + to delete text position of the token or non-terminal. + + The user-defined function must have the prototype: + void DeleteYYposn(YYPOSN p, int type); + v is semantic value to delete, + type is one of the following: + 0 discarding token + 1 discarding state + 2 cleaning up stack when aborting + + +** User can define "detailed" syntax error processing +function that reports an *exact* position of +the token that caused the error. + +If you define preprocessor variable YYERROR_DETAILED in +your grammar then you need define the following +error processing function: + +void yyerror_detailed(char *text, + int errt, + YYSTYPE &errt_value, + YYPOSN &errt_posn); + +It receives the following arguments: +text Error message. +errt Code of the token that caused the error. +errt_value Value of the token that caused the error. +errt_posn Text position of token that caused error. + + +** Dropped compatibility with C. + +Compatibility with C became increasingly difficult +to maintain as new features were added to btyaccpa.ske. +So we dropped it. If anybody wants to make the new version +compatible with C, we would gladly accept the changes. + +Meanwhile we expect that you use C++ to write grammar +actions and everything else in grammar files. +Since C is (in a sense) subset of C++, your C-based +grammar may work if you use C++ compiler to compile it. + + Version 3.0 bugs fixed + ---------------------- + +Matthias Meixner <meixner@mes.th-darmstadt.de> fixed a bug: +BtYacc does not correctly handle typenames, if one typename +is a prefix of another one and if this type is used after +the longer one. In this case BTYacc produces invalid code. + + + Version 2.1 changes + ------------------- + by Vadim Maslov + +** Added preprocessor statements to BtYacc that are similar +in function and behavior to C/C++ preprocessor statements. + +These statements are used to: + +- Introduce modularity into a grammar by breaking it + into several *.y files and assembling different + grammars from the *.y modules using %include and %ifdef. + +- Have several versions of the same grammar + by using %ifdef and $endif. + +- To include automatically generated grammar fragment. + For instance, we use %include to include + automatically generated list of tokens. + +Preprocessor statements are: + +%define <var-name> + Define preprocessor variable named <var-name>. + +%ifdef <var-name> + If preprocessor variable named <var-name> + is defined by %define, then process the text from + this %ifdef to the closing %endif. + +%endif + Closing bracket for %ifdef preprocessor statement. + Only one nesting level of %ifdef-%endif is allowed. + +%include <file-name> + Process contents of the file named <file-name>. + If <file-name> is a relative name, it is looked up + in a directory in which btyacc was started. + Only one nesting level of %include is allowed. + + + Version 2.0 changes + ------------------- + by Vadim Maslov + + +** Changed 16-bit short numbers to 32-bit int numbers in +grammar tables, so that huge grammar tables (tables that +are larger than 32768 elements) resulting from huge +grammars (Cobol grammar, for instance) can work correctly. +You need to have 32-bit integer to index table bigger than +32768 elements, 16-bit integer is not enough. + +The original BtYacc just generated non-working tables +larger than 32768 elements without even notifying about +the table overflow. + + +** Make error recovery work correctly when error happens +while processing nested conflicts. Original BtYacc could +infinitely cycle in certain situations that involved error +recovery while in nested conflict. + +More detailed explanation: when we have nested conflicts +(conflict that happens while trial-processing another +conflict), it leads btyacc into NP-complete searching of +conflict tree. The ultimate goal is YYVALID operator that +selects a particular branch of that tree as a valid one. + +If no YYVALID is found on the tree, then error recovery +takes over. The problem with this is that error recovery +is started in the same state context that exists on the +last surveyed branch of the conflict tree. Sometimes this +last branch may be of zero length and it results in +recovering to exactly the same state as existed before +entering the conflict. BtYacc cycles then. + +We solved this problem by memorizing the longest path in +the conflict tree while browsing it. If we ever get into +error recovery, we restore state that existed on the +longest path. Effectively we say: if we have an error, +let us move forward as far as we possibly could while we +were browsing the conflict tree. + + +** Introduce YYVALID_NESTED operation in addition to +simply YYVALID. When we have a nested conflict (conflict +while processing in trial mode for another conflict), we +want to relate YYVALID to a particular level of conflict +being in trial. + +Since we mostly anticipate only 2-level nested conflicts +YYVALID_NESTED tells the parser to satisfy only the +internal conflict. Therefore, in 1-level conflict +situation YYVALID_NESTED acts like a regular YYVALID, but +in 2-level conflict it is a no-op and the other YYVALID +for outer conflict will be searched for. + + +** Improved handling of situation where /tmp directory is +missing. Original btyacc just died quietly when /tmp +directory was missing. We added code that states the +problem explicitly. While on UNIX /tmp directory is always +present, it may be missing on WIN32 systems, therefore +diagnosing this situation is important. + + + Version 1.0 changes: BackTracking + ================================= + by Chris Dodd + +BTYACC is a modified version of yacc that supports +automatic backtracking and semantic disambiguation to +parse ambiguous grammars, as well as syntactic sugar for +inherited attributes (which tend to introduce conflicts). +Whenever a btyacc generated parser runs into a +shift-reduce or reduce-reduce error in the parse table, it +remembers the current parse point (yacc stack and input +stream state), and goes into trial parse mode. It then +continues parsing, ignoring most rule actions. If it runs +into an error (either through the parse table or through +an action calling YYERROR), it backtracks to the most +recent conflict point and tries a different alternative. +If it finds a successful parse (reaches the end of the +input or an action calls YYVALID), it backtracks to the +point where it first entered trial parse mode, and +continues with a full parse (executing all actions), +following the path of the successful trial. + +Actions in btyacc come in two flavors -- {}-actions, which +are only executed when not in trial mode, and []-actions +which are executed regardless of mode. There are also +inherited attributes, which look like arguments (they are +enclosed in "()") and act like []-actions. + +What this buys you: + +* No more lexer feedback hack. In yacc grammars for C, a +standard hack, know as the "lexer feedback hack" is used +to find typedef names. The lexer uses semantic +information to decide if any given identifier is a +typedef-name or not and returns a special token. With +btyacc, you no longer need to do this; the lexer should +just always return an identifier. The btyacc grammar then +needs a rule of the form: + +typename: ID [ if (!IsTypeName(LookupId($1))) YYERROR; ] + +While the hack works adequately well for parsing C, it +becomes a nightmare when you try to parse something like +C++, where treating an ID as a typedef becomes heavily +dependent on context. + +* Easy disambiguation via simple ordering. Btyacc runs +its trials via the rule "try shifting first, then try +reducing by the order that the conflicting rules appear in +the input file". This means you can deal with semantic a +disambiguation rule like: + [1] If it looks like a declaration it is, otherwise + [2] If it looks like an expression it is, otherwise + [3] it is a syntax error + [Ellis&Stroustrup, Annotated C++ Reference Manual, p93] + +To deal with this, you need only put all the rules for +declarations before the rules for expressions in the +grammar file. + +* No extra cost if you do not use it. Backtracking is +only triggered when the parse hits a shift/reduce or +reduce/reduce conflict in the table. If you have no +conflicts in your grammar, there is no extra cost, other +than some extra code which will never be invoked. + +* C++ and ANSI C compatible parsers. The parsers produced +by btyacc can be compiled with C++ correctly. If you +"#define" YYSTYPE to be some C++ type with constructor and +destructor, everything will work fine. My favorite is +"#define YYSTYPE SmartPointer", where SmartPointer is a +smart pointer type that does garbage collection on the +pointed to objects. + +BTYACC was originally written to make it easy to write a +C++ parser (my goal was to be able to use the grammar out +of the back of the ARM with as few modifications as +possible). Anyone who has ever looked at Jim Roskind +public domain C++ yacc grammar, or the yacc-based grammar +used in g++ knows how difficult this is. BTYACC is very +useful for parsing any ambiguous grammar, particularly +ones that come from trying to merge two (or more) complete +grammars. + +Limitations of the backtracking: Currently, the generated +parser does NO pruning of alternate parsing paths. To +avoid an exponential explosion of possible paths (and +parsing time), you need to manually tell the parser when +it can throw away saved paths using YYVALID. In practice, +this turns out to be fairly easy to do. A C++ parser (for +example) can just put a [YYVALID;] after every complete +declaration and statement rule, corresponding to pruning +the backtracking state after seeing a ';' or '}' -- there +will never be a situation in which it is useful to +backtrack past either of these. + +Inherited attributes in btyacc: + +Inherited attributes look a lot like function arguments to +non-terminals, which is what they end up being in a +recursive descent parser, but NOT how they are implemented +in btyacc. Basically they are just syntactic sugar for +embedded semantic actions and $0, $-1, ... in normal yacc. +btyacc gives you two big advantages besides just the +syntax: + 1. it does type checking on the inherited attributes, + so you do not have to specify $<type>0 and makes sure + you give the correct number of arguments (inherited + attributes) to every use of a non-terminal. + 2. It "collapses" identical actions from that are produced + from inherited attributes. This eliminates many + potential reduce-reduce conflicts arising from + the inherited attributes. + +You use inherited attributes by declaring the types of the +attributes in the preamble with a type declaration and +declaring names of the attributes on the lhs of the yacc +rule. You can of course have more than one rule with the +same lhs, and you can even give them different names in +each, but the type and number must be the same. + +Here is a small example: + /* lhs takes 2 inherited attributes */ +%type <t1> lhs(<t1>, <t2>) + stuff(<t1>, <t2>) +%% +lhs($i1, $i2) : { $$ = $i1 } + | lhs($i1, $i2) stuff($1,$i2) { $$ = $2; } + +This is roughly equivalent to the following yacc code: +lhs : + { $$ = $<t1>-1; } + | lhs [ $<t1>$ = $-1; ] [ $<t2>$ = $<t2>0; ] stuff + { $$ = $4; } + ; + +See the file "test/t2.y" for a longer and more complete +example. At the current time, the start symbol cannot +have any arguments. + +Variant parsers: + +Btyacc supports the -S flag to use a different parser +skeleton, changing the way that the parser is called and +used. The skeleton "push.skel" is included to produce a +"passive" parser that you feed tokens to (rather than +having the parser call a separate yylex routine). With +push.skel, yyparse is defined as follows: + +int yyparse(int token, YYSTYPE yylval) + +You should call yyparse repeatedly with successive tokens +of input. It returns 0 if more input is needed, 1 for a +successful parse, and -1 for an unrecoverable parse error. + + + Miscellaneous Features in ver. 1.0 + ---------------------------------- + by Chris Dodd + + The -r option has been implemented. The -r option tells +Yacc to put the read-only tables in y.tab.c and the code and +variables in y.code.c. Keith Bostic asked for this option so +that :yyfix could be eliminated. + + The -l and -t options have been implemented. The -l +option tells Yacc not to include #line directives in the code +it produces. The -t option causes debugging code to be +included in the compiled parser. + + The code for error recovery has been changed to +implement the same algorithm as AT&T Yacc. There will still +be differences in the way error recovery works because AT&T +Yacc uses more default reductions than Berkeley Yacc. + + The environment variable TMPDIR determines the directory +where temporary files will be created. If TMPDIR is defined, +temporary files will be created in the directory whose +pathname is the value of TMPDIR. By default, temporary files +are created in /tmp. + + The keywords are now case-insensitive. For example, +%nonassoc, %NONASSOC, %NonAssoc, and %nOnAsSoC are +all equivalent. + + Commas and semicolons that are not part of C code are +treated as commentary. + + Line-end comments, as in BCPL, are permitted. Line-end +comments begin with // and end at the next end-of-line. +Line-end comments are permitted in C code; they are converted +to C comments on output. + + The form of y.output files has been changed to look more +like those produced by AT&T Yacc. + + A new kind of declaration has been added. +The form of the declaration is + + %ident string + +where string is a sequence of characters beginning with a +double quote and ending with either a double quote or the +next end-of-line, whichever comes first. The declaration +will cause a #ident directive to be written near the start +of the output file. + + If a parser has been compiled with debugging code, that +code can be enabled by setting an environment variable. +If the environment variable YYDEBUG is set to 0, debugging +output is suppressed. If it is set to 1, debugging output +is written to standard output. + + + Building BtYacc + --------------- + by Chris Dodd and Vadim Maslov + +We used GCC and GNU make to compile BtYacc both on UNIX and +WIN32 paltforms. You are welcome to try different +combinations of makes and compilers. Most likely it will +work, but it may require Makefile changes. + +There is no config script. +Just type "make" and it should compile. + +AWK. If you want to change file btyaccpa.ske (backtracking +parser skeleton), you will need awk to compile it into +skeleton.c file. We used GNU AWK (gawk) version 3.0. + +It is known that using older versions of gawk +may create problems in compilation, because older awks +have problems with backslashes at the end of a line. + +For MSDOS, there a "makefile.dos" that should do the trick. +Note: makefile.dos was not tested for a long time. + +The result of compilation should be a single executable called +"btyacc" which you can install anywhere you like; +it does not require any other files in the distribution to run. + + + Legal Stuff + ----------- + by Chris Dodd and Vadim Maslov + +In English: BtYacc is freeware. BtYacc is distributed with +no warranty whatsoever. The author and any other contributors +take no responsibility for any and all consequences of its use. + +In Legalese: LIMITATION OF LIABILITY. NEITHER SIBER SYSTEMS +NOR ANY OF ITS LICENSORS NOR ANY BTYACC CONTRIBUTOR SHALL BE +LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL +DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR +DATA USE, CAUSED BY BTYACC AND INCURRED BY CUSTOMER OR ANY +THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT, EVEN +IF SIBER SYSTEMS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. @@ -1 +1 @@ -20140101 +20140409 diff --git a/aclocal.m4 b/aclocal.m4 index 0bb2b6d68e91..5283b2e53cc2 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl $Id: aclocal.m4,v 1.33 2014/01/01 14:08:07 tom Exp $ +dnl $Id: aclocal.m4,v 1.34 2014/04/06 19:16:18 tom Exp $ dnl Macros for byacc configure script (Thomas E. Dickey) dnl --------------------------------------------------------------------------- dnl Copyright 2004-2013,2014 Thomas E. Dickey @@ -600,7 +600,7 @@ make an error test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05 +dnl CF_INTEL_COMPILER version: 6 updated: 2014/03/17 13:13:07 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch @@ -629,7 +629,7 @@ if test "$ifelse([$1],,[$1],GCC)" = yes ; then make an error #endif ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes -cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" +cf_save_CFLAGS="$cf_save_CFLAGS -we147" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) @@ -638,7 +638,7 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MAKE_DOCS version: 2 updated: 2013/01/02 20:04:08 +dnl CF_MAKE_DOCS version: 3 updated: 2014/01/05 13:21:25 dnl ------------ dnl $1 = name(s) to generate rules for dnl $2 = suffix of corresponding manpages used as input. @@ -684,10 +684,10 @@ clean \\ docs-clean :: rm -f $cf_name.html $cf_name.pdf $cf_name.ps $cf_name.txt -$cf_name.html : $cf_name.$2 +$cf_name.html : $cf_name.\$2 $cf_name.pdf : $cf_name.ps -$cf_name.ps : $cf_name.$2 -$cf_name.txt : $cf_name.$2 +$cf_name.ps : $cf_name.\$2 +$cf_name.txt : $cf_name.\$2 CF_EOF done ])dnl @@ -921,6 +921,15 @@ fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59 +dnl ----------- +dnl Check for awk, ensure that the check found something. +AC_DEFUN([CF_PROG_AWK], +[ +AC_PROG_AWK +test -z "$AWK" && AC_MSG_ERROR(No awk program found) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 dnl ---------- dnl standard check for CC, plus followup sanity checks @@ -1076,7 +1085,7 @@ fi fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 45 updated: 2013/09/07 14:06:25 +dnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 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, @@ -1154,6 +1163,7 @@ sco*) #(vi ;; solaris2.*) #(vi cf_xopen_source="-D__EXTENSIONS__" + cf_cv_xopen_source=broken ;; *) CF_TRY_XOPEN_SOURCE diff --git a/btyaccpar.c b/btyaccpar.c new file mode 100644 index 000000000000..f9c6216fbce0 --- /dev/null +++ b/btyaccpar.c @@ -0,0 +1,1246 @@ +/* This file generated automatically using + * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @ + */ + +/* @Id: btyaccpar.skel,v 1.1 2014/04/02 22:44:41 tom Exp @ */ + +#include "defs.h" + +/* If the skeleton is changed, the banner should be changed so that */ +/* the altered version can be easily distinguished from the original. */ +/* */ +/* The #defines included with the banner are there because they are */ +/* useful in subsequent code. The macros #defined in the header or */ +/* the body either are not useful outside of semantic actions or */ +/* are conditional. */ + +const char *const banner[] = +{ + "/* original parser id follows */", + "/* yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\" */", + "/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */", + "", + "#define YYBYACC 1", + CONCAT1("#define YYMAJOR ", YYMAJOR), + CONCAT1("#define YYMINOR ", YYMINOR), +#ifdef YYPATCH + CONCAT1("#define YYPATCH ", YYPATCH), +#endif + "", + "#define YYEMPTY (-1)", + "#define yyclearin (yychar = YYEMPTY)", + "#define yyerrok (yyerrflag = 0)", + "#define YYRECOVERING() (yyerrflag != 0)", + "#define YYENOMEM (-2)", + "#define YYEOF 0", + 0 +}; + +const char *const xdecls[] = +{ + "", + "extern int YYPARSE_DECL();", + 0 +}; + +const char *const tables[] = +{ + "extern const YYINT yylhs[];", + "extern const YYINT yylen[];", + "extern const YYINT yydefred[];", + "extern const YYINT yystos[];", + "extern const YYINT yydgoto[];", + "extern const YYINT yysindex[];", + "extern const YYINT yyrindex[];", +#if defined(YYBTYACC) + "#if YYBTYACC", + "extern const YYINT yycindex[];", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "extern const YYINT yygindex[];", + "extern const YYINT yytable[];", + "extern const YYINT yycheck[];", +#if defined(YYBTYACC) + "#if YYBTYACC", + "extern const YYINT yyctable[];", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "", + "#if YYDEBUG", + "extern const char *const yyname[];", + "extern const char *const yyrule[];", + "#endif", + 0 +}; + +const char *const global_vars[] = +{ + "", + "int yydebug;", + "int yynerrs;", + 0 +}; + +const char *const impure_vars[] = +{ + "", + "int yyerrflag;", + "int yychar;", + "YYSTYPE yyval;", + "YYSTYPE yylval;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + "YYLTYPE yyloc; /* position returned by actions */", + "YYLTYPE yylloc; /* position from the lexer */", + "#endif", + 0 +}; + +const char *const hdr_defs[] = +{ + "", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + "#ifndef YYLLOC_DEFAULT", + "#define YYLLOC_DEFAULT(loc, rhs, n) \\", + "do \\", + "{ \\", + " if (n == 0) \\", + " { \\", + " (loc).first_line = ((rhs)[-1]).last_line; \\", + " (loc).first_column = ((rhs)[-1]).last_column; \\", + " (loc).last_line = ((rhs)[-1]).last_line; \\", + " (loc).last_column = ((rhs)[-1]).last_column; \\", + " } \\", + " else \\", + " { \\", + " (loc).first_line = ((rhs)[ 0 ]).first_line; \\", + " (loc).first_column = ((rhs)[ 0 ]).first_column; \\", + " (loc).last_line = ((rhs)[n-1]).last_line; \\", + " (loc).last_column = ((rhs)[n-1]).last_column; \\", + " } \\", + "} while (0)", + "#endif /* YYLLOC_DEFAULT */", + "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */", +#if defined(YYBTYACC) + "#if YYBTYACC", + "", + "#ifndef YYLVQUEUEGROWTH", + "#define YYLVQUEUEGROWTH 32", + "#endif", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "", + "/* define the initial stack-sizes */", + "#ifdef YYSTACKSIZE", + "#undef YYMAXDEPTH", + "#define YYMAXDEPTH YYSTACKSIZE", + "#else", + "#ifdef YYMAXDEPTH", + "#define YYSTACKSIZE YYMAXDEPTH", + "#else", + "#define YYSTACKSIZE 10000", + "#define YYMAXDEPTH 10000", + "#endif", + "#endif", + "", + "#ifndef YYINITSTACKSIZE", + "#define YYINITSTACKSIZE 200", + "#endif", + "", + "typedef struct {", + " unsigned stacksize;", + " short *s_base;", + " short *s_mark;", + " short *s_last;", + " YYSTYPE *l_base;", + " YYSTYPE *l_mark;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " YYLTYPE *p_base;", + " YYLTYPE *p_mark;", + "#endif", + "} YYSTACKDATA;", +#if defined(YYBTYACC) + "#if YYBTYACC", + "", + "struct YYParseState_s", + "{", + " struct YYParseState_s *save; /* Previously saved parser state */", + " YYSTACKDATA yystack; /* saved parser stack */", + " int state; /* saved parser state */", + " int errflag; /* saved error recovery status */", + " int lexeme; /* saved index of the conflict lexeme in the lexical queue */", + " YYINT ctry; /* saved index in yyctable[] for this conflict */", + "};", + "typedef struct YYParseState_s YYParseState;", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + 0 +}; + +const char *const hdr_vars[] = +{ + "/* variables for the parser stack */", + "static YYSTACKDATA yystack;", +#if defined(YYBTYACC) + "#if YYBTYACC", + "", + "/* Current parser state */", + "static YYParseState *yyps = 0;", + "", + "/* yypath != NULL: do the full parse, starting at *yypath parser state. */", + "static YYParseState *yypath = 0;", + "", + "/* Base of the lexical value queue */", + "static YYSTYPE *yylvals = 0;", + "", + "/* Current position at lexical value queue */", + "static YYSTYPE *yylvp = 0;", + "", + "/* End position of lexical value queue */", + "static YYSTYPE *yylve = 0;", + "", + "/* The last allocated position at the lexical value queue */", + "static YYSTYPE *yylvlim = 0;", + "", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + "/* Base of the lexical position queue */", + "static YYLTYPE *yylpsns = 0;", + "", + "/* Current position at lexical position queue */", + "static YYLTYPE *yylpp = 0;", + "", + "/* End position of lexical position queue */", + "static YYLTYPE *yylpe = 0;", + "", + "/* The last allocated position at the lexical position queue */", + "static YYLTYPE *yylplim = 0;", + "#endif", + "", + "/* Current position at lexical token queue */", + "static short *yylexp = 0;", + "", + "static short *yylexemes = 0;", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + 0 +}; + +const char *const body_vars[] = +{ + " int yyerrflag;", + " int yychar;", + " YYSTYPE yyval;", + " YYSTYPE yylval;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " YYLTYPE yyloc; /* position returned by actions */", + " YYLTYPE yylloc; /* position from the lexer */", + "#endif", + "", + " /* variables for the parser stack */", + " YYSTACKDATA yystack;", +#if defined(YYBTYACC) + "#if YYBTYACC", + "", + " /* Current parser state */", + " static YYParseState *yyps = 0;", + "", + " /* yypath != NULL: do the full parse, starting at *yypath parser state. */", + " static YYParseState *yypath = 0;", + "", + " /* Base of the lexical value queue */", + " static YYSTYPE *yylvals = 0;", + "", + " /* Current position at lexical value queue */", + " static YYSTYPE *yylvp = 0;", + "", + " /* End position of lexical value queue */", + " static YYSTYPE *yylve = 0;", + "", + " /* The last allocated position at the lexical value queue */", + " static YYSTYPE *yylvlim = 0;", + "", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " /* Base of the lexical position queue */", + " static YYLTYPE *yylpsns = 0;", + "", + " /* Current position at lexical position queue */", + " static YYLTYPE *yylpp = 0;", + "", + " /* End position of lexical position queue */", + " static YYLTYPE *yylpe = 0;", + "", + " /* The last allocated position at the lexical position queue */", + " static YYLTYPE *yylplim = 0;", + "#endif", + "", + " /* Current position at lexical token queue */", + " static short *yylexp = 0;", + "", + " static short *yylexemes = 0;", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + 0 +}; + +const char *const body_1[] = +{ + "", + "/* For use in generated program */", + "#define yydepth (int)(yystack.s_mark - yystack.s_base)", +#if defined(YYBTYACC) + "#if YYBTYACC", + "#define yytrial (yyps->save)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "", + "#if YYDEBUG", + "#include <stdio.h> /* needed for printf */", + "#endif", + "", + "#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;", + " YYSTYPE *newvs;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " YYLTYPE *newps;", + "#endif", + "", + " if ((newsize = data->stacksize) == 0)", + " newsize = YYINITSTACKSIZE;", + " else if (newsize >= YYMAXDEPTH)", + " return YYENOMEM;", + " else if ((newsize *= 2) > YYMAXDEPTH)", + " newsize = YYMAXDEPTH;", + "", + " i = (int) (data->s_mark - data->s_base);", + " newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));", + " if (newss == 0)", + " return YYENOMEM;", + "", + " data->s_base = newss;", + " data->s_mark = newss + i;", + "", + " newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));", + " if (newvs == 0)", + " return YYENOMEM;", + "", + " data->l_base = newvs;", + " data->l_mark = newvs + i;", + "", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));", + " if (newps == 0)", + " return YYENOMEM;", + "", + " data->p_base = newps;", + " data->p_mark = newps + i;", + "#endif", + "", + " data->stacksize = newsize;", + " data->s_last = data->s_base + newsize - 1;", + "", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%sdebug: stack size increased to %d\\n\", YYPREFIX, newsize);", + "#endif", + " return 0;", + "}", + "", + "#if YYPURE || defined(YY_NO_LEAKS)", + "static void yyfreestack(YYSTACKDATA *data)", + "{", + " free(data->s_base);", + " free(data->l_base);", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " free(data->p_base);", + "#endif", + " memset(data, 0, sizeof(*data));", + "}", + "#else", + "#define yyfreestack(data) /* nothing */", + "#endif /* YYPURE || defined(YY_NO_LEAKS) */", +#if defined(YYBTYACC) + "#if YYBTYACC", + "", + "static YYParseState *", + "yyNewState(unsigned size)", + "{", + " YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));", + " if (p == NULL) return NULL;", + "", + " p->yystack.stacksize = size;", + " if (size == 0)", + " {", + " p->yystack.s_base = NULL;", + " p->yystack.l_base = NULL;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " p->yystack.p_base = NULL;", + "#endif", + " return p;", + " }", + " p->yystack.s_base = (short *) malloc(size * sizeof(short));", + " 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;", + " memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));", + " if (p->yystack.p_base == NULL) return NULL;", + " memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));", + "#endif", + "", + " return p;", + "}", + "", + "static void", + "yyFreeState(YYParseState *p)", + "{", + " yyfreestack(&p->yystack);", + " free(p);", + "}", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "", + "#define YYABORT goto yyabort", + "#define YYREJECT goto yyabort", + "#define YYACCEPT goto yyaccept", + "#define YYERROR goto yyerrlab", +#if defined(YYBTYACC) + "#if YYBTYACC", + "#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)", + "#define YYVALID_NESTED do { if (yyps->save && \\", + " yyps->save->save == 0) goto yyvalid; } while(0)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "", + "int", + "YYPARSE_DECL()", + "{", + 0 +}; + +const char *const body_2[] = +{ + " int yym, yyn, yystate, yyresult;", +#if defined(YYBTYACC) + "#if YYBTYACC", + " int yynewerrflag;", + " YYParseState *yyerrctx = NULL;", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " YYLTYPE yyerror_loc_range[2]; /* position of error start & end */", + "#endif", + "#if YYDEBUG", + " const char *yys;", + "", + " if ((yys = getenv(\"YYDEBUG\")) != 0)", + " {", + " yyn = *yys;", + " if (yyn >= '0' && yyn <= '9')", + " yydebug = yyn - '0';", + " }", + " if (yydebug)", + " fprintf(stderr, \"%sdebug[<# of symbols on state stack>]\\n\", YYPREFIX);", + "#endif", + "", +#if defined(YYBTYACC) + "#if YYBTYACC", + " yyps = yyNewState(0); if (yyps == 0) goto yyenomem;", + " yyps->save = 0;", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " yynerrs = 0;", + " yyerrflag = 0;", + " yychar = YYEMPTY;", + " yystate = 0;", + "", + "#if YYPURE", + " memset(&yystack, 0, sizeof(yystack));", + "#endif", + "", + " if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", + " yystack.s_mark = yystack.s_base;", + " yystack.l_mark = yystack.l_base;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yystack.p_mark = yystack.p_base;", + "#endif", + " yystate = 0;", + " *yystack.s_mark = 0;", + "", + "yyloop:", + " if ((yyn = yydefred[yystate]) != 0) goto yyreduce;", + " if (yychar < 0)", + " {", +#if defined(YYBTYACC) + "#if YYBTYACC", + " do {", + " if (yylvp < yylve)", + " {", + " /* we're currently re-reading tokens */", + " yylval = *yylvp++;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylloc = *yylpp++;", + "#endif", + " yychar = *yylexp++;", + " break;", + " }", + " if (yyps->save)", + " {", + " /* 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;", + "", + " 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 defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;", + "#endif", + " yylvp = yylve = yylvals + p;", + " yylvlim = yylvals + s;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpp = yylpe = yylpsns + p;", + " yylplim = yylpsns + s;", + "#endif", + " yylexp = yylexemes + p;", + " }", + " *yylexp = (short) YYLEX;", + " *yylvp++ = yylval;", + " yylve++;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " *yylpp++ = yylloc;", + " yylpe++;", + "#endif", + " yychar = *yylexp++;", + " break;", + " }", + " /* normal operation, no conflict encountered */", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " yychar = YYLEX;", +#if defined(YYBTYACC) + "#if YYBTYACC", + " } while (0);", + "#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 token %d (%s)\",", + " YYDEBUGSTR, yydepth, yystate, yychar, yys);", + "#ifdef YYSTYPE_TOSTRING", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (!yytrial)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " fprintf(stderr, \" <%s>\", YYSTYPE_TOSTRING(yychar, yylval));", + "#endif", + " fputc('\\n', stderr);", + " }", + "#endif", + " }", +#if defined(YYBTYACC) + "#if YYBTYACC", + "", + " /* Do we have a conflict? */", + " if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", + " {", + " YYINT ctry;", + "", + " if (yypath)", + " {", + " YYParseState *save;", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%s[%d]: CONFLICT in state %d: following successful trial parse\\n\",", + " YYDEBUGSTR, yydepth, yystate);", + "#endif", + " /* Switch to the next conflict context */", + " save = yypath;", + " yypath = save->save;", + " save->save = NULL;", + " ctry = save->ctry;", + " if (save->state != yystate) YYABORT;", + " yyFreeState(save);", + "", + " }", + " else", + " {", + "", + " /* Unresolved conflict - start/continue trial parse */", + " YYParseState *save;", + "#if YYDEBUG", + " if (yydebug)", + " {", + " fprintf(stderr, \"%s[%d]: CONFLICT in state %d. \", YYDEBUGSTR, yydepth, yystate);", + " if (yyps->save)", + " fputs(\"ALREADY in conflict, continuing trial parse.\\n\", stderr);", + " else", + " fputs(\"Starting trial parse.\\n\", stderr);", + " }", + "#endif", + " save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));", + " if (save == NULL) goto yyenomem;", + " save->save = yyps->save;", + " 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));", + " 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));", + "#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));", + "#endif", + " ctry = yytable[yyn];", + " if (yyctable[ctry] == -1)", + " {", + "#if YYDEBUG", + " if (yydebug && yychar >= YYEOF)", + " fprintf(stderr, \"%s[%d]: backtracking 1 token\\n\", YYDEBUGSTR, yydepth);", + "#endif", + " ctry++;", + " }", + " save->ctry = ctry;", + " if (yyps->save == NULL)", + " {", + " /* If this is a first conflict in the stack, start saving lexemes */", + " if (!yylexemes)", + " {", + " yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));", + " if (yylexemes == NULL) goto yyenomem;", + " yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));", + " if (yylvals == NULL) goto yyenomem;", + " yylvlim = yylvals + YYLVQUEUEGROWTH;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));", + " if (yylpsns == NULL) goto yyenomem;", + " yylplim = yylpsns + YYLVQUEUEGROWTH;", + "#endif", + " }", + " if (yylvp == yylve)", + " {", + " yylvp = yylve = yylvals;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpp = yylpe = yylpsns;", + "#endif", + " yylexp = yylexemes;", + " if (yychar >= YYEOF)", + " {", + " *yylve++ = yylval;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " *yylpe++ = yylloc;", + "#endif", + " *yylexp = (short) yychar;", + " yychar = YYEMPTY;", + " }", + " }", + " }", + " if (yychar >= YYEOF)", + " {", + " yylvp--;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpp--;", + "#endif", + " yylexp--;", + " yychar = YYEMPTY;", + " }", + " save->lexeme = yylvp - yylvals;", + " yyps->save = save;", + " }", + " if (yytable[yyn] == ctry)", + " {", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",", + " YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);", + "#endif", + " if (yychar < 0)", + " {", + " yylvp++;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpp++;", + "#endif", + " yylexp++;", + " }", + " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)", + " goto yyoverflow;", + " yystate = yyctable[ctry];", + " *++yystack.s_mark = (short) yystate;", + " *++yystack.l_mark = yylval;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " *++yystack.p_mark = yylloc;", + "#endif", + " yychar = YYEMPTY;", + " if (yyerrflag > 0) --yyerrflag;", + " goto yyloop;", + " }", + " else", + " {", + " yyn = yyctable[ctry];", + " goto yyreduce;", + " }", + " } /* End of code dealing with conflicts */", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", + " {", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",", + " YYDEBUGSTR, yydepth, yystate, yytable[yyn]);", + "#endif", + " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", + " yystate = yytable[yyn];", + " *++yystack.s_mark = yytable[yyn];", + " *++yystack.l_mark = yylval;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " *++yystack.p_mark = yylloc;", + "#endif", + " yychar = YYEMPTY;", + " if (yyerrflag > 0) --yyerrflag;", + " goto yyloop;", + " }", + " if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", + " {", + " yyn = yytable[yyn];", + " goto yyreduce;", + " }", + " if (yyerrflag != 0) goto yyinrecovery;", +#if defined(YYBTYACC) + "#if YYBTYACC", + "", + " yynewerrflag = 1;", + " goto yyerrhandler;", + " goto yyerrlab;", + "", + "yyerrlab:", + " yynewerrflag = 0;", + "yyerrhandler:", + " while (yyps->save)", + " {", + " int ctry;", + " YYParseState *save = yyps->save;", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\\n\",", + " YYDEBUGSTR, yydepth, yystate, yyps->save->state,", + " (int)(yylvp - yylvals - yyps->save->lexeme));", + "#endif", + " /* Memorize most forward-looking error state in case it's really an error. */", + " if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)", + " {", + " /* Free old saved error context state */", + " if (yyerrctx) yyFreeState(yyerrctx);", + " /* Create and fill out new saved error context state */", + " yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));", + " if (yyerrctx == NULL) goto yyenomem;", + " yyerrctx->save = yyps->save;", + " 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));", + " 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));", + "#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));", + "#endif", + " yyerrctx->lexeme = yylvp - yylvals;", + " }", + " yylvp = yylvals + save->lexeme;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpp = yylpsns + save->lexeme;", + "#endif", + " 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));", + " 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));", + "#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));", + "#endif", + " ctry = ++save->ctry;", + " yystate = save->state;", + " /* We tried shift, try reduce now */", + " if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;", + " yyps->save = save->save;", + " save->save = NULL;", + " yyFreeState(save);", + "", + " /* Nothing left on the stack -- error */", + " if (!yyps->save)", + " {", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\\n\",", + " YYPREFIX, yydepth);", + "#endif", + " /* Restore state as it was in the most forward-advanced error */", + " yylvp = yylvals + yyerrctx->lexeme;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpp = yylpsns + yyerrctx->lexeme;", + "#endif", + " yylexp = yylexemes + yyerrctx->lexeme;", + " yychar = yylexp[-1];", + " yylval = yylvp[-1];", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " 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));", + " 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));", + "#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));", + "#endif", + " yystate = yyerrctx->state;", + " yyFreeState(yyerrctx);", + " yyerrctx = NULL;", + " }", + " yynewerrflag = 1;", + " }", + " if (yynewerrflag == 0) goto yyinrecovery;", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "", + " YYERROR_CALL(\"syntax error\");", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */", + "#endif", + "", + "#if !YYBTYACC", + " goto yyerrlab;", + "yyerrlab:", + "#endif", + " ++yynerrs;", + "", + "yyinrecovery:", + " if (yyerrflag < 3)", + " {", + " yyerrflag = 3;", + " for (;;)", + " {", + " if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)", + " {", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%s[%d]: state %d, error recovery shifting to state %d\\n\",", + " YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);", + "#endif", + " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", + " yystate = yytable[yyn];", + " *++yystack.s_mark = yytable[yyn];", + " *++yystack.l_mark = yylval;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " /* lookahead position is error end position */", + " yyerror_loc_range[1] = yylloc;", + " YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */", + " *++yystack.p_mark = yyloc;", + "#endif", + " goto yyloop;", + " }", + " else", + " {", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%s[%d]: error recovery discarding state %d\\n\",", + " YYDEBUGSTR, yydepth, *yystack.s_mark);", + "#endif", + " if (yystack.s_mark <= yystack.s_base) goto yyabort;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " /* the current TOS position is the error start position */", + " yyerror_loc_range[0] = *yystack.p_mark;", + "#endif", + "#if defined(YYDESTRUCT_CALL)", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (!yytrial)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " YYDESTRUCT_CALL(\"error: discarding state\",", + " yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);", + "#else", + " YYDESTRUCT_CALL(\"error: discarding state\",", + " yystos[*yystack.s_mark], yystack.l_mark);", + "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */", + "#endif /* defined(YYDESTRUCT_CALL) */", + " --yystack.s_mark;", + " --yystack.l_mark;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " --yystack.p_mark;", + "#endif", + " }", + " }", + " }", + " else", + " {", + " if (yychar == YYEOF) goto yyabort;", + "#if YYDEBUG", + " if (yydebug)", + " {", + " yys = yyname[YYTRANSLATE(yychar)];", + " fprintf(stderr, \"%s[%d]: state %d, error recovery discarding token %d (%s)\\n\",", + " YYDEBUGSTR, yydepth, yystate, yychar, yys);", + " }", + "#endif", + "#if defined(YYDESTRUCT_CALL)", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (!yytrial)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval, &yylloc);", + "#else", + " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval);", + "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */", + "#endif /* defined(YYDESTRUCT_CALL) */", + " yychar = YYEMPTY;", + " goto yyloop;", + " }", + "", + "yyreduce:", + " yym = yylen[yyn];", + "#if YYDEBUG", + " if (yydebug)", + " {", + " fprintf(stderr, \"%s[%d]: state %d, reducing by rule %d (%s)\",", + " YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);", + "#ifdef YYSTYPE_TOSTRING", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (!yytrial)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " if (yym > 0)", + " {", + " int i;", + " fputc('<', stderr);", + " for (i = yym; i > 0; i--)", + " {", + " if (i != yym) fputs(\", \", stderr);", + " fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],", + " yystack.l_mark[1-i]), stderr);", + " }", + " fputc('>', stderr);", + " }", + "#endif", + " fputc('\\n', stderr);", + " }", + "#endif", + " if (yym > 0)", + " yyval = yystack.l_mark[1-yym];", + " else", + " memset(&yyval, 0, sizeof yyval);", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + "", + " /* Perform position reduction */", + " memset(&yyloc, 0, sizeof(yyloc));", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (!yytrial)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " {", + " YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);", + " /* just in case YYERROR is invoked within the action, save", + " the start of the rhs as the error start position */", + " yyerror_loc_range[0] = yystack.p_mark[1-yym];", + " }", + "#endif", + "", + " switch (yyn)", + " {", + 0 +}; + +const char *const trailer[] = +{ + " default:", + " break;", + " }", + " yystack.s_mark -= yym;", + " yystate = *yystack.s_mark;", + " yystack.l_mark -= yym;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yystack.p_mark -= yym;", + "#endif", + " yym = yylhs[yyn];", + " if (yystate == 0 && yym == 0)", + " {", + "#if YYDEBUG", + " if (yydebug)", + " {", + " fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);", + "#ifdef YYSTYPE_TOSTRING", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (!yytrial)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));", + "#endif", + " fprintf(stderr, \"shifting from state 0 to final state %d\\n\", YYFINAL);", + " }", + "#endif", + " yystate = YYFINAL;", + " *++yystack.s_mark = YYFINAL;", + " *++yystack.l_mark = yyval;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " *++yystack.p_mark = yyloc;", + "#endif", + " if (yychar < 0)", + " {", +#if defined(YYBTYACC) + "#if YYBTYACC", + " do {", + " if (yylvp < yylve)", + " {", + " /* we're currently re-reading tokens */", + " yylval = *yylvp++;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylloc = *yylpp++;", + "#endif", + " yychar = *yylexp++;", + " break;", + " }", + " if (yyps->save)", + " {", + " /* 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;", + "", + " 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 defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)", + " goto yyenomem;", + "#endif", + " yylvp = yylve = yylvals + p;", + " yylvlim = yylvals + s;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpp = yylpe = yylpsns + p;", + " yylplim = yylpsns + s;", + "#endif", + " yylexp = yylexemes + p;", + " }", + " *yylexp = (short) YYLEX;", + " *yylvp++ = yylval;", + " yylve++;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " *yylpp++ = yylloc;", + " yylpe++;", + "#endif", + " yychar = *yylexp++;", + " break;", + " }", + " /* normal operation, no conflict encountered */", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " yychar = YYLEX;", +#if defined(YYBTYACC) + "#if YYBTYACC", + " } while (0);", + "#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\",", + " YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);", + " }", + "#endif", + " }", + " if (yychar == YYEOF) goto yyaccept;", + " goto yyloop;", + " }", + " if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&", + " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)", + " yystate = yytable[yyn];", + " else", + " yystate = yydgoto[yym];", + "#if YYDEBUG", + " if (yydebug)", + " {", + " fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);", + "#ifdef YYSTYPE_TOSTRING", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (!yytrial)", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[yystate], yyval));", + "#endif", + " fprintf(stderr, \"shifting from state %d to state %d\\n\", *yystack.s_mark, yystate);", + " }", + "#endif", + " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;", + " *++yystack.s_mark = (short) yystate;", + " *++yystack.l_mark = yyval;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " *++yystack.p_mark = yyloc;", + "#endif", + " goto yyloop;", +#if defined(YYBTYACC) + "#if YYBTYACC", + "", + " /* Reduction declares that this path is valid. Set yypath and do a full parse */", + "yyvalid:", + " if (yypath) YYABORT;", + " while (yyps->save)", + " {", + " YYParseState *save = yyps->save;", + " yyps->save = save->save;", + " save->save = yypath;", + " yypath = save;", + " }", + "#if YYDEBUG", + " if (yydebug)", + " fprintf(stderr, \"%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\\n\",", + " YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));", + "#endif", + " if (yyerrctx)", + " {", + " yyFreeState(yyerrctx);", + " yyerrctx = NULL;", + " }", + " yylvp = yylvals + yypath->lexeme;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " yylpp = yylpsns + yypath->lexeme;", + "#endif", + " 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));", + " 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));", + "#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));", + "#endif", + " yystate = yypath->state;", + " goto yyloop;", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + "", + "yyoverflow:", + " YYERROR_CALL(\"yacc stack overflow\");", +#if defined(YYBTYACC) + "#if YYBTYACC", + " goto yyabort_nomem;", + "yyenomem:", + " YYERROR_CALL(\"memory exhausted\");", + "yyabort_nomem:", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " yyresult = 2;", + " goto yyreturn;", + "", + "yyabort:", + " yyresult = 1;", + " goto yyreturn;", + "", + "yyaccept:", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (yyps->save) goto yyvalid;", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " yyresult = 0;", + "", + "yyreturn:", + "#if defined(YYDESTRUCT_CALL)", + " if (yychar != YYEOF && yychar != YYEMPTY)", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " YYDESTRUCT_CALL(\"cleanup: discarding token\", yychar, &yylval, &yylloc);", + "#else", + " YYDESTRUCT_CALL(\"cleanup: discarding token\", yychar, &yylval);", + "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */", + "", + " {", + " YYSTYPE *pv;", + "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", + " YYLTYPE *pp;", + "", + " for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)", + " YYDESTRUCT_CALL(\"cleanup: discarding state\",", + " yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);", + "#else", + " for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)", + " YYDESTRUCT_CALL(\"cleanup: discarding state\",", + " yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);", + "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */", + " }", + "#endif /* defined(YYDESTRUCT_CALL) */", + "", +#if defined(YYBTYACC) + "#if YYBTYACC", + " if (yyerrctx)", + " {", + " yyFreeState(yyerrctx);", + " yyerrctx = NULL;", + " }", + " while (yyps)", + " {", + " YYParseState *save = yyps;", + " yyps = save->save;", + " save->save = NULL;", + " yyFreeState(save);", + " }", + " while (yypath)", + " {", + " YYParseState *save = yypath;", + " yypath = save->save;", + " save->save = NULL;", + " yyFreeState(save);", + " }", + "#endif /* YYBTYACC */", +#endif /* defined(YYBTYACC) */ + " yyfreestack(&yystack);", + " return (yyresult);", + "}", + 0 +}; + +void +write_section(FILE * fp, const char *const section[]) +{ + int i; + const char *s; + + for (i = 0; (s = section[i]) != 0; ++i) + { + if (fp == code_file) + ++outline; + fprintf(fp, "%s\n", s); + } +} diff --git a/btyaccpar.skel b/btyaccpar.skel new file mode 100644 index 000000000000..265be42c0aec --- /dev/null +++ b/btyaccpar.skel @@ -0,0 +1,1125 @@ +/* $Id: btyaccpar.skel,v 1.1 2014/04/02 22:44:41 tom Exp $ */ + +#include "defs.h" + +/* If the skeleton is changed, the banner should be changed so that */ +/* the altered version can be easily distinguished from the original. */ +/* */ +/* The #defines included with the banner are there because they are */ +/* useful in subsequent code. The macros #defined in the header or */ +/* the body either are not useful outside of semantic actions or */ +/* are conditional. */ + +%% banner +/* original parser id follows */ +/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ + +#define YYBYACC 1 +%% insert VERSION here + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) +#define YYENOMEM (-2) +#define YYEOF 0 +%% xdecls + +extern int YYPARSE_DECL(); +%% tables +extern const YYINT yylhs[]; +extern const YYINT yylen[]; +extern const YYINT yydefred[]; +extern const YYINT yystos[]; +extern const YYINT yydgoto[]; +extern const YYINT yysindex[]; +extern const YYINT yyrindex[]; +%%ifdef YYBTYACC +extern const YYINT yycindex[]; +%%endif +extern const YYINT yygindex[]; +extern const YYINT yytable[]; +extern const YYINT yycheck[]; +%%ifdef YYBTYACC +extern const YYINT yyctable[]; +%%endif + +#if YYDEBUG +extern const char *const yyname[]; +extern const char *const yyrule[]; +#endif +%% global_vars + +int yydebug; +int yynerrs; +%% impure_vars + +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +YYLTYPE yyloc; /* position returned by actions */ +YYLTYPE yylloc; /* position from the lexer */ +#endif +%% hdr_defs + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +#ifndef YYLLOC_DEFAULT +#define YYLLOC_DEFAULT(loc, rhs, n) \ +do \ +{ \ + if (n == 0) \ + { \ + (loc).first_line = ((rhs)[-1]).last_line; \ + (loc).first_column = ((rhs)[-1]).last_column; \ + (loc).last_line = ((rhs)[-1]).last_line; \ + (loc).last_column = ((rhs)[-1]).last_column; \ + } \ + else \ + { \ + (loc).first_line = ((rhs)[ 0 ]).first_line; \ + (loc).first_column = ((rhs)[ 0 ]).first_column; \ + (loc).last_line = ((rhs)[n-1]).last_line; \ + (loc).last_column = ((rhs)[n-1]).last_column; \ + } \ +} while (0) +#endif /* YYLLOC_DEFAULT */ +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +%%ifdef YYBTYACC + +#ifndef YYLVQUEUEGROWTH +#define YYLVQUEUEGROWTH 32 +#endif +%%endif + +/* define the initial stack-sizes */ +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 +#endif +#endif + +#ifndef YYINITSTACKSIZE +#define YYINITSTACKSIZE 200 +#endif + +typedef struct { + unsigned stacksize; + short *s_base; + short *s_mark; + short *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *p_base; + YYLTYPE *p_mark; +#endif +} YYSTACKDATA; +%%ifdef YYBTYACC + +struct YYParseState_s +{ + struct YYParseState_s *save; /* Previously saved parser state */ + YYSTACKDATA yystack; /* saved parser stack */ + int state; /* saved parser state */ + int errflag; /* saved error recovery status */ + int lexeme; /* saved index of the conflict lexeme in the lexical queue */ + YYINT ctry; /* saved index in yyctable[] for this conflict */ +}; +typedef struct YYParseState_s YYParseState; +%%endif YYBTYACC +%% hdr_vars +/* variables for the parser stack */ +static YYSTACKDATA yystack; +%%ifdef YYBTYACC + +/* Current parser state */ +static YYParseState *yyps = 0; + +/* yypath != NULL: do the full parse, starting at *yypath parser state. */ +static YYParseState *yypath = 0; + +/* Base of the lexical value queue */ +static YYSTYPE *yylvals = 0; + +/* Current position at lexical value queue */ +static YYSTYPE *yylvp = 0; + +/* End position of lexical value queue */ +static YYSTYPE *yylve = 0; + +/* The last allocated position at the lexical value queue */ +static YYSTYPE *yylvlim = 0; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +/* Base of the lexical position queue */ +static YYLTYPE *yylpsns = 0; + +/* Current position at lexical position queue */ +static YYLTYPE *yylpp = 0; + +/* End position of lexical position queue */ +static YYLTYPE *yylpe = 0; + +/* The last allocated position at the lexical position queue */ +static YYLTYPE *yylplim = 0; +#endif + +/* Current position at lexical token queue */ +static short *yylexp = 0; + +static short *yylexemes = 0; +%%endif YYBTYACC +%% body_vars + int yyerrflag; + int yychar; + YYSTYPE yyval; + YYSTYPE yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE yyloc; /* position returned by actions */ + YYLTYPE yylloc; /* position from the lexer */ +#endif + + /* variables for the parser stack */ + YYSTACKDATA yystack; +%%ifdef YYBTYACC + + /* Current parser state */ + static YYParseState *yyps = 0; + + /* yypath != NULL: do the full parse, starting at *yypath parser state. */ + static YYParseState *yypath = 0; + + /* Base of the lexical value queue */ + static YYSTYPE *yylvals = 0; + + /* Current position at lexical value queue */ + static YYSTYPE *yylvp = 0; + + /* End position of lexical value queue */ + static YYSTYPE *yylve = 0; + + /* The last allocated position at the lexical value queue */ + static YYSTYPE *yylvlim = 0; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* Base of the lexical position queue */ + static YYLTYPE *yylpsns = 0; + + /* Current position at lexical position queue */ + static YYLTYPE *yylpp = 0; + + /* End position of lexical position queue */ + static YYLTYPE *yylpe = 0; + + /* The last allocated position at the lexical position queue */ + static YYLTYPE *yylplim = 0; +#endif + + /* Current position at lexical token queue */ + static short *yylexp = 0; + + static short *yylexemes = 0; +%%endif YYBTYACC +%% body_1 + +/* For use in generated program */ +#define yydepth (int)(yystack.s_mark - yystack.s_base) +%%ifdef YYBTYACC +#define yytrial (yyps->save) +%%endif + +#if YYDEBUG +#include <stdio.h> /* needed for printf */ +#endif + +#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; + YYSTYPE *newvs; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *newps; +#endif + + if ((newsize = data->stacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return YYENOMEM; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + + i = (int) (data->s_mark - data->s_base); + newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); + if (newss == 0) + return YYENOMEM; + + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); + if (newvs == 0) + return YYENOMEM; + + data->l_base = newvs; + data->l_mark = newvs + i; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); + if (newps == 0) + return YYENOMEM; + + data->p_base = newps; + data->p_mark = newps + i; +#endif + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; + +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); +#endif + return 0; +} + +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + free(data->p_base); +#endif + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif /* YYPURE || defined(YY_NO_LEAKS) */ +%%ifdef YYBTYACC + +static YYParseState * +yyNewState(unsigned size) +{ + YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); + if (p == NULL) return NULL; + + p->yystack.stacksize = size; + if (size == 0) + { + p->yystack.s_base = NULL; + p->yystack.l_base = NULL; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = NULL; +#endif + return p; + } + p->yystack.s_base = (short *) malloc(size * sizeof(short)); + 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; + memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); + if (p->yystack.p_base == NULL) return NULL; + memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); +#endif + + return p; +} + +static void +yyFreeState(YYParseState *p) +{ + yyfreestack(&p->yystack); + free(p); +} +%%endif YYBTYACC + +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab +%%ifdef YYBTYACC +#define YYVALID do { if (yyps->save) goto yyvalid; } while(0) +#define YYVALID_NESTED do { if (yyps->save && \ + yyps->save->save == 0) goto yyvalid; } while(0) +%%endif + +int +YYPARSE_DECL() +{ +%% body_2 + int yym, yyn, yystate, yyresult; +%%ifdef YYBTYACC + int yynewerrflag; + YYParseState *yyerrctx = NULL; +%%endif +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE yyerror_loc_range[2]; /* position of error start & end */ +#endif +#if YYDEBUG + const char *yys; + + if ((yys = getenv("YYDEBUG")) != 0) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } + if (yydebug) + fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); +#endif + +%%ifdef YYBTYACC + yyps = yyNewState(0); if (yyps == 0) goto yyenomem; + yyps->save = 0; +%%endif + yynerrs = 0; + yyerrflag = 0; + yychar = YYEMPTY; + yystate = 0; + +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base; +#endif + yystate = 0; + *yystack.s_mark = 0; + +yyloop: + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; + if (yychar < 0) + { +%%ifdef YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* 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; + + 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 defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (short) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +%%endif YYBTYACC + yychar = YYLEX; +%%ifdef YYBTYACC + } 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 token %d (%s)", + YYDEBUGSTR, yydepth, yystate, yychar, yys); +#ifdef YYSTYPE_TOSTRING +%%ifdef YYBTYACC + if (!yytrial) +%%endif + fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); +#endif + fputc('\n', stderr); + } +#endif + } +%%ifdef YYBTYACC + + /* Do we have a conflict? */ + if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + YYINT ctry; + + if (yypath) + { + YYParseState *save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", + YYDEBUGSTR, yydepth, yystate); +#endif + /* Switch to the next conflict context */ + save = yypath; + yypath = save->save; + save->save = NULL; + ctry = save->ctry; + if (save->state != yystate) YYABORT; + yyFreeState(save); + + } + else + { + + /* Unresolved conflict - start/continue trial parse */ + YYParseState *save; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); + if (yyps->save) + fputs("ALREADY in conflict, continuing trial parse.\n", stderr); + else + fputs("Starting trial parse.\n", stderr); + } +#endif + save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (save == NULL) goto yyenomem; + save->save = yyps->save; + 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)); + 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)); +#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)); +#endif + ctry = yytable[yyn]; + if (yyctable[ctry] == -1) + { +#if YYDEBUG + if (yydebug && yychar >= YYEOF) + fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); +#endif + ctry++; + } + save->ctry = ctry; + if (yyps->save == NULL) + { + /* If this is a first conflict in the stack, start saving lexemes */ + if (!yylexemes) + { + yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short)); + if (yylexemes == NULL) goto yyenomem; + yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); + if (yylvals == NULL) goto yyenomem; + yylvlim = yylvals + YYLVQUEUEGROWTH; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); + if (yylpsns == NULL) goto yyenomem; + yylplim = yylpsns + YYLVQUEUEGROWTH; +#endif + } + if (yylvp == yylve) + { + yylvp = yylve = yylvals; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns; +#endif + yylexp = yylexemes; + if (yychar >= YYEOF) + { + *yylve++ = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpe++ = yylloc; +#endif + *yylexp = (short) yychar; + yychar = YYEMPTY; + } + } + } + if (yychar >= YYEOF) + { + yylvp--; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp--; +#endif + yylexp--; + yychar = YYEMPTY; + } + save->lexeme = yylvp - yylvals; + yyps->save = save; + } + if (yytable[yyn] == ctry) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); +#endif + if (yychar < 0) + { + yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp++; +#endif + yylexp++; + } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) + goto yyoverflow; + yystate = yyctable[ctry]; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + else + { + yyn = yyctable[ctry]; + goto yyreduce; + } + } /* End of code dealing with conflicts */ +%%endif YYBTYACC + if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag != 0) goto yyinrecovery; +%%ifdef YYBTYACC + + yynewerrflag = 1; + goto yyerrhandler; + goto yyerrlab; + +yyerrlab: + yynewerrflag = 0; +yyerrhandler: + while (yyps->save) + { + int ctry; + YYParseState *save = yyps->save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yyps->save->state, + (int)(yylvp - yylvals - yyps->save->lexeme)); +#endif + /* Memorize most forward-looking error state in case it's really an error. */ + if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) + { + /* Free old saved error context state */ + if (yyerrctx) yyFreeState(yyerrctx); + /* Create and fill out new saved error context state */ + yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (yyerrctx == NULL) goto yyenomem; + yyerrctx->save = yyps->save; + 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)); + 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)); +#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)); +#endif + yyerrctx->lexeme = yylvp - yylvals; + } + yylvp = yylvals + save->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + save->lexeme; +#endif + 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)); + 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)); +#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)); +#endif + ctry = ++save->ctry; + yystate = save->state; + /* We tried shift, try reduce now */ + if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; + yyps->save = save->save; + save->save = NULL; + yyFreeState(save); + + /* Nothing left on the stack -- error */ + if (!yyps->save) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", + YYPREFIX, yydepth); +#endif + /* Restore state as it was in the most forward-advanced error */ + yylvp = yylvals + yyerrctx->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yyerrctx->lexeme; +#endif + yylexp = yylexemes + yyerrctx->lexeme; + yychar = yylexp[-1]; + yylval = yylvp[-1]; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + 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)); + 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)); +#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)); +#endif + yystate = yyerrctx->state; + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yynewerrflag = 1; + } + if (yynewerrflag == 0) goto yyinrecovery; +%%endif YYBTYACC + + YYERROR_CALL("syntax error"); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ +#endif + +#if !YYBTYACC + goto yyerrlab; +yyerrlab: +#endif + ++yynerrs; + +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* lookahead position is error end position */ + yyerror_loc_range[1] = yylloc; + YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ + *++yystack.p_mark = yyloc; +#endif + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark); +#endif + if (yystack.s_mark <= yystack.s_base) goto yyabort; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* the current TOS position is the error start position */ + yyerror_loc_range[0] = *yystack.p_mark; +#endif +#if defined(YYDESTRUCT_CALL) +%%ifdef YYBTYACC + if (!yytrial) +%%endif +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); +#else + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + --yystack.s_mark; + --yystack.l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + --yystack.p_mark; +#endif + } + } + } + else + { + if (yychar == YYEOF) goto yyabort; +#if YYDEBUG + if (yydebug) + { + yys = yyname[YYTRANSLATE(yychar)]; + fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", + YYDEBUGSTR, yydepth, yystate, yychar, yys); + } +#endif +#if defined(YYDESTRUCT_CALL) +%%ifdef YYBTYACC + if (!yytrial) +%%endif +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + yychar = YYEMPTY; + goto yyloop; + } + +yyreduce: + yym = yylen[yyn]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", + YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); +#ifdef YYSTYPE_TOSTRING +%%ifdef YYBTYACC + if (!yytrial) +%%endif + if (yym > 0) + { + int i; + fputc('<', stderr); + for (i = yym; i > 0; i--) + { + if (i != yym) fputs(", ", stderr); + fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], + yystack.l_mark[1-i]), stderr); + } + fputc('>', stderr); + } +#endif + fputc('\n', stderr); + } +#endif + if (yym > 0) + yyval = yystack.l_mark[1-yym]; + else + memset(&yyval, 0, sizeof yyval); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + + /* Perform position reduction */ + memset(&yyloc, 0, sizeof(yyloc)); +%%ifdef YYBTYACC + if (!yytrial) +%%endif + { + YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); + /* just in case YYERROR is invoked within the action, save + the start of the rhs as the error start position */ + yyerror_loc_range[0] = yystack.p_mark[1-yym]; + } +#endif + + switch (yyn) + { +%% trailer + default: + break; + } + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark -= yym; +#endif + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +%%ifdef YYBTYACC + if (!yytrial) +%%endif + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); +#endif + fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); + } +#endif + yystate = YYFINAL; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + if (yychar < 0) + { +%%ifdef YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* 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; + + 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 defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (short) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +%%endif YYBTYACC + yychar = YYLEX; +%%ifdef YYBTYACC + } 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", + YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == YYEOF) goto yyaccept; + goto yyloop; + } + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +%%ifdef YYBTYACC + if (!yytrial) +%%endif + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); +#endif + fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); + } +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + goto yyloop; +%%ifdef YYBTYACC + + /* Reduction declares that this path is valid. Set yypath and do a full parse */ +yyvalid: + if (yypath) YYABORT; + while (yyps->save) + { + YYParseState *save = yyps->save; + yyps->save = save->save; + save->save = yypath; + yypath = save; + } +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); +#endif + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yylvp = yylvals + yypath->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yypath->lexeme; +#endif + 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)); + 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)); +#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)); +#endif + yystate = yypath->state; + goto yyloop; +%%endif YYBTYACC + +yyoverflow: + YYERROR_CALL("yacc stack overflow"); +%%ifdef YYBTYACC + goto yyabort_nomem; +yyenomem: + YYERROR_CALL("memory exhausted"); +yyabort_nomem: +%%endif + yyresult = 2; + goto yyreturn; + +yyabort: + yyresult = 1; + goto yyreturn; + +yyaccept: +%%ifdef YYBTYACC + if (yyps->save) goto yyvalid; +%%endif + yyresult = 0; + +yyreturn: +#if defined(YYDESTRUCT_CALL) + if (yychar != YYEOF && yychar != YYEMPTY) +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + + { + YYSTYPE *pv; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *pp; + + for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); +#else + for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + } +#endif /* defined(YYDESTRUCT_CALL) */ + +%%ifdef YYBTYACC + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + while (yyps) + { + YYParseState *save = yyps; + yyps = save->save; + save->save = NULL; + yyFreeState(save); + } + while (yypath) + { + YYParseState *save = yypath; + yypath = save->save; + save->save = NULL; + yyFreeState(save); + } +%%endif YYBTYACC + yyfreestack(&yystack); + return (yyresult); +} diff --git a/closure.c b/closure.c index 7573ff5bbd3f..76003c0aa69e 100644 --- a/closure.c +++ b/closure.c @@ -1,4 +1,4 @@ -/* $Id: closure.c,v 1.9 2010/06/09 08:21:47 tom Exp $ */ +/* $Id: closure.c,v 1.10 2014/02/19 00:45:42 Tom.Shields Exp $ */ #include "defs.h" @@ -9,12 +9,18 @@ unsigned *ruleset; static unsigned *first_derives; static unsigned *EFF; +#ifdef DEBUG +static void print_closure(int); +static void print_EFF(void); +static void print_first_derives(void); +#endif + static void set_EFF(void) { unsigned *row; int symbol; - short *sp; + Value_t *sp; int rowsize; int i; int rule; @@ -53,7 +59,7 @@ set_first_derives(void) int j; unsigned k; unsigned cword = 0; - short *rp; + Value_t *rp; int rule; int i; @@ -100,7 +106,7 @@ set_first_derives(void) } void -closure(short *nucleus, int n) +closure(Value_t *nucleus, int n) { unsigned ruleno; unsigned word; @@ -175,17 +181,17 @@ finalize_closure(void) #ifdef DEBUG -void +static void print_closure(int n) { - short *isp; + Value_t *isp; printf("\n\nn = %d\n\n", n); for (isp = itemset; isp < itemsetend; isp++) printf(" %d\n", *isp); } -void +static void print_EFF(void) { int i, j; @@ -216,7 +222,7 @@ print_EFF(void) } } -void +static void print_first_derives(void) { int i; diff --git a/config_h.in b/config_h.in index afd46fd96334..6d47167602a3 100644 --- a/config_h.in +++ b/config_h.in @@ -30,6 +30,9 @@ /* Define to 1 if mkstemp() is available and working. */ #undef HAVE_MKSTEMP +/* Define to maximum table size (default: 32500) */ +#undef MAXTABLE + /* Define to 1 if filesystem supports mixed-case filenames. */ #undef MIXEDCASE_FILENAMES @@ -48,5 +51,8 @@ /* "Define to 1 if you want to use valgrind for testing." */ #undef USE_VALGRIND +/* Define to 1 to enable backtracking extension */ +#undef YYBTYACC + /* Define to 1 if you want to perform memory-leak testing. */ #undef YY_NO_LEAKS diff --git a/configure b/configure index 80e89b4eb77e..361ee7e222f0 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.15 . +# From configure.in Revision: 1.18 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20121002. # @@ -652,6 +652,9 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-max-table-size=N set the maximum table size = N (no default) + --enable-btyacc turn on support for the btyacc backtracking + extension (default: no) --with-warnings test: turn on gcc warnings --disable-echo do not display "compiling" commands --with-dmalloc test: use Gray Watson's dmalloc library @@ -851,7 +854,7 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - { echo "$as_me:854: loading site script $ac_site_file" >&5 + { echo "$as_me:857: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" @@ -862,7 +865,7 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:865: loading cache $cache_file" >&5 + { echo "$as_me:868: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; @@ -870,7 +873,7 @@ echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { echo "$as_me:873: creating cache $cache_file" >&5 + { echo "$as_me:876: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -886,21 +889,21 @@ for ac_var in `(set) 2>&1 | eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:889: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { echo "$as_me:892: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:893: error: \`$ac_var' was not set in the previous run" >&5 + { echo "$as_me:896: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:899: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:902: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:901: former value: $ac_old_val" >&5 + { echo "$as_me:904: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:903: current value: $ac_new_val" >&5 + { echo "$as_me:906: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; @@ -919,9 +922,9 @@ echo "$as_me: current value: $ac_new_val" >&2;} fi done if $ac_cache_corrupted; then - { echo "$as_me:922: error: changes in the environment can compromise the build" >&5 + { echo "$as_me:925: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:924: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 + { { echo "$as_me:927: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -942,10 +945,10 @@ esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh -if { (echo "$as_me:945: PATH=\".;.\"; conftest.sh") >&5 +if { (echo "$as_me:948: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? - echo "$as_me:948: \$? = $ac_status" >&5 + echo "$as_me:951: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else @@ -973,7 +976,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:976: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 + { { echo "$as_me:979: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi @@ -983,11 +986,11 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:986: error: cannot run $ac_config_sub" >&5 + { { echo "$as_me:989: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } -echo "$as_me:990: checking build system type" >&5 +echo "$as_me:993: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -996,23 +999,23 @@ else test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && - { { echo "$as_me:999: error: cannot guess build type; you must specify one" >&5 + { { echo "$as_me:1002: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:1003: error: $ac_config_sub $ac_cv_build_alias failed." >&5 + { { echo "$as_me:1006: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1008: result: $ac_cv_build" >&5 +echo "$as_me:1011: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$as_me:1015: checking host system type" >&5 +echo "$as_me:1018: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1021,12 +1024,12 @@ else test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:1024: error: $ac_config_sub $ac_cv_host_alias failed" >&5 + { { echo "$as_me:1027: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1029: result: $ac_cv_host" >&5 +echo "$as_me:1032: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` @@ -1034,7 +1037,7 @@ host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then - echo "$as_me:1037: checking target system type" >&5 + echo "$as_me:1040: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1043,12 +1046,12 @@ else test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || - { { echo "$as_me:1046: error: $ac_config_sub $ac_cv_target_alias failed" >&5 + { { echo "$as_me:1049: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1051: result: $ac_cv_target" >&5 +echo "$as_me:1054: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` @@ -1080,13 +1083,13 @@ else fi test -z "$system_name" && system_name="$cf_cv_system_name" -test -n "$cf_cv_system_name" && echo "$as_me:1083: result: Configuring for $cf_cv_system_name" >&5 +test -n "$cf_cv_system_name" && echo "$as_me:1086: result: Configuring for $cf_cv_system_name" >&5 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 if test ".$system_name" != ".$cf_cv_system_name" ; then - echo "$as_me:1087: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 + echo "$as_me:1090: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 - { { echo "$as_me:1089: error: \"Please remove config.cache and try again.\"" >&5 + { { echo "$as_me:1092: error: \"Please remove config.cache and try again.\"" >&5 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} { (exit 1); exit 1; }; } fi @@ -1113,7 +1116,7 @@ ac_main_return=return if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:1116: checking for $ac_word" >&5 +echo "$as_me:1119: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1128,7 +1131,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_CC="${ac_tool_prefix}gcc" -echo "$as_me:1131: found $ac_dir/$ac_word" >&5 +echo "$as_me:1134: found $ac_dir/$ac_word" >&5 break done @@ -1136,10 +1139,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1139: result: $CC" >&5 + echo "$as_me:1142: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1142: result: no" >&5 + echo "$as_me:1145: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1148,7 +1151,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:1151: checking for $ac_word" >&5 +echo "$as_me:1154: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1163,7 +1166,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_ac_ct_CC="gcc" -echo "$as_me:1166: found $ac_dir/$ac_word" >&5 +echo "$as_me:1169: found $ac_dir/$ac_word" >&5 break done @@ -1171,10 +1174,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1174: result: $ac_ct_CC" >&5 + echo "$as_me:1177: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1177: result: no" >&5 + echo "$as_me:1180: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1187,7 +1190,7 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:1190: checking for $ac_word" >&5 +echo "$as_me:1193: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1202,7 +1205,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_CC="${ac_tool_prefix}cc" -echo "$as_me:1205: found $ac_dir/$ac_word" >&5 +echo "$as_me:1208: found $ac_dir/$ac_word" >&5 break done @@ -1210,10 +1213,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1213: result: $CC" >&5 + echo "$as_me:1216: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1216: result: no" >&5 + echo "$as_me:1219: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1222,7 +1225,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1225: checking for $ac_word" >&5 +echo "$as_me:1228: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1237,7 +1240,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_ac_ct_CC="cc" -echo "$as_me:1240: found $ac_dir/$ac_word" >&5 +echo "$as_me:1243: found $ac_dir/$ac_word" >&5 break done @@ -1245,10 +1248,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1248: result: $ac_ct_CC" >&5 + echo "$as_me:1251: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1251: result: no" >&5 + echo "$as_me:1254: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1261,7 +1264,7 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1264: checking for $ac_word" >&5 +echo "$as_me:1267: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1281,7 +1284,7 @@ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then continue fi ac_cv_prog_CC="cc" -echo "$as_me:1284: found $ac_dir/$ac_word" >&5 +echo "$as_me:1287: found $ac_dir/$ac_word" >&5 break done @@ -1303,10 +1306,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1306: result: $CC" >&5 + echo "$as_me:1309: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1309: result: no" >&5 + echo "$as_me:1312: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1317,7 +1320,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:1320: checking for $ac_word" >&5 +echo "$as_me:1323: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1332,7 +1335,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_CC="$ac_tool_prefix$ac_prog" -echo "$as_me:1335: found $ac_dir/$ac_word" >&5 +echo "$as_me:1338: found $ac_dir/$ac_word" >&5 break done @@ -1340,10 +1343,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1343: result: $CC" >&5 + echo "$as_me:1346: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1346: result: no" >&5 + echo "$as_me:1349: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1356,7 +1359,7 @@ if test -z "$CC"; then 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:1359: checking for $ac_word" >&5 +echo "$as_me:1362: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1371,7 +1374,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_ac_ct_CC="$ac_prog" -echo "$as_me:1374: found $ac_dir/$ac_word" >&5 +echo "$as_me:1377: found $ac_dir/$ac_word" >&5 break done @@ -1379,10 +1382,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1382: result: $ac_ct_CC" >&5 + echo "$as_me:1385: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1385: result: no" >&5 + echo "$as_me:1388: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1394,32 +1397,32 @@ fi fi -test -z "$CC" && { { echo "$as_me:1397: error: no acceptable cc found in \$PATH" >&5 +test -z "$CC" && { { echo "$as_me:1400: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:1402:" \ +echo "$as_me:1405:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:1405: \"$ac_compiler --version </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1408: \"$ac_compiler --version </dev/null >&5\"") >&5 (eval $ac_compiler --version </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1408: \$? = $ac_status" >&5 + echo "$as_me:1411: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1410: \"$ac_compiler -v </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1413: \"$ac_compiler -v </dev/null >&5\"") >&5 (eval $ac_compiler -v </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1413: \$? = $ac_status" >&5 + echo "$as_me:1416: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1415: \"$ac_compiler -V </dev/null >&5\"") >&5 +{ (eval echo "$as_me:1418: \"$ac_compiler -V </dev/null >&5\"") >&5 (eval $ac_compiler -V </dev/null >&5) 2>&5 ac_status=$? - echo "$as_me:1418: \$? = $ac_status" >&5 + echo "$as_me:1421: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line 1422 "configure" +#line 1425 "configure" #include "confdefs.h" int @@ -1435,13 +1438,13 @@ ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:1438: checking for C compiler default output" >&5 +echo "$as_me:1441: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:1441: \"$ac_link_default\"") >&5 +if { (eval echo "$as_me:1444: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? - echo "$as_me:1444: \$? = $ac_status" >&5 + echo "$as_me:1447: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last @@ -1464,34 +1467,34 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1467: error: C compiler cannot create executables" >&5 +{ { echo "$as_me:1470: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext -echo "$as_me:1473: result: $ac_file" >&5 +echo "$as_me:1476: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1478: checking whether the C compiler works" >&5 +echo "$as_me:1481: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (eval echo "$as_me:1484: \"$ac_try\"") >&5 + { (eval echo "$as_me:1487: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1487: \$? = $ac_status" >&5 + echo "$as_me:1490: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:1494: error: cannot run C compiled programs. + { { echo "$as_me:1497: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} @@ -1499,24 +1502,24 @@ If you meant to cross compile, use \`--host'." >&2;} fi fi fi -echo "$as_me:1502: result: yes" >&5 +echo "$as_me:1505: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1509: checking whether we are cross compiling" >&5 +echo "$as_me:1512: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:1511: result: $cross_compiling" >&5 +echo "$as_me:1514: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 -echo "$as_me:1514: checking for executable suffix" >&5 +echo "$as_me:1517: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 -if { (eval echo "$as_me:1516: \"$ac_link\"") >&5 +if { (eval echo "$as_me:1519: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:1519: \$? = $ac_status" >&5 + echo "$as_me:1522: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -1532,25 +1535,25 @@ for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do esac done else - { { echo "$as_me:1535: error: cannot compute EXEEXT: cannot compile and link" >&5 + { { echo "$as_me:1538: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -echo "$as_me:1541: result: $ac_cv_exeext" >&5 +echo "$as_me:1544: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:1547: checking for object suffix" >&5 +echo "$as_me:1550: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1553 "configure" +#line 1556 "configure" #include "confdefs.h" int @@ -1562,10 +1565,10 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:1565: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1568: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1568: \$? = $ac_status" >&5 + echo "$as_me:1571: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in @@ -1577,24 +1580,24 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1580: error: cannot compute OBJEXT: cannot compile" >&5 +{ { echo "$as_me:1583: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:1587: result: $ac_cv_objext" >&5 +echo "$as_me:1590: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:1591: checking whether we are using the GNU C compiler" >&5 +echo "$as_me:1594: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1597 "configure" +#line 1600 "configure" #include "confdefs.h" int @@ -1609,16 +1612,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1612: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1615: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1615: \$? = $ac_status" >&5 + echo "$as_me:1618: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1618: \"$ac_try\"") >&5 + { (eval echo "$as_me:1621: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1621: \$? = $ac_status" >&5 + echo "$as_me:1624: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else @@ -1630,19 +1633,19 @@ rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:1633: result: $ac_cv_c_compiler_gnu" >&5 +echo "$as_me:1636: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" -echo "$as_me:1639: checking whether $CC accepts -g" >&5 +echo "$as_me:1642: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1645 "configure" +#line 1648 "configure" #include "confdefs.h" int @@ -1654,16 +1657,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1657: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1660: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1660: \$? = $ac_status" >&5 + echo "$as_me:1663: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1663: \"$ac_try\"") >&5 + { (eval echo "$as_me:1666: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1666: \$? = $ac_status" >&5 + echo "$as_me:1669: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else @@ -1673,7 +1676,7 @@ ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:1676: result: $ac_cv_prog_cc_g" >&5 +echo "$as_me:1679: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -1700,16 +1703,16 @@ cat >conftest.$ac_ext <<_ACEOF #endif _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1703: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1706: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1706: \$? = $ac_status" >&5 + echo "$as_me:1709: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1709: \"$ac_try\"") >&5 + { (eval echo "$as_me:1712: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1712: \$? = $ac_status" >&5 + echo "$as_me:1715: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ @@ -1721,7 +1724,7 @@ if { (eval echo "$as_me:1703: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line 1724 "configure" +#line 1727 "configure" #include "confdefs.h" #include <stdlib.h> $ac_declaration @@ -1734,16 +1737,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1737: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1740: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1740: \$? = $ac_status" >&5 + echo "$as_me:1743: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1743: \"$ac_try\"") >&5 + { (eval echo "$as_me:1746: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1746: \$? = $ac_status" >&5 + echo "$as_me:1749: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -1753,7 +1756,7 @@ continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 1756 "configure" +#line 1759 "configure" #include "confdefs.h" $ac_declaration int @@ -1765,16 +1768,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1768: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1771: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1771: \$? = $ac_status" >&5 + echo "$as_me:1774: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1774: \"$ac_try\"") >&5 + { (eval echo "$as_me:1777: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1777: \$? = $ac_status" >&5 + echo "$as_me:1780: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -1804,15 +1807,15 @@ ac_main_return=return GCC_VERSION=none if test "$GCC" = yes ; then - echo "$as_me:1807: checking version of $CC" >&5 + echo "$as_me:1810: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown - echo "$as_me:1811: result: $GCC_VERSION" >&5 + echo "$as_me:1814: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi -echo "$as_me:1815: checking for $CC option to accept ANSI C" >&5 +echo "$as_me:1818: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1820,7 +1823,7 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line 1823 "configure" +#line 1826 "configure" #include "confdefs.h" #include <stdarg.h> #include <stdio.h> @@ -1869,16 +1872,16 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:1872: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1875: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1875: \$? = $ac_status" >&5 + echo "$as_me:1878: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1878: \"$ac_try\"") >&5 + { (eval echo "$as_me:1881: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1881: \$? = $ac_status" >&5 + echo "$as_me:1884: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break @@ -1895,10 +1898,10 @@ fi case "x$ac_cv_prog_cc_stdc" in x|xno) - echo "$as_me:1898: result: none needed" >&5 + echo "$as_me:1901: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) - echo "$as_me:1901: result: $ac_cv_prog_cc_stdc" >&5 + echo "$as_me:1904: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac @@ -1906,13 +1909,13 @@ esac # This should have been defined by AC_PROG_CC : ${CC:=cc} -echo "$as_me:1909: checking \$CC variable" >&5 +echo "$as_me:1912: checking \$CC variable" >&5 echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 case "$CC" in #(vi *[\ \ ]-[IUD]*) - echo "$as_me:1913: result: broken" >&5 + echo "$as_me:1916: result: broken" >&5 echo "${ECHO_T}broken" >&6 - { echo "$as_me:1915: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 + { echo "$as_me:1918: 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/^[^ ]*[ ]//'` @@ -1998,12 +2001,12 @@ fi ;; *) - echo "$as_me:2001: result: ok" >&5 + echo "$as_me:2004: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac -echo "$as_me:2006: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:2009: 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 @@ -2023,11 +2026,11 @@ fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:2026: result: yes" >&5 + echo "$as_me:2029: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:2030: result: no" >&5 + echo "$as_me:2033: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -2044,7 +2047,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:2047: checking for a BSD compatible install" >&5 +echo "$as_me:2050: 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 @@ -2093,7 +2096,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:2096: result: $INSTALL" >&5 +echo "$as_me:2099: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -2104,7 +2107,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo "$as_me:2107: checking if filesystem supports mixed-case filenames" >&5 +echo "$as_me:2110: 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 @@ -2131,7 +2134,7 @@ else fi fi -echo "$as_me:2134: result: $cf_cv_mixedcase" >&5 +echo "$as_me:2137: result: $cf_cv_mixedcase" >&5 echo "${ECHO_T}$cf_cv_mixedcase" >&6 test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF @@ -2142,7 +2145,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:2145: checking for $ac_word" >&5 +echo "$as_me:2148: 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 @@ -2157,7 +2160,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:2160: found $ac_dir/$ac_word" >&5 +echo "$as_me:2163: found $ac_dir/$ac_word" >&5 break done @@ -2165,10 +2168,10 @@ fi fi CTAGS=$ac_cv_prog_CTAGS if test -n "$CTAGS"; then - echo "$as_me:2168: result: $CTAGS" >&5 + echo "$as_me:2171: result: $CTAGS" >&5 echo "${ECHO_T}$CTAGS" >&6 else - echo "$as_me:2171: result: no" >&5 + echo "$as_me:2174: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2179,7 +2182,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:2182: checking for $ac_word" >&5 +echo "$as_me:2185: 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 @@ -2194,7 +2197,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:2197: found $ac_dir/$ac_word" >&5 +echo "$as_me:2200: found $ac_dir/$ac_word" >&5 break done @@ -2202,10 +2205,10 @@ fi fi ETAGS=$ac_cv_prog_ETAGS if test -n "$ETAGS"; then - echo "$as_me:2205: result: $ETAGS" >&5 + echo "$as_me:2208: result: $ETAGS" >&5 echo "${ECHO_T}$ETAGS" >&6 else - echo "$as_me:2208: result: no" >&5 + echo "$as_me:2211: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2214,7 +2217,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:2217: checking for $ac_word" >&5 +echo "$as_me:2220: 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 @@ -2229,7 +2232,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:2232: found $ac_dir/$ac_word" >&5 +echo "$as_me:2235: found $ac_dir/$ac_word" >&5 break done @@ -2238,17 +2241,17 @@ fi fi MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS if test -n "$MAKE_LOWER_TAGS"; then - echo "$as_me:2241: result: $MAKE_LOWER_TAGS" >&5 + echo "$as_me:2244: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else - echo "$as_me:2244: result: no" >&5 + echo "$as_me:2247: 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:2251: checking for $ac_word" >&5 +echo "$as_me:2254: 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 @@ -2263,7 +2266,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:2266: found $ac_dir/$ac_word" >&5 +echo "$as_me:2269: found $ac_dir/$ac_word" >&5 break done @@ -2272,10 +2275,10 @@ fi fi MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS if test -n "$MAKE_UPPER_TAGS"; then - echo "$as_me:2275: result: $MAKE_UPPER_TAGS" >&5 + echo "$as_me:2278: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else - echo "$as_me:2278: result: no" >&5 + echo "$as_me:2281: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2295,11 +2298,52 @@ else MAKE_LOWER_TAGS="#" fi +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:2305: 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 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_AWK="$ac_prog" +echo "$as_me:2320: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:2328: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:2331: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +test -z "$AWK" && { { echo "$as_me:2338: 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 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:2302: checking for $ac_word" >&5 +echo "$as_me:2346: 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 @@ -2314,7 +2358,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:2317: found $ac_dir/$ac_word" >&5 +echo "$as_me:2361: found $ac_dir/$ac_word" >&5 break done @@ -2322,10 +2366,10 @@ fi fi LINT=$ac_cv_prog_LINT if test -n "$LINT"; then - echo "$as_me:2325: result: $LINT" >&5 + echo "$as_me:2369: result: $LINT" >&5 echo "${ECHO_T}$LINT" >&6 else - echo "$as_me:2328: result: no" >&5 + echo "$as_me:2372: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2370,14 +2414,14 @@ irix[56].*) #(vi ;; linux*|gnu*|mint*|k*bsd*-gnu) #(vi -echo "$as_me:2373: checking if we must define _GNU_SOURCE" >&5 +echo "$as_me:2417: 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 2380 "configure" +#line 2424 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2392,16 +2436,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2395: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2439: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2398: \$? = $ac_status" >&5 + echo "$as_me:2442: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2401: \"$ac_try\"") >&5 + { (eval echo "$as_me:2445: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2404: \$? = $ac_status" >&5 + echo "$as_me:2448: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else @@ -2410,7 +2454,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 2413 "configure" +#line 2457 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2425,16 +2469,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2428: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2472: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2431: \$? = $ac_status" >&5 + echo "$as_me:2475: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2434: \"$ac_try\"") >&5 + { (eval echo "$as_me:2478: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2437: \$? = $ac_status" >&5 + echo "$as_me:2481: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else @@ -2449,7 +2493,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2452: result: $cf_cv_gnu_source" >&5 +echo "$as_me:2496: 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" @@ -2471,16 +2515,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:2474: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:2518: 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}:2480: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:2524: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2483 "configure" +#line 2527 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2495,16 +2539,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2498: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2542: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2501: \$? = $ac_status" >&5 + echo "$as_me:2545: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2504: \"$ac_try\"") >&5 + { (eval echo "$as_me:2548: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2507: \$? = $ac_status" >&5 + echo "$as_me:2551: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -2525,7 +2569,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 2528 "configure" +#line 2572 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2540,16 +2584,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2543: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2587: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2546: \$? = $ac_status" >&5 + echo "$as_me:2590: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2549: \"$ac_try\"") >&5 + { (eval echo "$as_me:2593: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2552: \$? = $ac_status" >&5 + echo "$as_me:2596: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2560,15 +2604,15 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:2563: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:2607: 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}:2568: testing if the second compile does not leave our definition intact error ..." 1>&5 +echo "${as_me:-configure}:2612: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2571 "configure" +#line 2615 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2583,16 +2627,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2586: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2630: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2589: \$? = $ac_status" >&5 + echo "$as_me:2633: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2592: \"$ac_try\"") >&5 + { (eval echo "$as_me:2636: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2595: \$? = $ac_status" >&5 + echo "$as_me:2639: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2608,7 +2652,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2611: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:2655: 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 @@ -2718,17 +2762,18 @@ sco*) #(vi ;; solaris2.*) #(vi cf_xopen_source="-D__EXTENSIONS__" + cf_cv_xopen_source=broken ;; *) -echo "$as_me:2724: checking if we should define _XOPEN_SOURCE" >&5 +echo "$as_me:2769: 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 2731 "configure" +#line 2776 "configure" #include "confdefs.h" #include <stdlib.h> @@ -2747,16 +2792,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2750: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2795: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2753: \$? = $ac_status" >&5 + echo "$as_me:2798: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2756: \"$ac_try\"") >&5 + { (eval echo "$as_me:2801: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2759: \$? = $ac_status" >&5 + echo "$as_me:2804: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2765,7 +2810,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 2768 "configure" +#line 2813 "configure" #include "confdefs.h" #include <stdlib.h> @@ -2784,16 +2829,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2787: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2832: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2790: \$? = $ac_status" >&5 + echo "$as_me:2835: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2793: \"$ac_try\"") >&5 + { (eval echo "$as_me:2838: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2796: \$? = $ac_status" >&5 + echo "$as_me:2841: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2808,7 +2853,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2811: result: $cf_cv_xopen_source" >&5 +echo "$as_me:2856: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -2916,16 +2961,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:2919: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:2964: 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}:2925: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:2970: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2928 "configure" +#line 2973 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2940,16 +2985,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2943: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2988: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2946: \$? = $ac_status" >&5 + echo "$as_me:2991: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2949: \"$ac_try\"") >&5 + { (eval echo "$as_me:2994: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2952: \$? = $ac_status" >&5 + echo "$as_me:2997: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -2970,7 +3015,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 2973 "configure" +#line 3018 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2985,16 +3030,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2988: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3033: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2991: \$? = $ac_status" >&5 + echo "$as_me:3036: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2994: \"$ac_try\"") >&5 + { (eval echo "$as_me:3039: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2997: \$? = $ac_status" >&5 + echo "$as_me:3042: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3005,15 +3050,15 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:3008: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:3053: 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}:3013: testing if the second compile does not leave our definition intact error ..." 1>&5 +echo "${as_me:-configure}:3058: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3016 "configure" +#line 3061 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -3028,16 +3073,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3031: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3076: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3034: \$? = $ac_status" >&5 + echo "$as_me:3079: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3037: \"$ac_try\"") >&5 + { (eval echo "$as_me:3082: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3040: \$? = $ac_status" >&5 + echo "$as_me:3085: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3053,7 +3098,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3056: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:3101: 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 @@ -3226,10 +3271,10 @@ fi fi if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then - echo "$as_me:3229: checking if _XOPEN_SOURCE really is set" >&5 + echo "$as_me:3274: 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 3232 "configure" +#line 3277 "configure" #include "confdefs.h" #include <stdlib.h> int @@ -3244,16 +3289,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3247: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3292: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3250: \$? = $ac_status" >&5 + echo "$as_me:3295: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3253: \"$ac_try\"") >&5 + { (eval echo "$as_me:3298: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3256: \$? = $ac_status" >&5 + echo "$as_me:3301: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set=yes else @@ -3262,12 +3307,12 @@ cat conftest.$ac_ext >&5 cf_XOPEN_SOURCE_set=no fi rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:3265: result: $cf_XOPEN_SOURCE_set" >&5 + echo "$as_me:3310: 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 3270 "configure" +#line 3315 "configure" #include "confdefs.h" #include <stdlib.h> int @@ -3282,16 +3327,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3285: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3330: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3288: \$? = $ac_status" >&5 + echo "$as_me:3333: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3291: \"$ac_try\"") >&5 + { (eval echo "$as_me:3336: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3294: \$? = $ac_status" >&5 + echo "$as_me:3339: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set_ok=yes else @@ -3302,19 +3347,19 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext if test $cf_XOPEN_SOURCE_set_ok = no then - { echo "$as_me:3305: WARNING: _XOPEN_SOURCE is lower than requested" >&5 + { echo "$as_me:3350: WARNING: _XOPEN_SOURCE is lower than requested" >&5 echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} fi else -echo "$as_me:3310: checking if we should define _XOPEN_SOURCE" >&5 +echo "$as_me:3355: 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 3317 "configure" +#line 3362 "configure" #include "confdefs.h" #include <stdlib.h> @@ -3333,16 +3378,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3336: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3381: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3339: \$? = $ac_status" >&5 + echo "$as_me:3384: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3342: \"$ac_try\"") >&5 + { (eval echo "$as_me:3387: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3345: \$? = $ac_status" >&5 + echo "$as_me:3390: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3351,7 +3396,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 3354 "configure" +#line 3399 "configure" #include "confdefs.h" #include <stdlib.h> @@ -3370,16 +3415,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3373: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3418: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3376: \$? = $ac_status" >&5 + echo "$as_me:3421: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3379: \"$ac_try\"") >&5 + { (eval echo "$as_me:3424: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3382: \$? = $ac_status" >&5 + echo "$as_me:3427: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3394,7 +3439,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3397: result: $cf_cv_xopen_source" >&5 +echo "$as_me:3442: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -3498,7 +3543,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:3501: checking how to run the C preprocessor" >&5 +echo "$as_me:3546: 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 @@ -3519,18 +3564,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 3522 "configure" +#line 3567 "configure" #include "confdefs.h" #include <assert.h> Syntax error _ACEOF -if { (eval echo "$as_me:3527: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3572: \"$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:3533: \$? = $ac_status" >&5 + echo "$as_me:3578: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3553,17 +3598,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 3556 "configure" +#line 3601 "configure" #include "confdefs.h" #include <ac_nonexistent.h> _ACEOF -if { (eval echo "$as_me:3560: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3605: \"$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:3566: \$? = $ac_status" >&5 + echo "$as_me:3611: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3600,7 +3645,7 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:3603: result: $CPP" >&5 +echo "$as_me:3648: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -3610,18 +3655,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 3613 "configure" +#line 3658 "configure" #include "confdefs.h" #include <assert.h> Syntax error _ACEOF -if { (eval echo "$as_me:3618: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3663: \"$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:3624: \$? = $ac_status" >&5 + echo "$as_me:3669: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3644,17 +3689,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 3647 "configure" +#line 3692 "configure" #include "confdefs.h" #include <ac_nonexistent.h> _ACEOF -if { (eval echo "$as_me:3651: \"$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:3657: \$? = $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 @@ -3682,7 +3727,7 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:3685: error: C preprocessor \"$CPP\" fails sanity check" >&5 + { { echo "$as_me:3730: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -3697,23 +3742,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:3700: checking for $ac_header" >&5 +echo "$as_me:3745: 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 3706 "configure" +#line 3751 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:3710: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:3755: \"$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:3716: \$? = $ac_status" >&5 + echo "$as_me:3761: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -3732,7 +3777,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:3735: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:3780: 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 @@ -3742,7 +3787,7 @@ EOF fi done -echo "$as_me:3745: checking for working mkstemp" >&5 +echo "$as_me:3790: 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 @@ -3753,7 +3798,7 @@ if test "$cross_compiling" = yes; then cf_cv_func_mkstemp=maybe else cat >conftest.$ac_ext <<_ACEOF -#line 3756 "configure" +#line 3801 "configure" #include "confdefs.h" #include <sys/types.h> @@ -3791,15 +3836,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:3794: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3839: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3797: \$? = $ac_status" >&5 + echo "$as_me:3842: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:3799: \"$ac_try\"") >&5 + { (eval echo "$as_me:3844: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3802: \$? = $ac_status" >&5 + echo "$as_me:3847: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_mkstemp=yes @@ -3814,16 +3859,16 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:3817: result: $cf_cv_func_mkstemp" >&5 +echo "$as_me:3862: 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:3820: checking for mkstemp" >&5 + echo "$as_me:3865: 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 3826 "configure" +#line 3871 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mkstemp (); below. */ @@ -3854,16 +3899,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:3857: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3902: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3860: \$? = $ac_status" >&5 + echo "$as_me:3905: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3863: \"$ac_try\"") >&5 + { (eval echo "$as_me:3908: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3866: \$? = $ac_status" >&5 + echo "$as_me:3911: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mkstemp=yes else @@ -3873,7 +3918,7 @@ ac_cv_func_mkstemp=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:3876: result: $ac_cv_func_mkstemp" >&5 +echo "$as_me:3921: result: $ac_cv_func_mkstemp" >&5 echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 fi @@ -3885,9 +3930,59 @@ EOF fi +echo "$as_me:3933: 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. +if test "${with_max_table_size+set}" = set; then + withval="$with_max_table_size" + +fi; +if test -n "$with_max_table_size" +then + echo "$as_me:3943: 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:3948: 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 + +cat >>confdefs.h <<EOF +#define MAXTABLE $with_max_table_size +EOF + +else + echo "$as_me:3958: result: default" >&5 +echo "${ECHO_T}default" >&6 +fi + +echo "$as_me:3962: 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. +if test "${enable_btyacc+set}" = set; then + enableval="$enable_btyacc" + +fi; +echo "$as_me:3970: result: $enable_btyacc" >&5 +echo "${ECHO_T}$enable_btyacc" >&6 +if test "$enable_btyacc" = "yes"; then + +cat >>confdefs.h <<\EOF +#define YYBTYACC 1 +EOF + + SKELETON=btyaccpar +else + SKELETON=yaccpar +fi + if ( test "$GCC" = yes || test "$GXX" = yes ) then -echo "$as_me:3890: checking if you want to check for gcc warnings" >&5 +echo "$as_me:3985: 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. @@ -3897,7 +3992,7 @@ if test "${with_warnings+set}" = set; then else cf_opt_with_warnings=no fi; -echo "$as_me:3900: result: $cf_opt_with_warnings" >&5 +echo "$as_me:3995: result: $cf_opt_with_warnings" >&5 echo "${ECHO_T}$cf_opt_with_warnings" >&6 if test "$cf_opt_with_warnings" != no ; then @@ -3919,10 +4014,10 @@ cat > conftest.i <<EOF EOF if test "$GCC" = yes then - { echo "$as_me:3922: checking for $CC __attribute__ directives..." >&5 + { echo "$as_me:4017: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <<EOF -#line 3925 "${as_me:-configure}" +#line 4020 "${as_me:-configure}" #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -3971,12 +4066,12 @@ EOF ;; esac - if { (eval echo "$as_me:3974: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4069: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3977: \$? = $ac_status" >&5 + echo "$as_me:4072: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:3979: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:4074: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case $cf_attribute in #(vi @@ -4040,12 +4135,12 @@ INTEL_COMPILER=no if test "$GCC" = yes ; then case $host_os in linux*|gnu*) - echo "$as_me:4043: checking if this is really Intel C compiler" >&5 + echo "$as_me:4138: 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 4048 "configure" +#line 4143 "configure" #include "confdefs.h" int @@ -4062,19 +4157,19 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4065: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4160: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4068: \$? = $ac_status" >&5 + echo "$as_me:4163: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4071: \"$ac_try\"") >&5 + { (eval echo "$as_me:4166: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4074: \$? = $ac_status" >&5 + echo "$as_me:4169: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes -cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" +cf_save_CFLAGS="$cf_save_CFLAGS -we147" else echo "$as_me: failed program was:" >&5 @@ -4082,7 +4177,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4085: result: $INTEL_COMPILER" >&5 + echo "$as_me:4180: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac @@ -4091,12 +4186,12 @@ fi CLANG_COMPILER=no if test "$GCC" = yes ; then - echo "$as_me:4094: checking if this is really Clang C compiler" >&5 + echo "$as_me:4189: 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 4099 "configure" +#line 4194 "configure" #include "confdefs.h" int @@ -4113,16 +4208,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4116: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4211: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4119: \$? = $ac_status" >&5 + echo "$as_me:4214: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4122: \"$ac_try\"") >&5 + { (eval echo "$as_me:4217: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4125: \$? = $ac_status" >&5 + echo "$as_me:4220: \$? = $ac_status" >&5 (exit $ac_status); }; }; then CLANG_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" @@ -4133,12 +4228,12 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4136: result: $CLANG_COMPILER" >&5 + echo "$as_me:4231: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi cat > conftest.$ac_ext <<EOF -#line 4141 "${as_me:-configure}" +#line 4236 "${as_me:-configure}" int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } EOF @@ -4155,7 +4250,7 @@ then # remark #981: operands are evaluated in unspecified order # warning #279: controlling expression is constant - { echo "$as_me:4158: checking for $CC warning options..." >&5 + { echo "$as_me:4253: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" @@ -4171,12 +4266,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:4174: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4269: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4177: \$? = $ac_status" >&5 + echo "$as_me:4272: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4179: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4274: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi @@ -4185,7 +4280,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 elif test "$GCC" = yes then - { echo "$as_me:4188: checking for $CC warning options..." >&5 + { echo "$as_me:4283: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= @@ -4209,12 +4304,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:4212: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4307: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4215: \$? = $ac_status" >&5 + echo "$as_me:4310: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4217: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4312: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in #(vi Wcast-qual) #(vi @@ -4225,7 +4320,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}:4228: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4323: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4235,7 +4330,7 @@ echo "${as_me:-configure}:4228: 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}:4238: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4333: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4251,7 +4346,7 @@ rm -rf conftest* fi fi -echo "$as_me:4254: checking if you want to see long compiling messages" >&5 +echo "$as_me:4349: 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. @@ -4285,10 +4380,10 @@ else ECHO_CC='' fi; -echo "$as_me:4288: result: $enableval" >&5 +echo "$as_me:4383: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 -echo "$as_me:4291: checking if you want to use dmalloc for testing" >&5 +echo "$as_me:4386: 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. @@ -4305,7 +4400,7 @@ EOF else with_dmalloc= fi; -echo "$as_me:4308: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:4403: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -4399,23 +4494,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:4402: checking for dmalloc.h" >&5 + echo "$as_me:4497: 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 4408 "configure" +#line 4503 "configure" #include "confdefs.h" #include <dmalloc.h> _ACEOF -if { (eval echo "$as_me:4412: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4507: \"$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:4418: \$? = $ac_status" >&5 + echo "$as_me:4513: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4434,11 +4529,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4437: result: $ac_cv_header_dmalloc_h" >&5 +echo "$as_me:4532: 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:4441: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:4536: 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 @@ -4446,7 +4541,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4449 "configure" +#line 4544 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4465,16 +4560,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4468: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4563: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4471: \$? = $ac_status" >&5 + echo "$as_me:4566: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4474: \"$ac_try\"") >&5 + { (eval echo "$as_me:4569: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4477: \$? = $ac_status" >&5 + echo "$as_me:4572: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -4485,7 +4580,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4488: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:4583: 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 @@ -4500,7 +4595,7 @@ fi fi -echo "$as_me:4503: checking if you want to use dbmalloc for testing" >&5 +echo "$as_me:4598: 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. @@ -4517,7 +4612,7 @@ EOF else with_dbmalloc= fi; -echo "$as_me:4520: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:4615: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -4611,23 +4706,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:4614: checking for dbmalloc.h" >&5 + echo "$as_me:4709: 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 4620 "configure" +#line 4715 "configure" #include "confdefs.h" #include <dbmalloc.h> _ACEOF -if { (eval echo "$as_me:4624: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4719: \"$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:4630: \$? = $ac_status" >&5 + echo "$as_me:4725: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4646,11 +4741,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4649: result: $ac_cv_header_dbmalloc_h" >&5 +echo "$as_me:4744: 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:4653: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:4748: 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 @@ -4658,7 +4753,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4661 "configure" +#line 4756 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4677,16 +4772,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4680: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4775: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4683: \$? = $ac_status" >&5 + echo "$as_me:4778: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4686: \"$ac_try\"") >&5 + { (eval echo "$as_me:4781: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4689: \$? = $ac_status" >&5 + echo "$as_me:4784: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -4697,7 +4792,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4700: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:4795: 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 @@ -4712,7 +4807,7 @@ fi fi -echo "$as_me:4715: checking if you want to use valgrind for testing" >&5 +echo "$as_me:4810: 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. @@ -4729,7 +4824,7 @@ EOF else with_valgrind= fi; -echo "$as_me:4732: result: ${with_valgrind:-no}" >&5 +echo "$as_me:4827: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case .$with_cflags in #(vi @@ -4822,7 +4917,7 @@ fi ;; esac -echo "$as_me:4825: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:4920: 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. @@ -4832,7 +4927,7 @@ if test "${enable_leaks+set}" = set; then else : ${with_no_leaks:=no} fi; -echo "$as_me:4835: result: $with_no_leaks" >&5 +echo "$as_me:4930: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$with_no_leaks" = yes ; then @@ -4928,7 +5023,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:4931: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:5026: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -5101,7 +5196,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:5104: error: ambiguous option: $1 + { { echo "$as_me:5199: 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;} @@ -5120,7 +5215,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:5123: error: unrecognized option: $1 + -*) { { echo "$as_me:5218: 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;} @@ -5157,7 +5252,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:5160: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:5255: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -5267,9 +5362,11 @@ s,@CTAGS@,$CTAGS,;t t s,@ETAGS@,$ETAGS,;t t s,@MAKE_LOWER_TAGS@,$MAKE_LOWER_TAGS,;t t s,@MAKE_UPPER_TAGS@,$MAKE_UPPER_TAGS,;t t +s,@AWK@,$AWK,;t t s,@LINT@,$LINT,;t t s,@LINT_OPTS@,$LINT_OPTS,;t t s,@CPP@,$CPP,;t t +s,@SKELETON@,$SKELETON,;t t s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t s,@ECHO_LT@,$ECHO_LT,;t t s,@ECHO_LD@,$ECHO_LD,;t t @@ -5390,7 +5487,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:5393: creating $ac_file" >&5 + { echo "$as_me:5490: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -5408,7 +5505,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:5411: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5508: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5421,7 +5518,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5424: error: cannot find input file: $f" >&5 + { { echo "$as_me:5521: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5437,7 +5534,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:5440: WARNING: datarootdir was used implicitly but not set: + { echo "$as_me:5537: 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;} @@ -5446,7 +5543,7 @@ $ac_seen" >&2;} fi ac_seen=`grep '${datarootdir}' $ac_item` if test -n "$ac_seen"; then - { echo "$as_me:5449: WARNING: datarootdir was used explicitly but not set: + { echo "$as_me:5546: 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;} @@ -5483,7 +5580,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:5486: WARNING: Variable $ac_name is used but was not set: + { echo "$as_me:5583: 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;} @@ -5494,7 +5591,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:5497: WARNING: Some variables may not be substituted: + { echo "$as_me:5594: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} @@ -5543,7 +5640,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:5546: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:5643: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -5554,7 +5651,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:5557: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5654: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5567,7 +5664,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5570: error: cannot find input file: $f" >&5 + { { echo "$as_me:5667: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5685,7 +5782,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:5688: $ac_file is unchanged" >&5 + { echo "$as_me:5785: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ @@ -5793,10 +5890,10 @@ clean \\ docs-clean :: rm -f $cf_name.html $cf_name.pdf $cf_name.ps $cf_name.txt -$cf_name.html : $cf_name.1 +$cf_name.html : $cf_name.\1 $cf_name.pdf : $cf_name.ps -$cf_name.ps : $cf_name.1 -$cf_name.txt : $cf_name.1 +$cf_name.ps : $cf_name.\1 +$cf_name.txt : $cf_name.\1 CF_EOF done diff --git a/configure.in b/configure.in index 477c187a3852..0cd7a1996ded 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with 'autoconf' to produce a 'configure' script -dnl $Id: configure.in,v 1.15 2014/01/01 14:07:34 tom Exp $ +dnl $Id: configure.in,v 1.18 2014/04/06 19:11:51 tom Exp $ AC_PREREQ(2.52.20011201) -AC_REVISION($Revision: 1.15 $) +AC_REVISION($Revision: 1.18 $) AC_INIT(main.c) AC_CONFIG_HEADER(config.h:config_h.in) @@ -12,12 +12,43 @@ CF_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL CF_MAKE_TAGS +CF_PROG_AWK CF_PROG_LINT CF_XOPEN_SOURCE AC_CHECK_HEADERS(fcntl.h) CF_MKSTEMP +AC_MSG_CHECKING(for maximum table size) +AC_ARG_WITH([max-table-size], + [AC_HELP_STRING([--with-max-table-size=N], + [set the maximum table size = N (no default)])]) +if test -n "$with_max_table_size" +then + AC_MSG_RESULT($with_max_table_size) + check=`expr "$with_max_table_size" + 0` + if test "x$check" != "x$with_max_table_size" + then + AC_MSG_ERROR([invalid value for --with-max-table-size: $with_max_table_size]) + fi + AC_DEFINE_UNQUOTED(MAXTABLE,$with_max_table_size,[Define to maximum table size (default: 32500)]) +else + AC_MSG_RESULT(default) +fi + +AC_MSG_CHECKING(if backtracking extension is wanted) +AC_ARG_ENABLE([btyacc], + [AC_HELP_STRING([--enable-btyacc], + [turn on support for the btyacc backtracking extension (default: no)])]) +AC_MSG_RESULT($enable_btyacc) +if test "$enable_btyacc" = "yes"; then + AC_DEFINE(YYBTYACC,1,[Define to 1 to enable backtracking extension]) + SKELETON=btyaccpar +else + SKELETON=yaccpar +fi +AC_SUBST(SKELETON) + CF_WITH_WARNINGS(Wwrite-strings) CF_DISABLE_ECHO CF_DISABLE_LEAKS @@ -1,9 +1,10 @@ -/* $Id: defs.h,v 1.38 2014/01/01 14:23:27 Christos.Zoulas Exp $ */ +/* $Id: defs.h,v 1.47 2014/04/09 21:23:45 Rick.Spates Exp $ */ #ifdef HAVE_CONFIG_H #include <config.h> #endif +#include <limits.h> #include <stdlib.h> #include <string.h> #include <errno.h> @@ -30,14 +31,14 @@ #define VERSION VSTRING(YYMAJOR, YYMINOR) -/* machine-dependent definitions */ -/* the following definitions are for the Tahoe */ -/* they might have to be changed for other machines */ +/* machine-dependent definitions: */ /* MAXCHAR is the largest unsigned character value */ -/* MAXSHORT is the largest value of a C short */ -/* MINSHORT is the most negative value of a C short */ /* MAXTABLE is the maximum table size */ +/* YYINT is the smallest C integer type that can be */ +/* used to address a table of size MAXTABLE */ +/* MAXYYINT is the largest value of a YYINT */ +/* MINYYINT is the most negative value of a YYINT */ /* BITS_PER_WORD is the number of bits in a C unsigned */ /* WORDSIZE computes the number of words needed to */ /* store n bits */ @@ -45,14 +46,26 @@ /* from r (0-indexed) */ /* SETBIT sets the n-th bit starting from r */ -#define MAXCHAR 255 -#define MAXSHORT 32767 -#define MINSHORT -32768 +#define MAXCHAR UCHAR_MAX +#ifndef MAXTABLE #define MAXTABLE 32500 -#define BITS_PER_WORD 32 -#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD) -#define BIT(r, n) ((((r)[(n)>>5])>>((n)&31))&1) -#define SETBIT(r, n) ((r)[(n)>>5]|=((unsigned)1<<((n)&31))) +#endif +#if MAXTABLE <= SHRT_MAX +#define YYINT short +#define MAXYYINT SHRT_MAX +#define MINYYINT SHRT_MIN +#elif MAXTABLE <= INT_MAX +#define YYINT int +#define MAXYYINT INT_MAX +#define MINYYINT INT_MIN +#else +#error "MAXTABLE is too large for this machine architecture!" +#endif + +#define BITS_PER_WORD ((int) sizeof (unsigned) * CHAR_BIT) +#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD) +#define BIT(r, n) ((((r)[(n)/BITS_PER_WORD])>>((n)&(BITS_PER_WORD-1)))&1) +#define SETBIT(r, n) ((r)[(n)/BITS_PER_WORD]|=((unsigned)1<<((n)&(BITS_PER_WORD-1)))) /* character names */ @@ -106,11 +119,18 @@ #define POSIX_YACC 15 #define TOKEN_TABLE 16 +#if defined(YYBTYACC) +#define LOCATIONS 17 +#define DESTRUCTOR 18 +#endif + /* symbol classes */ #define UNKNOWN 0 #define TERM 1 #define NONTERM 2 +#define ACTION 3 +#define ARGUMENT 4 /* the undefined value */ @@ -150,10 +170,20 @@ /* messages */ #define PLURAL(n) ((n) > 1 ? "s" : "") +/* + * Features which depend indirectly on the btyacc configuration, but are not + * essential. + */ +#if defined(YYBTYACC) +#define USE_HEADER_GUARDS 1 +#else +#define USE_HEADER_GUARDS 0 +#endif + typedef char Assoc_t; typedef char Class_t; -typedef short Index_t; -typedef short Value_t; +typedef YYINT Index_t; +typedef YYINT Value_t; /* the structure of a symbol table entry */ @@ -164,6 +194,12 @@ struct bucket struct bucket *next; char *name; char *tag; +#if defined(YYBTYACC) + char **argnames; + char **argtags; + int args; + char *destructor; +#endif Value_t value; Index_t index; Value_t prec; @@ -250,6 +286,11 @@ extern int outline; extern int exit_code; extern int pure_parser; extern int token_table; +#if defined(YYBTYACC) +extern int locations; +extern int backtrack; +extern int destructor; +#endif extern const char *const banner[]; extern const char *const xdecls[]; @@ -261,9 +302,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 const char *const trailer_2[]; extern char *code_file_name; extern char *input_file_name; @@ -281,11 +320,11 @@ extern FILE *union_file; extern FILE *verbose_file; extern FILE *graph_file; -extern int nitems; -extern int nrules; -extern int nsyms; -extern int ntokens; -extern int nvars; +extern Value_t nitems; +extern Value_t nrules; +extern Value_t nsyms; +extern Value_t ntokens; +extern Value_t nvars; extern int ntags; extern char unionized; @@ -298,6 +337,12 @@ extern Value_t *symbol_value; extern Value_t *symbol_prec; extern char *symbol_assoc; +#if defined(YYBTYACC) +extern Value_t *symbol_pval; +extern char **symbol_destructor; +extern char **symbol_type_tag; +#endif + extern Value_t *ritem; extern Value_t *rlhs; extern Value_t *rrhs; @@ -346,9 +391,6 @@ extern param *parse_param; /* global functions */ -extern bucket *lookup(const char *); -extern bucket *make_bucket(const char *); - #ifndef GCC_NORETURN #if defined(__dead2) #define GCC_NORETURN __dead2 @@ -373,7 +415,13 @@ extern void finalize_closure(void); extern void set_first_derives(void); /* error.c */ +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 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; @@ -389,6 +437,7 @@ extern void reprec_warning(char *s); extern void restarted_warning(void); extern void retyped_warning(char *s); extern void revalued_warning(char *s); +extern void start_requires_args(char *a_name); extern void syntax_error(int st_lineno, char *st_line, char *st_cptr) GCC_NORETURN; extern void terminal_lhs(int s_lineno) GCC_NORETURN; extern void terminal_start(char *s) GCC_NORETURN; @@ -396,25 +445,26 @@ extern void tokenized_start(char *s) GCC_NORETURN; extern void undefined_goal(char *s) GCC_NORETURN; extern void undefined_symbol_warning(char *s); 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 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 wrong_number_args_warning(const char *which, const char *a_name); +extern void wrong_type_for_arg_warning(int i, char *a_name); /* graph.c */ extern void graph(void); /* lalr.c */ -extern void create_symbol_table(void); -extern void free_symbol_table(void); -extern void free_symbols(void); - -/* lalr.c */ extern void lalr(void); /* lr0.c */ @@ -432,21 +482,54 @@ extern void done(int k) GCC_NORETURN; extern void free_parser(void); extern void make_parser(void); +/* mstring.c */ +struct mstring +{ + char *base, *ptr, *end; +}; + +extern void msprintf(struct mstring *, const char *, ...); +extern int mputchar(struct mstring *, int); +extern struct mstring *msnew(void); +extern char *msdone(struct mstring *); +extern int strnscmp(const char *, const char *); +extern unsigned int strnshash(const char *); + +#define mputc(m, ch) (((m)->ptr == (m)->end) \ + ? mputchar(m,ch) \ + : (*(m)->ptr++ = (char) (ch))) + /* output.c */ extern void output(void); /* reader.c */ extern void reader(void); -/* skeleton.c */ +/* skeleton.c (generated by skel2c) */ extern void write_section(FILE * fp, const char *const section[]); +/* symtab.c */ +extern bucket *make_bucket(const char *); +extern bucket *lookup(const char *); +extern void create_symbol_table(void); +extern void free_symbol_table(void); +extern void free_symbols(void); + /* verbose.c */ extern void verbose(void); /* warshall.c */ extern void reflexive_transitive_closure(unsigned *R, int n); +#ifdef DEBUG + /* closure.c */ +extern void print_closure(int n); +extern void print_EFF(void); +extern void print_first_derives(void); + /* lr0.c */ +extern void print_derives(void); +#endif + #ifdef NO_LEAKS extern void lr0_leaks(void); extern void lalr_leaks(void); diff --git a/descrip.mms b/descrip.mms index 0dcb70fbbea0..007468b07b36 100644 --- a/descrip.mms +++ b/descrip.mms @@ -12,7 +12,7 @@ OBJS = closure.obj, \ mkpar.obj, \ output.obj, \ reader.obj, \ - skeleton.obj, \ + yaccpar.obj, \ symtab.obj, \ verbose.obj, \ warshall.obj @@ -1,4 +1,4 @@ -/* $Id: error.c,v 1.9 2011/09/05 23:27:43 tom Exp $ */ +/* $Id: error.c,v 1.11 2014/04/07 22:22:49 tom Exp $ */ /* routines for printing error messages */ @@ -42,9 +42,9 @@ unexpected_EOF(void) } static void -print_pos(char *st_line, char *st_cptr) +print_pos(const char *st_line, const char *st_cptr) { - char *s; + const char *s; if (st_line == 0) return; @@ -286,3 +286,117 @@ undefined_symbol_warning(char *s) { fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s); } + +#if ! defined(YYBTYACC) +void +unsupported_flag_warning(const char *flag, const char *details) +{ + fprintf(stderr, "%s: w - %s flag unsupported, %s\n", + myname, flag, details); +} +#endif + +#if defined(YYBTYACC) +void +at_warning(int a_lineno, int i) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", @%d references beyond the \ +end of the current rule\n", myname, a_lineno, input_file_name, i); +} + +void +at_error(int a_lineno, char *a_line, char *a_cptr) +{ + fprintf(stderr, + "%s: e - line %d of \"%s\", illegal @$ or @N reference\n", + myname, a_lineno, input_file_name); + print_pos(a_line, a_cptr); + done(1); +} + +void +unterminated_arglist(int a_lineno, char *a_line, char *a_cptr) +{ + fprintf(stderr, + "%s: e - line %d of \"%s\", unterminated argument list\n", + myname, a_lineno, input_file_name); + print_pos(a_line, a_cptr); + done(1); +} + +void +arg_number_disagree_warning(int a_lineno, char *a_name) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", number of arguments of %s " + "doesn't agree with previous declaration\n", + myname, a_lineno, input_file_name, a_name); +} + +void +bad_formals(void) +{ + fprintf(stderr, "%s: e - line %d of \"%s\", bad formal argument list\n", + myname, lineno, input_file_name); + print_pos(line, cptr); + done(1); +} + +void +arg_type_disagree_warning(int a_lineno, int i, char *a_name) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", type of argument %d " + "to %s doesn't agree with previous declaration\n", + myname, a_lineno, input_file_name, i, a_name); +} + +void +unknown_arg_warning(int d_lineno, const char *dlr_opt, const char *d_arg, const char + *d_line, const char *d_cptr) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", unknown argument %s%s\n", + myname, d_lineno, input_file_name, dlr_opt, d_arg); + print_pos(d_line, d_cptr); +} + +void +untyped_arg_warning(int a_lineno, const char *dlr_opt, const char *a_name) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", untyped argument %s%s\n", + myname, a_lineno, input_file_name, dlr_opt, a_name); +} + +void +wrong_number_args_warning(const char *which, const char *a_name) +{ + fprintf(stderr, + "%s: w - line %d of \"%s\", wrong number of %sarguments for %s\n", + myname, lineno, input_file_name, which, a_name); + print_pos(line, cptr); +} + +void +wrong_type_for_arg_warning(int i, char *a_name) +{ + fprintf(stderr, + "%s: w - line %d of \"%s\", wrong type for default argument %d to %s\n", + myname, lineno, input_file_name, i, a_name); + print_pos(line, cptr); +} + +void +start_requires_args(char *a_name) +{ + fprintf(stderr, + "%s: w - line %d of \"%s\", start symbol %s requires arguments\n", + myname, 0, input_file_name, a_name); + +} + +void +destructor_redeclared_warning(int a_lineno, char *a_line, char *a_cptr) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", destructor redeclared\n", + myname, a_lineno, input_file_name); + print_pos(a_line, a_cptr); +} +#endif @@ -1,4 +1,4 @@ -/* $Id: graph.c,v 1.7 2009/10/27 09:25:20 tom Exp $ */ +/* $Id: graph.c,v 1.8 2014/02/19 00:46:57 Tom.Shields Exp $ */ #include "defs.h" @@ -51,10 +51,10 @@ graph(void) static void graph_state(int stateno) { - short *isp; + Value_t *isp; int rule; - short *sp; - short *sp1; + Value_t *sp; + Value_t *sp1; larno = (unsigned)lookaheads[stateno]; fprintf(graph_file, "\n\tq%d [label=\"%d:\\l", stateno, stateno); @@ -1,4 +1,4 @@ -/* $Id: lalr.c,v 1.9 2009/10/27 09:49:27 tom Exp $ */ +/* $Id: lalr.c,v 1.10 2014/02/19 00:35:17 Tom.Shields Exp $ */ #include "defs.h" @@ -196,7 +196,7 @@ set_goto_map(void) if (ISTOKEN(symbol)) break; - if (ngotos == MAXSHORT) + if (ngotos == MAXYYINT) fatal("too many gotos"); ngotos++; @@ -1,4 +1,4 @@ -/* $Id: lr0.c,v 1.13 2012/05/26 00:40:47 tom Exp $ */ +/* $Id: lr0.c,v 1.16 2014/04/07 21:53:50 tom Exp $ */ #include "defs.h" @@ -28,7 +28,7 @@ static shifts *last_shift; static reductions *last_reduction; static int nshifts; -static short *shift_symbol; +static Value_t *shift_symbol; static Value_t *redset; static Value_t *shiftset; @@ -40,16 +40,16 @@ static Value_t *kernel_items; static void allocate_itemsets(void) { - short *itemp; - short *item_end; + Value_t *itemp; + Value_t *item_end; int symbol; int i; int count; int max; - short *symbol_count; + Value_t *symbol_count; count = 0; - symbol_count = NEW2(nsyms, short); + symbol_count = NEW2(nsyms, Value_t); item_end = ritem + nitems; for (itemp = ritem; itemp < item_end; itemp++) @@ -62,8 +62,8 @@ allocate_itemsets(void) } } - kernel_base = NEW2(nsyms, short *); - kernel_items = NEW2(count, short); + kernel_base = NEW2(nsyms, Value_t *); + kernel_items = NEW2(count, Value_t); count = 0; max = 0; @@ -76,15 +76,15 @@ allocate_itemsets(void) } shift_symbol = symbol_count; - kernel_end = NEW2(nsyms, short *); + kernel_end = NEW2(nsyms, Value_t *); } static void allocate_storage(void) { allocate_itemsets(); - shiftset = NEW2(nsyms, short); - redset = NEW2(nrules + 1, short); + shiftset = NEW2(nsyms, Value_t); + redset = NEW2(nrules + 1, Value_t); state_set = NEW2(nitems, core *); } @@ -133,7 +133,7 @@ static void generate_states(void) { allocate_storage(); - itemset = NEW2(nitems, short); + itemset = NEW2(nitems, Value_t); ruleset = NEW2(WORDSIZE(nrules), unsigned); set_first_derives(); initialize_states(); @@ -158,9 +158,9 @@ static Value_t get_state(int symbol) { int key; - short *isp1; - short *isp2; - short *iend; + Value_t *isp1; + Value_t *isp2; + Value_t *iend; core *sp; int found; int n; @@ -220,14 +220,14 @@ static void initialize_states(void) { unsigned i; - short *start_derives; + Value_t *start_derives; core *p; start_derives = derives[start_symbol]; for (i = 0; start_derives[i] >= 0; ++i) continue; - p = (core *)MALLOC(sizeof(core) + i * sizeof(short)); + p = (core *)MALLOC(sizeof(core) + i * sizeof(Value_t)); NO_SPACE(p); p->next = 0; @@ -248,8 +248,8 @@ new_itemsets(void) { Value_t i; int shiftcount; - short *isp; - short *ksp; + Value_t *isp; + Value_t *ksp; Value_t symbol; for (i = 0; i < nsyms; i++) @@ -283,22 +283,22 @@ new_state(int symbol) { unsigned n; core *p; - short *isp1; - short *isp2; - short *iend; + Value_t *isp1; + Value_t *isp2; + Value_t *iend; #ifdef TRACE fprintf(stderr, "Entering new_state(%d)\n", symbol); #endif - if (nstates >= MAXSHORT) + if (nstates >= MAXYYINT) fatal("too many states"); isp1 = kernel_base[symbol]; iend = kernel_end[symbol]; n = (unsigned)(iend - isp1); - p = (core *)allocate((sizeof(core) + (n - 1) * sizeof(short))); + 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; @@ -316,7 +316,7 @@ new_state(int symbol) } /* show_cores is used for debugging */ - +#ifdef DEBUG void show_cores(void) { @@ -393,17 +393,18 @@ show_shifts(void) printf("\t%d\n", p->shift[i]); } } +#endif static void save_shifts(void) { shifts *p; - short *sp1; - short *sp2; - short *send; + Value_t *sp1; + Value_t *sp2; + Value_t *send; p = (shifts *)allocate((sizeof(shifts) + - (unsigned)(nshifts - 1) * sizeof(short))); + (unsigned)(nshifts - 1) * sizeof(Value_t))); p->number = this_state->number; p->nshifts = (Value_t) nshifts; @@ -430,13 +431,13 @@ save_shifts(void) static void save_reductions(void) { - short *isp; - short *rp1; - short *rp2; + Value_t *isp; + Value_t *rp1; + Value_t *rp2; int item; Value_t count; reductions *p; - short *rend; + Value_t *rend; count = 0; for (isp = itemset; isp < itemsetend; isp++) @@ -452,7 +453,7 @@ save_reductions(void) { p = (reductions *)allocate((sizeof(reductions) + (unsigned)(count - 1) * - sizeof(short))); + sizeof(Value_t))); p->number = this_state->number; p->nreds = count; @@ -482,10 +483,10 @@ set_derives(void) { Value_t i, k; int lhs; - short *rules; + Value_t *rules; - derives = NEW2(nsyms, short *); - rules = NEW2(nvars + nrules, short); + derives = NEW2(nsyms, Value_t *); + rules = NEW2(nvars + nrules, Value_t); k = 0; for (lhs = start_symbol; lhs < nsyms; lhs++) @@ -513,7 +514,7 @@ void print_derives(void) { int i; - short *sp; + Value_t *sp; printf("\nDERIVES\n\n"); @@ -592,8 +593,11 @@ lr0(void) void lr0_leaks(void) { - DO_FREE(derives[start_symbol]); - DO_FREE(derives); + if (derives) + { + DO_FREE(derives[start_symbol]); + DO_FREE(derives); + } DO_FREE(nullable); } #endif @@ -1,7 +1,11 @@ -/* $Id: main.c,v 1.41 2014/01/01 14:23:27 Christos.Zoulas Exp $ */ +/* $Id: main.c,v 1.49 2014/04/09 21:25:20 Rick.Spates Exp $ */ #include <signal.h> +#ifndef _WIN32 #include <unistd.h> /* for _exit() */ +#else +#include <stdlib.h> /* for _exit() */ +#endif #include "defs.h" @@ -73,21 +77,30 @@ FILE *union_file; /* a temp file, used to save the union */ FILE *verbose_file; /* y.output */ FILE *graph_file; /* y.dot */ -int nitems; -int nrules; -int nsyms; -int ntokens; -int nvars; +Value_t nitems; +Value_t nrules; +Value_t nsyms; +Value_t ntokens; +Value_t nvars; Value_t start_symbol; char **symbol_name; char **symbol_pname; Value_t *symbol_value; -short *symbol_prec; +Value_t *symbol_prec; char *symbol_assoc; int pure_parser; int token_table; + +#if defined(YYBTYACC) +Value_t *symbol_pval; +char **symbol_destructor; +char **symbol_type_tag; +int locations = 0; /* default to no position processing */ +int backtrack = 0; /* default is no backtracking */ +#endif + int exit_code; Value_t *ritem; @@ -116,6 +129,10 @@ done(int k) { DO_CLOSE(input_file); DO_CLOSE(output_file); + if (iflag) + DO_CLOSE(externs_file); + if (rflag) + DO_CLOSE(code_file); DO_CLOSE(action_file); DO_CLOSE(defines_file); @@ -153,9 +170,6 @@ done(int k) reader_leaks(); #endif - if (rflag) - DO_CLOSE(code_file); - exit(k); } @@ -191,11 +205,14 @@ usage(void) "" ,"Options:" ," -b file_prefix set filename prefix (default \"y.\")" - ," -d write definitions (y.tab.h)" + ," -B create a backtracking parser" + ," -d write definitions (" DEFINES_SUFFIX ")" + ," -D enable value stack memory reclamation" ," -i write interface (y.tab.i)" ," -g write a graphical description" ," -l suppress #line directives" - ," -o output_file (default \"y.tab.c\")" + ," -L enable position processing, e.g., \"%locations\"" + ," -o output_file (default \"" OUTPUT_SUFFIX "\")" ," -p symbol_prefix set symbol prefix (default \"yy\")" ," -P create a reentrant parser, e.g., \"%pure-parser\"" ," -r produce separate code and table files (y.code.c)" @@ -219,6 +236,14 @@ setflag(int ch) { switch (ch) { + case 'B': +#if defined(YYBTYACC) + backtrack = 1; +#else + unsupported_flag_warning("-B", "reconfigure with --enable-btyacc"); +#endif + break; + case 'd': dflag = 1; break; @@ -235,6 +260,14 @@ setflag(int ch) lflag = 1; break; + case 'L': +#if defined(YYBTYACC) + locations = 1; +#else + unsupported_flag_warning("-B", "reconfigure with --enable-btyacc"); +#endif + break; + case 'P': pure_parser = 1; break; @@ -364,10 +397,18 @@ allocate(size_t n) } #define CREATE_FILE_NAME(dest, suffix) \ - dest = TMALLOC(char, len + strlen(suffix) + 1); \ - NO_SPACE(dest); \ - strcpy(dest, file_prefix); \ - strcpy(dest + len, suffix) + dest = alloc_file_name(len, suffix) + +static char * +alloc_file_name(size_t len, const char *suffix) +{ + char *result = TMALLOC(char, len + strlen(suffix) + 1); + if (result == 0) + no_space(); + strcpy(result, file_prefix); + strcpy(result + len, suffix); + return result; +} static void create_file_names(void) @@ -384,7 +425,7 @@ create_file_names(void) /* compute the file_prefix from the user provided output_file_name */ if (output_file_name != 0) { - if (!(prefix = strstr(output_file_name, ".tab.c")) + if (!(prefix = strstr(output_file_name, OUTPUT_SUFFIX)) && (prefix = strstr(output_file_name, ".c"))) { defines_suffix = ".h"; diff --git a/makefile.in b/makefile.in index 3da923869409..1701862fe2a6 100644 --- a/makefile.in +++ b/makefile.in @@ -1,4 +1,4 @@ -# $Id: makefile.in,v 1.19 2014/01/01 14:09:43 tom Exp $ +# $Id: makefile.in,v 1.23 2014/04/09 12:15:52 tom Exp $ # # UNIX template-makefile for Berkeley Yacc @@ -24,9 +24,11 @@ CFLAGS = @CFLAGS@ $(CPPFLAGS) $(EXTRA_CFLAGS) LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ +AWK = @AWK@ CTAGS = @CTAGS@ ETAGS = @ETAGS@ LINT = @LINT@ +LINTFLAGS = @LINT_OPTS@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -38,6 +40,7 @@ manext = 1 testdir = $(srcdir)/test +SKELETON = @SKELETON@ x = @EXEEXT@ o = .@OBJEXT@ @@ -57,9 +60,10 @@ C_FILES = \ lr0.c \ main.c \ mkpar.c \ + mstring.c \ output.c \ reader.c \ - skeleton.c \ + $(SKELETON).c \ symtab.c \ verbose.c \ warshall.c @@ -72,13 +76,18 @@ OBJS = \ lr0$o \ main$o \ mkpar$o \ + mstring$o \ output$o \ reader$o \ - skeleton$o \ + $(SKELETON)$o \ symtab$o \ verbose$o \ warshall$o +YACCPAR = \ + btyaccpar.c \ + yaccpar.c + TRANSFORM_BIN = sed 's/$x$$//' |sed '$(transform)'|sed 's/$$/$x/' TRANSFORM_MAN = sed 's/$(manext)$$//'|sed '$(transform)'|sed 's/$$/$(manext)/' @@ -100,7 +109,7 @@ uninstall: - rm -f $(mandir)/$(actual_man) ################################################################################ -.SUFFIXES : $o .i +.SUFFIXES : .c $o .i .skel .c$o: @RULE_CC@ @@ -110,6 +119,9 @@ uninstall: @RULE_CC@ @ECHO_CC@$(CPP) -C $(CPPFLAGS) $*.c >$@ +.skel.c : + $(AWK) -f $(srcdir)/skel2c $*.skel > $@ + ################################################################################ $(THIS)$x : $(OBJS) @@ -123,11 +135,16 @@ clean :: mostlyclean distclean :: clean - rm -f config.log config.cache config.status config.h makefile - - cd test && rm -f test-* + - rm -f $(testdir)/yacc/test-* $(testdir)/btyacc/test-* realclean :: distclean - rm -f tags TAGS +sources : $(YACCPAR) + +maintainer-clean :: realclean + rm -f $(YACCPAR) + ################################################################################ check: $(THIS)$x $(SHELL) $(testdir)/run_test.sh $(testdir) @@ -142,7 +159,7 @@ tags: $(H_FILES) $(C_FILES) $(CTAGS) $(C_FILES) $(H_FILES) lint: $(C_FILES) - $(LINT) $(CPPFLAGS) $(C_FILES) + $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(C_FILES) @MAKE_UPPER_TAGS@TAGS: $(H_FILES) $(C_FILES) @MAKE_UPPER_TAGS@ $(ETAGS) $(C_FILES) $(H_FILES) @@ -150,9 +167,9 @@ lint: $(C_FILES) depend: makedepend -- $(CPPFLAGS) -- $(C_FILES) -$(OBJS) : defs.h +$(OBJS) : defs.h makefile main$o \ -skeleton$o : makefile VERSION +$(SKELETON)$o : VERSION # DO NOT DELETE THIS LINE -- make depend depends on it. @@ -1,7 +1,18 @@ -/* $Id: mkpar.c,v 1.12 2012/05/26 00:42:18 tom Exp $ */ +/* $Id: mkpar.c,v 1.14 2014/04/01 23:05:37 tom Exp $ */ #include "defs.h" +#define NotSuppressed(p) ((p)->suppressed == 0) + +#if defined(YYBTYACC) +#define MaySuppress(p) ((backtrack ? ((p)->suppressed <= 1) : (p)->suppressed == 0)) + /* suppress the preferred action => enable backtracking */ +#define StartBacktrack(p) if (backtrack && (p) != NULL && NotSuppressed(p)) (p)->suppressed = 1 +#else +#define MaySuppress(p) ((p)->suppressed == 0) +#define StartBacktrack(p) /*nothing */ +#endif + static action *add_reduce(action *actions, int ruleno, int symbol); static action *add_reductions(int stateno, action *actions); static action *get_shifts(int stateno); @@ -190,7 +201,7 @@ unused_rules(void) { for (p = parser[i]; p; p = p->next) { - if (p->action_code == REDUCE && p->suppressed == 0) + if ((p->action_code == REDUCE) && MaySuppress(p)) rules_used[p->number] = 1; } } @@ -225,17 +236,23 @@ remove_conflicts(void) SRcount = 0; RRcount = 0; symbol = -1; +#if defined(YYBTYACC) + pref = NULL; +#endif for (p = parser[i]; p; p = p->next) { if (p->symbol != symbol) { + /* the first parse action for each symbol is the preferred action */ pref = p; symbol = p->symbol; } + /* following conditions handle multiple, i.e., conflicting, parse actions */ else if (i == final_state && symbol == 0) { SRcount++; p->suppressed = 1; + StartBacktrack(pref); } else if (pref != 0 && pref->action_code == SHIFT) { @@ -269,12 +286,14 @@ remove_conflicts(void) { SRcount++; p->suppressed = 1; + StartBacktrack(pref); } } else { RRcount++; p->suppressed = 1; + StartBacktrack(pref); } } SRtotal += SRcount; @@ -329,9 +348,9 @@ sole_reduction(int stateno) ruleno = 0; for (p = parser[stateno]; p; p = p->next) { - if (p->action_code == SHIFT && p->suppressed == 0) + if (p->action_code == SHIFT && MaySuppress(p)) return (0); - else if (p->action_code == REDUCE && p->suppressed == 0) + else if ((p->action_code == REDUCE) && MaySuppress(p)) { if (ruleno > 0 && p->number != ruleno) return (0); diff --git a/mstring.c b/mstring.c new file mode 100644 index 000000000000..d3d1f834e4b8 --- /dev/null +++ b/mstring.c @@ -0,0 +1,152 @@ +/* $Id: mstring.c,v 1.3 2014/04/08 20:37:26 tom Exp $ */ + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <ctype.h> +#include <string.h> +#include "defs.h" + +/* parameters about string length. HEAD is the starting size and +** HEAD+TAIL should be a power of two */ +#define HEAD 24 +#define TAIL 8 + +#if defined(YYBTYACC) +void +msprintf(struct mstring *s, const char *fmt,...) +{ + static char buf[4096]; /* a big static buffer */ + va_list args; + size_t len; + + if (!s || !s->base) + return; + va_start(args, fmt); + vsprintf(buf, fmt, args); + va_end(args); + + len = strlen(buf); + if (len > (size_t) (s->end - s->ptr)) + { + size_t cp = (size_t) (s->ptr - s->base); + size_t cl = (size_t) (s->end - s->base); + size_t nl = cl; + while (len > (nl - cp)) + nl = nl + nl + TAIL; + if ((s->base = realloc(s->base, nl))) + { + s->ptr = s->base + cp; + s->end = s->base + nl; + } + else + { + s->ptr = s->end = 0; + return; + } + } + memcpy(s->ptr, buf, len); + s->ptr += len; +} +#endif + +int +mputchar(struct mstring *s, int ch) +{ + if (!s || !s->base) + return ch; + if (s->ptr == s->end) + { + size_t len = (size_t) (s->end - s->base); + if ((s->base = realloc(s->base, len + len + TAIL))) + { + s->ptr = s->base + len; + s->end = s->base + len + len + TAIL; + } + else + { + s->ptr = s->end = 0; + return ch; + } + } + *s->ptr++ = (char)ch; + return ch; +} + +struct mstring * +msnew(void) +{ + struct mstring *n = malloc(sizeof(struct mstring)); + + if (n) + { + if ((n->base = n->ptr = malloc(HEAD)) != 0) + { + n->end = n->base + HEAD; + } + else + { + free(n); + n = 0; + } + } + return n; +} + +char * +msdone(struct mstring *s) +{ + char *r = 0; + if (s) + { + mputc(s, 0); + r = s->base; + free(s); + } + return r; +} + +#if defined(YYBTYACC) +/* compare two strings, ignoring whitespace, except between two letters or +** digits (and treat all of these as equal) */ +int +strnscmp(const char *a, const char *b) +{ + while (1) + { + while (isspace(*a)) + a++; + while (isspace(*b)) + b++; + while (*a && *a == *b) + a++, b++; + if (isspace(*a)) + { + if (isalnum(a[-1]) && isalnum(*b)) + break; + } + else if (isspace(*b)) + { + if (isalnum(b[-1]) && isalnum(*a)) + break; + } + else + break; + } + return *a - *b; +} + +unsigned int +strnshash(const char *s) +{ + unsigned int h = 0; + + while (*s) + { + if (!isspace(*s)) + h = (h << 5) - h + (unsigned char)*s; + s++; + } + return h; +} +#endif @@ -1,14 +1,24 @@ -/* $Id: output.c,v 1.47 2014/01/01 17:22:38 tom Exp $ */ +/* $Id: output.c,v 1.65 2014/04/09 21:10:48 tom Exp $ */ #include "defs.h" #define StaticOrR (rflag ? "" : "static ") #define CountLine(fp) (!rflag || ((fp) == code_file)) +#if defined(YYBTYACC) +#define PER_STATE 3 +#else +#define PER_STATE 2 +#endif + static int nvectors; static int nentries; static Value_t **froms; static Value_t **tos; +#if defined(YYBTYACC) +static Value_t *conflicts = NULL; +static Value_t nconflicts = 0; +#endif static Value_t *tally; static Value_t *width; static Value_t *state_count; @@ -19,7 +29,7 @@ static int maxtable; static Value_t *table; static Value_t *check; static int lowzero; -static int high; +static long high; static void putc_code(FILE * fp, int c) @@ -49,7 +59,7 @@ write_code_lineno(FILE * fp) if (!lflag && (fp == code_file)) { ++outline; - fprintf(fp, line_format, outline, code_file_name); + fprintf(fp, line_format, outline + 1, code_file_name); } } @@ -105,6 +115,9 @@ output_prefix(FILE * fp) define_prefixed(fp, "yylhs"); define_prefixed(fp, "yylen"); define_prefixed(fp, "yydefred"); +#if defined(YYBTYACC) + define_prefixed(fp, "yystos"); +#endif define_prefixed(fp, "yydgoto"); define_prefixed(fp, "yysindex"); define_prefixed(fp, "yyrindex"); @@ -113,6 +126,22 @@ output_prefix(FILE * fp) define_prefixed(fp, "yycheck"); define_prefixed(fp, "yyname"); define_prefixed(fp, "yyrule"); +#if defined(YYBTYACC) + if (locations) + { + define_prefixed(fp, "yyloc"); + define_prefixed(fp, "yylloc"); + } + putc_code(fp, '\n'); + putl_code(fp, "#if YYBTYACC\n"); + + define_prefixed(fp, "yycindex"); + define_prefixed(fp, "yyctable"); + + putc_code(fp, '\n'); + putl_code(fp, "#endif /* YYBTYACC */\n"); + putc_code(fp, '\n'); +#endif } if (CountLine(fp)) ++outline; @@ -148,7 +177,7 @@ start_int_table(const char *name, int value) if (need < 6) need = 6; fprintf(output_file, - "%sconst short %s%s[] = {%*d,", + "%sconst YYINT %s%s[] = {%*d,", StaticOrR, symbol_prefix, name, need, value); } @@ -156,8 +185,8 @@ static void start_str_table(const char *name) { fprintf(output_file, - "%sconst char *%s%s[] = {", - StaticOrR, "yy", name); + "%sconst char *const %s%s[] = {", + StaticOrR, symbol_prefix, name); output_newline(); } @@ -169,11 +198,22 @@ end_table(void) } static void +output_YYINT_typedef(FILE * fp) +{ + /* generate the type used to index the various parser tables */ + if (CountLine(fp)) + ++outline; + fprintf(fp, "typedef %s YYINT;\n", CONCAT1("", YYINT)); +} + +static void output_rule_data(void) { int i; int j; + output_YYINT_typedef(output_file); + start_int_table("lhs", symbol_value[start_symbol]); j = 10; @@ -233,27 +273,123 @@ output_yydefred(void) end_table(); } +#if defined(YYBTYACC) +static void +output_accessing_symbols(void) +{ + int i, j; + int *translate; + + if (nstates != 0) + { + translate = TMALLOC(int, nstates); + NO_SPACE(translate); + + for (i = 0; i < nstates; ++i) + { + int gsymb = accessing_symbol[i]; + + translate[i] = symbol_pval[gsymb]; + } + + /* yystos[] may be unused, depending on compile-time defines */ + start_int_table("stos", translate[0]); + + j = 10; + for (i = 1; i < nstates; ++i) + { + if (j < 10) + ++j; + else + { + output_newline(); + j = 1; + } + + output_int(translate[i]); + } + + end_table(); + FREE(translate); + } +} + +static Value_t +find_conflict_base(Value_t cbase) +{ + Value_t i, j; + + for (i = 0; i < cbase; i++) + { + for (j = 0; j + cbase < nconflicts; j++) + { + if (conflicts[i + j] != conflicts[cbase + j]) + break; + } + if (j + cbase >= nconflicts) + return i; + } + return cbase; +} +#endif + static void token_actions(void) { int i, j; Value_t shiftcount, reducecount; +#if defined(YYBTYACC) + Value_t conflictcount = 0; + Value_t csym = -1; + Value_t cbase = 0; +#endif int max, min; Value_t *actionrow, *r, *s; action *p; - actionrow = NEW2(2 * ntokens, Value_t); + actionrow = NEW2(PER_STATE * ntokens, Value_t); for (i = 0; i < nstates; ++i) { if (parser[i]) { - for (j = 0; j < 2 * ntokens; ++j) + for (j = 0; j < PER_STATE * ntokens; ++j) actionrow[j] = 0; shiftcount = 0; reducecount = 0; +#if defined(YYBTYACC) + if (backtrack) + { + conflictcount = 0; + csym = -1; + cbase = nconflicts; + } +#endif for (p = parser[i]; p; p = p->next) { +#if defined(YYBTYACC) + if (backtrack) + { + if (csym != -1 && csym != p->symbol) + { + conflictcount++; + conflicts[nconflicts++] = -1; + j = find_conflict_base(cbase); + actionrow[csym + 2 * ntokens] = (Value_t) (j + 1); + if (j == cbase) + { + cbase = nconflicts; + } + else + { + if (conflicts[cbase] == -1) + cbase++; + nconflicts = cbase; + } + csym = -1; + } + } +#endif if (p->suppressed == 0) { if (p->action_code == SHIFT) @@ -267,17 +403,65 @@ token_actions(void) actionrow[p->symbol + ntokens] = p->number; } } +#if defined(YYBTYACC) + else if (backtrack && p->suppressed == 1) + { + csym = p->symbol; + if (p->action_code == SHIFT) + { + conflicts[nconflicts++] = p->number; + } + else if (p->action_code == REDUCE && p->number != defred[i]) + { + if (cbase == nconflicts) + { + if (cbase) + cbase--; + else + conflicts[nconflicts++] = -1; + } + conflicts[nconflicts++] = (Value_t) (p->number - 2); + } + } +#endif } +#if defined(YYBTYACC) + if (backtrack && csym != -1) + { + conflictcount++; + conflicts[nconflicts++] = -1; + j = find_conflict_base(cbase); + actionrow[csym + 2 * ntokens] = (Value_t) (j + 1); + if (j == cbase) + { + cbase = nconflicts; + } + else + { + if (conflicts[cbase] == -1) + cbase++; + nconflicts = cbase; + } + } +#endif tally[i] = shiftcount; tally[nstates + i] = reducecount; +#if defined(YYBTYACC) + if (backtrack) + tally[2 * nstates + i] = conflictcount; +#endif width[i] = 0; width[nstates + i] = 0; +#if defined(YYBTYACC) + if (backtrack) + width[2 * nstates + i] = 0; +#endif if (shiftcount > 0) { froms[i] = r = NEW2(shiftcount, Value_t); tos[i] = s = NEW2(shiftcount, Value_t); - min = MAXSHORT; + min = MAXYYINT; max = 0; for (j = 0; j < ntokens; ++j) { @@ -297,7 +481,7 @@ token_actions(void) { froms[nstates + i] = r = NEW2(reducecount, Value_t); tos[nstates + i] = s = NEW2(reducecount, Value_t); - min = MAXSHORT; + min = MAXYYINT; max = 0; for (j = 0; j < ntokens; ++j) { @@ -313,6 +497,28 @@ token_actions(void) } width[nstates + i] = (Value_t) (max - min + 1); } +#if defined(YYBTYACC) + if (backtrack && conflictcount > 0) + { + froms[2 * nstates + i] = r = NEW2(conflictcount, Value_t); + tos[2 * nstates + i] = s = NEW2(conflictcount, Value_t); + min = MAXYYINT; + max = 0; + for (j = 0; j < ntokens; ++j) + { + if (actionrow[2 * ntokens + j]) + { + if (min > symbol_value[j]) + min = symbol_value[j]; + if (max < symbol_value[j]) + max = symbol_value[j]; + *r++ = symbol_value[j]; + *s++ = (Value_t) (actionrow[2 * ntokens + j] - 1); + } + } + width[2 * nstates + i] = (Value_t) (max - min + 1); + } +#endif } } FREE(actionrow); @@ -377,7 +583,7 @@ save_column(int symbol, int default_state) if (count == 0) return; - symno = symbol_value[symbol] + 2 * nstates; + symno = symbol_value[symbol] + PER_STATE * nstates; froms[symno] = sp1 = sp = NEW2(count, Value_t); tos[symno] = sp2 = NEW2(count, Value_t); @@ -476,6 +682,11 @@ sort_actions(void) /* Matching_vector is poorly designed. The test could easily be made */ /* faster. Also, it depends on the vectors being in a specific */ /* order. */ +#if defined(YYBTYACC) +/* */ +/* Not really any point in checking for matching conflicts -- it is */ +/* extremely unlikely to occur, and conflicts are (hopefully) rare. */ +#endif static int matching_vector(int vector) @@ -639,9 +850,11 @@ pack_table(void) FREE(tos[i]); } - FREE(froms); - FREE(tos); - FREE(pos); + DO_FREE(froms); + DO_FREE(tos); + DO_FREE(tally); + DO_FREE(width); + DO_FREE(pos); } static void @@ -685,10 +898,32 @@ output_base(void) end_table(); - start_int_table("gindex", base[2 * nstates]); +#if defined(YYBTYACC) + output_line("#if YYBTYACC"); + start_int_table("cindex", base[2 * nstates]); + + j = 10; + for (i = 2 * nstates + 1; i < 3 * nstates; i++) + { + if (j >= 10) + { + output_newline(); + j = 1; + } + else + ++j; + + output_int(base[i]); + } + + end_table(); + output_line("#endif"); +#endif + + start_int_table("gindex", base[PER_STATE * nstates]); j = 10; - for (i = 2 * nstates + 1; i < nvectors - 1; i++) + for (i = PER_STATE * nstates + 1; i < nvectors - 1; i++) { if (j >= 10) { @@ -711,8 +946,15 @@ output_table(void) int i; int j; + if (high >= MAXYYINT) + { + fprintf(stderr, "YYTABLESIZE: %ld\n", high); + fprintf(stderr, "Table is longer than %d elements.\n", MAXYYINT); + done(1); + } + ++outline; - fprintf(code_file, "#define YYTABLESIZE %d\n", high); + fprintf(code_file, "#define YYTABLESIZE %ld\n", high); start_int_table("table", table[0]); j = 10; @@ -759,16 +1001,54 @@ output_check(void) FREE(check); } +#if defined(YYBTYACC) +static void +output_ctable(void) +{ + int i; + int j; + + if (conflicts) + { + output_line("#if YYBTYACC"); + start_int_table("ctable", conflicts[0]); + + j = 10; + for (i = 1; i < nconflicts; i++) + { + if (j >= 10) + { + output_newline(); + j = 1; + } + else + ++j; + + output_int(conflicts[i]); + } + + end_table(); + output_line("#endif"); + FREE(conflicts); + } +} +#endif + static void output_actions(void) { - nvectors = 2 * nstates + nvars; + nvectors = PER_STATE * nstates + nvars; froms = NEW2(nvectors, Value_t *); tos = NEW2(nvectors, Value_t *); tally = NEW2(nvectors, Value_t); width = NEW2(nvectors, Value_t); +#if defined(YYBTYACC) + if (backtrack && (SRtotal + RRtotal) != 0) + conflicts = NEW2(4 * (SRtotal + RRtotal), Value_t); +#endif + token_actions(); FREE(lookaheads); FREE(LA); @@ -785,6 +1065,9 @@ output_actions(void) output_base(); output_table(); output_check(); +#if defined(YYBTYACC) + output_ctable(); +#endif } static int @@ -818,6 +1101,24 @@ is_C_identifier(char *name) return (1); } +#if USE_HEADER_GUARDS +static void +start_defines_file(void) +{ + fprintf(defines_file, "#ifndef _%s_defines_h_\n", symbol_prefix); + fprintf(defines_file, "#define _%s_defines_h_\n\n", symbol_prefix); +} + +static void +end_defines_file(void) +{ + fprintf(defines_file, "\n#endif /* _%s_defines_h_ */\n", symbol_prefix); +} +#else +#define start_defines_file() /* nothing */ +#define end_defines_file() /* nothing */ +#endif + static void output_defines(FILE * fp) { @@ -865,7 +1166,7 @@ output_defines(FILE * fp) { rewind(union_file); while ((c = getc(union_file)) != EOF) - putc(c, fp); + putc_code(fp, c); } fprintf(fp, "extern YYSTYPE %slval;\n", symbol_prefix); } @@ -895,7 +1196,7 @@ output_stored_text(FILE * fp) static void output_debug(void) { - int i, j, k, max; + int i, j, k, max, maxtok; const char **symnam; const char *s; @@ -914,32 +1215,52 @@ output_debug(void) fprintf(output_file, "#endif\n"); } - max = 0; - for (i = 2; i < ntokens; ++i) - if (symbol_value[i] > max) - max = symbol_value[i]; + maxtok = 0; + for (i = 0; i < ntokens; ++i) + if (symbol_value[i] > maxtok) + maxtok = symbol_value[i]; + + /* symbol_value[$accept] = -1 */ + /* symbol_value[<goal>] = 0 */ + /* remaining non-terminals start at 1 */ + max = maxtok; + for (i = ntokens; i < nsyms; ++i) + if (((maxtok + 1) + (symbol_value[i] + 1)) > max) + max = (maxtok + 1) + (symbol_value[i] + 1); + + ++outline; + fprintf(code_file, "#define YYMAXTOKEN %d\n", maxtok); + + ++outline; + fprintf(code_file, "#define YYUNDFTOKEN %d\n", max + 1); ++outline; - fprintf(code_file, "#define YYMAXTOKEN %d\n", max); fprintf(code_file, "#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? " - "(YYMAXTOKEN + 1) : (a))\n"); + "YYUNDFTOKEN : (a))\n"); symnam = TMALLOC(const char *, max + 2); NO_SPACE(symnam); - /* Note that it is not necessary to initialize the element */ + /* Note that it is not necessary to initialize the element */ /* symnam[max]. */ +#if defined(YYBTYACC) + for (i = 0; i < max; ++i) + symnam[i] = 0; + for (i = nsyms - 1; i >= 0; --i) + symnam[symbol_pval[i]] = symbol_name[i]; + symnam[max + 1] = "illegal-symbol"; +#else for (i = 0; i <= max; ++i) symnam[i] = 0; for (i = ntokens - 1; i >= 2; --i) symnam[symbol_value[i]] = symbol_name[i]; symnam[0] = "end-of-file"; symnam[max + 1] = "illegal-symbol"; +#endif /* * bison's yytname[] array is roughly the same as byacc's yyname[] array. - * The difference is that byacc does not predefine "$end", "$error" or - * "$undefined". + * The difference is that byacc does not predefine "$undefined". * * If the grammar declares "%token-table", define symbol "yytname" so * an application such as ntpd can build. @@ -1133,13 +1454,34 @@ output_debug(void) output_line("#endif"); } +#if defined(YYBTYACC) +static void +output_backtracking_parser(FILE * fp) +{ + putl_code(fp, "#undef YYBTYACC\n"); +#if defined(YYBTYACC) + if (backtrack) + { + putl_code(fp, "#define YYBTYACC 1\n"); + putl_code(fp, + "#define YYDEBUGSTR (yytrial ? YYPREFIX \"debug(trial)\" : YYPREFIX \"debug\")\n"); + } + else +#endif + { + putl_code(fp, "#define YYBTYACC 0\n"); + putl_code(fp, "#define YYDEBUGSTR YYPREFIX \"debug\"\n"); + } +} +#endif + static void output_pure_parser(FILE * fp) { putc_code(fp, '\n'); if (fp == code_file) - outline += 1; + ++outline; fprintf(fp, "#define YYPURE %d\n", pure_parser); putc_code(fp, '\n'); } @@ -1150,12 +1492,35 @@ output_stype(FILE * fp) if (!unionized && ntags == 0) { putc_code(fp, '\n'); - putl_code(fp, "#ifndef YYSTYPE\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) { @@ -1229,7 +1594,7 @@ output_semantic_actions(void) static void output_parse_decl(FILE * fp) { - putl_code(fp, "\n"); + putc_code(fp, '\n'); putl_code(fp, "/* compatibility with bison */\n"); putl_code(fp, "#ifdef YYPARSE_PARAM\n"); putl_code(fp, "/* compatibility with FreeBSD */\n"); @@ -1259,19 +1624,45 @@ output_parse_decl(FILE * fp) static void output_lex_decl(FILE * fp) { - putl_code(fp, "\n"); + putc_code(fp, '\n'); putl_code(fp, "/* Parameters sent to lex. */\n"); putl_code(fp, "#ifdef YYLEX_PARAM\n"); if (pure_parser) { putl_code(fp, "# ifdef YYLEX_PARAM_TYPE\n"); - putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval," - " YYLEX_PARAM_TYPE YYLEX_PARAM)\n"); +#if defined(YYBTYACC) + if (locations) + { + putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLTYPE *yylloc," + " YYLEX_PARAM_TYPE YYLEX_PARAM)\n"); + } + else +#endif + { + putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval," + " YYLEX_PARAM_TYPE YYLEX_PARAM)\n"); + } putl_code(fp, "# else\n"); - putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval," - " void * YYLEX_PARAM)\n"); +#if defined(YYBTYACC) + if (locations) + { + putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLTYPE *yylloc," + " void * YYLEX_PARAM)\n"); + } + else +#endif + { + putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval," + " void * YYLEX_PARAM)\n"); + } putl_code(fp, "# endif\n"); - putl_code(fp, "# define YYLEX yylex(&yylval, YYLEX_PARAM)\n"); +#if defined(YYBTYACC) + if (locations) + putl_code(fp, + "# define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)\n"); + else +#endif + putl_code(fp, "# define YYLEX yylex(&yylval, YYLEX_PARAM)\n"); } else { @@ -1282,25 +1673,49 @@ output_lex_decl(FILE * fp) if (pure_parser && lex_param) { param *p; - puts_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, "); + +#if defined(YYBTYACC) + if (locations) + puts_code(fp, + "# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLTYPE *yylloc, "); + else +#endif + puts_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, "); for (p = lex_param; p; p = p->next) fprintf(fp, "%s %s%s%s", p->type, p->name, p->type2, p->next ? ", " : ""); putl_code(fp, ")\n"); - puts_code(fp, "# define YYLEX yylex(&yylval, "); +#if defined(YYBTYACC) + if (locations) + puts_code(fp, "# define YYLEX yylex(&yylval, &yylloc, "); + else +#endif + puts_code(fp, "# define YYLEX yylex(&yylval, "); for (p = lex_param; p; p = p->next) fprintf(fp, "%s%s", p->name, p->next ? ", " : ""); putl_code(fp, ")\n"); } else if (pure_parser) { - putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval)\n"); - putl_code(fp, "# define YYLEX yylex(&yylval)\n"); +#if defined(YYBTYACC) + if (locations) + { + putl_code(fp, + "# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLTYPE *yylloc)\n"); + putl_code(fp, "# define YYLEX yylex(&yylval, &yylloc)\n"); + } + else +#endif + { + putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval)\n"); + putl_code(fp, "# define YYLEX yylex(&yylval)\n"); + } } else if (lex_param) { param *p; + puts_code(fp, "# define YYLEX_DECL() yylex("); for (p = lex_param; p; p = p->next) fprintf(fp, "%s %s%s%s", p->type, p->name, p->type2, @@ -1323,38 +1738,100 @@ output_lex_decl(FILE * fp) static void output_error_decl(FILE * fp) { - putl_code(fp, "\n"); + param *p; + + putc_code(fp, '\n'); putl_code(fp, "/* Parameters sent to yyerror. */\n"); - if (parse_param) - { - param *p; + putl_code(fp, "#ifndef YYERROR_DECL\n"); + puts_code(fp, "#define YYERROR_DECL() yyerror("); +#if defined(YYBTYACC) + if (locations) + puts_code(fp, "YYLTYPE loc, "); +#endif + for (p = parse_param; p; p = p->next) + fprintf(fp, "%s %s%s, ", p->type, p->name, p->type2); + putl_code(fp, "const char *s)\n"); + putl_code(fp, "#endif\n"); - putl_code(fp, "#ifndef YYERROR_DECL\n"); - fprintf(fp, "#define YYERROR_DECL() yyerror("); - for (p = parse_param; p; p = p->next) - fprintf(fp, "%s %s%s, ", p->type, p->name, p->type2); - putl_code(fp, "const char *s)\n"); - putl_code(fp, "#endif\n"); + putl_code(fp, "#ifndef YYERROR_CALL\n"); + puts_code(fp, "#define YYERROR_CALL(msg) yyerror("); - putl_code(fp, "#ifndef YYERROR_CALL\n"); - puts_code(fp, "#define YYERROR_CALL(msg) yyerror("); +#if defined(YYBTYACC) + if (locations) + puts_code(fp, "yylloc, "); +#endif + for (p = parse_param; p; p = p->next) + fprintf(fp, "%s, ", p->name); - for (p = parse_param; p; p = p->next) - fprintf(fp, "%s, ", p->name); + putl_code(fp, "msg)\n"); + putl_code(fp, "#endif\n"); +} - putl_code(fp, "msg)\n"); - putl_code(fp, "#endif\n"); - } +#if defined(YYBTYACC) +static void +output_yydestruct_decl(FILE * fp) +{ + putc_code(fp, '\n'); + putl_code(fp, "#ifndef YYDESTRUCT_DECL\n"); +#if defined(YYBTYACC) + if (locations) + putl_code(fp, + "#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)\n"); else +#endif + putl_code(fp, + "#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val)\n"); + putl_code(fp, "#endif\n"); + putl_code(fp, "#ifndef YYDESTRUCT_CALL\n"); +#if defined(YYBTYACC) + if (locations) + putl_code(fp, + "#define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)\n"); + else +#endif + putl_code(fp, + "#define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val)\n"); + putl_code(fp, "#endif\n"); +} + +static void +output_yydestruct_impl(void) +{ + int i; + char *s, *destructor_code; + + putc_code(code_file, '\n'); + putl_code(code_file, "/* Release memory associated with symbol. */\n"); + putl_code(code_file, "#if ! defined YYDESTRUCT_IS_DECLARED\n"); + putl_code(code_file, "static void\n"); + putl_code(code_file, "YYDESTRUCT_DECL()\n"); + putl_code(code_file, "{\n"); + putl_code(code_file, " switch (psymb)\n"); + putl_code(code_file, " {\n"); + for (i = 2; i < nsyms; ++i) { - putl_code(fp, "#ifndef YYERROR_DECL\n"); - putl_code(fp, "#define YYERROR_DECL() yyerror(const char *s)\n"); - putl_code(fp, "#endif\n"); - putl_code(fp, "#ifndef YYERROR_CALL\n"); - putl_code(fp, "#define YYERROR_CALL(msg) yyerror(msg)\n"); - putl_code(fp, "#endif\n"); + if ((destructor_code = symbol_destructor[i]) != NULL) + { + ++outline; + fprintf(code_file, "\tcase %d:\n", symbol_pval[i]); + /* comprehend the number of lines in the destructor code */ + for (s = destructor_code; (s = strchr(s, '\n')) != NULL; s++) + ++outline; + puts_code(code_file, destructor_code); + putc_code(code_file, '\n'); + putl_code(code_file, "\tbreak;\n"); + write_code_lineno(code_file); + FREE(destructor_code); + } } + putl_code(code_file, " }\n"); + putl_code(code_file, "}\n"); + putl_code(code_file, "#define YYDESTRUCT_IS_DECLARED 1\n"); + putl_code(code_file, "#endif\n"); + + DO_FREE(symbol_destructor); } +#endif static void free_itemsets(void) @@ -1396,41 +1873,20 @@ free_reductions(void) } static void -output_yyerror_call(const char *msg) -{ - FILE *fp = code_file; - - puts_code(fp, " yyerror("); - if (parse_param) - { - param *p; - for (p = parse_param; p; p = p->next) - fprintf(fp, "%s, ", p->name); - } - puts_code(fp, "\""); - puts_code(fp, msg); - putl_code(fp, "\");\n"); -} - -static void output_externs(FILE * fp, const char *const section[]) { - int c; int i; const char *s; for (i = 0; (s = section[i]) != 0; ++i) { - if (*s && *s != '#') + /* prefix non-blank lines that don't start with + C pre-processor directives with 'extern ' */ + if (*s && (*s != '#')) fputs("extern\t", fp); - while ((c = *s) != 0) - { - putc(c, fp); - ++s; - } if (fp == code_file) ++outline; - putc('\n', fp); + fprintf(fp, "%s\n", s); } } @@ -1443,8 +1899,15 @@ output(void) free_shifts(); free_reductions(); +#if defined(YYBTYACC) + output_backtracking_parser(output_file); + if (rflag) + output_backtracking_parser(code_file); +#endif + if (iflag) { + write_code_lineno(code_file); ++outline; fprintf(code_file, "#include \"%s\"\n", externs_file_name); fp = externs_file; @@ -1452,14 +1915,25 @@ output(void) else fp = code_file; - output_prefix(iflag ? externs_file : output_file); + output_prefix(fp); output_pure_parser(fp); output_stored_text(fp); output_stype(fp); +#if defined(YYBTYACC) + if (locations) + output_ltype(fp); +#endif output_parse_decl(fp); output_lex_decl(fp); output_error_decl(fp); - write_section(fp, xdecls); +#if defined(YYBTYACC) + if (destructor) + output_yydestruct_decl(fp); +#endif + if (iflag || !rflag) + { + write_section(fp, xdecls); + } if (iflag) { @@ -1485,17 +1959,24 @@ output(void) } if (dflag) + { + start_defines_file(); output_defines(defines_file); + end_defines_file(); + } output_rule_data(); output_yydefred(); +#if defined(YYBTYACC) + output_accessing_symbols(); +#endif output_actions(); free_parser(); output_debug(); if (rflag) { - output_prefix(code_file); write_section(code_file, xdecls); + output_YYINT_typedef(code_file); write_section(code_file, tables); } write_section(code_file, global_vars); @@ -1509,18 +1990,18 @@ output(void) write_section(code_file, hdr_vars); } output_trailing_text(); +#if defined(YYBTYACC) + if (destructor) + output_yydestruct_impl(); +#endif write_section(code_file, body_1); if (pure_parser) { write_section(code_file, body_vars); } write_section(code_file, body_2); - output_yyerror_call("syntax error"); - write_section(code_file, body_3); output_semantic_actions(); write_section(code_file, trailer); - output_yyerror_call("yacc stack overflow"); - write_section(code_file, trailer_2); } #ifdef NO_LEAKS diff --git a/package/byacc.spec b/package/byacc.spec index 7bdf0ca46a66..d4116cb62bff 100644 --- a/package/byacc.spec +++ b/package/byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20140101 +%define AppVersion 20140409 %define UseProgram yacc -# $XTermId: byacc.spec,v 1.18 2014/01/01 17:26:25 tom Exp $ +# $XTermId: byacc.spec,v 1.19 2014/04/09 19:53:59 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/debian/changelog b/package/debian/changelog index ec5c16af4eb0..c96c6933512f 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,3 +1,10 @@ +byacc (20140409) unstable; urgency=low + + * integrate Tom Shield's btyacc-related changes + * add test-cases to fill in gaps reported by lcov + + -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 09 Apr 2014 15:53:59 -0400 + byacc (20140101) unstable; urgency=low * yytname[] changes diff --git a/package/mingw-byacc.spec b/package/mingw-byacc.spec index 563b53d4fd1b..30813be195d7 100644 --- a/package/mingw-byacc.spec +++ b/package/mingw-byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20130925 +%define AppVersion 20140409 %define UseProgram yacc -# $XTermId: mingw-byacc.spec,v 1.1 2013/09/25 23:12:06 tom Exp $ +# $XTermId: mingw-byacc.spec,v 1.2 2014/04/09 19:53:59 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/pkgsrc/Makefile b/package/pkgsrc/Makefile index 416ea851c454..e1947dc87109 100644 --- a/package/pkgsrc/Makefile +++ b/package/pkgsrc/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $ # -DISTNAME= byacc-20050813 +DISTNAME= byacc-20140409 PKGREVISION= 1 CATEGORIES= devel MASTER_SITES= ftp://invisible-island.net/byacc/ @@ -1,4 +1,4 @@ -/* $Id: reader.c,v 1.38 2014/01/01 14:23:27 Christos.Zoulas Exp $ */ +/* $Id: reader.c,v 1.47 2014/04/09 21:09:27 tom Exp $ */ #include "defs.h" @@ -9,16 +9,28 @@ #define LINESIZE 100 -#define L_CURL '{' -#define R_CURL '}' +#define L_CURL '{' +#define R_CURL '}' +#define L_PAREN '(' +#define R_PAREN ')' +#define L_BRAC '[' +#define R_BRAC ']' + +/* the maximum number of arguments (inherited attributes) to a non-terminal */ +/* this is a hard limit, but seems more than adequate */ +#define MAXARGS 20 static void start_rule(bucket *bp, int s_lineno); +#if defined(YYBTYACC) +static void copy_destructor(void); +static char *process_destructor_XX(char *code, char *tag); +#endif static char *cache; static int cinc, cache_size; int ntags; -static int tagmax; +static int tagmax, havetags; static char **tag_table; static char saw_eof; @@ -45,6 +57,36 @@ char line_format[] = "#line %d \"%s\"\n"; param *lex_param; param *parse_param; +#if defined(YYBTYACC) +int destructor = 0; /* =1 if at least one %destructor */ + +static bucket *default_destructor[3] = +{0, 0, 0}; + +#define UNTYPED_DEFAULT 0 +#define TYPED_DEFAULT 1 +#define TYPE_SPECIFIED 2 + +static bucket * +lookup_type_destructor(char *tag) +{ + char name[1024] = "\0"; + bucket *bp, **bpp = &default_destructor[TYPE_SPECIFIED]; + + while ((bp = *bpp) != NULL) + { + if (bp->tag == tag) + return (bp); + bpp = &bp->link; + } + + *bpp = bp = make_bucket(strcat(strcpy(name, tag), " destructor")); + bp->tag = tag; + + return (bp); +} +#endif /* defined(YYBTYACC) */ + static void cachec(int c) { @@ -93,10 +135,7 @@ get_line(void) { line[i] = (char)c; if (c == '\n') - { - cptr = line; - return; - } + break; if (++i >= linesize) { linesize += LINESIZE; @@ -108,10 +147,11 @@ get_line(void) { line[i] = '\n'; saw_eof = 1; - cptr = line; - return; + break; } } + cptr = line; + return; } static char * @@ -226,35 +266,45 @@ nextc(void) } } } +/* *INDENT-OFF* */ +static struct keyword +{ + char name[13]; + int token; +} +keywords[] = { + { "binary", NONASSOC }, +#if defined(YYBTYACC) + { "destructor", DESTRUCTOR }, +#endif + { "expect", EXPECT }, + { "expect-rr", EXPECT_RR }, + { "ident", IDENT }, + { "left", LEFT }, + { "lex-param", LEX_PARAM }, +#if defined(YYBTYACC) + { "locations", LOCATIONS }, +#endif + { "nonassoc", NONASSOC }, + { "parse-param", PARSE_PARAM }, + { "pure-parser", PURE_PARSER }, + { "right", RIGHT }, + { "start", START }, + { "term", TOKEN }, + { "token", TOKEN }, + { "token-table", TOKEN_TABLE }, + { "type", TYPE }, + { "union", UNION }, + { "yacc", POSIX_YACC }, +}; +/* *INDENT-ON* */ -/* - * Compare keyword to cached token, treating '_' and '-' the same. Some - * grammars rely upon this misfeature. - */ static int -matchec(const char *name) +compare_keys(const void *a, const void *b) { - const char *p = cache; - const char *q = name; - int code = 0; /* assume mismatch */ - - while (*p != '\0' && *q != '\0') - { - char a = *p++; - char b = *q++; - if (a == '_') - a = '-'; - if (b == '_') - b = '-'; - if (a != b) - break; - if (*p == '\0' && *q == '\0') - { - code = 1; - break; - } - } - return code; + const struct keyword *p = (const struct keyword *)a; + const struct keyword *q = (const struct keyword *)b; + return strcmp(p->name, q->name); } static int @@ -262,6 +312,7 @@ keyword(void) { int c; char *t_cptr = cptr; + struct keyword *key; c = *++cptr; if (isalpha(c)) @@ -277,12 +328,16 @@ keyword(void) } else if (isdigit(c) || c == '-' - || c == '_' || c == '.' || c == '$') { cachec(c); } + else if (c == '_') + { + /* treat keywords spelled with '_' as if it were '-' */ + cachec('-'); + } else { break; @@ -291,36 +346,10 @@ keyword(void) } cachec(NUL); - if (matchec("token") || matchec("term")) - return (TOKEN); - if (matchec("type")) - return (TYPE); - if (matchec("left")) - return (LEFT); - if (matchec("right")) - return (RIGHT); - if (matchec("nonassoc") || matchec("binary")) - return (NONASSOC); - if (matchec("start")) - return (START); - if (matchec("union")) - return (UNION); - if (matchec("ident")) - return (IDENT); - if (matchec("expect")) - return (EXPECT); - if (matchec("expect-rr")) - return (EXPECT_RR); - if (matchec("pure-parser")) - return (PURE_PARSER); - if (matchec("parse-param")) - return (PARSE_PARAM); - if (matchec("lex-param")) - return (LEX_PARAM); - if (matchec("token-table")) - return (TOKEN_TABLE); - if (matchec("yacc")) - return (POSIX_YACC); + if ((key = bsearch(cache, keywords, + sizeof(keywords) / sizeof(*key), + sizeof(*key), compare_keys))) + return key->token; } else { @@ -339,7 +368,6 @@ keyword(void) return (NONASSOC); } syntax_error(lineno, line, t_cptr); - /*NOTREACHED */ } static void @@ -373,11 +401,93 @@ copy_ident(void) } } +static char * +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); + + for (;;) + { + c = *cptr++; + mputc(temp, c); + if (c == quote) + { + FREE(s_line); + return msdone(temp); + } + if (c == '\n') + unterminated_string(s_lineno, s_line, s_cptr); + if (c == '\\') + { + c = *cptr++; + mputc(temp, c); + if (c == '\n') + { + get_line(); + if (line == 0) + unterminated_string(s_lineno, s_line, s_cptr); + } + } + } +} + +static char * +copy_comment(void) +{ + struct mstring *temp = msnew(); + int c; + + c = *cptr; + if (c == '/') + { + mputc(temp, '*'); + while ((c = *++cptr) != '\n') + { + mputc(temp, c); + if (c == '*' && cptr[1] == '/') + mputc(temp, ' '); + } + mputc(temp, '*'); + mputc(temp, '/'); + } + else if (c == '*') + { + int c_lineno = lineno; + char *c_line = dup_line(); + char *c_cptr = c_line + (cptr - line - 1); + + mputc(temp, c); + ++cptr; + for (;;) + { + c = *cptr++; + mputc(temp, c); + if (c == '*' && *cptr == '/') + { + mputc(temp, '/'); + ++cptr; + FREE(c_line); + return msdone(temp); + } + if (c == '\n') + { + get_line(); + if (line == 0) + unterminated_comment(c_lineno, c_line, c_cptr); + } + } + } + return msdone(temp); +} + static void copy_text(void) { int c; - int quote; FILE *f = text_file; int need_newline = 0; int t_lineno = lineno; @@ -398,7 +508,6 @@ copy_text(void) switch (c) { case '\n': - next_line: putc('\n', f); need_newline = 0; get_line(); @@ -408,82 +517,21 @@ copy_text(void) case '\'': case '"': + putc(c, f); { - int s_lineno = lineno; - char *s_line = dup_line(); - char *s_cptr = s_line + (cptr - line - 1); - - quote = c; - putc(c, f); - for (;;) - { - c = *cptr++; - putc(c, f); - if (c == quote) - { - need_newline = 1; - FREE(s_line); - goto loop; - } - if (c == '\n') - unterminated_string(s_lineno, s_line, s_cptr); - if (c == '\\') - { - c = *cptr++; - putc(c, f); - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_string(s_lineno, s_line, s_cptr); - } - } - } + char *s = copy_string(c); + fputs(s, f); + free(s); } + need_newline = 1; + goto loop; case '/': putc(c, f); - need_newline = 1; - c = *cptr; - if (c == '/') - { - putc('*', f); - while ((c = *++cptr) != '\n') - { - if (c == '*' && cptr[1] == '/') - fprintf(f, "* "); - else - putc(c, f); - } - fprintf(f, "*/"); - goto next_line; - } - if (c == '*') { - int c_lineno = lineno; - char *c_line = dup_line(); - char *c_cptr = c_line + (cptr - line - 1); - - putc('*', f); - ++cptr; - for (;;) - { - c = *cptr++; - putc(c, f); - if (c == '*' && *cptr == '/') - { - putc('/', f); - ++cptr; - FREE(c_line); - goto loop; - } - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_comment(c_lineno, c_line, c_cptr); - } - } + char *s = copy_comment(); + fputs(s, f); + free(s); } need_newline = 1; goto loop; @@ -527,7 +575,6 @@ static void copy_union(void) { int c; - int quote; int depth; int u_lineno = lineno; char *u_line = dup_line(); @@ -555,7 +602,6 @@ copy_union(void) switch (c) { case '\n': - next_line: get_line(); if (line == 0) unterminated_union(u_lineno, u_line, u_cptr); @@ -578,81 +624,17 @@ copy_union(void) case '\'': case '"': { - int s_lineno = lineno; - char *s_line = dup_line(); - char *s_cptr = s_line + (cptr - line - 1); - - quote = c; - for (;;) - { - c = *cptr++; - putc_both(c); - if (c == quote) - { - FREE(s_line); - goto loop; - } - if (c == '\n') - unterminated_string(s_lineno, s_line, s_cptr); - if (c == '\\') - { - c = *cptr++; - putc_both(c); - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_string(s_lineno, s_line, s_cptr); - } - } - } + char *s = copy_string(c); + puts_both(s); + free(s); } + goto loop; case '/': - c = *cptr; - if (c == '/') { - putc_both('*'); - while ((c = *++cptr) != '\n') - { - if (c == '*' && cptr[1] == '/') - { - puts_both("* "); - } - else - { - putc_both(c); - } - } - puts_both("*/\n"); - goto next_line; - } - if (c == '*') - { - int c_lineno = lineno; - char *c_line = dup_line(); - char *c_cptr = c_line + (cptr - line - 1); - - putc_both('*'); - ++cptr; - for (;;) - { - c = *cptr++; - putc_both(c); - if (c == '*' && *cptr == '/') - { - putc_both('/'); - ++cptr; - FREE(c_line); - goto loop; - } - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_comment(c_lineno, c_line, c_cptr); - } - } + char *s = copy_comment(); + puts_both(s); + free(s); } goto loop; @@ -676,20 +658,20 @@ copy_param(int k) c = nextc(); if (c == EOF) unexpected_EOF(); - if (c != '{') + if (c != L_CURL) goto out; cptr++; c = nextc(); if (c == EOF) unexpected_EOF(); - if (c == '}') + if (c == R_CURL) goto out; buf = TMALLOC(char, linesize); NO_SPACE(buf); - for (i = 0; (c = *cptr++) != '}'; i++) + for (i = 0; (c = *cptr++) != R_CURL; i++) { if (c == '\0') missing_brace(); @@ -1015,11 +997,41 @@ get_number(void) } static char * -get_tag(void) +cache_tag(char *tag, size_t len) { - int c; int i; char *s; + + for (i = 0; i < ntags; ++i) + { + if (strncmp(tag, tag_table[i], len) == 0 && + tag_table[i][len] == NUL) + return (tag_table[i]); + } + + if (ntags >= tagmax) + { + tagmax += 16; + tag_table = + (tag_table + ? TREALLOC(char *, tag_table, tagmax) + : TMALLOC(char *, tagmax)); + NO_SPACE(tag_table); + } + + s = TMALLOC(char, len + 1); + NO_SPACE(s); + + strncpy(s, tag, len); + s[len] = 0; + tag_table[ntags++] = s; + return s; +} + +static char * +get_tag(void) +{ + int c; int t_lineno = lineno; char *t_line = dup_line(); char *t_cptr = t_line + (cptr - line); @@ -1047,34 +1059,22 @@ get_tag(void) illegal_tag(t_lineno, t_line, t_cptr); ++cptr; - for (i = 0; i < ntags; ++i) - { - if (strcmp(cache, tag_table[i]) == 0) - { - FREE(t_line); - return (tag_table[i]); - } - } - - if (ntags >= tagmax) - { - tagmax += 16; - tag_table = - (tag_table - ? TREALLOC(char *, tag_table, tagmax) - : TMALLOC(char *, tagmax)); - NO_SPACE(tag_table); - } + FREE(t_line); + havetags = 1; + return cache_tag(cache, (size_t) cinc); +} - s = TMALLOC(char, cinc); - NO_SPACE(s); +#if defined(YYBTYACC) +static char * +scan_id(void) +{ + char *b = cptr; - strcpy(s, cache); - tag_table[ntags] = s; - ++ntags; - FREE(t_line); - return (s); + while (isalnum(*cptr) || *cptr == '_' || *cptr == '$') + cptr++; + return cache_tag(b, (size_t) (cptr - b)); } +#endif static void declare_tokens(int assoc) @@ -1192,33 +1192,88 @@ declare_expect(int assoc) } } +#if defined(YYBTYACC) +static void +declare_argtypes(bucket *bp) +{ + char *tags[MAXARGS]; + int args = 0, c; + + if (bp->args >= 0) + retyped_warning(bp->name); + cptr++; /* skip open paren */ + for (;;) + { + c = nextc(); + if (c == EOF) + unexpected_EOF(); + if (c != '<') + syntax_error(lineno, line, cptr); + tags[args++] = get_tag(); + c = nextc(); + if (c == R_PAREN) + break; + if (c == EOF) + unexpected_EOF(); + } + cptr++; /* skip close paren */ + bp->args = args; + bp->argnames = TMALLOC(char *, args); + NO_SPACE(bp->argnames); + bp->argtags = CALLOC(sizeof(char *), args + 1); + NO_SPACE(bp->argtags); + while (--args >= 0) + { + bp->argtags[args] = tags[args]; + bp->argnames[args] = NULL; + } +} +#endif + static void declare_types(void) { int c; bucket *bp; - char *tag; + char *tag = NULL; c = nextc(); if (c == EOF) unexpected_EOF(); - if (c != '<') - syntax_error(lineno, line, cptr); - tag = get_tag(); + if (c == '<') + tag = get_tag(); for (;;) { c = nextc(); + if (c == EOF) + unexpected_EOF(); if (isalpha(c) || c == '_' || c == '.' || c == '$') + { bp = get_name(); +#if defined(YYBTYACC) + if (nextc() == L_PAREN) + declare_argtypes(bp); + else + bp->args = 0; +#endif + } else if (c == '\'' || c == '"') + { bp = get_literal(); +#if defined(YYBTYACC) + bp->args = 0; +#endif + } else return; - if (bp->tag && tag != bp->tag) - retyped_warning(bp->name); - bp->tag = tag; + if (tag) + { + if (bp->tag && tag != bp->tag) + retyped_warning(bp->name); + bp->tag = tag; + } } } @@ -1307,6 +1362,17 @@ read_declarations(void) token_table = 1; break; +#if defined(YYBTYACC) + case LOCATIONS: + locations = 1; + break; + + case DESTRUCTOR: + destructor = 1; + copy_destructor(); + break; +#endif + case POSIX_YACC: /* noop for bison compatibility. byacc is already designed to be posix * yacc compatible. */ @@ -1377,6 +1443,330 @@ expand_rules(void) NO_SPACE(rassoc); } +/* set immediately prior to where copy_args() could be called, and incremented by + the various routines that will rescan the argument list as appropriate */ +static int rescan_lineno; +#if defined(YYBTYACC) + +static char * +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); + + while ((c = *cptr++) != R_PAREN || depth || quote) + { + if (c == ',' && !quote && !depth) + { + len++; + mputc(s, 0); + continue; + } + mputc(s, c); + if (c == '\n') + { + get_line(); + if (!line) + { + if (quote) + unterminated_string(a_lineno, a_line, a_cptr); + else + unterminated_arglist(a_lineno, a_line, a_cptr); + } + } + else if (quote) + { + if (c == quote) + quote = 0; + else if (c == '\\') + { + if (*cptr != '\n') + mputc(s, *cptr++); + } + } + else + { + if (c == L_PAREN) + depth++; + else if (c == R_PAREN) + depth--; + else if (c == '\"' || c == '\'') + quote = c; + } + } + if (alen) + *alen = len; + FREE(a_line); + return msdone(s); +} + +static char * +parse_id(char *p, char **save) +{ + char *b; + + while (isspace(*p)) + if (*p++ == '\n') + rescan_lineno++; + if (!isalpha(*p) && *p != '_') + return NULL; + b = p; + while (isalnum(*p) || *p == '_' || *p == '$') + p++; + if (save) + { + *save = cache_tag(b, (size_t) (p - b)); + } + return p; +} + +static char * +parse_int(char *p, int *save) +{ + int neg = 0, val = 0; + + while (isspace(*p)) + if (*p++ == '\n') + rescan_lineno++; + if (*p == '-') + { + neg = 1; + p++; + } + if (!isdigit(*p)) + return NULL; + while (isdigit(*p)) + val = val * 10 + *p++ - '0'; + if (neg) + val = -val; + if (save) + *save = val; + return p; +} + +static void +parse_arginfo(bucket *a, char *args, int argslen) +{ + char *p = args, *tmp; + int i, redec = 0; + + if (a->args > 0) + { + if (a->args != argslen) + arg_number_disagree_warning(rescan_lineno, a->name); + redec = 1; + } + else + { + if ((a->args = argslen) == 0) + return; + a->argnames = TMALLOC(char *, argslen); + NO_SPACE(a->argnames); + a->argtags = TMALLOC(char *, argslen); + NO_SPACE(a->argtags); + } + if (!args) + return; + for (i = 0; i < argslen; i++) + { + while (isspace(*p)) + if (*p++ == '\n') + rescan_lineno++; + if (*p++ != '$') + bad_formals(); + while (isspace(*p)) + if (*p++ == '\n') + rescan_lineno++; + if (*p == '<') + { + havetags = 1; + if (!(p = parse_id(p + 1, &tmp))) + bad_formals(); + while (isspace(*p)) + if (*p++ == '\n') + rescan_lineno++; + if (*p++ != '>') + bad_formals(); + if (redec) + { + if (a->argtags[i] != tmp) + arg_type_disagree_warning(rescan_lineno, i + 1, a->name); + } + else + a->argtags[i] = tmp; + } + else if (!redec) + a->argtags[i] = NULL; + if (!(p = parse_id(p, &a->argnames[i]))) + bad_formals(); + while (isspace(*p)) + if (*p++ == '\n') + rescan_lineno++; + if (*p++) + bad_formals(); + } + free(args); +} + +static char * +compile_arg(char **theptr, char *yyvaltag) +{ + char *p = *theptr; + struct mstring *c = msnew(); + int i, j, n; + Value_t *offsets = NULL, maxoffset; + bucket **rhs; + + maxoffset = 0; + n = 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 (yyvaltag) + msprintf(c, "yyval.%s = ", yyvaltag); + else + msprintf(c, "yyval = "); + while (*p) + { + if (*p == '$') + { + char *tag = NULL; + if (*++p == '<') + if (!(p = parse_id(++p, &tag)) || *p++ != '>') + illegal_tag(rescan_lineno, NULL, NULL); + if (isdigit(*p) || *p == '-') + { + int val; + if (!(p = parse_int(p, &val))) + dollar_error(rescan_lineno, NULL, NULL); + if (val <= 0) + i = val - n; + else if (val > maxoffset) + { + dollar_warning(rescan_lineno, val); + i = val - maxoffset; + } + else + { + i = offsets[val]; + if (!tag && !(tag = rhs[i]->tag) && havetags) + untyped_rhs(val, rhs[i]->name); + } + msprintf(c, "yystack.l_mark[%d]", i); + if (tag) + msprintf(c, ".%s", tag); + else if (havetags) + unknown_rhs(val); + } + else if (isalpha(*p) || *p == '_') + { + char *arg; + if (!(p = parse_id(p, &arg))) + dollar_error(rescan_lineno, NULL, NULL); + for (i = plhs[nrules]->args - 1; i >= 0; i--) + if (arg == plhs[nrules]->argnames[i]) + break; + if (i < 0) + 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); + if (tag) + msprintf(c, ".%s", tag); + else if (havetags) + untyped_arg_warning(rescan_lineno, "$", arg); + } + else + dollar_error(rescan_lineno, NULL, NULL); + } + else if (*p == '@') + { + at_error(rescan_lineno, NULL, NULL); + } + else + { + if (*p == '\n') + rescan_lineno++; + mputc(c, *p++); + } + } + *theptr = p; + if (maxoffset > 0) + FREE(offsets); + return msdone(c); +} + +#define ARG_CACHE_SIZE 1024 +static struct arg_cache +{ + struct arg_cache *next; + char *code; + int rule; +} + *arg_cache[ARG_CACHE_SIZE]; + +static int +lookup_arg_cache(char *code) +{ + struct arg_cache *entry; + + entry = arg_cache[strnshash(code) % ARG_CACHE_SIZE]; + while (entry) + { + if (!strnscmp(entry->code, code)) + return entry->rule; + entry = entry->next; + } + return -1; +} + +static void +insert_arg_cache(char *code, int rule) +{ + struct arg_cache *entry = NEW(struct arg_cache); + int i; + + NO_SPACE(entry); + i = strnshash(code) % ARG_CACHE_SIZE; + entry->code = code; + entry->rule = rule; + entry->next = arg_cache[i]; + arg_cache[i] = entry; +} + +static void +clean_arg_cache(void) +{ + struct arg_cache *e, *t; + int i; + + for (i = 0; i < ARG_CACHE_SIZE; i++) + { + for (e = arg_cache[i]; (t = e); e = e->next, FREE(t)) + free(e->code); + arg_cache[i] = NULL; + } +} +#endif + static void advance_to_start(void) { @@ -1384,6 +1774,10 @@ advance_to_start(void) bucket *bp; char *s_cptr; int s_lineno; +#if defined(YYBTYACC) + char *args = NULL; + int argslen = 0; +#endif for (;;) { @@ -1424,9 +1818,22 @@ advance_to_start(void) c = nextc(); if (c == EOF) unexpected_EOF(); + rescan_lineno = lineno; /* line# for possible inherited args rescan */ +#if defined(YYBTYACC) + if (c == L_PAREN) + { + ++cptr; + args = copy_args(&argslen); + NO_SPACE(args); + c = nextc(); + } +#endif if (c != ':') syntax_error(lineno, line, cptr); start_rule(bp, s_lineno); +#if defined(YYBTYACC) + parse_arginfo(bp, args, argslen); +#endif ++cptr; } @@ -1436,6 +1843,8 @@ start_rule(bucket *bp, int s_lineno) if (bp->class == TERM) terminal_lhs(s_lineno); bp->class = NONTERM; + if (!bp->index) + bp->index = nrules; if (nrules >= maxrules) expand_rules(); plhs[nrules] = bp; @@ -1482,9 +1891,13 @@ insert_empty_rule(void) last_symbol->next = bp; last_symbol = bp; bp->tag = plhs[nrules]->tag; - bp->class = NONTERM; + bp->class = ACTION; +#if defined(YYBTYACC) + bp->args = 0; +#endif - if ((nitems += 2) > maxitems) + nitems = (Value_t) (nitems + 2); + if (nitems > maxitems) expand_items(); bpp = pitem + nitems - 1; *bpp-- = bp; @@ -1501,12 +1914,49 @@ insert_empty_rule(void) rassoc[nrules - 1] = TOKEN; } +#if defined(YYBTYACC) +static char * +insert_arg_rule(char *arg, char *tag) +{ + int line_number = rescan_lineno; + char *code = compile_arg(&arg, tag); + int rule = lookup_arg_cache(code); + FILE *f = action_file; + + if (rule < 0) + { + rule = nrules; + insert_arg_cache(code, rule); + 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]->class = ARGUMENT; + } + else + { + if (++nitems > maxitems) + expand_items(); + pitem[nitems - 1] = plhs[rule]; + free(code); + } + return arg + 1; +} +#endif + static void add_symbol(void) { int c; bucket *bp; int s_lineno = lineno; +#if defined(YYBTYACC) + char *args = NULL; + int argslen = 0; +#endif c = *cptr; if (c == '\'' || c == '"') @@ -1515,10 +1965,23 @@ add_symbol(void) bp = get_name(); c = nextc(); + rescan_lineno = lineno; /* line# for possible inherited args rescan */ +#if defined(YYBTYACC) + if (c == L_PAREN) + { + ++cptr; + args = copy_args(&argslen); + NO_SPACE(args); + c = nextc(); + } +#endif if (c == ':') { end_rule(); start_rule(bp, s_lineno); +#if defined(YYBTYACC) + parse_arginfo(bp, args, argslen); +#endif ++cptr; return; } @@ -1527,6 +1990,30 @@ add_symbol(void) insert_empty_rule(); last_was_action = 0; +#if defined(YYBTYACC) + if (bp->args < 0) + bp->args = argslen; + if (argslen == 0 && bp->args > 0 && pitem[nitems - 1] == NULL) + { + int i; + if (plhs[nrules]->args != bp->args) + wrong_number_args_warning("default ", bp->name); + for (i = bp->args - 1; i >= 0; i--) + if (plhs[nrules]->argtags[i] != bp->argtags[i]) + wrong_type_for_arg_warning(i + 1, bp->name); + } + else if (bp->args != argslen) + wrong_number_args_warning("", bp->name); + if (bp->args > 0 && argslen > 0) + { + char *ap; + int i; + for (ap = args, i = 0; i < argslen; i++) + ap = insert_arg_rule(ap, bp->argtags[i]); + free(args); + } +#endif /* defined(YYBTYACC) */ + if (++nitems > maxitems) expand_items(); pitem[nitems - 1] = bp; @@ -1544,20 +2031,34 @@ static void copy_action(void) { int c; - int i, n; + int i, j, n; int depth; - int quote; +#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); + Value_t *offsets = NULL, maxoffset; + bucket **rhs; if (last_was_action) insert_empty_rule(); last_was_action = 1; fprintf(f, "case %d:\n", nrules - 2); +#if defined(YYBTYACC) + if (backtrack) + { + if (*cptr != L_BRAC) + fprintf(f, " if (!yytrial)\n"); + else + trialaction = 1; + } +#endif if (!lflag) fprintf(f, line_format, lineno, input_file_name); if (*cptr == '=') @@ -1570,9 +2071,27 @@ copy_action(void) cptr = after_blanks(cptr); } + maxoffset = 0; n = 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; depth = 0; loop: @@ -1598,9 +2117,15 @@ copy_action(void) else if (isdigit(c)) { i = get_number(); - if (i > n) + if (i == 0) + fprintf(f, "yystack.l_mark[%d].%s", -n, tag); + else if (i > maxoffset) + { dollar_warning(d_lineno, i); - fprintf(f, "yystack.l_mark[%d].%s", i - n, tag); + fprintf(f, "yystack.l_mark[%d].%s", i - maxoffset, tag); + } + else if (offsets) + fprintf(f, "yystack.l_mark[%d].%s", offsets[i], tag); FREE(d_line); goto loop; } @@ -1612,12 +2137,27 @@ copy_action(void) FREE(d_line); goto loop; } +#if defined(YYBTYACC) + else if (isalpha(c) || c == '_') + { + char *arg = scan_id(); + for (i = plhs[nrules]->args - 1; i >= 0; i--) + if (arg == plhs[nrules]->argnames[i]) + 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); + FREE(d_line); + goto loop; + } +#endif else dollar_error(d_lineno, d_line, d_cptr); } else if (cptr[1] == '$') { - if (ntags) + if (havetags) { tag = plhs[nrules]->tag; if (tag == 0) @@ -1627,26 +2167,35 @@ copy_action(void) else fprintf(f, "yyval"); cptr += 2; +#if defined(YYBTYACC) + haveyyval = 1; +#endif goto loop; } else if (isdigit(UCH(cptr[1]))) { ++cptr; i = get_number(); - if (ntags) + if (havetags) { - if (i <= 0 || i > n) + if (i <= 0 || i > maxoffset) unknown_rhs(i); - tag = pitem[nitems + i - n - 1]->tag; + tag = rhs[offsets[i]]->tag; if (tag == 0) - untyped_rhs(i, pitem[nitems + i - n - 1]->name); - fprintf(f, "yystack.l_mark[%d].%s", i - n, tag); + untyped_rhs(i, rhs[offsets[i]]->name); + fprintf(f, "yystack.l_mark[%d].%s", offsets[i], tag); } else { - if (i > n) + if (i == 0) + fprintf(f, "yystack.l_mark[%d]", -n); + else if (i > maxoffset) + { dollar_warning(lineno, i); - fprintf(f, "yystack.l_mark[%d]", i - n); + fprintf(f, "yystack.l_mark[%d]", i - maxoffset); + } + else if (offsets) + fprintf(f, "yystack.l_mark[%d]", offsets[i]); } goto loop; } @@ -1654,12 +2203,65 @@ copy_action(void) { cptr += 2; i = get_number(); - if (ntags) + if (havetags) unknown_rhs(-i); fprintf(f, "yystack.l_mark[%d]", -i - n); goto loop; } +#if defined(YYBTYACC) + else if (isalpha(cptr[1]) || cptr[1] == '_') + { + char *arg; + ++cptr; + arg = scan_id(); + for (i = plhs[nrules]->args - 1; i >= 0; i--) + if (arg == plhs[nrules]->argnames[i]) + break; + if (i < 0) + unknown_arg_warning(lineno, "$", arg, line, cptr); + tag = (i < 0 ? NULL : plhs[nrules]->argtags[i]); + fprintf(f, "yystack.l_mark[%d]", i - plhs[nrules]->args + 1 - n); + if (tag) + fprintf(f, ".%s", tag); + else if (havetags) + untyped_arg_warning(lineno, "$", arg); + goto loop; + } +#endif + } +#if defined(YYBTYACC) + if (c == '@') + { + if (!locations) + { + int l_lineno = lineno; + char *l_line = dup_line(); + char *l_cptr = l_line + (cptr - line); + syntax_error(l_lineno, l_line, l_cptr); + } + if (cptr[1] == '$') + { + fprintf(f, "yyloc"); + cptr += 2; + goto loop; + } + else if (isdigit(UCH(cptr[1]))) + { + ++cptr; + i = get_number(); + if (i == 0) + fprintf(f, "yystack.p_mark[%d]", -n); + else if (i > maxoffset) + { + at_warning(lineno, i); + fprintf(f, "yystack.p_mark[%d]", i - maxoffset); + } + else if (offsets) + fprintf(f, "yystack.p_mark[%d]", offsets[i]); + goto loop; + } } +#endif if (isalpha(c) || c == '_' || c == '$') { do @@ -1670,12 +2272,45 @@ copy_action(void) while (isalnum(c) || c == '_' || c == '$'); goto loop; } - putc(c, f); ++cptr; +#if defined(YYBTYACC) + if (backtrack) + { + if (trialaction && c == L_BRAC && depth == 0) + { + ++depth; + putc(L_CURL, f); + goto loop; + } + if (trialaction && c == R_BRAC && depth == 1) + { + --depth; + putc(R_CURL, f); + c = nextc(); + if (c == L_BRAC && !haveyyval) + { + goto loop; + } + if (c == L_CURL && !haveyyval) + { + fprintf(f, " if (!yytrial)\n"); + if (!lflag) + fprintf(f, line_format, lineno, input_file_name); + trialaction = 0; + goto loop; + } + fprintf(f, "\nbreak;\n"); + FREE(a_line); + if (maxoffset > 0) + FREE(offsets); + return; + } + } +#endif + putc(c, f); switch (c) { case '\n': - next_line: get_line(); if (line) goto loop; @@ -1686,8 +2321,22 @@ copy_action(void) goto loop; fprintf(f, "\nbreak;\n"); free(a_line); + if (maxoffset > 0) + FREE(offsets); return; +#if defined(YYBTYACC) + case L_BRAC: + if (backtrack) + ++depth; + goto loop; + + case R_BRAC: + if (backtrack) + --depth; + goto loop; +#endif + case L_CURL: ++depth; goto loop; @@ -1695,83 +2344,326 @@ copy_action(void) case R_CURL: if (--depth > 0) goto loop; +#if defined(YYBTYACC) + if (backtrack) + { + c = nextc(); + if (c == L_BRAC && !haveyyval) + { + trialaction = 1; + goto loop; + } + if (c == L_CURL && !haveyyval) + { + fprintf(f, " if (!yytrial)\n"); + if (!lflag) + fprintf(f, line_format, lineno, input_file_name); + goto loop; + } + } +#endif fprintf(f, "\nbreak;\n"); free(a_line); + if (maxoffset > 0) + FREE(offsets); return; case '\'': case '"': { - int s_lineno = lineno; - char *s_line = dup_line(); - char *s_cptr = s_line + (cptr - line - 1); + char *s = copy_string(c); + fputs(s, f); + free(s); + } + goto loop; - quote = c; - for (;;) + case '/': + { + char *s = copy_comment(); + fputs(s, f); + free(s); + } + goto loop; + + default: + goto loop; + } +} + +#if defined(YYBTYACC) +static void +copy_destructor(void) +{ + 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; + + if (!lflag) + msprintf(destructor_text, 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'); + else + syntax_error(lineno, line, cptr); + + a_lineno = lineno; + a_line = dup_line(); + a_cptr = a_line + (cptr - line); + + depth = 0; + loop: + c = *cptr; + if (c == '$') + { + if (cptr[1] == '<') + { + int d_lineno = lineno; + char *d_line = dup_line(); + char *d_cptr = d_line + (cptr - line); + + ++cptr; + tag = get_tag(); + c = *cptr; + if (c == '$') { - c = *cptr++; - putc(c, f); - if (c == quote) + msprintf(destructor_text, "(*val).%s", tag); + ++cptr; + FREE(d_line); + goto loop; + } + else + dollar_error(d_lineno, d_line, d_cptr); + } + else if (cptr[1] == '$') + { + /* process '$$' later; replacement is context dependent */ + msprintf(destructor_text, "$$"); + cptr += 2; + goto loop; + } + } + if (c == '@' && cptr[1] == '$') + { + if (!locations) + { + int l_lineno = lineno; + char *l_line = dup_line(); + char *l_cptr = l_line + (cptr - line); + syntax_error(l_lineno, l_line, l_cptr); + } + msprintf(destructor_text, "(*loc)"); + cptr += 2; + goto loop; + } + if (isalpha(c) || c == '_' || c == '$') + { + do + { + mputc(destructor_text, c); + c = *++cptr; + } + while (isalnum(c) || c == '_' || c == '$'); + goto loop; + } + ++cptr; + mputc(destructor_text, c); + switch (c) + { + case '\n': + get_line(); + if (line) + goto loop; + unterminated_action(a_lineno, a_line, a_cptr); + + case L_CURL: + ++depth; + goto loop; + + case R_CURL: + if (--depth > 0) + goto loop; + goto process_symbols; + + case '\'': + case '"': + { + char *s = copy_string(c); + msprintf(destructor_text, "%s", s); + free(s); + } + goto loop; + + case '/': + { + char *s = copy_comment(); + msprintf(destructor_text, "%s", s); + free(s); + } + goto loop; + + default: + goto loop; + } + process_symbols: + code_text = msdone(destructor_text); + for (;;) + { + c = nextc(); + if (c == EOF) + unexpected_EOF(); + if (c == '<') + { + if (cptr[1] == '>') + { /* "no semantic type" default destructor */ + cptr += 2; + if ((bp = default_destructor[UNTYPED_DEFAULT]) == NULL) { - FREE(s_line); - goto loop; + static char untyped_default[] = "<>"; + bp = make_bucket("untyped default"); + bp->tag = untyped_default; + default_destructor[UNTYPED_DEFAULT] = bp; } - if (c == '\n') - unterminated_string(s_lineno, s_line, s_cptr); - if (c == '\\') + if (bp->destructor != NULL) + destructor_redeclared_warning(a_lineno, a_line, a_cptr); + else + /* replace "$$" with "(*val)" in destructor code */ + bp->destructor = process_destructor_XX(code_text, NULL); + } + else if (cptr[1] == '*' && cptr[2] == '>') + { /* "no per-symbol or per-type" default destructor */ + cptr += 3; + if ((bp = default_destructor[TYPED_DEFAULT]) == NULL) { - c = *cptr++; - putc(c, f); - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_string(s_lineno, s_line, s_cptr); - } + static char typed_default[] = "<*>"; + bp = make_bucket("typed default"); + bp->tag = typed_default; + default_destructor[TYPED_DEFAULT] = bp; + } + if (bp->destructor != NULL) + destructor_redeclared_warning(a_lineno, a_line, a_cptr); + else + { + /* postpone re-processing destructor $$s until end of grammar spec */ + bp->destructor = TMALLOC(char, strlen(code_text) + 1); + NO_SPACE(bp->destructor); + strcpy(bp->destructor, code_text); } } + else + { /* "semantic type" default destructor */ + tag = get_tag(); + bp = lookup_type_destructor(tag); + if (bp->destructor != NULL) + destructor_redeclared_warning(a_lineno, a_line, a_cptr); + else + /* replace "$$" with "(*val).tag" in destructor code */ + bp->destructor = process_destructor_XX(code_text, tag); + } } + else if (isalpha(c) || c == '_' || c == '.' || c == '$') + { /* "symbol" destructor */ + bp = get_name(); + if (bp->destructor != NULL) + destructor_redeclared_warning(a_lineno, a_line, a_cptr); + else + { + /* postpone re-processing destructor $$s until end of grammar spec */ + bp->destructor = TMALLOC(char, strlen(code_text) + 1); + NO_SPACE(bp->destructor); + strcpy(bp->destructor, code_text); + } + } + else + break; + } + free(a_line); + free(code_text); +} - case '/': - c = *cptr; - if (c == '/') +static char * +process_destructor_XX(char *code, char *tag) +{ + int c; + int quote; + int depth; + struct mstring *new_code = msnew(); + char *codeptr = code; + + depth = 0; + loop: /* step thru code */ + c = *codeptr; + if (c == '$' && codeptr[1] == '$') + { + codeptr += 2; + if (tag == NULL) + msprintf(new_code, "(*val)"); + else + msprintf(new_code, "(*val).%s", tag); + goto loop; + } + if (isalpha(c) || c == '_' || c == '$') + { + do { - putc('*', f); - while ((c = *++cptr) != '\n') + mputc(new_code, c); + c = *++codeptr; + } + while (isalnum(c) || c == '_' || c == '$'); + goto loop; + } + ++codeptr; + mputc(new_code, c); + switch (c) + { + case L_CURL: + ++depth; + goto loop; + + case R_CURL: + if (--depth > 0) + goto loop; + return msdone(new_code); + + case '\'': + case '"': + quote = c; + for (;;) + { + c = *codeptr++; + mputc(new_code, c); + if (c == quote) + goto loop; + if (c == '\\') { - if (c == '*' && cptr[1] == '/') - fprintf(f, "* "); - else - putc(c, f); + c = *codeptr++; + mputc(new_code, c); } - fprintf(f, "*/\n"); - goto next_line; } + + case '/': + c = *codeptr; if (c == '*') { - int c_lineno = lineno; - char *c_line = dup_line(); - char *c_cptr = c_line + (cptr - line - 1); - - putc('*', f); - ++cptr; + mputc(new_code, c); + ++codeptr; for (;;) { - c = *cptr++; - putc(c, f); - if (c == '*' && *cptr == '/') + c = *codeptr++; + mputc(new_code, c); + if (c == '*' && *codeptr == '/') { - putc('/', f); - ++cptr; - FREE(c_line); + mputc(new_code, '/'); + ++codeptr; goto loop; } - if (c == '\n') - { - get_line(); - if (line == 0) - unterminated_comment(c_lineno, c_line, c_cptr); - } } } goto loop; @@ -1780,6 +2672,7 @@ copy_action(void) goto loop; } } +#endif /* defined(YYBTYACC) */ static int mark_symbol(void) @@ -1813,7 +2706,6 @@ mark_symbol(void) else { syntax_error(lineno, line, cptr); - /*NOTREACHED */ } if (rprec[nrules] != UNDEFINED && bp->prec != rprec[nrules]) @@ -1844,7 +2736,11 @@ read_grammar(void) || c == '\'' || c == '"') add_symbol(); +#if defined(YYBTYACC) + else if (c == L_CURL || c == '=' || (backtrack && c == L_BRAC)) +#else else if (c == L_CURL || c == '=') +#endif copy_action(); else if (c == '|') { @@ -1861,6 +2757,10 @@ read_grammar(void) syntax_error(lineno, line, cptr); } end_rule(); +#if defined(YYBTYACC) + if (goal->args > 0) + start_requires_args(goal->name); +#endif } static void @@ -1964,6 +2864,9 @@ pack_symbols(void) bucket *bp; bucket **v; Value_t i, j, k, n; +#if defined(YYBTYACC) + Value_t max_tok_pval; +#endif nsyms = 2; ntokens = 1; @@ -1974,7 +2877,7 @@ pack_symbols(void) ++ntokens; } start_symbol = (Value_t) ntokens; - nvars = nsyms - ntokens; + nvars = (Value_t) (nsyms - ntokens); symbol_name = TMALLOC(char *, nsyms); NO_SPACE(symbol_name); @@ -1982,12 +2885,26 @@ pack_symbols(void) symbol_value = TMALLOC(Value_t, nsyms); NO_SPACE(symbol_value); - symbol_prec = TMALLOC(short, nsyms); + symbol_prec = TMALLOC(Value_t, nsyms); NO_SPACE(symbol_prec); symbol_assoc = TMALLOC(char, nsyms); NO_SPACE(symbol_assoc); +#if defined(YYBTYACC) + symbol_pval = TMALLOC(Value_t, nsyms); + NO_SPACE(symbol_pval); + + if (destructor) + { + symbol_destructor = CALLOC(sizeof(char *), nsyms); + NO_SPACE(symbol_destructor); + + symbol_type_tag = CALLOC(sizeof(char *), nsyms); + NO_SPACE(symbol_type_tag); + } +#endif + v = TMALLOC(bucket *, nsyms); NO_SPACE(v); @@ -2066,17 +2983,34 @@ pack_symbols(void) symbol_value[0] = 0; symbol_prec[0] = 0; symbol_assoc[0] = TOKEN; +#if defined(YYBTYACC) + symbol_pval[0] = 0; + max_tok_pval = 0; +#endif for (i = 1; i < ntokens; ++i) { symbol_name[i] = v[i]->name; symbol_value[i] = v[i]->value; symbol_prec[i] = v[i]->prec; symbol_assoc[i] = v[i]->assoc; +#if defined(YYBTYACC) + symbol_pval[i] = v[i]->value; + if (symbol_pval[i] > max_tok_pval) + max_tok_pval = symbol_pval[i]; + if (destructor) + { + symbol_destructor[i] = v[i]->destructor; + symbol_type_tag[i] = v[i]->tag; + } +#endif } symbol_name[start_symbol] = name_pool; symbol_value[start_symbol] = -1; symbol_prec[start_symbol] = 0; symbol_assoc[start_symbol] = TOKEN; +#if defined(YYBTYACC) + symbol_pval[start_symbol] = (Value_t) (max_tok_pval + 1); +#endif for (++i; i < nsyms; ++i) { k = v[i]->index; @@ -2084,6 +3018,14 @@ pack_symbols(void) symbol_value[k] = v[i]->value; 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); + if (destructor) + { + symbol_destructor[k] = v[i]->destructor; + symbol_type_tag[k] = v[i]->tag; + } +#endif } if (gflag) @@ -2135,6 +3077,21 @@ pack_grammar(void) j = 4; for (i = 3; i < nrules; ++i) { +#if defined(YYBTYACC) + if (plhs[i]->args > 0) + { + if (plhs[i]->argnames) + { + FREE(plhs[i]->argnames); + plhs[i]->argnames = NULL; + } + if (plhs[i]->argtags) + { + FREE(plhs[i]->argtags); + plhs[i]->argtags = NULL; + } + } +#endif /* defined(YYBTYACC) */ rlhs[i] = plhs[i]->index; rrhs[i] = j; assoc = TOKEN; @@ -2161,6 +3118,9 @@ pack_grammar(void) FREE(plhs); FREE(pitem); +#if defined(YYBTYACC) + clean_arg_cache(); +#endif } static void @@ -2202,6 +3162,85 @@ print_grammar(void) } } +#if defined(YYBTYACC) +static void +finalize_destructors(void) +{ + int i; + bucket *bp; + char *tag; + + for (i = 2; i < nsyms; ++i) + { + tag = symbol_type_tag[i]; + if (symbol_destructor[i] == NULL) + { + if (tag == NULL) + { /* use <> destructor, if there is one */ + if ((bp = default_destructor[UNTYPED_DEFAULT]) != NULL) + { + symbol_destructor[i] = TMALLOC(char, + strlen(bp->destructor) + 1); + NO_SPACE(symbol_destructor[i]); + strcpy(symbol_destructor[i], bp->destructor); + } + } + else + { /* use type destructor for this tag, if there is one */ + bp = lookup_type_destructor(tag); + if (bp->destructor != NULL) + { + symbol_destructor[i] = TMALLOC(char, + strlen(bp->destructor) + 1); + NO_SPACE(symbol_destructor[i]); + strcpy(symbol_destructor[i], bp->destructor); + } + else + { /* use <*> destructor, if there is one */ + if ((bp = default_destructor[TYPED_DEFAULT]) != NULL) + /* replace "$$" with "(*val).tag" in destructor code */ + symbol_destructor[i] + = process_destructor_XX(bp->destructor, tag); + } + } + } + else + { /* replace "$$" with "(*val)[.tag]" in destructor code */ + symbol_destructor[i] + = process_destructor_XX(symbol_destructor[i], tag); + } + } + /* 'symbol_type_tag[]' elements are freed by 'free_tags()' */ + DO_FREE(symbol_type_tag); /* no longer needed */ + if ((bp = default_destructor[UNTYPED_DEFAULT]) != NULL) + { + FREE(bp->name); + /* 'bp->tag' is a static value, don't free */ + FREE(bp->destructor); + FREE(bp); + } + if ((bp = default_destructor[TYPED_DEFAULT]) != NULL) + { + FREE(bp->name); + /* 'bp->tag' is a static value, don't free */ + FREE(bp->destructor); + FREE(bp); + } + if ((bp = default_destructor[TYPE_SPECIFIED]) != NULL) + { + bucket *p; + for (; bp; bp = p) + { + p = bp->link; + FREE(bp->name); + /* 'bp->tag' freed by 'free_tags()' */ + FREE(bp->destructor); + FREE(bp); + } + } +} +#endif /* defined(YYBTYACC) */ + void reader(void) { @@ -2210,13 +3249,17 @@ reader(void) read_declarations(); read_grammar(); free_symbol_table(); - free_tags(); pack_names(); check_symbols(); pack_symbols(); pack_grammar(); free_symbols(); print_grammar(); +#if defined(YYBTYACC) + if (destructor) + finalize_destructors(); +#endif + free_tags(); } #ifdef NO_LEAKS @@ -2253,5 +3296,10 @@ reader_leaks(void) DO_FREE(symbol_prec); DO_FREE(symbol_assoc); DO_FREE(symbol_value); +#if defined(YYBTYACC) + DO_FREE(symbol_pval); + DO_FREE(symbol_destructor); + DO_FREE(symbol_type_tag); +#endif } #endif diff --git a/skel2c b/skel2c new file mode 100644 index 000000000000..d6f9f590949b --- /dev/null +++ b/skel2c @@ -0,0 +1,112 @@ +# vile: awkmode +function noident(given) { + gsub(/\$/,"@", given); + return given; +} +BEGIN { havesection = 0; + version = "$Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp $"; + nsec = 0; + ifdef = ""; + printf "/* This file generated automatically using\n * %s\n */\n\n", + noident(version); + } +/[$]Id[:][^$]*[$]/ { + printf "%s\n", noident($0); + next; + } +/^%% *insert *VERSION *here/ { + printf " CONCAT1(\"#define YYMAJOR \", YYMAJOR),\n"; + printf " CONCAT1(\"#define YYMINOR \", YYMINOR),\n"; + printf "#ifdef YYPATCH\n"; + printf " CONCAT1(\"#define YYPATCH \", YYPATCH),\n"; + printf "#endif\n"; + next; + } +/^%%ifdef/ { + if (NF >= 2) { + printf "#if defined(%s)\n", $2; + printf " \"#if %s\",\n", $2; + } else { + _abort_exit = 1; + printf "skel2c: ill-formed %%ifdef in skeleton file on line %d\n", FNR > "/dev/stderr"; + exit 2; + } + if (ifdef != "") { + printf "skel2c: nested %%ifdef in skeleton file on line %d\n", FNR > "/dev/stderr"; + exit 2; + } + ifdef = $2; + next; + } +/^%%endif/ { + if (ifdef != "") { + if (NF >= 2) { + printf " \"#endif /* %s */\",\n", $2; + printf "#endif /* defined(%s) */\n", $2; + } else { + printf " \"#endif /* %s */\",\n", ifdef; + printf "#endif /* defined(%s) */\n", ifdef; + } + ifdef = ""; + } else { + printf " \"#endif\",\n"; + printf "#endif\n"; + printf "skel2c: unmatched %endif in skeleton file on line %d\n", FNR > "/dev/stderr"; + exit 2; + } + next; + } +/^%%/ { if (havesection) { + printf " 0\n};\n\n"; + } + if (NF >= 2) { + havesection = 1; + section = $2; + seclist[nsec] = section; + nsec = nsec + 1; + printf "const char *const %s[] =\n{\n", $2; + } else { + havesection = 0; + } + next; + } + { if (havesection) { + # Could use 'gsub(/\\/, "\\\\")' instead of the following + # two lines, but there's a bug in mawk and the original + # awk (not in gawk) which is triggered by that. + gsub(/\\/, "\\\1"); + gsub(/\1/, "\\"); +# gsub(/\t/, "\\t"); # change '\t' to "\\t" + gsub(/\"/, "\\\""); + printf " \"%s\",\n", $0; + } else { + print $0; + } + } +END { if (_abort_exit) + exit 2; + if (havesection) { + print " 0\n};\n"; + } + if (nsec > 0) { + print "void"; + print "write_section(FILE * fp, const char *const section[])"; + print "{"; + print " int i;"; + print " const char *s;\n"; + print " for (i = 0; (s = section[i]) != 0; ++i)"; + print " {"; + print "\tif (fp == code_file)"; + print "\t ++outline;"; + print "\tfprintf(fp, \"%s\\n\", s);"; + print " }"; + print "}"; + } else { + print "skel2c: no sections defined in skeleton file" > "/dev/stderr"; + exit 2; + } + if (ifdef != "") { + printf "skel2c: unmatched %%ifdef %s at end of skeleton file\n", $ifdef > "/dev/stderr"; + exit 2; + } + } @@ -1,4 +1,4 @@ -/* $Id: symtab.c,v 1.10 2012/05/26 15:16:12 tom Exp $ */ +/* $Id: symtab.c,v 1.11 2014/03/26 00:17:09 Tom.Shields Exp $ */ #include "defs.h" @@ -48,6 +48,12 @@ make_bucket(const char *name) bp->prec = 0; bp->class = UNKNOWN; bp->assoc = TOKEN; +#if defined(YYBTYACC) + bp->args = -1; + bp->argnames = 0; + bp->argtags = 0; + bp->destructor = 0; +#endif strcpy(bp->name, name); return (bp); diff --git a/test/code_error.tab.h b/test/btyacc/big_b.error index e69de29bb2d1..e69de29bb2d1 100644 --- a/test/code_error.tab.h +++ b/test/btyacc/big_b.error diff --git a/test/btyacc/big_b.output b/test/btyacc/big_b.output new file mode 100644 index 000000000000..28e455543be0 --- /dev/null +++ b/test/btyacc/big_b.output @@ -0,0 +1,19 @@ +Usage: YACC [options] filename + +Options: + -b file_prefix set filename prefix (default "y.") + -B create a backtracking parser + -d write definitions (.tab.h) + -D enable value stack memory reclamation + -i write interface (y.tab.i) + -g write a graphical description + -l suppress #line directives + -L enable position processing, e.g., "%locations" + -o output_file (default ".tab.c") + -p symbol_prefix set symbol prefix (default "yy") + -P create a reentrant parser, e.g., "%pure-parser" + -r produce separate code and table files (y.code.c) + -s suppress #define's for quoted names in %token lines + -t add debugging support + -v write description (y.output) + -V show version information and exit diff --git a/test/error.tab.h b/test/btyacc/big_l.error index e69de29bb2d1..e69de29bb2d1 100644 --- a/test/error.tab.h +++ b/test/btyacc/big_l.error diff --git a/test/btyacc/big_l.output b/test/btyacc/big_l.output new file mode 100644 index 000000000000..28e455543be0 --- /dev/null +++ b/test/btyacc/big_l.output @@ -0,0 +1,19 @@ +Usage: YACC [options] filename + +Options: + -b file_prefix set filename prefix (default "y.") + -B create a backtracking parser + -d write definitions (.tab.h) + -D enable value stack memory reclamation + -i write interface (y.tab.i) + -g write a graphical description + -l suppress #line directives + -L enable position processing, e.g., "%locations" + -o output_file (default ".tab.c") + -p symbol_prefix set symbol prefix (default "yy") + -P create a reentrant parser, e.g., "%pure-parser" + -r produce separate code and table files (y.code.c) + -s suppress #define's for quoted names in %token lines + -t add debugging support + -v write description (y.output) + -V show version information and exit diff --git a/test/btyacc/btyacc_calc1.error b/test/btyacc/btyacc_calc1.error new file mode 100644 index 000000000000..1807ff988010 --- /dev/null +++ b/test/btyacc/btyacc_calc1.error @@ -0,0 +1 @@ +YACC: 17 shift/reduce conflicts, 27 reduce/reduce conflicts. diff --git a/test/btyacc/btyacc_calc1.output b/test/btyacc/btyacc_calc1.output new file mode 100644 index 000000000000..fe68c43780cb --- /dev/null +++ b/test/btyacc/btyacc_calc1.output @@ -0,0 +1,949 @@ + 0 $accept : lines $end + + 1 lines : + 2 | lines line '\n' + 3 | lines error '\n' + + 4 line : dexp + 5 | vexp + 6 | DREG '=' dexp + 7 | VREG '=' vexp + + 8 dexp : CONST + 9 | DREG + 10 | dexp '+' dexp + 11 | dexp '-' dexp + 12 | dexp '*' dexp + 13 | dexp '/' dexp + 14 | '-' dexp + 15 | '(' dexp ')' + + 16 vexp : dexp + 17 | '(' dexp ',' dexp ')' + 18 | VREG + 19 | vexp '+' vexp + 20 | dexp '+' vexp + 21 | vexp '-' vexp + 22 | dexp '-' vexp + 23 | vexp '*' vexp + 24 | dexp '*' vexp + 25 | vexp '/' vexp + 26 | dexp '/' vexp + 27 | '-' vexp + 28 | '(' vexp ')' + +state 0 + $accept : . lines $end (0) + lines : . (1) + + . reduce 1 + + lines goto 1 + + +state 1 + $accept : lines . $end (0) + lines : lines . line '\n' (2) + lines : lines . error '\n' (3) + + $end accept + error shift 2 + DREG shift 3 + VREG shift 4 + CONST shift 5 + '-' shift 6 + '(' shift 7 + . error + + dexp goto 8 + vexp goto 9 + line goto 10 + + +state 2 + lines : lines error . '\n' (3) + + '\n' shift 11 + . error + + +state 3 + line : DREG . '=' dexp (6) + dexp : DREG . (9) + + '=' shift 12 + '+' reduce 9 + '-' reduce 9 + '*' reduce 9 + '/' reduce 9 + '\n' reduce 9 + + +state 4 + line : VREG . '=' vexp (7) + vexp : VREG . (18) + + '=' shift 13 + '+' reduce 18 + '-' reduce 18 + '*' reduce 18 + '/' reduce 18 + '\n' reduce 18 + + +state 5 + dexp : CONST . (8) + + . reduce 8 + + +state 6 + dexp : '-' . dexp (14) + vexp : '-' . vexp (27) + + DREG shift 14 + VREG shift 15 + CONST shift 5 + '-' shift 6 + '(' shift 7 + . error + + dexp goto 16 + vexp goto 17 + + +state 7 + dexp : '(' . dexp ')' (15) + vexp : '(' . dexp ',' dexp ')' (17) + vexp : '(' . vexp ')' (28) + + DREG shift 14 + VREG shift 15 + CONST shift 5 + '-' shift 6 + '(' shift 7 + . error + + dexp goto 18 + vexp goto 19 + + +8: shift/reduce conflict (shift 20, reduce 16) on '+' +8: shift/reduce conflict (shift 21, reduce 16) on '-' +8: shift/reduce conflict (shift 22, reduce 16) on '*' +8: shift/reduce conflict (shift 23, reduce 16) on '/' +8: reduce/reduce conflict (reduce 4, reduce 16) on '\n' +state 8 + line : dexp . (4) + dexp : dexp . '+' dexp (10) + dexp : dexp . '-' dexp (11) + dexp : dexp . '*' dexp (12) + dexp : dexp . '/' dexp (13) + vexp : dexp . (16) + vexp : dexp . '+' vexp (20) + vexp : dexp . '-' vexp (22) + vexp : dexp . '*' vexp (24) + vexp : dexp . '/' vexp (26) + + '+' [trial] shift 20 + '-' [trial] shift 21 + '*' [trial] shift 22 + '/' [trial] shift 23 + '+' [trial] reduce 16 + '-' [trial] reduce 16 + '*' [trial] reduce 16 + '/' [trial] reduce 16 + '\n' [trial] reduce 4 + '\n' [trial] reduce 16 + + +state 9 + line : vexp . (5) + vexp : vexp . '+' vexp (19) + vexp : vexp . '-' vexp (21) + vexp : vexp . '*' vexp (23) + vexp : vexp . '/' vexp (25) + + '+' shift 24 + '-' shift 25 + '*' shift 26 + '/' shift 27 + '\n' reduce 5 + + +state 10 + lines : lines line . '\n' (2) + + '\n' shift 28 + . error + + +state 11 + lines : lines error '\n' . (3) + + . reduce 3 + + +state 12 + line : DREG '=' . dexp (6) + + DREG shift 14 + CONST shift 5 + '-' shift 29 + '(' shift 30 + . error + + dexp goto 31 + + +state 13 + line : VREG '=' . vexp (7) + + DREG shift 14 + VREG shift 15 + CONST shift 5 + '-' shift 6 + '(' shift 7 + . error + + dexp goto 32 + vexp goto 33 + + +state 14 + dexp : DREG . (9) + + . reduce 9 + + +state 15 + vexp : VREG . (18) + + . reduce 18 + |