diff --git a/CHANGES b/CHANGES index d5fc2a9689dd..79a97e712467 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,48 @@ +2014-01-01 Thomas E. Dickey + + * yacc.1: document %token-table, improve presentation of double-quotes + + * VERSION, package/byacc.spec, package/debian/changelog: bump + + * 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 + + * output.c, skeleton.c: + amend the last change so that yytname is #define'd as needed rather than + permanent - to avoid breaking cproto for instance. + +2014-01-01 Christos.Zoulas + + * output.c, defs.h, main.c, reader.c, skeleton.c: + changes to build ntpd using byacc: + - rename yyname[] to yytname[] + - add YYTRANSLATE() macro + - recognize bison's %token-table declaration + +2014-01-01 Thomas E. Dickey + + * configure: regen + + * yacc.1: s/EE/XE/ to work around groff bug on Debian 6 + + * makefile.in: use CF_MAKE_DOCS + + * aclocal.m4: add CF_MAKE_DOCS + + * configure.in: use CF_MAKE_DOCS + +2013-12-26 Thomas E. Dickey + + * config.guess: 2013-11-29 + +2013-11-19 Thomas E. Dickey + + * aclocal.m4: resync with my-autoconf (fixes for clang and mingw) + +2013-10-25 Thomas E. Dickey + + * config.sub: 2013-10-01 + 2013-09-25 Thomas E. Dickey * reader.c: fix two loop-limits found by clang 3.3 --analyze diff --git a/VERSION b/VERSION index 5ef5240213b0..c34e8a225425 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -20130925 +20140101 diff --git a/aclocal.m4 b/aclocal.m4 index 07a32f2702c2..0bb2b6d68e91 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -dnl $Id: aclocal.m4,v 1.31 2013/09/25 23:15:41 tom Exp $ +dnl $Id: aclocal.m4,v 1.33 2014/01/01 14:08:07 tom Exp $ dnl Macros for byacc configure script (Thomas E. Dickey) dnl --------------------------------------------------------------------------- -dnl Copyright 2004-2012,2013 Thomas E. Dickey +dnl Copyright 2004-2013,2014 Thomas E. Dickey dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the @@ -232,7 +232,7 @@ if test ".$system_name" != ".$cf_cv_system_name" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39 +dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does @@ -243,7 +243,7 @@ dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from dnl the wrappers for gcc and g++ warnings. dnl dnl $1 = GCC (default) or GXX -dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS +dnl $2 = CLANG_COMPILER (default) dnl $3 = CFLAGS (default) or CXXFLAGS AC_DEFUN([CF_CLANG_COMPILER],[ ifelse([$2],,CLANG_COMPILER,[$2])=no @@ -449,7 +449,7 @@ if test "$GCC" = yes ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39 +dnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: @@ -521,10 +521,14 @@ then EXTRA_CFLAGS= cf_warn_CONST="" test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" + test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= for cf_opt in W Wall \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ + Wdeclaration-after-statement \ + Wextra \ Winline \ Wmissing-declarations \ Wmissing-prototypes \ @@ -532,7 +536,7 @@ then Wpointer-arith \ Wshadow \ Wstrict-prototypes \ - Wundef $cf_warn_CONST $1 + Wundef $cf_gcc_warnings $cf_warn_CONST $1 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if AC_TRY_EVAL(ac_compile); then @@ -634,6 +638,60 @@ 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 ------------ +dnl $1 = name(s) to generate rules for +dnl $2 = suffix of corresponding manpages used as input. +define([CF_MAKE_DOCS],[ +test -z "$cf_make_docs" && cf_make_docs=0 + +cf_output=makefile +test -f "$cf_output" || cf_output=Makefile + +if test "$cf_make_docs" = 0 +then +cat >>$cf_output <<"CF_EOF" +################################################################################ +.SUFFIXES : .html .$2 .man .ps .pdf .txt + +.$2.html : + GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | groff -P -o0 -I$*_ -Thtml -man" >[$]@ + +.$2.ps : + [$](SHELL) -c "tbl [$]*.$2 | groff -man" >[$]@ + +.$2.txt : + GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | nroff -Tascii -man | col -bx" >[$]@ + +.ps.pdf : + ps2pdf [$]*.ps + +CF_EOF + cf_make_docs=1 +fi + +for cf_name in $1 +do +cat >>$cf_output </dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; diff --git a/config.sub b/config.sub index 85a159e57939..61cb4bc22db8 100755 --- a/config.sub +++ b/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2013-09-05' +timestamp='2013-10-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -265,6 +265,7 @@ case $basic_machine in | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ @@ -381,6 +382,7 @@ case $basic_machine in | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ diff --git a/configure b/configure index d0e8424a3ae5..80e89b4eb77e 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.14 . +# From configure.in Revision: 1.15 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20121002. # @@ -2112,7 +2112,7 @@ else if test "$cross_compiling" = yes ; then case $target_alias in #(vi - *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw32*|*-uwin*) #(vi + *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi cf_cv_mixedcase=no ;; *) @@ -4191,10 +4191,14 @@ echo "$as_me: checking for $CC warning options..." >&6;} EXTRA_CFLAGS= cf_warn_CONST="" test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" + test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= for cf_opt in W Wall \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ + Wdeclaration-after-statement \ + Wextra \ Winline \ Wmissing-declarations \ Wmissing-prototypes \ @@ -4202,15 +4206,15 @@ echo "$as_me: checking for $CC warning options..." >&6;} Wpointer-arith \ Wshadow \ Wstrict-prototypes \ - Wundef $cf_warn_CONST Wwrite-strings + Wundef $cf_gcc_warnings $cf_warn_CONST Wwrite-strings do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4208: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4212: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4211: \$? = $ac_status" >&5 + echo "$as_me:4215: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4213: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4217: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in #(vi Wcast-qual) #(vi @@ -4221,7 +4225,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}:4224: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4228: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4231,7 +4235,7 @@ echo "${as_me:-configure}:4224: 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}:4234: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4238: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4247,7 +4251,7 @@ rm -rf conftest* fi fi -echo "$as_me:4250: checking if you want to see long compiling messages" >&5 +echo "$as_me:4254: 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. @@ -4281,10 +4285,10 @@ else ECHO_CC='' fi; -echo "$as_me:4284: result: $enableval" >&5 +echo "$as_me:4288: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 -echo "$as_me:4287: checking if you want to use dmalloc for testing" >&5 +echo "$as_me:4291: 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. @@ -4301,7 +4305,7 @@ EOF else with_dmalloc= fi; -echo "$as_me:4304: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:4308: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -4395,23 +4399,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:4398: checking for dmalloc.h" >&5 + echo "$as_me:4402: 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 4404 "configure" +#line 4408 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4408: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4412: \"$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:4414: \$? = $ac_status" >&5 + echo "$as_me:4418: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4430,11 +4434,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4433: result: $ac_cv_header_dmalloc_h" >&5 +echo "$as_me:4437: 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:4437: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:4441: 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 @@ -4442,7 +4446,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4445 "configure" +#line 4449 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4461,16 +4465,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4464: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4468: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4467: \$? = $ac_status" >&5 + echo "$as_me:4471: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4470: \"$ac_try\"") >&5 + { (eval echo "$as_me:4474: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4473: \$? = $ac_status" >&5 + echo "$as_me:4477: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -4481,7 +4485,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4484: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:4488: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then cat >>confdefs.h <&5 +echo "$as_me:4503: 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. @@ -4513,7 +4517,7 @@ EOF else with_dbmalloc= fi; -echo "$as_me:4516: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:4520: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -4607,23 +4611,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:4610: checking for dbmalloc.h" >&5 + echo "$as_me:4614: 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 4616 "configure" +#line 4620 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4620: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4624: \"$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:4626: \$? = $ac_status" >&5 + echo "$as_me:4630: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4642,11 +4646,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4645: result: $ac_cv_header_dbmalloc_h" >&5 +echo "$as_me:4649: 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:4649: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:4653: 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 @@ -4654,7 +4658,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4657 "configure" +#line 4661 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4673,16 +4677,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4676: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4680: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4679: \$? = $ac_status" >&5 + echo "$as_me:4683: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4682: \"$ac_try\"") >&5 + { (eval echo "$as_me:4686: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4685: \$? = $ac_status" >&5 + echo "$as_me:4689: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -4693,7 +4697,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4696: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:4700: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then cat >>confdefs.h <&5 +echo "$as_me:4715: 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. @@ -4725,7 +4729,7 @@ EOF else with_valgrind= fi; -echo "$as_me:4728: result: ${with_valgrind:-no}" >&5 +echo "$as_me:4732: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case .$with_cflags in #(vi @@ -4818,7 +4822,7 @@ fi ;; esac -echo "$as_me:4821: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:4825: 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. @@ -4828,7 +4832,7 @@ if test "${enable_leaks+set}" = set; then else : ${with_no_leaks:=no} fi; -echo "$as_me:4831: result: $with_no_leaks" >&5 +echo "$as_me:4835: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$with_no_leaks" = yes ; then @@ -4924,7 +4928,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:4927: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:4931: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -5097,7 +5101,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:5100: error: ambiguous option: $1 + { { echo "$as_me:5104: 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;} @@ -5116,7 +5120,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:5119: error: unrecognized option: $1 + -*) { { echo "$as_me:5123: 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;} @@ -5153,7 +5157,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:5156: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:5160: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -5386,7 +5390,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:5389: creating $ac_file" >&5 + { echo "$as_me:5393: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -5404,7 +5408,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:5407: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5411: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5417,7 +5421,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5420: error: cannot find input file: $f" >&5 + { { echo "$as_me:5424: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5433,7 +5437,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:5436: WARNING: datarootdir was used implicitly but not set: + { echo "$as_me:5440: 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;} @@ -5442,7 +5446,7 @@ $ac_seen" >&2;} fi ac_seen=`grep '${datarootdir}' $ac_item` if test -n "$ac_seen"; then - { echo "$as_me:5445: WARNING: datarootdir was used explicitly but not set: + { echo "$as_me:5449: 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;} @@ -5479,7 +5483,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:5482: WARNING: Variable $ac_name is used but was not set: + { echo "$as_me:5486: 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;} @@ -5490,7 +5494,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:5493: WARNING: Some variables may not be substituted: + { echo "$as_me:5497: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} @@ -5539,7 +5543,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:5542: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:5546: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -5550,7 +5554,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:5553: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:5557: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -5563,7 +5567,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:5566: error: cannot find input file: $f" >&5 + { { echo "$as_me:5570: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -5681,7 +5685,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:5684: $ac_file is unchanged" >&5 + { echo "$as_me:5688: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ @@ -5748,3 +5752,51 @@ if test "$no_create" != yes; then $ac_cs_success || { (exit 1); exit 1; } fi +test -z "$cf_make_docs" && cf_make_docs=0 + +cf_output=makefile +test -f "$cf_output" || cf_output=Makefile + +if test "$cf_make_docs" = 0 +then +cat >>$cf_output <<"CF_EOF" +################################################################################ +.SUFFIXES : .html .1 .man .ps .pdf .txt + +.1.html : + GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.1 | groff -P -o0 -Iyacc,1_ -Thtml -man" >$@ + +.1.ps : + $(SHELL) -c "tbl $*.1 | groff -man" >$@ + +.1.txt : + GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.1 | nroff -Tascii -man | col -bx" >$@ + +.ps.pdf : + ps2pdf $*.ps + +CF_EOF + cf_make_docs=1 +fi + +for cf_name in yacc +do +cat >>$cf_output < @@ -104,6 +104,7 @@ #define PARSE_PARAM 13 #define LEX_PARAM 14 #define POSIX_YACC 15 +#define TOKEN_TABLE 16 /* symbol classes */ @@ -248,6 +249,7 @@ extern int lineno; extern int outline; extern int exit_code; extern int pure_parser; +extern int token_table; extern const char *const banner[]; extern const char *const xdecls[]; diff --git a/main.c b/main.c index 816e1547f82c..83301e57d62f 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.40 2012/09/29 13:11:00 Adrian.Bunk Exp $ */ +/* $Id: main.c,v 1.41 2014/01/01 14:23:27 Christos.Zoulas Exp $ */ #include #include /* for _exit() */ @@ -87,6 +87,7 @@ short *symbol_prec; char *symbol_assoc; int pure_parser; +int token_table; int exit_code; Value_t *ritem; diff --git a/makefile.in b/makefile.in index d3d9655b1e60..3da923869409 100644 --- a/makefile.in +++ b/makefile.in @@ -1,4 +1,4 @@ -# $Id: makefile.in,v 1.18 2012/09/29 13:10:15 Adrian.Bunk Exp $ +# $Id: makefile.in,v 1.19 2014/01/01 14:09:43 tom Exp $ # # UNIX template-makefile for Berkeley Yacc @@ -100,7 +100,7 @@ uninstall: - rm -f $(mandir)/$(actual_man) ################################################################################ -.SUFFIXES : $o .i .html .$(manext) .cat .ps .pdf .txt +.SUFFIXES : $o .i .c$o: @RULE_CC@ @@ -110,21 +110,6 @@ uninstall: @RULE_CC@ @ECHO_CC@$(CPP) -C $(CPPFLAGS) $*.c >$@ -.$(manext).cat : - - nroff -man $(srcdir)/$(THIS).$(manext) >$@ - -.$(manext).html : - GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | groff -Thtml -man" >$@ - -.$(manext).ps : - $(SHELL) -c "tbl $*.$(manext) | groff -man" >$@ - -.$(manext).txt : - GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | nroff -Tascii -man | col -bx" >$@ - -.ps.pdf : - ps2pdf $*.ps - ################################################################################ $(THIS)$x : $(OBJS) @@ -133,26 +118,16 @@ $(THIS)$x : $(OBJS) mostlyclean : - rm -f core .nfs* *$o *.bak *.BAK *.out -clean : mostlyclean +clean :: mostlyclean - rm -f $(THIS)$x -distclean : clean +distclean :: clean - rm -f config.log config.cache config.status config.h makefile - - rm -f *.html *.cat *.pdf *.ps *.txt - cd test && rm -f test-* -realclean: distclean +realclean :: distclean - rm -f tags TAGS -################################################################################ -docs :: $(THIS).html \ - $(THIS).pdf \ - $(THIS).ps \ - $(THIS).txt -$(THIS).html : $(THIS).$(manext) -$(THIS).pdf : $(THIS).ps -$(THIS).ps : $(THIS).$(manext) -$(THIS).txt : $(THIS).$(manext) ################################################################################ check: $(THIS)$x $(SHELL) $(testdir)/run_test.sh $(testdir) diff --git a/output.c b/output.c index 05c35d8292e4..f57c7e9f047b 100644 --- a/output.c +++ b/output.c @@ -1,4 +1,4 @@ -/* $Id: output.c,v 1.45 2013/03/05 00:29:17 tom Exp $ */ +/* $Id: output.c,v 1.47 2014/01/01 17:22:38 tom Exp $ */ #include "defs.h" @@ -921,23 +921,42 @@ output_debug(void) ++outline; fprintf(code_file, "#define YYMAXTOKEN %d\n", max); + fprintf(code_file, "#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? " + "(YYMAXTOKEN + 1) : (a))\n"); - symnam = TMALLOC(const char *, max + 1); + symnam = TMALLOC(const char *, max + 2); NO_SPACE(symnam); /* Note that it is not necessary to initialize the element */ /* symnam[max]. */ - for (i = 0; i < max; ++i) + 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"; - output_line("#if YYDEBUG"); + /* + * 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". + * + * If the grammar declares "%token-table", define symbol "yytname" so + * an application such as ntpd can build. + */ + if (token_table) + { + output_line("#undef yytname"); + output_line("#define yytname yyname"); + } + else + { + output_line("#if YYDEBUG"); + } start_str_table("name"); j = 80; - for (i = 0; i <= max; ++i) + for (i = 0; i <= max + 1; ++i) { if ((s = symnam[i]) != 0) { @@ -1058,6 +1077,8 @@ output_debug(void) end_table(); FREE(symnam); + if (token_table) + output_line("#if YYDEBUG"); start_str_table("rule"); for (i = 2; i < nrules; ++i) { diff --git a/package/byacc.spec b/package/byacc.spec index 9484619a2133..7bdf0ca46a66 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 20130925 +%define AppVersion 20140101 %define UseProgram yacc -# $XTermId: byacc.spec,v 1.17 2013/09/25 22:41:54 tom Exp $ +# $XTermId: byacc.spec,v 1.18 2014/01/01 17:26:25 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/debian/changelog b/package/debian/changelog index 500ed9ab2c91..ec5c16af4eb0 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,3 +1,9 @@ +byacc (20140101) unstable; urgency=low + + * yytname[] changes + + -- Thomas E. Dickey Wed, 01 Jan 2014 10:02:12 -0500 + byacc (20130925) unstable; urgency=low * increase default stack-size diff --git a/reader.c b/reader.c index 8fded5669e80..98f574cd5197 100644 --- a/reader.c +++ b/reader.c @@ -1,4 +1,4 @@ -/* $Id: reader.c,v 1.37 2013/09/25 23:46:18 tom Exp $ */ +/* $Id: reader.c,v 1.38 2014/01/01 14:23:27 Christos.Zoulas Exp $ */ #include "defs.h" @@ -317,6 +317,8 @@ keyword(void) return (PARSE_PARAM); if (matchec("lex-param")) return (LEX_PARAM); + if (matchec("token-table")) + return (TOKEN_TABLE); if (matchec("yacc")) return (POSIX_YACC); } @@ -1301,6 +1303,10 @@ read_declarations(void) copy_param(k); break; + case TOKEN_TABLE: + token_table = 1; + break; + case POSIX_YACC: /* noop for bison compatibility. byacc is already designed to be posix * yacc compatible. */ diff --git a/skeleton.c b/skeleton.c index dda69e60b314..7305b58d8394 100644 --- a/skeleton.c +++ b/skeleton.c @@ -1,4 +1,4 @@ -/* $Id: skeleton.c,v 1.33 2013/09/25 22:44:22 tom Exp $ */ +/* $Id: skeleton.c,v 1.35 2014/01/01 16:52:33 tom Exp $ */ #include "defs.h" @@ -231,9 +231,7 @@ const char *const body_2[] = "#if YYDEBUG", " if (yydebug)", " {", - " yys = 0;", - " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];", - " if (!yys) yys = \"illegal-symbol\";", + " yys = yyname[YYTRANSLATE(yychar)];", " printf(\"%sdebug: state %d, reading %d (%s)\\n\",", " YYPREFIX, yystate, yychar, yys);", " }", @@ -320,9 +318,7 @@ const char *const body_3[] = "#if YYDEBUG", " if (yydebug)", " {", - " yys = 0;", - " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];", - " if (!yys) yys = \"illegal-symbol\";", + " yys = yyname[YYTRANSLATE(yychar)];", " printf(\"%sdebug: state %d, error recovery discards token %d\ (%s)\\n\",", " YYPREFIX, yystate, yychar, yys);", @@ -371,9 +367,7 @@ const char *const trailer[] = "#if YYDEBUG", " if (yydebug)", " {", - " yys = 0;", - " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];", - " if (!yys) yys = \"illegal-symbol\";", + " yys = yyname[YYTRANSLATE(yychar)];", " printf(\"%sdebug: state %d, reading %d (%s)\\n\",", " YYPREFIX, YYFINAL, yychar, yys);", " }", diff --git a/test/calc.tab.c b/test/calc.tab.c index e86e30d1b861..1f3a81f58dbc 100644 --- a/test/calc.tab.c +++ b/test/calc.tab.c @@ -232,6 +232,7 @@ static const short calc_check[] = { 40, #define YYDEBUG 0 #endif #define YYMAXTOKEN 259 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -242,7 +243,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,"DIGIT","LETTER","UMINUS", +0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -441,9 +442,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -525,9 +524,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -609,7 +606,7 @@ case 18: #line 63 "calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 613 "calc.tab.c" +#line 609 "calc.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -631,9 +628,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/calc1.tab.c b/test/calc1.tab.c index 619bc71039f0..b7706a534e4e 100644 --- a/test/calc1.tab.c +++ b/test/calc1.tab.c @@ -272,6 +272,7 @@ static const short calc1_check[] = { 40, #define YYDEBUG 0 #endif #define YYMAXTOKEN 260 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -282,7 +283,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,"DREG","VREG","CONST","UMINUS", +0,0,"DREG","VREG","CONST","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : line", @@ -580,9 +581,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -664,9 +663,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -851,7 +848,7 @@ case 28: yyval.vval = yystack.l_mark[-1].vval; } break; -#line 855 "calc1.tab.c" +#line 851 "calc1.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -873,9 +870,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/calc2.tab.c b/test/calc2.tab.c index 359dbe24a44d..093ca4b55e29 100644 --- a/test/calc2.tab.c +++ b/test/calc2.tab.c @@ -234,6 +234,7 @@ static const short calc2_check[] = { 40, #define YYDEBUG 0 #endif #define YYMAXTOKEN 259 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -244,7 +245,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,"DIGIT","LETTER","UMINUS", +0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -450,9 +451,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -534,9 +533,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -618,7 +615,7 @@ case 18: #line 70 "calc2.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 622 "calc2.tab.c" +#line 618 "calc2.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -640,9 +637,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/calc3.tab.c b/test/calc3.tab.c index 4760f152d675..2611b218c42c 100644 --- a/test/calc3.tab.c +++ b/test/calc3.tab.c @@ -239,6 +239,7 @@ static const short calc3_check[] = { 40, #define YYDEBUG 0 #endif #define YYMAXTOKEN 259 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -249,7 +250,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,"DIGIT","LETTER","UMINUS", +0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -455,9 +456,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -539,9 +538,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -623,7 +620,7 @@ case 18: #line 73 "calc3.y" { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 627 "calc3.tab.c" +#line 623 "calc3.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -645,9 +642,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/code_calc.code.c b/test/code_calc.code.c index f921570c45aa..7aab9715af7e 100644 --- a/test/code_calc.code.c +++ b/test/code_calc.code.c @@ -73,6 +73,7 @@ extern int YYPARSE_DECL(); #define YYDEBUG 0 #endif #define YYMAXTOKEN 259 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #ifndef yyparse #define yyparse calc_parse @@ -348,9 +349,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -432,9 +431,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -516,7 +513,7 @@ case 18: #line 65 "code_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 520 "code_calc.code.c" +#line 516 "code_calc.code.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -538,9 +535,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/code_calc.tab.c b/test/code_calc.tab.c index 37a17ef4f814..c4bc96a23624 100644 --- a/test/code_calc.tab.c +++ b/test/code_calc.tab.c @@ -172,7 +172,7 @@ const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,"DIGIT","LETTER","UMINUS", +0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol", }; const char *yyrule[] = { "$accept : list", diff --git a/test/code_error.code.c b/test/code_error.code.c index 481381c58816..c15517f293b8 100644 --- a/test/code_error.code.c +++ b/test/code_error.code.c @@ -65,6 +65,7 @@ extern int YYPARSE_DECL(); #define YYDEBUG 0 #endif #define YYMAXTOKEN 0 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #ifndef yyparse #define yyparse error_parse @@ -320,9 +321,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -404,9 +403,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -449,9 +446,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/code_error.tab.c b/test/code_error.tab.c index eb4db127835f..c178fdd08796 100644 --- a/test/code_error.tab.c +++ b/test/code_error.tab.c @@ -108,7 +108,7 @@ const short error_check[] = { 256, #if YYDEBUG const char *yyname[] = { -"end-of-file", +"end-of-file","illegal-symbol", }; const char *yyrule[] = { "$accept : S", diff --git a/test/error.tab.c b/test/error.tab.c index 35c82a601a48..f0406b7e81db 100644 --- a/test/error.tab.c +++ b/test/error.tab.c @@ -165,10 +165,11 @@ static const short error_check[] = { 256, #define YYDEBUG 0 #endif #define YYMAXTOKEN 0 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { -"end-of-file", +"end-of-file","illegal-symbol", }; static const char *yyrule[] = { "$accept : S", @@ -330,9 +331,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -414,9 +413,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -459,9 +456,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/ftp.tab.c b/test/ftp.tab.c index b7b4d46217d8..71d7c6e70e93 100644 --- a/test/ftp.tab.c +++ b/test/ftp.tab.c @@ -448,6 +448,7 @@ static const short ftp_check[] = { 89, #define YYDEBUG 0 #endif #define YYMAXTOKEN 319 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -462,7 +463,7 @@ static const char *yyname[] = { "QUIT","PORT","PASV","TYPE","STRU","MODE","RETR","STOR","APPE","MLFL","MAIL", "MSND","MSOM","MSAM","MRSQ","MRCP","ALLO","REST","RNFR","RNTO","ABOR","DELE", "CWD","LIST","NLST","SITE","STAT","HELP","NOOP","MKD","RMD","PWD","CDUP","STOU", -"SMNT","SYST","SIZE","MDTM","UMASK","IDLE","CHMOD","LEXERR", +"SMNT","SYST","SIZE","MDTM","UMASK","IDLE","CHMOD","LEXERR","illegal-symbol", }; static const char *yyrule[] = { "$accept : cmd_list", @@ -1197,9 +1198,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -1281,9 +1280,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -1946,7 +1943,7 @@ case 73: } } break; -#line 1950 "ftp.tab.c" +#line 1946 "ftp.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -1968,9 +1965,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/grammar.tab.c b/test/grammar.tab.c index 7b1871508ad7..42e8494c7283 100644 --- a/test/grammar.tab.c +++ b/test/grammar.tab.c @@ -740,6 +740,7 @@ static const short grammar_check[] = { 38, #define YYDEBUG 0 #endif #define YYMAXTOKEN 291 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -756,6 +757,7 @@ static const char *yyname[] = { "T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary", "T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS", "T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL", +"illegal-symbol", }; static const char *yyrule[] = { "$accept : program", @@ -1081,7 +1083,7 @@ free_parser(void) #endif } #endif -#line 1085 "grammar.tab.c" +#line 1086 "grammar.tab.c" #if YYDEBUG #include /* needed for printf */ @@ -1179,9 +1181,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -1263,9 +1263,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -1961,7 +1959,7 @@ case 114: yyval.declarator->func_def = FUNC_ANSI; } break; -#line 1965 "grammar.tab.c" +#line 1962 "grammar.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -1983,9 +1981,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/pure_calc.tab.c b/test/pure_calc.tab.c index 40d784eadf10..112da016d4e8 100644 --- a/test/pure_calc.tab.c +++ b/test/pure_calc.tab.c @@ -242,6 +242,7 @@ static const short calc_check[] = { 40, #define YYDEBUG 0 #endif #define YYMAXTOKEN 259 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -252,7 +253,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,"DIGIT","LETTER","UMINUS", +0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -455,9 +456,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -539,9 +538,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -623,7 +620,7 @@ case 18: #line 69 "pure_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 627 "pure_calc.tab.c" +#line 623 "pure_calc.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -645,9 +642,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/pure_error.tab.c b/test/pure_error.tab.c index 7b6334caf0da..9af29c8006f7 100644 --- a/test/pure_error.tab.c +++ b/test/pure_error.tab.c @@ -177,10 +177,11 @@ static const short error_check[] = { 256, #define YYDEBUG 0 #endif #define YYMAXTOKEN 0 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { -"end-of-file", +"end-of-file","illegal-symbol", }; static const char *yyrule[] = { "$accept : S", @@ -346,9 +347,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -430,9 +429,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -475,9 +472,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/quote_calc-s.tab.c b/test/quote_calc-s.tab.c index 5f34b24c5afa..510a74de2b20 100644 --- a/test/quote_calc-s.tab.c +++ b/test/quote_calc-s.tab.c @@ -246,6 +246,7 @@ static const short quote_calc_check[] = { 10, #define YYDEBUG 0 #endif #define YYMAXTOKEN 271 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -258,6 +259,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV", "\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS", +"illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -357,7 +359,7 @@ yylex(void) { } return( c ); } -#line 361 "quote_calc-s.tab.c" +#line 362 "quote_calc-s.tab.c" #if YYDEBUG #include /* needed for printf */ @@ -455,9 +457,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -539,9 +539,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -623,7 +621,7 @@ case 18: #line 70 "quote_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 627 "quote_calc-s.tab.c" +#line 624 "quote_calc-s.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -645,9 +643,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/quote_calc.tab.c b/test/quote_calc.tab.c index 1c6e111bc774..c48ea29ae5ec 100644 --- a/test/quote_calc.tab.c +++ b/test/quote_calc.tab.c @@ -252,6 +252,7 @@ static const short quote_calc_check[] = { 10, #define YYDEBUG 0 #endif #define YYMAXTOKEN 271 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -264,6 +265,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV", "\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS", +"illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -363,7 +365,7 @@ yylex(void) { } return( c ); } -#line 367 "quote_calc.tab.c" +#line 368 "quote_calc.tab.c" #if YYDEBUG #include /* needed for printf */ @@ -461,9 +463,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -545,9 +545,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -629,7 +627,7 @@ case 18: #line 70 "quote_calc.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 633 "quote_calc.tab.c" +#line 630 "quote_calc.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -651,9 +649,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/quote_calc2-s.tab.c b/test/quote_calc2-s.tab.c index fdd9c9092adb..e2e0235b2406 100644 --- a/test/quote_calc2-s.tab.c +++ b/test/quote_calc2-s.tab.c @@ -246,6 +246,7 @@ static const short quote_calc2_check[] = { 10, #define YYDEBUG 0 #endif #define YYMAXTOKEN 271 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -258,6 +259,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV", "\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS", +"illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -357,7 +359,7 @@ yylex(void) { } return( c ); } -#line 361 "quote_calc2-s.tab.c" +#line 362 "quote_calc2-s.tab.c" #if YYDEBUG #include /* needed for printf */ @@ -455,9 +457,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -539,9 +539,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -623,7 +621,7 @@ case 18: #line 70 "quote_calc2.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 627 "quote_calc2-s.tab.c" +#line 624 "quote_calc2-s.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -645,9 +643,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/quote_calc2.tab.c b/test/quote_calc2.tab.c index 0043df4cb6c5..c7222342596f 100644 --- a/test/quote_calc2.tab.c +++ b/test/quote_calc2.tab.c @@ -252,6 +252,7 @@ static const short quote_calc2_check[] = { 10, #define YYDEBUG 0 #endif #define YYMAXTOKEN 271 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -264,6 +265,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV", "\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS", +"illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -363,7 +365,7 @@ yylex(void) { } return( c ); } -#line 367 "quote_calc2.tab.c" +#line 368 "quote_calc2.tab.c" #if YYDEBUG #include /* needed for printf */ @@ -461,9 +463,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -545,9 +545,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -629,7 +627,7 @@ case 18: #line 70 "quote_calc2.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 633 "quote_calc2.tab.c" +#line 630 "quote_calc2.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -651,9 +649,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/quote_calc3-s.tab.c b/test/quote_calc3-s.tab.c index 4cd55a9318c9..237bf9d7b55a 100644 --- a/test/quote_calc3-s.tab.c +++ b/test/quote_calc3-s.tab.c @@ -246,6 +246,7 @@ static const short quote_calc3_check[] = { 10, #define YYDEBUG 0 #endif #define YYMAXTOKEN 271 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -258,7 +259,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL", "\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"", -"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS", +"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -456,9 +457,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -540,9 +539,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -624,7 +621,7 @@ case 18: #line 70 "quote_calc3.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 628 "quote_calc3-s.tab.c" +#line 624 "quote_calc3-s.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -646,9 +643,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/quote_calc3.tab.c b/test/quote_calc3.tab.c index 8b00113a59d0..8107441939d8 100644 --- a/test/quote_calc3.tab.c +++ b/test/quote_calc3.tab.c @@ -246,6 +246,7 @@ static const short quote_calc3_check[] = { 10, #define YYDEBUG 0 #endif #define YYMAXTOKEN 271 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -258,7 +259,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL", "\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"", -"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS", +"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -456,9 +457,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -540,9 +539,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -624,7 +621,7 @@ case 18: #line 70 "quote_calc3.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 628 "quote_calc3.tab.c" +#line 624 "quote_calc3.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -646,9 +643,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/quote_calc4-s.tab.c b/test/quote_calc4-s.tab.c index bf0fda09f780..7f84277faaf9 100644 --- a/test/quote_calc4-s.tab.c +++ b/test/quote_calc4-s.tab.c @@ -246,6 +246,7 @@ static const short quote_calc4_check[] = { 10, #define YYDEBUG 0 #endif #define YYMAXTOKEN 271 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -258,7 +259,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL", "\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"", -"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS", +"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -456,9 +457,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -540,9 +539,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -624,7 +621,7 @@ case 18: #line 70 "quote_calc4.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 628 "quote_calc4-s.tab.c" +#line 624 "quote_calc4-s.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -646,9 +643,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/test/quote_calc4.tab.c b/test/quote_calc4.tab.c index 5913dde86184..239a593e441b 100644 --- a/test/quote_calc4.tab.c +++ b/test/quote_calc4.tab.c @@ -246,6 +246,7 @@ static const short quote_calc4_check[] = { 10, #define YYDEBUG 0 #endif #define YYMAXTOKEN 271 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) #if YYDEBUG static const char *yyname[] = { @@ -258,7 +259,7 @@ static const char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL", "\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"", -"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS", +"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol", }; static const char *yyrule[] = { "$accept : list", @@ -456,9 +457,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -540,9 +539,7 @@ YYPARSE_DECL() #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } @@ -624,7 +621,7 @@ case 18: #line 70 "quote_calc4.y" { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } break; -#line 628 "quote_calc4.tab.c" +#line 624 "quote_calc4.tab.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; @@ -646,9 +643,7 @@ break; #if YYDEBUG if (yydebug) { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; + yys = yyname[YYTRANSLATE(yychar)]; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } diff --git a/yacc.1 b/yacc.1 index 239380a360b1..e7c5b996934b 100644 --- a/yacc.1 +++ b/yacc.1 @@ -1,4 +1,4 @@ -.\" $Id: yacc.1,v 1.18 2012/01/15 18:12:28 tom Exp $ +.\" $Id: yacc.1,v 1.20 2014/01/01 17:40:13 tom Exp $ .\" .\" .TH YACC 1 "July\ 15,\ 1990" .\" .UC 6 @@ -8,15 +8,22 @@ .sp .in +4 .. -.de EE +.de XE .in -4 .fi .. +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds AQ \(aq +.el .ds AQ ' +.ie \n(.g .ds `` \(lq +.el .ds `` `` +.ie \n(.g .ds '' \(rq +.el .ds '' '' .\" Bulleted paragraph .de bP .IP \(bu 4 .. -.TH YACC 1 "September 7, 2011" "Berkeley Yacc" "User Commands" +.TH YACC 1 "January 1, 2014" "Berkeley Yacc" "User Commands" .SH NAME Yacc \- an LALR(1) parser generator .SH SYNOPSIS @@ -105,30 +112,31 @@ The default prefix is the string .BR yy. .TP .B \-P -create a reentrant parser, e.g., "%pure-parser". +create a reentrant parser, e.g., \*(``%pure-parser\*(''. .TP .B \-r The .B \-r option causes .B yacc -to produce separate files for code and tables. The code file -is named +to produce separate files for code and tables. +The code file is named .IR y.code.c, and the tables file is named .IR y.tab.c. -The prefix "\fIy.\fP" can be overridden using the \fB\-b\fP option. +The prefix \*(``\fIy.\fP\*('' can be overridden using the \fB\-b\fP option. .TP .B \-s -suppress "\fB#define\fP" statements generated for string literals in -a "\fB%token\fP" statement, to more closely match original \fByacc\fP behavior. +suppress \*(``\fB#define\fP\*('' statements generated for string literals in +a \*(``\fB%token\fP\*('' statement, +to more closely match original \fByacc\fP behavior. .IP Normally when \fByacc\fP sees a line such as .ES %token OP_ADD "ADD" -.EE +.XE .IP -it notices that the quoted "ADD" is a valid C identifier, +it notices that the quoted \*(``ADD\*('' is a valid C identifier, and generates a #define not only for OP_ADD, but for ADD as well, e.g., @@ -136,12 +144,13 @@ e.g., #define OP_ADD 257 .br #define ADD 258 -.EE +.XE .IP -The original \fByacc\fP does not generate the second "\fB#define\fP". -The \fB\-s\fP option suppresses this "\fB#define\fP". +The original \fByacc\fP does not generate the second \*(``\fB#define\fP\*(''. +The \fB\-s\fP option suppresses this \*(``\fB#define\fP\*(''. .IP -POSIX (IEEE 1003.1 2004) documents only names and numbers for "\fB%token\fP", +POSIX (IEEE 1003.1 2004) documents only names and numbers +for \*(``\fB%token\fP\*('', though original \fByacc\fP and bison also accept string literals. .TP .B \-t @@ -166,8 +175,8 @@ print the version number to the standard output. which bison supports for ostensible POSIX compatibility. .SH EXTENSIONS .B yacc -provides some extensions for compatibility with bison and other implementations -of yacc: +provides some extensions for +compatibility with bison and other implementations of yacc: .TP \fB %expect\fP \fInumber\fP tell \fByacc\fP the expected number of shift/reduce conflicts. @@ -190,6 +199,13 @@ Use this directive to add parameter declarations for your customized parser. Most variables (other than \fByydebug\fP and \fByynerrs\fP) are allocated on the stack within \fByyparse\fP, making the parser reasonably reentrant. +.TP +\fB %token-table\fP +Make the parser's names for tokens available in the \fByytname\fP array. +However, +.B yacc +does not predefine \*(``$end\*('', \*(``$error\*('' +or \*(``$undefined\*('' in this array. .SH PORTABILITY According to Robert Corbett, .ES @@ -198,12 +214,12 @@ as compatible as possible with AT&T Yacc. Berkeley Yacc can accept any input specification that conforms to the AT&T Yacc documentation. Specifications that take advantage of undocumented features of AT&T Yacc will probably be rejected. -.EE +.XE .PP The rationale in .ES http://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html -.EE +.XE .PP documents some features of AT&T yacc which are no longer required for POSIX compliance. @@ -220,19 +236,19 @@ of an action (as in the original grammar file \fBftp.y\fP): = { statcmd(); } -.EE +.XE .bP \fBYacc\fP and bison emit code in different order, and in particular bison makes forward reference to common functions such as yylex, yyparse and yyerror without providing prototypes. .bP -Bison's support for "%expect" is broken in more than one release. +Bison's support for \*(``%expect\*('' is broken in more than one release. For best results using bison, delete that directive. .bP Bison has no equivalent for some of \fByacc\fP's commmand-line options, relying on directives embedded in the grammar file. .bP -Bison's "\fB\-y\fP" option does not affect bison's lack of support for +Bison's \*(``\fB\-y\fP\*('' option does not affect bison's lack of support for features of AT&T yacc which were deemed obsolescent. . .SH DIAGNOSTICS