snapshot of project "byacc", label t20221106

This commit is contained in:
Thomas E. Dickey 2022-11-06 21:55:25 +00:00
parent e9df24d3e5
commit 367a026638
No known key found for this signature in database
GPG Key ID: CC2AF4472167BE03
18 changed files with 1279 additions and 873 deletions

328
CHANGES

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
MANIFEST for byacc, version t20220128
MANIFEST for byacc, version t20221106
--------------------------------------------------------------------------------
MANIFEST this file
ACKNOWLEDGEMENTS original version of byacc - 1993

View File

@ -1 +1 @@
20220128
20221106

63
aclocal.m4 vendored
View File

@ -1,7 +1,7 @@
dnl $Id: aclocal.m4,v 1.56 2021/12/16 23:22:31 tom Exp $
dnl $Id: aclocal.m4,v 1.57 2022/10/02 23:55:56 tom Exp $
dnl Macros for byacc configure script (Thomas E. Dickey)
dnl ---------------------------------------------------------------------------
dnl Copyright 2004-2020,2021 Thomas E. Dickey
dnl Copyright 2004-2021,2022 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
@ -1449,7 +1449,7 @@ AC_SUBST(GROFF_NOTE)
AC_SUBST(NROFF_NOTE)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_LINT version: 4 updated: 2019/11/20 18:55:37
dnl CF_PROG_LINT version: 5 updated: 2022/08/20 15:44:13
dnl ------------
AC_DEFUN([CF_PROG_LINT],
[
@ -1460,6 +1460,7 @@ case "x$LINT" in
;;
esac
AC_SUBST(LINT_OPTS)
AC_SUBST(LINT_LIBS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40
@ -1497,34 +1498,20 @@ $1=`echo "$2" | \
-e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_TRY_XOPEN_SOURCE version: 3 updated: 2021/08/28 15:20:37
dnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16
dnl -------------------
dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
dnl can define it successfully.
AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
AC_TRY_COMPILE([
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
],[
#ifndef _XOPEN_SOURCE
make an error
#endif],
AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,
[cf_cv_xopen_source=no],
[cf_save="$CPPFLAGS"
CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE)
AC_TRY_COMPILE([
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
],[
#ifdef _XOPEN_SOURCE
make an error
#endif],
[cf_cv_xopen_source=no],
[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
CPPFLAGS="$cf_save"
AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,
[cf_cv_xopen_source=no],
[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
CPPFLAGS="$cf_save"
])
])
@ -1779,7 +1766,7 @@ CF_NO_LEAKS_OPTION(valgrind,
[USE_VALGRIND])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_XOPEN_SOURCE version: 59 updated: 2021/08/28 15:20:37
dnl CF_XOPEN_SOURCE version: 62 updated: 2022/10/02 19:55:56
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,
@ -1830,7 +1817,7 @@ case "$host_os" in
cf_xopen_source="-D_SGI_SOURCE"
cf_XOPEN_SOURCE=
;;
(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
CF_GNU_SOURCE($cf_XOPEN_SOURCE)
;;
(minix*)
@ -1879,7 +1866,13 @@ case "$host_os" in
;;
(*)
CF_TRY_XOPEN_SOURCE
cf_save_xopen_cppflags="$CPPFLAGS"
CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
# Some of these niche implementations use copy/paste, double-check...
CF_VERBOSE(checking if _POSIX_C_SOURCE inteferes)
AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[
AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable)
CPPFLAGS="$cf_save_xopen_cppflags"])
;;
esac
@ -1917,3 +1910,23 @@ make an error
fi
fi # cf_cv_posix_visible
])
dnl ---------------------------------------------------------------------------
dnl CF__XOPEN_SOURCE_BODY version: 1 updated: 2022/09/10 15:17:35
dnl ---------------------
dnl body of test when test-compiling for _XOPEN_SOURCE check
define([CF__XOPEN_SOURCE_BODY],
[
#ifndef _XOPEN_SOURCE
make an error
#endif
])
dnl ---------------------------------------------------------------------------
dnl CF__XOPEN_SOURCE_HEAD version: 1 updated: 2022/09/10 15:17:03
dnl ---------------------
dnl headers to include when test-compiling for _XOPEN_SOURCE check
define([CF__XOPEN_SOURCE_HEAD],
[
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
])

45
config.guess vendored
View File

@ -1,14 +1,14 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2021 Free Software Foundation, Inc.
# Copyright 1992-2022 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2021-11-30'
timestamp='2022-08-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
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@ -60,7 +60,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2021 Free Software Foundation, Inc.
Copyright 1992-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -929,6 +929,9 @@ EOF
i*:PW*:*)
GUESS=$UNAME_MACHINE-pc-pw32
;;
*:SerenityOS:*:*)
GUESS=$UNAME_MACHINE-pc-serenity
;;
*:Interix*:*)
case $UNAME_MACHINE in
x86)
@ -1033,7 +1036,7 @@ EOF
k1om:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
loongarch32:Linux:*:* | loongarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
m32r*:Linux:*:*)
@ -1148,16 +1151,27 @@ EOF
;;
x86_64:Linux:*:*)
set_cc_for_build
CPU=$UNAME_MACHINE
LIBCABI=$LIBC
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_X32 >/dev/null
then
LIBCABI=${LIBC}x32
fi
ABI=64
sed 's/^ //' << EOF > "$dummy.c"
#ifdef __i386__
ABI=x86
#else
#ifdef __ILP32__
ABI=x32
#endif
#endif
EOF
cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
eval "$cc_set_abi"
case $ABI in
x86) CPU=i686 ;;
x32) LIBCABI=${LIBC}x32 ;;
esac
fi
GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
GUESS=$CPU-pc-linux-$LIBCABI
;;
xtensa*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
@ -1364,8 +1378,11 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
GUESS=i586-pc-haiku
;;
x86_64:Haiku:*:*)
GUESS=x86_64-unknown-haiku
ppc:Haiku:*:*) # Haiku running on Apple PowerPC
GUESS=powerpc-apple-haiku
;;
*:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat)
GUESS=$UNAME_MACHINE-unknown-haiku
;;
SX-4:SUPER-UX:*:*)
GUESS=sx4-nec-superux$UNAME_RELEASE

15
config.sub vendored
View File

@ -1,14 +1,14 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2021 Free Software Foundation, Inc.
# Copyright 1992-2022 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2021-12-24'
timestamp='2022-08-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
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@ -76,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2021 Free Software Foundation, Inc.
Copyright 1992-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -1020,6 +1020,11 @@ case $cpu-$vendor in
;;
# Here we normalize CPU types with a missing or matching vendor
armh-unknown | armh-alt)
cpu=armv7l
vendor=alt
basic_os=${basic_os:-linux-gnueabihf}
;;
dpx20-unknown | dpx20-bull)
cpu=rs6000
vendor=bull
@ -1202,7 +1207,7 @@ case $cpu-$vendor in
| k1om \
| le32 | le64 \
| lm32 \
| loongarch32 | loongarch64 | loongarchx32 \
| loongarch32 | loongarch64 \
| m32c | m32r | m32rle \
| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \

868
configure vendored

File diff suppressed because it is too large Load Diff

4
defs.h
View File

@ -1,4 +1,4 @@
/* $Id: defs.h,v 1.70 2021/08/01 22:21:53 tom Exp $ */
/* $Id: defs.h,v 1.71 2022/11/06 21:44:54 tom Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -360,7 +360,7 @@ extern char line_format[];
#define fprintf_lineno(f, n, s) \
if (!lflag) \
fprintf(f, line_format, (n), (s))
fprintf(f, line_format, (n), (s) ? (s) : "(null)")
extern Value_t start_symbol;
extern char **symbol_name;

View File

@ -1,7 +1,8 @@
#! /bin/sh
#
#!/bin/sh
# install - install a program, script, or datafile
#
scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
@ -34,261 +35,507 @@
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# set DOITPROG to echo to test this script
# Set DOITPROG to "echo" to test this script.
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
# put in absolute paths if you don't have them in your path; or use env. vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
posix_mkdir=
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
stripcmd=
while [ x"$1" != x ]; do
case $1 in
-c) instcmd=$cpprog
shift
continue;;
src=
dst=
dir_arg=
dst_arg=
-d) dir_arg=true
shift
continue;;
copy_on_change=false
is_target_a_directory=possibly
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
Options:
--help display this help and exit.
--version display version info and exit.
-s) stripcmd=$stripprog
shift
continue;;
-c (ignored)
-C install only if different (preserve data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-p) cpprog="$cpprog -p";;
-s) stripcmd=$stripprog;;
-S) backupsuffix="$2"
shift;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
if [ x"$src" = x ]
then
echo "$0: no input file specified" >&2
exit 1
else
:
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "$0: $src does not exist" >&2
exit 1
fi
if [ x"$dst" = x ]
then
echo "$0: no destination specified" >&2
exit 1
else
:
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d "$dst" ]
then
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp=$pathcomp$1
shift
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "$pathcomp"
else
:
fi
pathcomp=$pathcomp/
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename "$dst"`
else
:
fi
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$#
rmtmp=$dstdir/#rm.$$#
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@ -1,4 +1,4 @@
# $Id: makefile.in,v 1.24 2015/07/05 22:12:29 tom Exp $
# $Id: makefile.in,v 1.25 2022/11/06 21:03:11 tom Exp $
#
# UNIX template-makefile for Berkeley Yacc
@ -27,6 +27,7 @@ LIBS = @LIBS@
AWK = @AWK@
CTAGS = @CTAGS@
ETAGS = @ETAGS@
FGREP = @FGREP@
LINT = @LINT@
LINTFLAGS = @LINT_OPTS@
@ -147,13 +148,16 @@ maintainer-clean :: realclean
################################################################################
check: $(THIS)$x
$(SHELL) $(testdir)/run_test.sh $(testdir)
@echo "** making $@"
@FGREP="$(FGREP)" $(SHELL) $(testdir)/run_test.sh $(testdir)
check_make: $(THIS)$x
$(SHELL) $(testdir)/run_make.sh $(testdir)
@echo "** making $@"
@FGREP="$(FGREP)" $(SHELL) $(testdir)/run_make.sh $(testdir)
check_lint:
$(SHELL) $(testdir)/run_lint.sh $(testdir)
@echo "** making $@"
@FGREP="$(FGREP)" $(SHELL) $(testdir)/run_lint.sh $(testdir)
################################################################################
tags: $(H_FILES) $(C_FILES)
$(CTAGS) $(C_FILES) $(H_FILES)

View File

@ -1,12 +1,12 @@
Summary: public domain Berkeley LALR Yacc parser generator
%global AppVersion 2.0
%global AppPatched 20220128
%global AppPatched 20221106
%global AltProgram byacc2
%global UseProgram yacc
# $Id: byacc.spec,v 1.67 2022/01/28 13:38:52 tom Exp $
# $Id: byacc.spec,v 1.68 2022/11/06 15:51:43 tom Exp $
Name: byacc
Version: %{AppVersion}.%{AppPatched}
Release: 1

View File

@ -1,3 +1,9 @@
byacc (1:2.0.20221106) unstable; urgency=low
* maintenance updates
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 06 Nov 2022 10:51:43 -0500
byacc (1:2.0.20220128) unstable; urgency=low
* maintenance updates

View File

@ -1,11 +1,11 @@
Summary: public domain Berkeley LALR Yacc parser generator
%global AppVersion 2.0
%global AppPatched 20220128
%global AppPatched 20221106
%global UseProgram yacc
# $Id: mingw-byacc.spec,v 1.44 2022/01/28 13:38:52 tom Exp $
# $Id: mingw-byacc.spec,v 1.45 2022/11/06 15:51:43 tom Exp $
Name: byacc
Version: %{AppVersion}.%{AppPatched}
Release: 1

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.24 2021/08/14 01:04:32 mef Exp $
#
DISTNAME= byacc-20220128
DISTNAME= byacc-20221106
CATEGORIES= devel
MASTER_SITES= https://invisible-mirror.net/archives/byacc/
DIST_SUBDIR= byacc-20220101

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $Id: run_lint.sh,v 1.4 2021/06/19 19:30:10 tom Exp $
# $Id: run_lint.sh,v 1.5 2022/11/06 20:56:42 tom Exp $
# vi:ts=4 sw=4:
# run lint on each of the ".c" files in the test directory
@ -13,7 +13,8 @@ else
TEST_DIR=.
fi
ifBTYACC=`grep -F -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
: "${FGREP:=grep -F}"
ifBTYACC=`$FGREP -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
if test "$ifBTYACC" = 0; then
REF_DIR=${TEST_DIR}/yacc

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $Id: run_make.sh,v 1.20 2022/01/01 20:53:16 tom Exp $
# $Id: run_make.sh,v 1.21 2022/11/06 20:57:33 tom Exp $
# vi:ts=4 sw=4:
# do a test-compile on each of the ".c" files in the test-directory
@ -16,7 +16,8 @@ else
fi
THIS_DIR=`pwd`
ifBTYACC=`grep -F -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
: "${FGREP:=grep -F}"
ifBTYACC=`$FGREP -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
if test "$ifBTYACC" = 0; then
REF_DIR=${TEST_DIR}/yacc
@ -99,7 +100,7 @@ then
case $input in
${TEST_DIR}/pure_*)
if test -z "`grep -F -i -l '%pure-parser' "$input"`"
if test -z "`$FGREP -i -l '%pure-parser' "$input"`"
then
echo "%pure-parser" >>run_make.y
fi
@ -160,11 +161,11 @@ then
continue;
;;
*)
if grep -F -i '%pure-parser' "$input" >/dev/null ||
grep -F -i '%parse-param' "$input" >/dev/null ||
grep -F -i '%lex-param' "$input" >/dev/null ||
grep -F -i '%token-table' "$input" >/dev/null ||
grep -F 'YYLEX_PARAM' "$input" >/dev/null
if $FGREP -i '%pure-parser' "$input" >/dev/null ||
$FGREP -i '%parse-param' "$input" >/dev/null ||
$FGREP -i '%lex-param' "$input" >/dev/null ||
$FGREP -i '%token-table' "$input" >/dev/null ||
$FGREP 'YYLEX_PARAM' "$input" >/dev/null
then
echo "... skipping $input"
continue;

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $Id: run_test.sh,v 1.35 2022/01/01 22:28:17 tom Exp $
# $Id: run_test.sh,v 1.37 2022/11/06 21:55:25 tom Exp $
# vi:ts=4 sw=4:
errors=0
@ -39,7 +39,7 @@ test_diffs() {
rm -f "$CMP"
else
echo "...diff $REF"
diff -u "$REF" "$CMP"
diff -c "$REF" "$CMP"
errors=1
fi
fi
@ -127,7 +127,8 @@ YACC_escaped=`echo "$PROG_DIR/yacc" | sed -e 's/\./\\\./g'`
tmpfile=temp$$
ifBTYACC=`grep -F -l 'define YYBTYACC' $PROG_DIR/config.h > /dev/null; test $? != 0; echo $?`
: "${FGREP:=grep -F}"
ifBTYACC=`$FGREP -l 'define YYBTYACC' $PROG_DIR/config.h > /dev/null; test $? != 0; echo $?`
if test "$ifBTYACC" = 0; then
REF_DIR=${TEST_DIR}/yacc

45
yacc.1
View File

@ -1,4 +1,4 @@
.\" $Id: yacc.1,v 1.38 2021/08/02 23:55:03 tom Exp $
.\" $Id: yacc.1,v 1.42 2022/11/06 17:07:16 tom Exp $
.\"
.\" .TH YACC 1 "July\ 15,\ 1990"
.\" .UC 6
@ -27,7 +27,7 @@
.ie n .IP \(bu 4
.el .IP \(bu 2
..
.TH YACC 1 "August 2, 2021" "Berkeley Yacc" "User Commands"
.TH YACC 1 "November 6, 2022" "Berkeley Yacc" "User Commands"
.SH NAME
\*N \- an LALR(1) parser generator
.SH SYNOPSIS
@ -54,7 +54,7 @@ normally writes the parse tables and the driver routine to the file
.PP
The following options are available:
.TP 5
\fB\-b \fP\fIfile_prefix\fR
\fB\-b \fIfile_prefix\fR
The
.B \-b
option changes the prefix prepended to the output file names to
@ -73,9 +73,9 @@ to be written.
It contains #define's for the token identifiers.
.TP
.B \-h
print a usage message.
print a usage message to the standard error.
.TP
\fB\-H \fP\fIdefines_file\fR
\fB\-H \fIdefines_file\fR
causes #define's for the token identifiers
to be written to the given \fIdefines_file\fP rather
than the \fBy.tab.h\fP file used by the \fB\-d\fP option.
@ -120,13 +120,13 @@ will not insert the \fI#line\fP directives.
enable position processing,
e.g., \*(``%locations\*('' (compile-time configuration for \fBbtyacc\fP).
.TP
\fB\-o \fP\fIoutput_file\fR
\fB\-o \fIoutput_file\fR
specify the filename for the parser file.
If this option is not given, the output filename is
the file prefix concatenated with the file suffix, e.g., \fBy.tab.c\fP.
This overrides the \fB\-b\fP option.
.TP
\fB\-p \fP\fIsymbol_prefix\fR
\fB\-p \fIsymbol_prefix\fR
The
.B \-p
option changes the prefix prepended to yacc-generated symbols to
@ -155,7 +155,7 @@ 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
Normally when \fB\*n\fP sees a line such as
.Ex
%token OP_ADD "ADD"
.Ee
@ -183,6 +183,11 @@ The
option changes the preprocessor directives generated by
.B \*n
so that debugging statements will be incorporated in the compiled code.
.IP
\fB\*N\fR sends debugging output to the standard output
(compatible with both the original \fByacc\fP and \fBbtyacc\fP),
while \fBbtyacc\fP writes debugging output to the standard error
(like \fBbison\fP).
.TP
.B \-v
The
@ -195,11 +200,11 @@ be written to the file
print the version number to the standard output.
.TP
.B \-y
\fByacc\fP ignores this option,
\fB\*n\fP ignores this option,
which bison supports for ostensible POSIX compatibility.
.PP
The \fIfilename\fP parameter is not optional.
However, \fByacc\fP accepts a single \*(``\-\*('' to read the grammar
However, \fB\*n\fP accepts a single \*(``\-\*('' to read the grammar
from the standard input.
A double \*(``\-\-\*('' marker denotes the end of options.
A single \fIfilename\fP parameter is expected after a \*(``\-\-\*('' marker.
@ -238,6 +243,9 @@ Multiple \fB%code\fP directives may be given;
\fB\*n\fP inserts those into the corresponding code- or defines-file
in the order that they appear in the source file.
.TP
\fB %debug\fP
This has the same effect as the \*(``\-t\*('' command-line option.
.TP
\fB %destructor\fP { \fIcode\fP } \fIsymbol+\fP
defines code that is invoked when a symbol is automatically
discarded during error recovery.
@ -256,7 +264,7 @@ pointers to dynamically allocated memory.
The bracketed \fIcode\fP is invoked whenever the parser discards one of
the symbols.
Within \fIcode\fP, \*(``\fB$$\fP\*('' or
\*(``\fB$<\fP\fItag\fP\fB>$\fP\*('' designates the semantic value associated with the
\*(``\fB$<\fItag\fB>$\fR\*('' designates the semantic value associated with the
discarded symbol, and \*(``\fB@$\fP\*('' designates its location (see
\fB%locations\fP directive).
.IP
@ -280,22 +288,25 @@ the code for \*(``\fB<>\fP\*('' is used
for grammar symbols that have no declared semantic type tag.
.RE
.TP
\fB %empty\fP
ignored by \fB\*n\fP.
.TP
\fB %expect\fP \fInumber\fP
tells \fByacc\fP the expected number of shift/reduce conflicts.
tells \fB\*n\fP the expected number of shift/reduce conflicts.
That makes it only report the number if it differs.
.TP
\fB %expect\-rr\fP \fInumber\fP
tell \fByacc\fP the expected number of reduce/reduce conflicts.
tell \fB\*n\fP the expected number of reduce/reduce conflicts.
That makes it only report the number if it differs.
This is (unlike bison) allowable in LALR parsers.
.TP
\fB %locations\fP
tells \fByacc\fP to enable management of position information associated
tells \fB\*n\fP to enable management of position information associated
with each token, provided by the lexer in the global variable \fByylloc\fP,
similar to management of semantic value information provided in \fByylval\fP.
.IP
As for semantic values, locations can be referenced within actions using
\fB@$\fP to refer to the location of the left hand side symbol, and \fB@\fP\fIN\fP
\fB@$\fP to refer to the location of the left hand side symbol, and \fB@\fIN\fR
(\fIN\fP an integer) to refer to the location of one of the right hand side
symbols.
Also as for semantic values, when a rule is matched, a default
@ -386,7 +397,7 @@ yyerror without providing prototypes.
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 command-line options,
Bison has no equivalent for some of \fB\*n\fP's command-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
@ -402,7 +413,7 @@ with \fB%lex\-param\fP and \fB%parse\-param\fP in two forms
Bison accepts the latter (though undocumented), but depending on the
release may generate bad code.
.bP
Like bison, \fByacc\fP will add parameters specified via \fB%parse\-param\fP
Like bison, \fB\*n\fP will add parameters specified via \fB%parse\-param\fP
to \fByyparse\fP, \fByyerror\fP and (if configured for back-tracking)
to the destructor declared using \fB%destructor\fP.
Bison puts the additional parameters \fIfirst\fP for