mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-12 04:05:14 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ad7e09e96 | ||
|
|
a3d760ef5d | ||
|
|
22cc8d813e | ||
|
|
9398411bfc | ||
|
|
d093cf8cbd | ||
|
|
c412a490ec | ||
|
|
2d2a7d608e | ||
|
|
5ea72c19da | ||
|
|
97d520633b | ||
|
|
af8a609a90 | ||
|
|
73edad9a25 | ||
|
|
9736697d6d | ||
|
|
e2f3fda11a | ||
|
|
3c0be43411 | ||
|
|
d45708d418 | ||
|
|
219c26ea51 | ||
|
|
f1ceed0774 | ||
|
|
d2829fdc04 | ||
|
|
43dc3c8bc4 | ||
|
|
3d04b5673d | ||
|
|
39c2566994 | ||
|
|
1694ac5cf2 | ||
|
|
dfff662817 | ||
|
|
adf1725fdb | ||
|
|
7aaf9ce758 | ||
|
|
2ceb8c617c | ||
|
|
87b9c9bc43 | ||
|
|
dc25ce6bb1 | ||
|
|
ace92a2691 | ||
|
|
397bb3932f | ||
|
|
bbbbe221d7 | ||
|
|
4d7b57b527 | ||
|
|
321fe707f4 | ||
|
|
1266b63674 | ||
|
|
b9ad39c1fb | ||
|
|
b1a4261e6d | ||
|
|
a022ff4186 | ||
|
|
b5b94bd5e6 | ||
|
|
b9e42bb439 | ||
|
|
75ac158b82 | ||
|
|
f23cd66008 | ||
|
|
9874460819 | ||
|
|
915becaa5d | ||
|
|
ae50972393 | ||
|
|
c9e0a88079 | ||
|
|
50bcb22c4c | ||
|
|
cfc9e431c3 | ||
|
|
42f8609bbd | ||
|
|
9e408f848d | ||
|
|
48578d6c12 | ||
|
|
914e713d07 | ||
|
|
94505fb7e2 | ||
|
|
1bcbca4368 | ||
|
|
a17352a9da | ||
|
|
c984dee8d1 | ||
|
|
cefb18280b | ||
|
|
2f3064f08e | ||
|
|
ab3a683f05 |
+32
@@ -0,0 +1,32 @@
|
|||||||
|
*.cache
|
||||||
|
*.flc
|
||||||
|
*.prj
|
||||||
|
*~
|
||||||
|
.tarball-version
|
||||||
|
.version
|
||||||
|
ABOUT-NLS
|
||||||
|
COPYING
|
||||||
|
GNUmakefile
|
||||||
|
INSTALL
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
_*
|
||||||
|
a.exe
|
||||||
|
a.out
|
||||||
|
aclocal.m4
|
||||||
|
b.out
|
||||||
|
bison-*
|
||||||
|
conf[0-9]*
|
||||||
|
confdefs*
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
configure
|
||||||
|
configure.lineno
|
||||||
|
conftest*
|
||||||
|
gnulib
|
||||||
|
javacomp.sh
|
||||||
|
javaexec.sh
|
||||||
|
maint.mk
|
||||||
|
patches
|
||||||
|
releases
|
||||||
|
stamp-h*
|
||||||
+1
-2
@@ -1,2 +1 @@
|
|||||||
*.at diff=autotest
|
ChangeLog merge=merge-changelog
|
||||||
*.texi diff=texinfo
|
|
||||||
|
|||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
# To use this gitconfig file, run
|
|
||||||
#
|
|
||||||
# git config --local include.path ../.gitconfig
|
|
||||||
#
|
|
||||||
# It adds an `[include]` section in .git/config.
|
|
||||||
# See <https://git-scm.com/docs/git-config#_includes>.
|
|
||||||
|
|
||||||
[diff "autotest"]
|
|
||||||
xfuncname = "^((m4_define|m4_pushdef|AT_SETUP).*)$"
|
|
||||||
|
|
||||||
[diff "texinfo"]
|
|
||||||
xfuncname = "^@node .*$"
|
|
||||||
+4
-20
@@ -1,37 +1,21 @@
|
|||||||
*.a
|
|
||||||
*.bak
|
|
||||||
*.diff
|
|
||||||
*.exe
|
|
||||||
*.log
|
|
||||||
*.o
|
|
||||||
*.orig
|
|
||||||
*.out
|
|
||||||
*.output
|
|
||||||
*.pdf
|
|
||||||
*.rej
|
|
||||||
*.stamp
|
|
||||||
*.tmp
|
|
||||||
*.trs
|
|
||||||
*~
|
|
||||||
.deps/
|
|
||||||
.dirstamp
|
|
||||||
/*.cache
|
/*.cache
|
||||||
/*.flc
|
/*.flc
|
||||||
/*.prj
|
/*.prj
|
||||||
|
/*~
|
||||||
/.tarball-version
|
/.tarball-version
|
||||||
/.version
|
/.version
|
||||||
/ABOUT-NLS
|
/ABOUT-NLS
|
||||||
/COPYING
|
/COPYING
|
||||||
/ChangeLog
|
|
||||||
/GNUmakefile
|
/GNUmakefile
|
||||||
/INSTALL
|
/INSTALL
|
||||||
/Makefile
|
/Makefile
|
||||||
/Makefile.in
|
/Makefile.in
|
||||||
/README-release
|
|
||||||
/_*
|
/_*
|
||||||
|
/a.exe
|
||||||
|
/a.out
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
|
/b.out
|
||||||
/bison-*
|
/bison-*
|
||||||
/build-aux/move-if-change
|
|
||||||
/conf[0-9]*
|
/conf[0-9]*
|
||||||
/confdefs*
|
/confdefs*
|
||||||
/config.log
|
/config.log
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
[submodule "gnulib"]
|
[submodule "gnulib"]
|
||||||
path = gnulib
|
path = gnulib
|
||||||
url = git://git.savannah.gnu.org/gnulib.git
|
url = git://git.savannah.gnu.org/gnulib.git
|
||||||
[submodule "submodules/autoconf"]
|
|
||||||
path = submodules/autoconf
|
|
||||||
url = git://git.sv.gnu.org/autoconf.git
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
3.8.2
|
2.3b
|
||||||
|
|||||||
-575
@@ -1,575 +0,0 @@
|
|||||||
version: ~> 1.0
|
|
||||||
|
|
||||||
# If the language is set to C or C++, Travis defines and exports CC
|
|
||||||
# and CXX *after* we have defined our environment variables via 'env'.
|
|
||||||
language: minimal
|
|
||||||
|
|
||||||
# Run in two steps:
|
|
||||||
# 1. Build the tarball
|
|
||||||
# On a modern distro, with all the needed dependencies, including the whole git history.
|
|
||||||
# 2. Check it on various environments.
|
|
||||||
# Less dependencies, and little git content (we would like to have none, but it's not
|
|
||||||
# an option on Travis).
|
|
||||||
stages:
|
|
||||||
- dist
|
|
||||||
- check
|
|
||||||
|
|
||||||
# The 'check' jobs do not need the repo at all, only the 'dist'
|
|
||||||
# does. Let's save time, bandwith, energy, and polar bears.
|
|
||||||
git:
|
|
||||||
clone: false
|
|
||||||
|
|
||||||
# matrix.include and jobs.include are aliases
|
|
||||||
# (https://docs.travis-ci.com/user/conditional-builds-stages-jobs/).
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
- stage: dist
|
|
||||||
name: "Make dist"
|
|
||||||
git:
|
|
||||||
clone: true
|
|
||||||
dist: bionic
|
|
||||||
script:
|
|
||||||
- sudo apt-get install -qq autoconf automake autopoint flex gettext gperf graphviz help2man m4 texinfo
|
|
||||||
- autoconf --version
|
|
||||||
- automake --version
|
|
||||||
- autopoint --version
|
|
||||||
- dot -V
|
|
||||||
- gettext --version
|
|
||||||
- gperf --version
|
|
||||||
- help2man --version
|
|
||||||
- makeinfo --version
|
|
||||||
- m4 --version
|
|
||||||
|
|
||||||
# Travis makes a shallow clone, but we need it in full to build the ChangeLog and apply the fixes in git-log-fix.
|
|
||||||
- git fetch --unshallow || true
|
|
||||||
- git submodule update --init --recursive
|
|
||||||
|
|
||||||
# As of 2021-08, we don't have Autoconf 2.71 on Ubuntu.
|
|
||||||
- sed -i 's/AC_PREREQ(\[2\.71])/AC_PREREQ([2.69])/g' configure.ac
|
|
||||||
- ./bootstrap
|
|
||||||
- ./configure --enable-gcc-warnings || { cat config.log && false; }
|
|
||||||
- make -j2
|
|
||||||
- make -j2 dist-xz
|
|
||||||
# Can help understanding why we get "dirty" tarballs.
|
|
||||||
- git status
|
|
||||||
- git diff
|
|
||||||
- dist=$(echo bison*.xz)
|
|
||||||
|
|
||||||
# Unfortunately we cannot deterministically know the name of the tarball without the full
|
|
||||||
# git history (because git describe --abbrev=4 may use more than 4 characters if there are
|
|
||||||
# conflicts).
|
|
||||||
#
|
|
||||||
# So for the sake of the 'check' jobs (that don't even have the repo at all), also expose this
|
|
||||||
# tarball on a name that only depends on the Travis build number.
|
|
||||||
#
|
|
||||||
# Without -b -, exit status is always 0.
|
|
||||||
#
|
|
||||||
# If we rerun a job that was already uploaded, 'ln -s' will fail: remove beforehand.
|
|
||||||
- sftp -b - [email protected] <<< "put $dist"$'\n'"-rm bison-$TRAVIS_BUILD_NUMBER.tar.xz"$'\n'"ln -s $dist bison-$TRAVIS_BUILD_NUMBER.tar.xz"
|
|
||||||
|
|
||||||
## ------- ##
|
|
||||||
## First. ##
|
|
||||||
## ------- ##
|
|
||||||
|
|
||||||
# Start with three completely different environments, to get errors asap.
|
|
||||||
|
|
||||||
- name: "GCC 11 -O3"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons: &gcc11
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
||||||
packages: g++-11
|
|
||||||
env:
|
|
||||||
- CC=gcc-11
|
|
||||||
- CXX=g++-11
|
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
|
||||||
|
|
||||||
# ASAN is time consuming, and we timeout the 50min granted by
|
|
||||||
# Travis if we run all the tests in one go. Run in two parts.
|
|
||||||
- name: "Clang 11 libc++ and ASAN part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons: &clang11
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
||||||
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
|
|
||||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
|
||||||
packages:
|
|
||||||
- clang-11
|
|
||||||
- libc++-11-dev
|
|
||||||
- libc++abi-11-dev
|
|
||||||
env:
|
|
||||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
|
||||||
- CC='clang-11 -fsanitize=address'
|
|
||||||
- CXX='clang++-11 -fsanitize=address -stdlib=libc++'
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
- name: "Clang 11 libc++ and ASAN part 2"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons: *clang11
|
|
||||||
env:
|
|
||||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
|
||||||
- CC='clang-11 -fsanitize=address'
|
|
||||||
- CXX='clang++-11 -fsanitize=address -stdlib=libc++'
|
|
||||||
- PART=2
|
|
||||||
|
|
||||||
# See https://github.com/simd-everywhere/simde/blob/master/.travis.yml
|
|
||||||
# and https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-render-linux/top/configure-your-system.html.
|
|
||||||
- name: "ICC"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
compiler: icc
|
|
||||||
env:
|
|
||||||
- CC=icc
|
|
||||||
- CXX=icpc
|
|
||||||
install:
|
|
||||||
- source /opt/intel/oneapi/compiler/latest/env/vars.sh
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- sourceline: 'deb https://apt.repos.intel.com/oneapi all main'
|
|
||||||
key_url: 'https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB'
|
|
||||||
packages:
|
|
||||||
- intel-oneapi-icc
|
|
||||||
|
|
||||||
- name: "ARM64: GCC 11 -O2 part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
arch: arm64
|
|
||||||
dist: bionic
|
|
||||||
addons: *gcc11
|
|
||||||
env:
|
|
||||||
- CC=gcc-11
|
|
||||||
- CXX=g++-11
|
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O2 CXXFLAGS=-O2'
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
- name: "PPC64le: GCC 11 -O2 part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
arch: ppc64le
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
||||||
packages: g++-11
|
|
||||||
env:
|
|
||||||
- CC=gcc-11
|
|
||||||
- CXX=g++-11
|
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
- name: "s390x: GCC 11 -O2 part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
arch: s390x
|
|
||||||
dist: bionic
|
|
||||||
addons: *gcc11
|
|
||||||
env:
|
|
||||||
- CC=gcc-11
|
|
||||||
- CXX=g++-11
|
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
## ----- ##
|
|
||||||
## GCC. ##
|
|
||||||
## ----- ##
|
|
||||||
|
|
||||||
- name: "GCC 10 with sanitizers part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
||||||
packages: g++-10
|
|
||||||
env:
|
|
||||||
- CC='gcc-10 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
|
||||||
- CXX='g++-10 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
|
||||||
- CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
# With glr2.cc, we run out of time with the full test suite.
|
|
||||||
- name: "GCC 9 part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
||||||
packages: g++-9
|
|
||||||
env:
|
|
||||||
- CC=gcc-9
|
|
||||||
- CXX=g++-9
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
# With glr2.cc, we run out of time with the full test suite.
|
|
||||||
- name: "GCC 8 part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages: g++-8
|
|
||||||
env:
|
|
||||||
- CC=gcc-8
|
|
||||||
- CXX=g++-8
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
- name: "GCC 7"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages: g++-7
|
|
||||||
env:
|
|
||||||
- CC=gcc-7
|
|
||||||
- CXX=g++-7
|
|
||||||
|
|
||||||
- name: "GCC 6"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ubuntu-toolchain-r-test
|
|
||||||
packages: g++-6
|
|
||||||
env:
|
|
||||||
- CC=gcc-6
|
|
||||||
- CXX=g++-6
|
|
||||||
|
|
||||||
- name: "GCC 5"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ubuntu-toolchain-r-test
|
|
||||||
packages: g++-5
|
|
||||||
env:
|
|
||||||
- CC=gcc-5
|
|
||||||
- CXX=g++-5
|
|
||||||
|
|
||||||
- name: "GCC 4.9"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ubuntu-toolchain-r-test
|
|
||||||
packages: g++-4.9
|
|
||||||
env:
|
|
||||||
- CC=gcc-4.9
|
|
||||||
- CXX=g++-4.9
|
|
||||||
|
|
||||||
- name: "GCC 4.8"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ubuntu-toolchain-r-test
|
|
||||||
packages: g++-4.8
|
|
||||||
env:
|
|
||||||
- CC=gcc-4.8
|
|
||||||
- CXX=g++-4.8
|
|
||||||
|
|
||||||
- name: "GCC 4.7"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ubuntu-toolchain-r-test
|
|
||||||
packages: g++-4.7
|
|
||||||
env:
|
|
||||||
- CC=gcc-4.7
|
|
||||||
- CXX=g++-4.7
|
|
||||||
|
|
||||||
- name: "GCC 4.6"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ubuntu-toolchain-r-test
|
|
||||||
packages: g++-4.6
|
|
||||||
env:
|
|
||||||
- CC=gcc-4.6
|
|
||||||
- CXX=g++-4.6
|
|
||||||
|
|
||||||
## ------- ##
|
|
||||||
## Clang. ##
|
|
||||||
## ------- ##
|
|
||||||
|
|
||||||
- name: "Clang 10 -O3, libc++, part 1"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
||||||
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
|
|
||||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
|
||||||
packages:
|
|
||||||
- clang-10
|
|
||||||
- libc++-10-dev
|
|
||||||
- libc++abi-10-dev
|
|
||||||
env:
|
|
||||||
- CC='clang-10'
|
|
||||||
- CXX='clang++-10 -stdlib=libc++'
|
|
||||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
|
||||||
- PART=1
|
|
||||||
|
|
||||||
- name: "Clang 9 and libc++"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
||||||
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
|
|
||||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
|
||||||
packages:
|
|
||||||
- clang-9
|
|
||||||
- libc++-9-dev
|
|
||||||
- libc++abi-9-dev
|
|
||||||
env:
|
|
||||||
- CC='clang-9'
|
|
||||||
- CXX='clang++-9 -stdlib=libc++'
|
|
||||||
|
|
||||||
- name: "Clang 8 and libc++"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-8
|
|
||||||
- libc++-8-dev
|
|
||||||
- libc++abi-8-dev
|
|
||||||
env:
|
|
||||||
- CC=clang-8
|
|
||||||
- CXX='clang++-8 -stdlib=libc++'
|
|
||||||
|
|
||||||
- name: "Clang 7 and libc++"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-7
|
|
||||||
- libc++-7-dev
|
|
||||||
- libc++abi-7-dev
|
|
||||||
env:
|
|
||||||
- CC=clang-7
|
|
||||||
- CXX='clang++-7 -stdlib=libc++'
|
|
||||||
|
|
||||||
- name: "Clang 6 and libc++"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-xenial-6.0
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- clang-6.0
|
|
||||||
- libc++-dev
|
|
||||||
env:
|
|
||||||
- CC=clang-6.0
|
|
||||||
- CXX='clang++-6.0 -stdlib=libc++'
|
|
||||||
|
|
||||||
- name: "Clang 5"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: llvm-toolchain-xenial-5.0
|
|
||||||
packages:
|
|
||||||
- clang-5.0
|
|
||||||
- libc++-dev
|
|
||||||
env:
|
|
||||||
- CC='clang-5.0'
|
|
||||||
- CXX='clang++-5.0'
|
|
||||||
|
|
||||||
- name: "Clang 4"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: llvm-toolchain-xenial-4.0
|
|
||||||
packages: clang-4.0
|
|
||||||
env:
|
|
||||||
- CC=clang-4.0
|
|
||||||
- CXX=clang++-4.0
|
|
||||||
|
|
||||||
- name: "Clang 3.9"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: llvm-toolchain-xenial-3.9
|
|
||||||
packages: clang-3.9
|
|
||||||
env:
|
|
||||||
- CC=clang-3.9
|
|
||||||
- CXX=clang++-3.9
|
|
||||||
|
|
||||||
- name: "Clang 3.8"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.8
|
|
||||||
packages: clang-3.8
|
|
||||||
env:
|
|
||||||
- CC=clang-3.8
|
|
||||||
- CXX=clang++-3.8
|
|
||||||
|
|
||||||
- name: "CLang 3.7"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.7
|
|
||||||
packages: clang-3.7
|
|
||||||
env:
|
|
||||||
- CC=clang-3.7
|
|
||||||
- CXX=clang++-3.7
|
|
||||||
|
|
||||||
- name: "Clang 3.6"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.6
|
|
||||||
packages: clang-3.6
|
|
||||||
env:
|
|
||||||
- CC=clang-3.6
|
|
||||||
- CXX=clang++-3.6
|
|
||||||
|
|
||||||
- name: "Clang 3.5"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.5
|
|
||||||
packages: clang-3.5
|
|
||||||
env:
|
|
||||||
- CC=clang-3.5
|
|
||||||
- CXX=clang++-3.5
|
|
||||||
|
|
||||||
- name: "Clang 3.4"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
# Not available on Xenial.
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages: clang-3.4
|
|
||||||
env:
|
|
||||||
# No versioned name installed, but beware that Travis installs
|
|
||||||
# a more modern clang earlier in the default PATH.
|
|
||||||
- CC=/usr/bin/clang
|
|
||||||
- CXX=/usr/bin/clang++
|
|
||||||
|
|
||||||
- name: "Clang 3.3"
|
|
||||||
stage: check
|
|
||||||
os: linux
|
|
||||||
# Not available on Xenial.
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages: clang-3.3
|
|
||||||
env:
|
|
||||||
# See comment for 3.4.
|
|
||||||
- CC=/usr/bin/clang
|
|
||||||
- CXX=/usr/bin/clang++
|
|
||||||
|
|
||||||
## From https://docs.gitlab.com/ce/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor.
|
|
||||||
## Applies to Travis too. Applied to all the 'script's (of all the jobs).
|
|
||||||
before_script:
|
|
||||||
- 'which ssh-agent || ( sudo apt-get install openssh-client -y )'
|
|
||||||
- eval "$(ssh-agent -s)"
|
|
||||||
# $SSH_PRIVATE_KEY is multiline. Use $'...' to register its value: $'-----BEGIN OPENSSH PRIVATE KEY-----\nXXXXX...\n...==\n-----END OPENSSH PRIVATE KEY-----'.
|
|
||||||
- echo "$SSH_PRIVATE_KEY" >/tmp/key.id_rsa
|
|
||||||
- chmod 600 /tmp/key.id_rsa
|
|
||||||
- ssh-add /tmp/key.id_rsa </dev/null
|
|
||||||
- mkdir -p ~/.ssh
|
|
||||||
- chmod 700 ~/.ssh
|
|
||||||
- echo '|1|bpc51UGxoDZjCPiwRlCStW32trI=|rfh6mLoLZv/vAvOVrpZXI1hTLxg= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIR+ckMoJTNXHvAQLHWSfrRnrNJGW2ZR6kr5pBVDGCkz1v1RcQ5rleq0NAt9kS3v4hgnuLiEVnK7KDRzcEH3ikc=' >>~/.ssh/known_hosts
|
|
||||||
- chmod 600 ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
# Applies only to the jobs that don't have a 'script', i.e., applies to all the 'check' jobs, but not the 'dist' one.
|
|
||||||
script:
|
|
||||||
# Beware not too leak $SSH_PRIVATE_KEY.
|
|
||||||
# - env
|
|
||||||
- sudo apt-get install -qq doxygen flex m4
|
|
||||||
# Install and activate dmd.
|
|
||||||
- mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
|
|
||||||
- source $(source ~/dlang/install.sh dmd -a) || true
|
|
||||||
|
|
||||||
- $CC --version
|
|
||||||
- $CXX --version
|
|
||||||
- dmd --version || true
|
|
||||||
- doxygen --version
|
|
||||||
- flex --version
|
|
||||||
- ld --version
|
|
||||||
- m4 --version
|
|
||||||
|
|
||||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
|
||||||
# Unset this variable, otherwise, Java programs' stderr is cluttered
|
|
||||||
# with `Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m`, which makes
|
|
||||||
# the test suite fail.
|
|
||||||
- unset _JAVA_OPTIONS
|
|
||||||
|
|
||||||
# Fail fast from now on.
|
|
||||||
- set -e
|
|
||||||
- sftp [email protected]:bison-$TRAVIS_BUILD_NUMBER.tar.xz
|
|
||||||
- tar xf bison-$TRAVIS_BUILD_NUMBER.tar.xz
|
|
||||||
- dir=$(tar tf bison-$TRAVIS_BUILD_NUMBER.tar.xz | sed 1q)
|
|
||||||
- cd $dir
|
|
||||||
- mkdir _build
|
|
||||||
- cd _build
|
|
||||||
- ../configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
|
|
||||||
- make -j2 $MAKE_ARGS
|
|
||||||
- if test ${PART-1} = 1; then make check VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat test-suite.log && cat tests/testsuite.log && false; }; fi
|
|
||||||
- if test ${PART-2} = 2; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
|
||||||
- if test ${PART-2} = 2; then make maintainer-check-g++ VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
COPYING
|
COPYING
|
||||||
^bootstrap$
|
|
||||||
^doc/fdl\.texi$
|
^doc/fdl\.texi$
|
||||||
^doc/gpl-3\.0\.texi$
|
^doc/gpl-3\.0\.texi$
|
||||||
^doc/yacc\.1\.in$
|
^doc/yacc\.1\.in$
|
||||||
^src/parse-gram\.h$
|
^src/parse-gram\.h$
|
||||||
|
^data/m4sugar/
|
||||||
|
|||||||
@@ -5,39 +5,4 @@ Bison was written primarily by Robert Corbett.
|
|||||||
Richard Stallman made it Yacc-compatible.
|
Richard Stallman made it Yacc-compatible.
|
||||||
|
|
||||||
Wilfred Hansen of Carnegie Mellon University added multicharacter
|
Wilfred Hansen of Carnegie Mellon University added multicharacter
|
||||||
string literals and other features (Bison 1.25, 1995).
|
string literals and other features.
|
||||||
|
|
||||||
Akim Demaille rewrote the parser in Bison, and changed the back end to
|
|
||||||
use M4 (1.50, 2002).
|
|
||||||
|
|
||||||
Paul Hilfinger added GLR support (Bison 1.50, 2002).
|
|
||||||
|
|
||||||
Joel E. Denny contributed canonical-LR support, and invented and added
|
|
||||||
IELR and LAC (Lookahead Correction) support (Bison 2.5, 2011).
|
|
||||||
|
|
||||||
Paolo Bonzini contributed Java support (Bison 2.4, 2008).
|
|
||||||
|
|
||||||
Alex Rozenman added named reference support (Bison 2.5, 2011).
|
|
||||||
|
|
||||||
Paul Eggert fixed a million portability issues, arbitrary limitations,
|
|
||||||
and nasty bugs.
|
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
Copyright (C) 1998-2015, 2018-2022, 2025-2026 Free Software Foundation,
|
|
||||||
Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
|
||||||
|
|
||||||
This program 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
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
|
|||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
<https://www.gnu.org/licenses/>.
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
The GNU General Public License does not permit incorporating your program
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
may consider it more useful to permit linking proprietary applications with
|
may consider it more useful to permit linking proprietary applications with
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License. But first, please read
|
Public License instead of this License. But first, please read
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
|
|||||||
+308
-5303
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,380 @@
|
|||||||
|
-*- outline -*-
|
||||||
|
|
||||||
|
This file attempts to describe the rules to use when hacking Bison.
|
||||||
|
Don't put this file into the distribution.
|
||||||
|
|
||||||
|
Everything related to the development of Bison is on Savannah:
|
||||||
|
|
||||||
|
http://savannah.gnu.org/projects/bison/
|
||||||
|
|
||||||
|
|
||||||
|
* Administrivia
|
||||||
|
|
||||||
|
** If you incorporate a change from somebody on the net:
|
||||||
|
First, if it is a large change, you must make sure they have signed
|
||||||
|
the appropriate paperwork. Second, be sure to add their name and
|
||||||
|
email address to THANKS.
|
||||||
|
|
||||||
|
** If a change fixes a test, mention the test in the ChangeLog entry.
|
||||||
|
|
||||||
|
** Bug reports
|
||||||
|
If somebody reports a new bug, mention his name in the ChangeLog entry
|
||||||
|
and in the test case you write. Put him into THANKS.
|
||||||
|
|
||||||
|
The correct response to most actual bugs is to write a new test case
|
||||||
|
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
||||||
|
and check everything in.
|
||||||
|
|
||||||
|
** You may find it useful to install the git-merge-changelog merge driver:
|
||||||
|
|
||||||
|
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c
|
||||||
|
|
||||||
|
When following the generic installation instructions there, keep in mind that
|
||||||
|
your clone of Bison's git repository already contains appropriate
|
||||||
|
.gitattributes files, and running Bison's bootstrap script will make the
|
||||||
|
necessary changes to .git/config.
|
||||||
|
|
||||||
|
|
||||||
|
* Hacking
|
||||||
|
|
||||||
|
** Visible changes
|
||||||
|
Which include serious bug fixes, must be mentioned in NEWS.
|
||||||
|
|
||||||
|
** Translations
|
||||||
|
Only user visible strings are to be translated: error messages, bits
|
||||||
|
of the .output file etc. This excludes impossible error messages
|
||||||
|
(comparable to assert/abort), and all the --trace output which is
|
||||||
|
meant for the maintainers only.
|
||||||
|
|
||||||
|
|
||||||
|
* Working from the repository
|
||||||
|
|
||||||
|
These notes intend to help people working on the checked-out sources.
|
||||||
|
These requirements do not apply when building from a distribution tarball.
|
||||||
|
|
||||||
|
** Requirements
|
||||||
|
|
||||||
|
We've opted to keep only the highest-level sources in the repository.
|
||||||
|
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||||
|
requirements on anyone wishing to build from the just-checked-out sources.
|
||||||
|
For example, you have to use the latest stable versions of the maintainer
|
||||||
|
tools we depend upon, including:
|
||||||
|
|
||||||
|
- Automake <http://www.gnu.org/software/automake/>
|
||||||
|
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||||
|
- Flex <http://www.gnu.org/software/flex/>
|
||||||
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
|
- Perl <http://www.cpan.org/>
|
||||||
|
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||||
|
- Tar <http://www.gnu.org/software/tar/>
|
||||||
|
|
||||||
|
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||||
|
Valgrind supports your architecture.
|
||||||
|
|
||||||
|
Bison is written using Bison grammars, so there are bootstrapping
|
||||||
|
issues. The bootstrap script attempts to discover when the C code
|
||||||
|
generated from the grammars is out of date, and to bootstrap with an
|
||||||
|
out-of-date version of the C code, but the process is not foolproof.
|
||||||
|
Also, you may run into similar problems yourself if you modify Bison.
|
||||||
|
|
||||||
|
Only building the initial full source tree will be a bit painful.
|
||||||
|
Later, after synchronizing from the repository a plain `make' should
|
||||||
|
be sufficient.
|
||||||
|
|
||||||
|
** First checkout
|
||||||
|
|
||||||
|
Obviously, if you are reading these notes, you did manage to check out
|
||||||
|
this package from the repository. For the record, you will find all the
|
||||||
|
relevant information on:
|
||||||
|
|
||||||
|
http://savannah.gnu.org/git/?group=bison
|
||||||
|
|
||||||
|
Bison uses Git submodules: subscriptions to other Git repositories.
|
||||||
|
In particular it uses gnulib, the GNU portability library. To ask Git
|
||||||
|
to perform the first checkout of the submodules, run
|
||||||
|
|
||||||
|
$ git submodule update --init
|
||||||
|
|
||||||
|
Git submodule support is weak before versions 1.6 and later, you
|
||||||
|
should probably upgrade Git if your version is older.
|
||||||
|
|
||||||
|
The next step is to get other files needed to build, which are
|
||||||
|
extracted from other source packages:
|
||||||
|
|
||||||
|
$ ./bootstrap
|
||||||
|
|
||||||
|
And there you are! Just
|
||||||
|
|
||||||
|
$ ./configure
|
||||||
|
$ make
|
||||||
|
$ make check
|
||||||
|
|
||||||
|
At this point, there should be no difference between your local copy,
|
||||||
|
and the master copy:
|
||||||
|
|
||||||
|
$ git diff
|
||||||
|
|
||||||
|
should output no difference.
|
||||||
|
|
||||||
|
Enjoy!
|
||||||
|
|
||||||
|
** Updating
|
||||||
|
|
||||||
|
The use of submodules make things somewhat different because git does
|
||||||
|
not support recursive operations: submodules must be taken care of
|
||||||
|
explicitly by the user.
|
||||||
|
|
||||||
|
*** Updating Bison
|
||||||
|
|
||||||
|
If you pull a newer version of a branch, say via `git pull', you might
|
||||||
|
import requests for updated submodules. A simple `git diff' will
|
||||||
|
reveal if the current version of the submodule (i.e., the actual
|
||||||
|
contents of the gnulib directory) and the current request from the
|
||||||
|
subscriber (i.e., the reference of the version of gnulib that the
|
||||||
|
Bison reporitory requests) differ. To upgrade the submodules (i.e.,
|
||||||
|
to check out the version that is actually requested by the subscriber,
|
||||||
|
run `git submodule update'.
|
||||||
|
|
||||||
|
$ git pull
|
||||||
|
$ git submodule update
|
||||||
|
|
||||||
|
*** Updating a submodule
|
||||||
|
To update a submodule, say gnulib, do as follows:
|
||||||
|
|
||||||
|
Get the most recent version of the master branch from git.
|
||||||
|
|
||||||
|
$ cd gnulib
|
||||||
|
$ git fetch
|
||||||
|
$ git checkout -b master --track origin/master
|
||||||
|
|
||||||
|
Make sure Bison can live with that version of gnulib.
|
||||||
|
|
||||||
|
$ cd ..
|
||||||
|
$ ./bootstrap
|
||||||
|
$ make distcheck
|
||||||
|
|
||||||
|
Register your changes.
|
||||||
|
|
||||||
|
$ git checkin ...
|
||||||
|
|
||||||
|
|
||||||
|
* Test suite
|
||||||
|
|
||||||
|
** make check
|
||||||
|
Use liberally.
|
||||||
|
|
||||||
|
** Release checks
|
||||||
|
Try to run the test suite with more severe conditions before a
|
||||||
|
release:
|
||||||
|
|
||||||
|
- Configure the package with --enable-gcc-warnings, so that one checks
|
||||||
|
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
||||||
|
cleanly too.
|
||||||
|
|
||||||
|
- run `make maintainer-check' which:
|
||||||
|
- runs `valgrind -q bison' to run Bison under Valgrind.
|
||||||
|
- runs the parsers under Valgrind.
|
||||||
|
- runs the test suite with G++ as C compiler...
|
||||||
|
|
||||||
|
- run `make maintainer-push-check', which runs `make maintainer-check'
|
||||||
|
while activating the push implementation and its pull interface wrappers
|
||||||
|
in many test cases that were originally written to exercise only the
|
||||||
|
pull implementation. This makes certain the push implementation can
|
||||||
|
perform every task the pull implementation can.
|
||||||
|
|
||||||
|
- run `make maintainer-xml-check', which runs `make maintainer-check'
|
||||||
|
while checking Bison's XML automaton report for every working grammar
|
||||||
|
passed to Bison in the test suite. The check just diffs the output of
|
||||||
|
Bison's included XSLT style sheets with the output of --report=all and
|
||||||
|
--graph.
|
||||||
|
|
||||||
|
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||||
|
instance, `-traditional' to check that the parsers are K&R. Note
|
||||||
|
that it does not make sense for glr.c, which should be ANSI,
|
||||||
|
but currently is actually GNU C, nor for lalr1.cc.
|
||||||
|
|
||||||
|
|
||||||
|
* Release Procedure
|
||||||
|
|
||||||
|
** Try to get the *.pot files to the Translation Project at least one
|
||||||
|
week before a stable release, to give them time to translate them.
|
||||||
|
Before generating the *.pot files, make sure that po/POTFILES.in and
|
||||||
|
runtime-po/POTFILES.in list all files with translatable strings.
|
||||||
|
This helps: grep -l '\<_(' *
|
||||||
|
|
||||||
|
** Tests
|
||||||
|
See above.
|
||||||
|
|
||||||
|
** Update the foreign files
|
||||||
|
Running `./bootstrap' in the top level should update them all for you.
|
||||||
|
This covers PO files too. Sometimes a PO file contains problems that
|
||||||
|
causes it to be rejected by recent Gettext releases; please report
|
||||||
|
these to the Translation Project.
|
||||||
|
|
||||||
|
** Update README
|
||||||
|
Make sure the information in README is current. Most notably, make sure
|
||||||
|
it recommends a version of GNU M4 that is compatible with the latest
|
||||||
|
Bison sources.
|
||||||
|
|
||||||
|
** Check copyright years.
|
||||||
|
We update years in copyright statements throughout Bison once at the
|
||||||
|
start of every year by running `make update-copyright'. However, before
|
||||||
|
a release, it's good to verify that it's actually been run. Besides the
|
||||||
|
copyright statement for each Bison file, check the copyright statements
|
||||||
|
that the skeletons insert into generated parsers, and check all
|
||||||
|
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
||||||
|
|
||||||
|
** Update NEWS
|
||||||
|
The version number, *and* the date of the release (including for
|
||||||
|
betas).
|
||||||
|
|
||||||
|
** Update ChangeLog
|
||||||
|
Should have an entry similar to `Version 1.49b.'.
|
||||||
|
|
||||||
|
** Tag the release
|
||||||
|
Before Bison will build with the right version number, you must tag the release
|
||||||
|
in git. Do this after all other changes. The command is similar to:
|
||||||
|
|
||||||
|
git tag -a v2.3b
|
||||||
|
|
||||||
|
The log message can be simply:
|
||||||
|
|
||||||
|
Bison 2.3b
|
||||||
|
|
||||||
|
** Push
|
||||||
|
Once `make distcheck' passes, push your changes and the tag.
|
||||||
|
`git push' without arguments will not push the tag.
|
||||||
|
|
||||||
|
** make alpha
|
||||||
|
FIXME: `make alpha' is not maintained and is broken. These
|
||||||
|
instructions need to be replaced or removed.
|
||||||
|
|
||||||
|
Running `make alpha' is absolutely perfect for beta releases: it makes
|
||||||
|
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
|
||||||
|
announcement. It is so neat, that that's what I use anyway for
|
||||||
|
genuine releases, but adjusting things by hand (e.g., the urls in the
|
||||||
|
announcement file, the ChangeLog which is not needed etc.).
|
||||||
|
|
||||||
|
If it fails, you're on your own...
|
||||||
|
|
||||||
|
It requires GNU Make.
|
||||||
|
|
||||||
|
** Upload
|
||||||
|
The generic GNU upload procedure is at:
|
||||||
|
|
||||||
|
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads
|
||||||
|
|
||||||
|
Follow the instructions there to register your information so you're permitted
|
||||||
|
to upload. Make sure your public key has been uploaded at least to
|
||||||
|
keys.gnupg.net. You can upload it with:
|
||||||
|
|
||||||
|
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
||||||
|
|
||||||
|
where F125BDF3 should be replaced with your key ID.
|
||||||
|
|
||||||
|
Here's a brief reminder of how to roll the tarballs and upload them:
|
||||||
|
|
||||||
|
*** make distcheck
|
||||||
|
*** gpg -b bison-2.3b.tar.gz
|
||||||
|
*** In a file named `bison-2.3b.tar.gz.directive', type:
|
||||||
|
|
||||||
|
version: 1.1
|
||||||
|
directory: bison
|
||||||
|
filename: bison-2.3b.tar.gz
|
||||||
|
|
||||||
|
*** gpg --clearsign bison-2.3b.tar.gz.directive
|
||||||
|
*** ftp ftp-upload.gnu.org # Log in as anonymous.
|
||||||
|
*** cd /incoming/alpha # cd /incoming/ftp for full release.
|
||||||
|
*** put bison-2.3b.tar.gz # This can take a while.
|
||||||
|
*** put bison-2.3b.tar.gz.sig
|
||||||
|
*** put bison-2.3b.tar.gz.directive.asc
|
||||||
|
*** Repeat all these steps for bison-2.3b.tar.bz2.
|
||||||
|
|
||||||
|
** Update Bison manual on www.gnu.org.
|
||||||
|
|
||||||
|
*** You need a non-anonymous checkout of the web pages directory.
|
||||||
|
|
||||||
|
$ cvs -d [email protected]:/web/bison checkout bison
|
||||||
|
|
||||||
|
*** Get familiar with the instructions for web page maintainers.
|
||||||
|
http://www.gnu.org/server/standards/readme_index.html
|
||||||
|
http://www.gnu.org/server/standards/README.software.html
|
||||||
|
especially the note about symlinks.
|
||||||
|
|
||||||
|
*** Build the web pages.
|
||||||
|
Assuming BISON_CHECKOUT refers to a checkout of the Bison dir, and
|
||||||
|
BISON_WWW_CHECKOUT refers to the web directory created above, do:
|
||||||
|
|
||||||
|
$ cd $BISON_CHECKOUT/doc
|
||||||
|
$ make stamp-vti
|
||||||
|
$ ../build-aux/gendocs.sh -o "$BISON_WWW_CHECKOUT/manual" \
|
||||||
|
bison "Bison - GNU parser generator"
|
||||||
|
$ cd $BISON_WWW_CHECKOUT
|
||||||
|
|
||||||
|
Verify that the result looks sane.
|
||||||
|
|
||||||
|
*** Commit the modified and the new files.
|
||||||
|
|
||||||
|
*** Remove old files.
|
||||||
|
Find the files which have not been overwritten (because they belonged to
|
||||||
|
sections that have been removed or renamed):
|
||||||
|
|
||||||
|
$ cd manual/html_node
|
||||||
|
$ ls -lt
|
||||||
|
|
||||||
|
Remove these files and commit their removal to CVS. For each of these
|
||||||
|
files, add a line to the file .symlinks. This will ensure that
|
||||||
|
hyperlinks to the removed files will redirect to the entire manual; this
|
||||||
|
is better than a 404 error.
|
||||||
|
|
||||||
|
There is a problem with 'index.html' being written twice (once for POSIX
|
||||||
|
function 'index', once for the table of contents); you can ignore this
|
||||||
|
issue.
|
||||||
|
|
||||||
|
** Announce
|
||||||
|
To generate a template announcement file:
|
||||||
|
|
||||||
|
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
||||||
|
|
||||||
|
where alpha can be replaced by beta or major and F125BDF3 should be replaced
|
||||||
|
with your key ID. For an example of how to fill out the template, search the
|
||||||
|
mailing list archives for the most recent release announcement.
|
||||||
|
|
||||||
|
Complete/fix the announcement file, and send it at least to
|
||||||
|
[email protected] (if a real release, or a ``serious beta''),
|
||||||
|
[email protected], [email protected], [email protected],
|
||||||
|
and [email protected].
|
||||||
|
|
||||||
|
Send the same announcement on the comp.compilers newsgroup by sending
|
||||||
|
email to [email protected]. Do not make any Cc as the moderator will
|
||||||
|
throw away anything cross-posted or Cc'ed. It really needs to be a
|
||||||
|
separate message.
|
||||||
|
|
||||||
|
** Bump the version number
|
||||||
|
In configure.ac. Run `make'. So that developers don't accidentally add new
|
||||||
|
items to the old NEWS entry, create a new empty NEWS entry something like:
|
||||||
|
|
||||||
|
Changes in version ?.? (????-??-??):
|
||||||
|
|
||||||
|
Push these changes.
|
||||||
|
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 2002-2005, 2007-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
+25
-108
@@ -1,8 +1,6 @@
|
|||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2001-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2001-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# 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
|
||||||
@@ -14,75 +12,35 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
SUBDIRS = po runtime-po gnulib-po .
|
SUBDIRS = build-aux po runtime-po lib data src doc examples tests etc
|
||||||
|
|
||||||
# Files installed for use by Automake.
|
# Files installed for use by Automake.
|
||||||
aclocaldir = @aclocaldir@
|
aclocaldir = @aclocaldir@
|
||||||
aclocal_DATA = m4/bison-i18n.m4
|
aclocal_DATA = m4/bison-i18n.m4
|
||||||
|
|
||||||
EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \
|
EXTRA_DIST = .prev-version .version cfg.mk \
|
||||||
ChangeLog-1998 ChangeLog-2012 ChangeLog
|
OChangeLog PACKAGING \
|
||||||
|
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
|
||||||
|
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
|
||||||
|
djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \
|
||||||
|
djgpp/fnchange.lst djgpp/testsuite.sed
|
||||||
|
|
||||||
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
|
|
||||||
|
|
||||||
# Let generated files (e.g., from examples/) depend on this variable,
|
.PHONY: maintainer-check
|
||||||
# to make sure they are regenerated when there are changes in Bison.
|
maintainer-check:
|
||||||
#
|
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
|
||||||
# in srcdir, including during distcheck, which is forbidden.
|
|
||||||
dependencies = $(BISON_IN) $(src_bison_SOURCES) $(dist_skeletons_DATA)
|
|
||||||
|
|
||||||
## Running the bison from this tarball. To generate our own parser,
|
.PHONY: maintainer-push-check
|
||||||
## but also to run the tests. Of course, you ought to keep a sane
|
maintainer-push-check:
|
||||||
## version of Bison nearby...
|
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
BISON = $(top_builddir)/tests/bison
|
|
||||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
|
||||||
YACC = $(BISON) -o y.tab.c
|
|
||||||
AM_YFLAGS_WITH_LINES = --defines -Werror -Wall,dangling-alias --report=all
|
|
||||||
AM_YFLAGS = $(AM_YFLAGS_WITH_LINES) --no-lines
|
|
||||||
|
|
||||||
# Initialization before completion by local.mk's.
|
.PHONY: maintainer-xml-check
|
||||||
AM_CFLAGS = $(WARN_CFLAGS)
|
maintainer-xml-check:
|
||||||
# Find builddir/src/scan-code.c etc. For some reason "-I./lib"
|
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
# instead of "-Ilib" avoids infinite recursions on #include_next.
|
|
||||||
AM_CPPFLAGS = -I. -I./lib -I$(top_srcdir) -I$(top_srcdir)/lib
|
|
||||||
BUILT_SOURCES =
|
|
||||||
CLEANDIRS =
|
|
||||||
CLEANFILES =
|
|
||||||
DISTCLEANFILES =
|
|
||||||
EXTRA_DIST += $(dist_TESTS)
|
|
||||||
MOSTLYCLEANDIRS =
|
|
||||||
MOSTLYCLEANFILES =
|
|
||||||
SUFFIXES =
|
|
||||||
TESTS = $(dist_TESTS)
|
|
||||||
check_PROGRAMS =
|
|
||||||
check_SCRIPTS =
|
|
||||||
dist_TESTS =
|
|
||||||
noinst_LIBRARIES =
|
|
||||||
|
|
||||||
include build-aux/local.mk
|
|
||||||
include data/local.mk
|
|
||||||
include doc/local.mk
|
|
||||||
include etc/local.mk
|
|
||||||
include examples/local.mk
|
|
||||||
include lib/local.mk
|
|
||||||
include src/local.mk
|
|
||||||
include tests/local.mk
|
|
||||||
|
|
||||||
clean-local:
|
|
||||||
rm -rf $(CLEANDIRS)
|
|
||||||
|
|
||||||
.PHONY: gitsort
|
|
||||||
gitsort:
|
|
||||||
cd $(srcdir) \
|
|
||||||
&& for i in $$(git ls-files '*.gitignore' | grep -v doc); do \
|
|
||||||
LC_ALL=C sort $$i -o $$i; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
# See comments in build-aux/git-version-gen. However, we make .version depend
|
||||||
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
||||||
@@ -93,58 +51,17 @@ gitsort:
|
|||||||
# a developer might naively reference .version in a test case while the bison
|
# a developer might naively reference .version in a test case while the bison
|
||||||
# executable still compiles with VERSION, and so the test case might fail or
|
# executable still compiles with VERSION, and so the test case might fail or
|
||||||
# pass incorrectly.
|
# pass incorrectly.
|
||||||
BUILT_SOURCES += $(top_srcdir)/.version
|
BUILT_SOURCES = $(top_srcdir)/.version
|
||||||
$(top_srcdir)/.version: configure
|
$(top_srcdir)/.version: configure
|
||||||
echo $(VERSION) > $@-t && mv $@-t $@
|
echo $(VERSION) > $@-t && mv $@-t $@
|
||||||
dist-hook: gen-ChangeLog gen-synclines
|
dist-hook:
|
||||||
echo $(VERSION) > $(distdir)/.tarball-version
|
echo $(VERSION) > $(distdir)/.tarball-version
|
||||||
|
|
||||||
# When generating a release, include the #lines in Bison's parser. Do it
|
|
||||||
# only if needed. In particular, distcheck runs dist with read-only
|
|
||||||
# sources, so don't try to update src/parse-gram.c: we don't have the
|
|
||||||
# permissions.
|
|
||||||
.PHONY: gen-synclines
|
|
||||||
gen-synclines:
|
|
||||||
cd $(distdir) && \
|
|
||||||
if ! grep '#line' src/parse-gram.c >/dev/null 2>&1; then \
|
|
||||||
$(abs_top_builddir)/tests/bison \
|
|
||||||
$(AM_YFLAGS_WITH_LINES) src/parse-gram.y \
|
|
||||||
-o src/parse-gram.c; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: update-b4-copyright update-package-copyright-year
|
.PHONY: update-b4-copyright update-package-copyright-year
|
||||||
update-b4-copyright:
|
update-b4-copyright:
|
||||||
$(AM_V_GEN)find $(srcdir)/data -type f \
|
find data -type f \
|
||||||
| xargs $(srcdir)/build-aux/$@
|
| grep -v -E '^data/bison.m4$$' \
|
||||||
|
| xargs $(build_aux)/$@
|
||||||
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
||||||
update-package-copyright-year:
|
update-package-copyright-year:
|
||||||
$(AM_V_GEN)$(srcdir)/build-aux/$@ $(srcdir)/configure.ac
|
$(build_aux)/$@ configure.ac
|
||||||
|
|
||||||
gen_start_date = 2012-01-16
|
|
||||||
.PHONY: gen-ChangeLog
|
|
||||||
gen-ChangeLog:
|
|
||||||
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
|
|
||||||
cl=$(distdir)/ChangeLog && \
|
|
||||||
rm -f $$cl.tmp && \
|
|
||||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
|
||||||
--strip-tab \
|
|
||||||
--strip-cherry-pick \
|
|
||||||
--no-cluster \
|
|
||||||
--amend=$(srcdir)/build-aux/git-log-fix \
|
|
||||||
--srcdir=$(srcdir) \
|
|
||||||
--since=$(gen_start_date) > $$cl.tmp && \
|
|
||||||
mv -f $$cl.tmp $$cl; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Useful to debug.
|
|
||||||
.c.i:
|
|
||||||
$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ -E $<
|
|
||||||
|
|
||||||
.PHONY: codespell
|
|
||||||
CODESPELL = codespell
|
|
||||||
codespell:
|
|
||||||
$(AM_V_GEN) cd $(srcdir) \
|
|
||||||
&& $(CODESPELL) \
|
|
||||||
--regex "[\\w\\-'’\`]+\+*" \
|
|
||||||
--ignore-words-list "ba,circularly,cloneable,copyable,define'd,dout,froms,iff,ifset,od,ois" \
|
|
||||||
$$(git ls-files data doc lib src tests)
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
1996-05-12 Jim Meyering <[email protected]>
|
1996-05-12 Jim Meyering <[email protected]>
|
||||||
|
|
||||||
* src/bison.simple (__yy_memcpy) [__cplusplus]: Reorder declarations
|
* src/bison.simple (__yy_memcpy) [__cplusplus]: Reorder declarations
|
||||||
of variables f and t.
|
of variables f and t.
|
||||||
|
|
||||||
1996-05-11 Richard Stallman <[email protected]>
|
1996-05-11 Richard Stallman <[email protected]>
|
||||||
|
|
||||||
@@ -36,8 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009-2015, 2018-2022, 2025-2026 Free Software
|
Copyright (C) 2002, 2005, 2009-2010 Free Software Foundation, Inc.
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -52,4 +51,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|||||||
@@ -1,135 +1,59 @@
|
|||||||
GNU Bison is a general-purpose parser generator that converts an annotated
|
This package contains the GNU Bison parser generator.
|
||||||
context-free grammar into a deterministic LR or generalized LR (GLR) parser
|
|
||||||
employing LALR(1) parser tables. Bison can also generate IELR(1) or
|
|
||||||
canonical LR(1) parser tables. Once you are proficient with Bison, you can
|
|
||||||
use it to develop a wide range of language parsers, from those used in
|
|
||||||
simple desk calculators to complex programming languages.
|
|
||||||
|
|
||||||
Bison is upward compatible with Yacc: all properly-written Yacc grammars
|
* Installation
|
||||||
work with Bison with no change. Anyone familiar with Yacc should be able to
|
** Build
|
||||||
use Bison with little trouble. You need to be fluent in C, C++, D or Java
|
See the file INSTALL for generic compilation and installation
|
||||||
programming in order to use Bison.
|
|
||||||
|
|
||||||
Bison and the parsers it generates are portable, they do not require any
|
|
||||||
specific compilers.
|
|
||||||
|
|
||||||
GNU Bison's home page is https://gnu.org/software/bison/.
|
|
||||||
|
|
||||||
# Installation
|
|
||||||
## Build from git
|
|
||||||
The [README-hacking.md file](README-hacking.md) is about building, modifying
|
|
||||||
and checking Bison. See its "Working from the Repository" section to build
|
|
||||||
Bison from the git repo. Roughly, run:
|
|
||||||
|
|
||||||
$ git submodule update --init
|
|
||||||
$ ./bootstrap
|
|
||||||
|
|
||||||
then proceed with the usual `configure && make` steps.
|
|
||||||
|
|
||||||
## Build from tarball
|
|
||||||
See the [INSTALL file](INSTALL) for generic compilation and installation
|
|
||||||
instructions.
|
instructions.
|
||||||
|
|
||||||
Bison requires GNU m4 1.4.6 or later. See
|
Bison requires GNU m4 1.4.6 or later. See:
|
||||||
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz.
|
|
||||||
|
|
||||||
## Running a non installed bison
|
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
||||||
Once you ran `make`, you might want to toy with this fresh bison before
|
|
||||||
installing it. In that case, do not use `src/bison`: it would use the
|
|
||||||
*installed* files (skeletons, etc.), not the local ones. Use `tests/bison`.
|
|
||||||
|
|
||||||
## Colored diagnostics
|
** Internationalization
|
||||||
As an experimental feature, diagnostics are now colored, controlled by the
|
Bison supports two catalogues: one for Bison itself (i.e., for the
|
||||||
`--color` and `--style` options.
|
maintainer-side parser generation), and one for the generated parsers
|
||||||
|
(i.e., for the user-side parser execution). The requirements between
|
||||||
|
both differ: bison needs ngettext, the generated parsers do not. To
|
||||||
|
simplify the build system, neither are installed if ngettext is not
|
||||||
|
supported, even if generated parsers could have been localized. See
|
||||||
|
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for
|
||||||
|
more details.
|
||||||
|
|
||||||
To use them, install the libtextstyle library, 0.20.5 or newer, before
|
* Questions
|
||||||
configuring Bison. It is available from https://alpha.gnu.org/gnu/gettext/,
|
See the section FAQ in the documentation (doc/bison.info) for
|
||||||
for instance https://alpha.gnu.org/gnu/gettext/libtextstyle-0.20.5.tar.gz,
|
frequently asked questions. The documentation is also available in
|
||||||
or as part of Gettext 0.21 or newer, for instance
|
PDF and HTML, provided you have a recent version of Texinfo installed:
|
||||||
https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.gz.
|
run "make pdf" or "make html".
|
||||||
|
|
||||||
The option --color supports the following arguments:
|
If you have questions about using Bison and the documentation does
|
||||||
- always, yes: Enable colors.
|
not answer them, please send mail to <[email protected]>.
|
||||||
- never, no: Disable colors.
|
|
||||||
- auto, tty (default): Enable colors if the output device is a tty.
|
|
||||||
|
|
||||||
To customize the styles, create a CSS file, say `bison-bw.css`, similar to
|
* Bug reports
|
||||||
|
Please send bug reports to <[email protected]>. Please include the
|
||||||
|
version number from `bison --version', and a complete, self-contained
|
||||||
|
test case in each bug report.
|
||||||
|
|
||||||
/* bison-bw.css */
|
|
||||||
.warning { }
|
|
||||||
.error { font-weight: 800; text-decoration: underline; }
|
|
||||||
.note { }
|
|
||||||
|
|
||||||
then invoke bison with `--style=bison-bw.css`, or set the `BISON_STYLE`
|
|
||||||
environment variable to `bison-bw.css`.
|
|
||||||
|
|
||||||
In some diagnostics, bison uses libtextstyle to emit special escapes to
|
|
||||||
generate clickable hyperlinks. The environment variable
|
|
||||||
`NO_TERM_HYPERLINKS` can be used to suppress them. This may be useful for
|
|
||||||
terminal emulators which produce garbage output when they receive the escape
|
|
||||||
sequence for a hyperlink. Currently (as of 2020), this affects some versions
|
|
||||||
of emacs, guake, konsole, lxterminal, rxvt, yakuake.
|
|
||||||
|
|
||||||
## Relocatability
|
|
||||||
If you pass `--enable-relocatable` to `configure`, Bison is relocatable.
|
|
||||||
|
|
||||||
A relocatable program can be moved or copied to a different location on the
|
|
||||||
file system. It can also be used through mount points for network sharing.
|
|
||||||
It is possible to make symlinks to the installed and moved programs, and
|
|
||||||
invoke them through the symlink.
|
|
||||||
|
|
||||||
See "Enabling Relocatability" in the documentation.
|
|
||||||
|
|
||||||
## Internationalization
|
|
||||||
Bison supports two catalogs: one for Bison itself (i.e., for the
|
|
||||||
maintainer-side parser generation), and one for the generated parsers (i.e.,
|
|
||||||
for the user-side parser execution). The requirements between both differ:
|
|
||||||
bison needs ngettext, the generated parsers do not. To simplify the build
|
|
||||||
system, neither are installed if ngettext is not supported, even if
|
|
||||||
generated parsers could have been localized. See
|
|
||||||
https://lists.gnu.org/r/bug-bison/2009-08/msg00006.html for more
|
|
||||||
details.
|
|
||||||
|
|
||||||
# Questions
|
|
||||||
See the section FAQ in the documentation (doc/bison.info) for frequently
|
|
||||||
asked questions. The documentation is also available in PDF and HTML,
|
|
||||||
provided you have a recent version of Texinfo installed: run `make pdf` or
|
|
||||||
`make html`.
|
|
||||||
|
|
||||||
If you have questions about using Bison and the documentation does not
|
|
||||||
answer them, please send mail to <[email protected]>.
|
|
||||||
|
|
||||||
# Bug reports
|
|
||||||
Please send bug reports to <[email protected]>. Be sure to include the
|
|
||||||
version number from `bison --version`, and a complete, self-contained test
|
|
||||||
case in each bug report.
|
|
||||||
|
|
||||||
# Copyright statements
|
|
||||||
For any copyright year range specified as YYYY-ZZZZ in this package, note
|
|
||||||
that the range specifies every single year in that closed interval.
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md
|
|
||||||
LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw
|
|
||||||
LocalWords: Relocatability symlinks symlink
|
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: markdown
|
mode: outline
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2022,
|
-----
|
||||||
2025-2026 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2010 Free Software
|
||||||
|
Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
||||||
any later version published by the Free Software Foundation; with no
|
|
||||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
|
||||||
Texts. A copy of the license is included in the "GNU Free
|
|
||||||
Documentation License" file as part of this distribution.
|
|
||||||
|
|
||||||
-->
|
This program 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
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|||||||
+2
-3
@@ -12,8 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2015, 2018-2022, 2025-2026 Free Software
|
Copyright (C) 2002, 2004, 2009-2010 Free Software Foundation, Inc.
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
@@ -28,4 +27,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|||||||
@@ -1,679 +0,0 @@
|
|||||||
This file attempts to describe the rules to use when hacking Bison.
|
|
||||||
Don't put this file into the distribution.
|
|
||||||
|
|
||||||
Everything related to the development of Bison is on Savannah:
|
|
||||||
https://savannah.gnu.org/projects/bison/.
|
|
||||||
|
|
||||||
|
|
||||||
Working from the Repository
|
|
||||||
===========================
|
|
||||||
|
|
||||||
These notes intend to help people working on the checked-out sources. These
|
|
||||||
requirements do not apply when building from a distribution tarball.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
We've opted to keep only the highest-level sources in the repository. This
|
|
||||||
eases our maintenance burden, (fewer merges etc.), but imposes more
|
|
||||||
requirements on anyone wishing to build from the just-checked-out sources.
|
|
||||||
For example, you have to use the latest stable versions of the maintainer
|
|
||||||
tools we depend upon, including:
|
|
||||||
|
|
||||||
- Autoconf <https://www.gnu.org/software/autoconf/>
|
|
||||||
- Automake <https://www.gnu.org/software/automake/>
|
|
||||||
- Flex <https://www.gnu.org/software/flex/>
|
|
||||||
- Gettext <https://www.gnu.org/software/gettext/>
|
|
||||||
- Gperf <https://www.gnu.org/software/gperf/>
|
|
||||||
- Graphviz <https://www.graphviz.org>
|
|
||||||
- Gzip <https://www.gnu.org/software/gzip/>
|
|
||||||
- Help2man <https://www.gnu.org/software/help2man/>
|
|
||||||
- Perl <https://www.cpan.org/>
|
|
||||||
- Rsync <https://rsync.samba.org/>
|
|
||||||
- Tar <https://www.gnu.org/software/tar/>
|
|
||||||
- Texinfo <https://www.gnu.org/software/texinfo/>
|
|
||||||
|
|
||||||
Valgrind <https://www.valgrind.org/> is also highly recommended, if it
|
|
||||||
supports your architecture.
|
|
||||||
|
|
||||||
If you're using a GNU/Linux distribution, the easiest way to install the
|
|
||||||
above packages depends on your system. The following shell command should
|
|
||||||
work for Debian-based systems such as Ubuntu:
|
|
||||||
|
|
||||||
sudo apt-get install \
|
|
||||||
autoconf automake autopoint flex gperf graphviz help2man texinfo valgrind
|
|
||||||
|
|
||||||
Bison is written using Bison grammars, so there are bootstrapping issues.
|
|
||||||
The bootstrap script attempts to discover when the C code generated from the
|
|
||||||
grammars is out of date, and to bootstrap with an out-of-date version of the
|
|
||||||
C code, but the process is not foolproof. Also, you may run into similar
|
|
||||||
problems yourself if you modify Bison.
|
|
||||||
|
|
||||||
Only building the initial full source tree will be a bit painful. Later,
|
|
||||||
after synchronizing from the repository a plain 'make' should be sufficient.
|
|
||||||
Note, however, that when gnulib is updated, running './bootstrap' again
|
|
||||||
might be needed.
|
|
||||||
|
|
||||||
## First checkout
|
|
||||||
|
|
||||||
Obviously, if you are reading these notes, you did manage to check out this
|
|
||||||
package from the repository. For the record, you will find all the relevant
|
|
||||||
information on https://savannah.gnu.org/git/?group=bison.
|
|
||||||
|
|
||||||
Bison uses Git submodules: subscriptions to other Git repositories. In
|
|
||||||
particular it uses gnulib, the GNU portability library. To ask Git to
|
|
||||||
perform the first checkout of the submodules, run
|
|
||||||
|
|
||||||
$ git submodule update --init
|
|
||||||
|
|
||||||
The next step is to get other files needed to build, which are extracted
|
|
||||||
from other source packages:
|
|
||||||
|
|
||||||
$ ./bootstrap
|
|
||||||
|
|
||||||
Bootstrapping updates the submodules to the versions registered in the
|
|
||||||
top-level directory. To change gnulib, first check out the version you want
|
|
||||||
in `gnulib`, then commit this change in Bison's repository, and finally run
|
|
||||||
bootstrap.
|
|
||||||
|
|
||||||
If it fails with missing symbols (e.g., `error: possibly undefined macro:
|
|
||||||
AC_PROG_GNU_M4`), you are likely to have forgotten the submodule
|
|
||||||
initialization part. To recover from it, run `git reset --hard HEAD`, and
|
|
||||||
restart with the submodule initialization. Otherwise, there you are! Just
|
|
||||||
|
|
||||||
$ ./configure
|
|
||||||
$ make
|
|
||||||
$ make check
|
|
||||||
|
|
||||||
At this point, there should be no difference between your local copy, and
|
|
||||||
the master copy:
|
|
||||||
|
|
||||||
$ git diff
|
|
||||||
|
|
||||||
should output no difference.
|
|
||||||
|
|
||||||
Enjoy!
|
|
||||||
|
|
||||||
## Updating
|
|
||||||
|
|
||||||
If you have git at version 1.8.2 or later, the command
|
|
||||||
|
|
||||||
$ git submodule update --recursive --remote
|
|
||||||
|
|
||||||
will be useful for updating to the latest version of all submodules.
|
|
||||||
|
|
||||||
Under earlier versions, use of submodules make things somewhat different
|
|
||||||
because git does not yet support recursive operations: submodules must be
|
|
||||||
taken care of explicitly.
|
|
||||||
|
|
||||||
### Updating Bison
|
|
||||||
|
|
||||||
If you pull a newer version of a branch, say via `git pull`, you might
|
|
||||||
import requests for updated submodules. A simple `git diff` will reveal if
|
|
||||||
the current version of the submodule (i.e., the actual contents of the
|
|
||||||
gnulib directory) and the current request from the subscriber (i.e., the
|
|
||||||
reference of the version of gnulib that the Bison repository requests)
|
|
||||||
differ. To upgrade the submodules (i.e., to check out the version that is
|
|
||||||
actually requested by the subscriber, run `git submodule update`.
|
|
||||||
|
|
||||||
$ git pull
|
|
||||||
$ git submodule update
|
|
||||||
|
|
||||||
### Updating a submodule
|
|
||||||
To update a submodule, say gnulib, do as follows:
|
|
||||||
|
|
||||||
Get the most recent version of the master branch from git.
|
|
||||||
|
|
||||||
$ cd gnulib
|
|
||||||
$ git fetch
|
|
||||||
$ git checkout -b master --track origin/master
|
|
||||||
|
|
||||||
Make sure Bison can live with that version of gnulib.
|
|
||||||
|
|
||||||
$ cd ..
|
|
||||||
$ ./bootstrap
|
|
||||||
$ make distcheck
|
|
||||||
|
|
||||||
Register your changes.
|
|
||||||
|
|
||||||
$ git commit ...
|
|
||||||
|
|
||||||
For a suggestion of what gnulib commit might be stable enough for a formal
|
|
||||||
release, see the ChangeLog in the latest gnulib snapshot at
|
|
||||||
https://erislabs.net/ianb/projects/gnulib/.
|
|
||||||
|
|
||||||
The Autoconf files we use are currently:
|
|
||||||
- m4/m4.m4
|
|
||||||
- lib/m4sugar/m4sugar.m4
|
|
||||||
- lib/m4sugar/foreach.m4
|
|
||||||
|
|
||||||
These files don't change very often in Autoconf, so it should be relatively
|
|
||||||
straight-forward to examine the differences in order to decide whether to
|
|
||||||
update.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
Bison is self-hosted: its parser is generated by Bison. We don't force
|
|
||||||
ourselves to use the previous release of Bison, we use the current git
|
|
||||||
master for several reasons:
|
|
||||||
- dogfooding: let Bison be its first user
|
|
||||||
- monitoring: seeing the diff on the generated parsers with git is very
|
|
||||||
helpful, as it allows to see easily the impact of the changes on a real
|
|
||||||
case parser.
|
|
||||||
|
|
||||||
If you are unlucky the generated files, src/parse-gram.[ch], may be older
|
|
||||||
than their source, src/parse-gram.y. And your current version of Bison
|
|
||||||
might not be able to grok it. In that case, first refresh the generated
|
|
||||||
files:
|
|
||||||
|
|
||||||
$ touch src/parse-gram.[ch]
|
|
||||||
|
|
||||||
Then proceed.
|
|
||||||
|
|
||||||
In case you wrecked your current copy of the parser, get back the previous
|
|
||||||
version, compile bison, then force it to recreate the files:
|
|
||||||
|
|
||||||
$ git checkout HEAD^ src/parse-gram.[ch]
|
|
||||||
$ make -C _build
|
|
||||||
$ touch src/parse-gram.y
|
|
||||||
$ make -C _build
|
|
||||||
|
|
||||||
|
|
||||||
Administrivia
|
|
||||||
=============
|
|
||||||
|
|
||||||
## If you incorporate a change from somebody on the net:
|
|
||||||
First, if it is a large change, you must make sure they have signed the
|
|
||||||
appropriate paperwork. Second, be sure to add their name and email address
|
|
||||||
to THANKS.
|
|
||||||
|
|
||||||
## If a change fixes a test, mention the test in the commit message.
|
|
||||||
|
|
||||||
## Bug reports
|
|
||||||
If somebody reports a new bug, mention his name in the commit message and in
|
|
||||||
the test case you write. Put him into THANKS.
|
|
||||||
|
|
||||||
The correct response to most actual bugs is to write a new test case which
|
|
||||||
demonstrates the bug. Then fix the bug, re-run the test suite, and check
|
|
||||||
everything in.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Hacking
|
|
||||||
=======
|
|
||||||
|
|
||||||
## Visible Changes
|
|
||||||
Which include serious bug fixes, must be mentioned in NEWS.
|
|
||||||
|
|
||||||
## Translations
|
|
||||||
Only user visible strings are to be translated: error messages, bits of the
|
|
||||||
.output file etc. This excludes impossible error messages (comparable to
|
|
||||||
assert/abort), and all the --trace output which is meant for the maintainers
|
|
||||||
only.
|
|
||||||
|
|
||||||
## Vocabulary
|
|
||||||
- "lookahead", not "look-ahead".
|
|
||||||
- "midrule", not "mid-rule".
|
|
||||||
- "nonterminal", not "variable" or "non-terminal" or "non terminal".
|
|
||||||
Abbreviated as "nterm".
|
|
||||||
- "shift/reduce" and "reduce/reduce", not "shift-reduce" or "shift reduce",
|
|
||||||
etc.
|
|
||||||
|
|
||||||
## Syntax Highlighting
|
|
||||||
It's quite nice to be in C++ mode when editing lalr1.cc for instance.
|
|
||||||
However tools such as Emacs will be fooled by the fact that braces and
|
|
||||||
parens do not nest, as in `[[}]]`. As a consequence you might be misguided
|
|
||||||
by its visual pairing to parens. The m4-mode is safer. Unfortunately the
|
|
||||||
m4-mode is also fooled by `#` which is sees as a comment, stops pairing with
|
|
||||||
parens/brackets that are inside...
|
|
||||||
|
|
||||||
## Implementation Notes
|
|
||||||
There are several places with interesting details about the implementation:
|
|
||||||
- [Understanding C parsers generated by GNU
|
|
||||||
Bison](https://www.cs.uic.edu/~spopuri/cparser.html) by Satya Kiran Popuri,
|
|
||||||
is a wonderful piece of work that explains the implementation of Bison,
|
|
||||||
- [src/gram.h](src/gram.h) documents the way the grammar is represented
|
|
||||||
- [src/tables.h](src/tables.h) documents the generated tables
|
|
||||||
- [data/README.md](data/README.md) contains details about the m4 implementation
|
|
||||||
|
|
||||||
## Coding Style
|
|
||||||
Do not add horizontal tab characters to any file in Bison's repository
|
|
||||||
except where required. For example, do not use tabs to format C code.
|
|
||||||
However, make files, ChangeLog, and some regular expressions require tabs.
|
|
||||||
Also, test cases might need to contain tabs to check that Bison properly
|
|
||||||
processes tabs in its input.
|
|
||||||
|
|
||||||
Prefer `res` as the name of the local variable that will be "return"ed by
|
|
||||||
the function.
|
|
||||||
|
|
||||||
In writing arithmetic comparisons, use "<" and "<=" rather than ">" and ">="
|
|
||||||
<https://public-inbox.org/git/7vfyw7yebj.fsf_-_@assigned-by-dhcp.cox.net/>.
|
|
||||||
|
|
||||||
### Bison
|
|
||||||
Follow the GNU Coding Standards.
|
|
||||||
|
|
||||||
Don't reinvent the wheel: we use gnulib, which features many components.
|
|
||||||
Actually, Bison has legacy code that we should replace with gnulib modules
|
|
||||||
(e.g., many ad hoc implementations of lists).
|
|
||||||
|
|
||||||
#### Includes
|
|
||||||
The `#include` directives follow an order:
|
|
||||||
- first section for *.c files is `<config.h>`. Don't include it in header
|
|
||||||
files
|
|
||||||
- then, for *.c files, the corresponding *.h file
|
|
||||||
- then possibly the `"system.h"` header
|
|
||||||
- then the system headers.
|
|
||||||
Consider headers from `lib/` like system headers (i.e., `#include
|
|
||||||
<verify.h>`, not `#include "verify.h"`).
|
|
||||||
- then headers from src/ with double quotes (`#include "getargs.h"`).
|
|
||||||
|
|
||||||
Keep headers sorted alphabetically in each section.
|
|
||||||
|
|
||||||
See also the [Header
|
|
||||||
files](https://www.gnu.org/software/gnulib/manual/html_node/Header-files.html)
|
|
||||||
and the [Implementation
|
|
||||||
files](https://www.gnu.org/software/gnulib/manual/html_node/Implementation-files.html#Implementation-files)
|
|
||||||
nodes of the gnulib documentation.
|
|
||||||
|
|
||||||
Some source files are in the build tree (e.g., `src/scan-gram.c` made from
|
|
||||||
`src/scan-gram.l`). For them to find the headers from `src/`, we actually
|
|
||||||
use `#include "src/getargs.h"` instead of `#include "getargs.h"`---that
|
|
||||||
saves us from additional `-I` flags.
|
|
||||||
|
|
||||||
### Skeletons
|
|
||||||
We try to use the "typical" coding style for each language.
|
|
||||||
|
|
||||||
#### CPP
|
|
||||||
We indent the CPP directives this way:
|
|
||||||
|
|
||||||
```
|
|
||||||
#if FOO
|
|
||||||
# if BAR
|
|
||||||
# define BAZ
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
```
|
|
||||||
|
|
||||||
Don't indent with leading spaces in the skeletons (it's OK in the grammar
|
|
||||||
files though, e.g., in `%code {...}` blocks).
|
|
||||||
|
|
||||||
On occasions, use `cppi -c` to see where we stand. We don't aim at full
|
|
||||||
correctness: depending `-d`, some bits can be in the *.c file, or the *.h
|
|
||||||
file within the double-inclusion cpp-guards. In that case, favor the case
|
|
||||||
of the *.h file, but don't waste time on this.
|
|
||||||
|
|
||||||
Don't hesitate to leave a comment on the `#endif` (e.g., `#endif /* FOO
|
|
||||||
*/`), especially for long blocks.
|
|
||||||
|
|
||||||
There is no consistency on `! defined` vs. `!defined`. The day gnulib
|
|
||||||
decides, we'll follow them.
|
|
||||||
|
|
||||||
#### C/C++
|
|
||||||
Follow the GNU Coding Standards.
|
|
||||||
|
|
||||||
The `glr.c` skeleton was implemented with `camlCase`. We are migrating it
|
|
||||||
to `snake_case`. Because we are gradually standardizing the code, it is
|
|
||||||
currently inconsistent.
|
|
||||||
|
|
||||||
Use `YYFOO` and `yyfoo` for entities that are exposed to the user. They are
|
|
||||||
part of our contract with the users wrt backward compatibility.
|
|
||||||
|
|
||||||
Use `YY_FOO` and `yy_foo` for private matters. Users should not use them,
|
|
||||||
we are free to change them without fear of backward compatibility issues.
|
|
||||||
|
|
||||||
Use `*_t` for types, especially for `yy*_t` in which case we shouldn't worry
|
|
||||||
about the C standard introducing such a name.
|
|
||||||
|
|
||||||
#### C++
|
|
||||||
Follow the [C++ Core
|
|
||||||
Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines).
|
|
||||||
The [Google ones](https://google.github.io/styleguide/cppguide.html) may be
|
|
||||||
interesting too.
|
|
||||||
|
|
||||||
Our enumerators, such as the kinds (symbol and token kinds), should be lower
|
|
||||||
case, but it was too late to follow that track for token kinds, and symbol
|
|
||||||
kind enumerators are made to be consistent with them.
|
|
||||||
|
|
||||||
Use `*_type` for type aliases. Use `foo_get()` and `foo_set(v)` for
|
|
||||||
accessors, or simply `foo()` and `foo(v)`.
|
|
||||||
|
|
||||||
Use the `yy` prefix for private stuff, but there's no need for it in the
|
|
||||||
public API. The `yy` prefix is already taken care of via the namespace.
|
|
||||||
|
|
||||||
#### Java
|
|
||||||
We follow the [Java Code
|
|
||||||
Conventions](https://www.oracle.com/technetwork/java/codeconventions-150003.pdf)
|
|
||||||
and [Google Java Style
|
|
||||||
Guide](https://google.github.io/styleguide/javaguide.html). Unfortunately
|
|
||||||
at some point some GNU Coding Style was installed in Java, but it's an
|
|
||||||
error. So we should for instance stop putting spaces in function calls.
|
|
||||||
Because we are standardizing the code, it is currently inconsistent. Treat
|
|
||||||
acronyms as words: `YYLacStack`, not `YYLACStack`.
|
|
||||||
|
|
||||||
Use a 2-space indentation (Google) rather than 4 (Oracle).
|
|
||||||
|
|
||||||
Don't use the `yy` prefix for public members: `getExpectedTokens`, not
|
|
||||||
`yyexpectedTokens` or `yygetExpectedTokens`. Keep the `yy` prefix though
|
|
||||||
for private details.
|
|
||||||
|
|
||||||
## Commit Messages
|
|
||||||
Imitate the style we use. Use `git log` to get sources of inspiration.
|
|
||||||
|
|
||||||
If the changes have a small impact on Bison's generated parser, embed these
|
|
||||||
changes in the commit itself. If the impact is large, first push all the
|
|
||||||
changes except those about src/parse-gram.[ch], and then another commit
|
|
||||||
named "regen" which is only about them.
|
|
||||||
|
|
||||||
## Debugging
|
|
||||||
Bison supports tracing of its various steps, via the `--trace` option.
|
|
||||||
Since it is not meant for the end user, it is not displayed by `bison
|
|
||||||
--help`, nor is it documented in the manual. Instead, run `bison
|
|
||||||
--trace=help`.
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
Use `@option` for options and options with their argument if they have no
|
|
||||||
space (e.g., `@option{-Dfoo=bar}`). However, use `@samp` elsewhere (e.g.,
|
|
||||||
`@samp{-I foo}`).
|
|
||||||
|
|
||||||
|
|
||||||
Test Suite
|
|
||||||
==========
|
|
||||||
|
|
||||||
## make check
|
|
||||||
Consume without moderation. It is composed of two kinds of tests: the
|
|
||||||
examples, and the main test suite.
|
|
||||||
|
|
||||||
### The Examples
|
|
||||||
In examples/, there is a number of ready-to-use examples (see
|
|
||||||
[examples/README.md](examples/README.md)). These examples have small test
|
|
||||||
suites run by `make check`. The test results are in local `*.log` files
|
|
||||||
(e.g., `$build/examples/c/calc/calc.log`).
|
|
||||||
|
|
||||||
To check only the examples, run `make check-examples`. To check just one
|
|
||||||
example,
|
|
||||||
|
|
||||||
make check-examples TESTS='examples/c/bistromathic/bistromathic.test'
|
|
||||||
|
|
||||||
### The Main Test Suite
|
|
||||||
The main test suite, in tests/, is written on top of GNU Autotest, which is
|
|
||||||
part of Autoconf. Run `info autoconf 'Using Autotest'` to read the
|
|
||||||
documentation, not only about how to write tests, but also where are the
|
|
||||||
logs, how to read them etc.
|
|
||||||
|
|
||||||
The main test suite generates a log for each test (e.g.,
|
|
||||||
`$build/tests/testsuite.dir/004/testsuite.log` for test #4), and a main log
|
|
||||||
file in `$build/tests/testsuite.log`. The latter is meant for end users: it
|
|
||||||
contains lots of details that should help diagnosing issues, including build
|
|
||||||
issues. The per-test logs are more convenient when working locally.
|
|
||||||
|
|
||||||
#### TESTSUITEFLAGS
|
|
||||||
To run just the main test suite, run `make check-tests`.
|
|
||||||
|
|
||||||
The default is for `make check-tests` to run all tests sequentially. This
|
|
||||||
can be very time consuming when checking repeatedly or on slower setups.
|
|
||||||
This can be sped up in two ways.
|
|
||||||
|
|
||||||
1. Using -j, in a make-like fashion, for example:
|
|
||||||
|
|
||||||
$ make check-tests TESTSUITEFLAGS='-j8'
|
|
||||||
|
|
||||||
When using GNU Make, TESTSUITEFLAGS defaults to the -jN passed to it, so you
|
|
||||||
may simply run
|
|
||||||
|
|
||||||
$ make check-tests -j8
|
|
||||||
|
|
||||||
2. Running only the tests of a certain category. See
|
|
||||||
[tests/README.md](tests/README.md#keywords) for the list of categories.
|
|
||||||
|
|
||||||
To get a list of all the tests (and their keywords for -k), run
|
|
||||||
|
|
||||||
$ ./tests/testsuite -l
|
|
||||||
|
|
||||||
To run a specific set of tests, use -k (for "keyword"). For example:
|
|
||||||
|
|
||||||
$ make check-tests TESTSUITEFLAGS='-k c++'
|
|
||||||
|
|
||||||
Both can be combined.
|
|
||||||
|
|
||||||
$ make check-tests TESTSUITEFLAGS='-j8 -k c++'
|
|
||||||
|
|
||||||
To rerun the tests that failed:
|
|
||||||
|
|
||||||
$ make recheck -j5
|
|
||||||
|
|
||||||
#### Updating the Expectations
|
|
||||||
Sometimes some changes have a large impact on the test suite (e.g., when we
|
|
||||||
added the `[-Wother]` part to all the warnings). Part of the update can be
|
|
||||||
done with a crude tool: `build-aux/update-test`.
|
|
||||||
|
|
||||||
Once you ran the test suite, and therefore have many `testsuite.log` files,
|
|
||||||
run `make update-tests`. Or, by hand, from the *source* tree:
|
|
||||||
|
|
||||||
$ ./build-aux/update-test $build/tests/testsuite.dir/*/testsuite.log
|
|
||||||
|
|
||||||
where `$build` would be your build tree. This will hopefully update most
|
|
||||||
tests. Re-run the test suite. It might be interesting to run `update-test`
|
|
||||||
again, since some early failures may stop latter tests from being run. Yet
|
|
||||||
at some point, you'll have to fix remaining issues by hand...
|
|
||||||
|
|
||||||
|
|
||||||
## Running Java parsers
|
|
||||||
Use the `javaexec.sh` script. For instance to run the parser of test case
|
|
||||||
504:
|
|
||||||
|
|
||||||
$ sh ./_build/javaexec.sh -cp ./_build/tests/testsuite.dir/504 Calc
|
|
||||||
|
|
||||||
## Using Sanitizers
|
|
||||||
Address sanitizer (ASAN) and undefined-behavior sanitizer (UBSAN) are very
|
|
||||||
useful. Here's one way to set them up with GCC 10 on Mac Ports
|
|
||||||
|
|
||||||
1. Configure with
|
|
||||||
```
|
|
||||||
$ ./configure -C --enable-gcc-warnings \
|
|
||||||
CPPFLAGS='-isystem /opt/local/include' \
|
|
||||||
CC='gcc-mp-10 -fsanitize=address -fsanitize=undefined' \
|
|
||||||
CFLAGS='-ggdb' \
|
|
||||||
CXX='g++-mp-10.0 -fsanitize=address -fsanitize=undefined' \
|
|
||||||
CXXFLAGS='-ggdb' \
|
|
||||||
LDFLAGS='-L/opt/local/lib'
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Compile
|
|
||||||
|
|
||||||
3. Generate debug symbols:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ dsymutil src/bison
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Run the tests with leak detection enabled
|
|
||||||
(`ASAN_OPTIONS=detect_leaks=1`). E.g. for counterexamples:
|
|
||||||
```
|
|
||||||
$ make check-tests TESTSUITEFLAGS='-j5 -k cex' ASAN_OPTIONS=detect_leaks=1
|
|
||||||
```
|
|
||||||
|
|
||||||
5. You might need a suppression file. See
|
|
||||||
https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions.
|
|
||||||
With G++ on a Mac, you might need a suppression file (say `leak.supp`)
|
|
||||||
that contains:
|
|
||||||
|
|
||||||
```
|
|
||||||
leak:std::clog
|
|
||||||
```
|
|
||||||
|
|
||||||
and pass the additional flags
|
|
||||||
`LSAN_OPTIONS=suppressions=$PWD/leak.supp,print_suppressions=0`
|
|
||||||
|
|
||||||
6. To run the debugger, you might want something like this:
|
|
||||||
```
|
|
||||||
$ YYDEBUG=1 \
|
|
||||||
UBSAN_OPTIONS=print_stacktrace=1 \
|
|
||||||
LSAN_OPTIONS=suppressions=$PWD/leak.supp,print_suppressions=0 \
|
|
||||||
ASAN_OPTIONS=detect_leaks=1 \
|
|
||||||
lldb -- ./_build/tests/testsuite.dir/712/glr-regr2a ./_build/tests/testsuite.dir/712/input1.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
In lldb to set a break on ubsan, try `rbreak ^__ubsan_handle_`.
|
|
||||||
|
|
||||||
## make maintainer-check-valgrind
|
|
||||||
This target uses valgrind both to check bison, and the generated parsers.
|
|
||||||
|
|
||||||
This is not mature on Mac OS X. First, Valgrind does support the way bison
|
|
||||||
calls m4, so Valgrind cannot be used to check bison on Mac OS X.
|
|
||||||
|
|
||||||
Second, there are many errors that come from the platform itself, not from
|
|
||||||
bison. build-aux/darwin11.4.0.valgrind addresses some of them.
|
|
||||||
|
|
||||||
Third, valgrind issues warnings such as:
|
|
||||||
|
|
||||||
--99312:0:syswrap- WARNING: Ignoring sigreturn( ..., UC_RESET_ALT_STACK );
|
|
||||||
|
|
||||||
which cause the test to fail uselessly. It is hard to ignore these errors
|
|
||||||
with a major overhaul of the way instrumentation is performed in the test
|
|
||||||
suite. So currently, do not try to run valgrind on Mac OS X.
|
|
||||||
|
|
||||||
## Release checks
|
|
||||||
Try to run the test suite with more severe conditions before a
|
|
||||||
release:
|
|
||||||
|
|
||||||
- Configure the package with --enable-gcc-warnings, so that one checks that
|
|
||||||
1. Bison compiles cleanly, 2. the parsers it produces compile cleanly too.
|
|
||||||
|
|
||||||
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that
|
|
||||||
can fix portability issues. See if you really want to pay attention to
|
|
||||||
its warnings; there's no need to obey blindly to it
|
|
||||||
(<https://lists.gnu.org/r/bison-patches/2012-05/msg00057.html>).
|
|
||||||
|
|
||||||
- Check with `make syntax-check` if there are issues diagnosed by gnulib.
|
|
||||||
|
|
||||||
- run `make maintainer-check` which:
|
|
||||||
- runs `valgrind -q bison` to run Bison under Valgrind.
|
|
||||||
- runs the parsers under Valgrind.
|
|
||||||
- runs the test suite with G++ as C compiler...
|
|
||||||
|
|
||||||
- run `make maintainer-check-push`, which runs `make maintainer-check` while
|
|
||||||
activating the push implementation and its pull interface wrappers in many
|
|
||||||
test cases that were originally written to exercise only the pull
|
|
||||||
implementation. This makes certain the push implementation can perform
|
|
||||||
every task the pull implementation can.
|
|
||||||
|
|
||||||
- run `make maintainer-check-xml`, which runs `make maintainer-check` while
|
|
||||||
checking Bison's XML automaton report for every working grammar passed to
|
|
||||||
Bison in the test suite. The check just diffs the output of Bison's
|
|
||||||
included XSLT style sheets with the output of --report=all and --graph.
|
|
||||||
|
|
||||||
- running `make maintainer-check-release` takes care of running
|
|
||||||
maintainer-check, maintainer-check-push and maintainer-check-xml.
|
|
||||||
|
|
||||||
- Change tests/atlocal/CFLAGS to add your preferred options.
|
|
||||||
|
|
||||||
- Test with a very recent version of GCC for both C and C++. Testing with
|
|
||||||
older versions that are still in use is nice too.
|
|
||||||
|
|
||||||
## gnulib
|
|
||||||
To run tests on gnulib components (e.g., on bitset):
|
|
||||||
|
|
||||||
cd gnulib
|
|
||||||
./gnulib-tool --test bitset-tests
|
|
||||||
|
|
||||||
possibly within a specified environment:
|
|
||||||
|
|
||||||
CC='gcc-mp-8 -fsanitize=undefined' ./gnulib-tool --test bitset-tests
|
|
||||||
|
|
||||||
To be able to run the tests several times, and to use symlinks instead of
|
|
||||||
copies so that one can update the origin gnulib directory and immediately
|
|
||||||
re-run the tests, run:
|
|
||||||
|
|
||||||
./gnulib-tool --symlink --create-test --dir=/tmp/gnutest bitset-tests
|
|
||||||
cd /tmp/gnutest
|
|
||||||
./configure -C CC='gcc-mp-8 -fsanitize=undefined' CFLAGS='-ggdb'
|
|
||||||
make check
|
|
||||||
|
|
||||||
|
|
||||||
## Docker
|
|
||||||
|
|
||||||
Running old compilers is not very easy. Docker can be used for some of
|
|
||||||
them. Have a look at .travis.yml for setups. Move the tarball in `/tmp`
|
|
||||||
and run, for instance:
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run -v /tmp:/tmp -it ubuntu:xenial
|
|
||||||
```
|
|
||||||
|
|
||||||
This way, the host and guest machines share `/tmp`.
|
|
||||||
|
|
||||||
### GCC 4.6
|
|
||||||
On Ubuntu Xenial.
|
|
||||||
|
|
||||||
```
|
|
||||||
apt-get update
|
|
||||||
apt-get install software-properties-common
|
|
||||||
apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y gcc-4.6 g++-4.6 m4 make
|
|
||||||
```
|
|
||||||
|
|
||||||
## Stow
|
|
||||||
|
|
||||||
If you want to install several versions of Bison using GNU Stow, do
|
|
||||||
something like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
for v in 3.7 3.7.1
|
|
||||||
do
|
|
||||||
cd /tmp
|
|
||||||
wget https://ftp.gnu.org/gnu/bison/bison-$v.tar.xz
|
|
||||||
tar xf bison-$v.tar.xz
|
|
||||||
cd bison-$v
|
|
||||||
./configure --prefix /usr/local/stow/bison-$v
|
|
||||||
make -j4
|
|
||||||
sudo make install
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
Release Procedure
|
|
||||||
=================
|
|
||||||
|
|
||||||
See the [README-release file](README-release), created when the package is
|
|
||||||
bootstrapped.
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
|
||||||
|
|
||||||
This program 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
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: markdown
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
LocalWords: Automake Autoconf Gettext Gzip Rsync Valgrind gnulib submodules
|
|
||||||
LocalWords: submodule init cd distcheck ChangeLog valgrind sigreturn sudo
|
|
||||||
LocalWords: UC gcc DGNULIB POSIXCHECK xml XSLT glr lalr README po runtime rc
|
|
||||||
LocalWords: gnupload gnupg gpg keyserver BDF ncftp filename clearsign cvs dir
|
|
||||||
LocalWords: symlinks vti html lt POSIX Cc'ed Graphviz Texinfo autoconf jN
|
|
||||||
LocalWords: automake autopoint graphviz texinfo PROG Wother parsers YYFOO
|
|
||||||
LocalWords: TESTSUITEFLAGS deprec struct gnulib's getopt config ggdb yyfoo
|
|
||||||
LocalWords: bitset fsanitize symlink CFLAGS MERCHANTABILITY ispell wrt YY
|
|
||||||
LocalWords: american Administrivia camlCase yy accessors namespace src hoc
|
|
||||||
LocalWords: getExpectedTokens yyexpectedTokens yygetExpectedTokens parens
|
|
||||||
LocalWords: regen dogfooding Autotest testsuite getargs CPP BAZ endif cppi
|
|
||||||
LocalWords: cpp javaexec cp Calc ASAN UBSAN CPPFLAGS isystem CXX cex Gperf
|
|
||||||
LocalWords: CXXFLAGS LDFLAGS dsymutil gperf
|
|
||||||
|
|
||||||
-->
|
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
From phr Tue Jul 8 10:36:19 1986
|
||||||
|
Date: Tue, 8 Jul 86 00:52:24 EDT
|
||||||
|
From: phr (Paul Rubin)
|
||||||
|
To: riferguson%[email protected], tower
|
||||||
|
Subject: Re: Bison documentation?
|
||||||
|
|
||||||
|
The main difference between Bison and Yacc that I know of is that
|
||||||
|
Bison supports the @N construction, which gives you access to
|
||||||
|
the starting and ending line number and character number associated
|
||||||
|
with any of the symbols in the current rule.
|
||||||
|
|
||||||
|
Also, Bison supports the command `%expect N' which says not to mention
|
||||||
|
the conflicts if there are N shift/reduce conflicts and no reduce/reduce
|
||||||
|
conflicts.
|
||||||
|
|
||||||
|
The differences in the algorithms stem mainly from the horrible
|
||||||
|
kludges that Johnson had to perpetrate to make Yacc fit in a PDP-11.
|
||||||
|
|
||||||
|
Also, Bison uses a faster but less space-efficient encoding for the
|
||||||
|
parse tables (see Corbett's PhD thesis from Berkeley, "Static
|
||||||
|
Semantics in Compiler Error Recovery", June 1985, Report No. UCB/CSD
|
||||||
|
85/251), and more modern technique for generating the lookahead sets.
|
||||||
|
(See Frank DeRemer and Thomas Pennello, "Efficient Computation of
|
||||||
|
LALR(1) Look-Ahead Sets", ACM Transactions on Programming Languages
|
||||||
|
and Systems (TOPLAS) 4, 4 (October 1982), 615-649. Their
|
||||||
|
technique is the standard one now.)
|
||||||
|
|
||||||
|
paul rubin
|
||||||
|
free software foundation
|
||||||
|
|
||||||
|
|
||||||
|
[DeRemer-Pennello reference corrected by Paul Eggert <[email protected]>,
|
||||||
|
2004-06-21.]
|
||||||
@@ -1,262 +1,112 @@
|
|||||||
Bison was originally written by Robert Corbett. It would not be what
|
Bison was originally written by Robert Corbett. It would not be what
|
||||||
it is today without the invaluable help of these people:
|
it is today without the invaluable help of these people:
|
||||||
|
|
||||||
Aaro Koskinen [email protected]
|
|
||||||
Аскар Сафин [email protected]
|
|
||||||
Adam Sampson [email protected]
|
|
||||||
Adrian Vogelsgesang [email protected]
|
|
||||||
Ahcheong Lee [email protected]
|
|
||||||
Airy Andre [email protected]
|
Airy Andre [email protected]
|
||||||
Akim Demaille akim@gnu.org
|
Akim Demaille akim@freefriends.org
|
||||||
Albert Chin-A-Young [email protected]
|
Albert Chin-A-Young [email protected]
|
||||||
Alexander Belopolsky [email protected]
|
Alexander Belopolsky [email protected]
|
||||||
Alexandre Duret-Lutz adl@lrde.epita.fr
|
Alexandre Duret-Lutz adl@src.lip6.fr
|
||||||
Andre da Costa Barros [email protected]
|
|
||||||
Andreas Damm [email protected]
|
|
||||||
Andreas Schwab [email protected]
|
Andreas Schwab [email protected]
|
||||||
Andrei Malashkin [email protected]
|
|
||||||
Andrew Suffield [email protected]
|
Andrew Suffield [email protected]
|
||||||
Angelo Borsotti [email protected]
|
|
||||||
Anthony Heading [email protected]
|
Anthony Heading [email protected]
|
||||||
Antonio Silva Correia [email protected]
|
|
||||||
Arnold Robbins [email protected]
|
Arnold Robbins [email protected]
|
||||||
Art Haas [email protected]
|
Art Haas [email protected]
|
||||||
Arthur Schwarz [email protected]
|
|
||||||
Askar Safin [email protected]
|
|
||||||
Balázs Scheidler [email protected]
|
|
||||||
Baron Schwartz [email protected]
|
Baron Schwartz [email protected]
|
||||||
Ben Pfaff [email protected]
|
|
||||||
Benoit Perrot [email protected]
|
Benoit Perrot [email protected]
|
||||||
Bernd Edlinger [email protected]
|
|
||||||
Bernd Kiefer [email protected]
|
|
||||||
Bert Deknuydt [email protected]
|
Bert Deknuydt [email protected]
|
||||||
Bill Allombert [email protected]
|
Bill Allombert [email protected]
|
||||||
Bob Rossi [email protected]
|
Bob Rossi [email protected]
|
||||||
Brandon Lucia [email protected]
|
Brandon Lucia [email protected]
|
||||||
Brooks Moses [email protected]
|
|
||||||
Bruce Lilly [email protected]
|
Bruce Lilly [email protected]
|
||||||
Bruno Belanyi [email protected]
|
|
||||||
Bruno Haible [email protected]
|
Bruno Haible [email protected]
|
||||||
Charles-Henri de Boysson [email protected]
|
Charles-Henri de Boysson [email protected]
|
||||||
Christian Burger [email protected]
|
Christian Burger [email protected]
|
||||||
Clément Démoulins [email protected]
|
|
||||||
Colin Daley [email protected]
|
|
||||||
Cris Bailiff [email protected]
|
Cris Bailiff [email protected]
|
||||||
Cris van Pelt [email protected]
|
Cris van Pelt [email protected]
|
||||||
Csaba Raduly [email protected]
|
Csaba Raduly [email protected]
|
||||||
Dagobert Michelsen [email protected]
|
|
||||||
Daniel Frużyński [email protected]
|
|
||||||
Daniel Galloway [email protected]
|
|
||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
Daniela Becker [email protected]
|
|
||||||
David Barto [email protected]
|
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
David Kastrup [email protected]
|
|
||||||
David Michael [email protected]
|
|
||||||
Dengke Du [email protected]
|
|
||||||
Denis Excoffier [email protected]
|
|
||||||
Dennis Clarke [email protected]
|
|
||||||
Derek Clegg [email protected]
|
|
||||||
Derek M. Jones [email protected]
|
Derek M. Jones [email protected]
|
||||||
Di-an Jan [email protected]
|
Di-an Jan [email protected]
|
||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
Didier Godefroy [email protected]
|
||||||
Don Macpherson [email protected]
|
|
||||||
Dwight Guth [email protected]
|
|
||||||
Efi Fogel [email protected]
|
|
||||||
Enrico Scholz [email protected]
|
Enrico Scholz [email protected]
|
||||||
Eric Blake [email protected]
|
Eric Blake [email protected]
|
||||||
Eric S. Raymond [email protected]
|
|
||||||
Étienne Renault [email protected]
|
|
||||||
Evan Lavelle [email protected]
|
|
||||||
Evan Nemerson [email protected]
|
|
||||||
Evgeny Stambulchik [email protected]
|
Evgeny Stambulchik [email protected]
|
||||||
Fabrice Bauzac [email protected]
|
Fabrice Bauzac [email protected]
|
||||||
Ferdinand Thiessen [email protected]
|
|
||||||
Florian Krohm [email protected]
|
Florian Krohm [email protected]
|
||||||
Frank Heckenbach [email protected]
|
Frank Heckenbach [email protected]
|
||||||
Frans Englich [email protected]
|
Frans Englich [email protected]
|
||||||
Gabriel Rassoul [email protected]
|
|
||||||
Gary L Peskin [email protected]
|
|
||||||
Gavin Smith [email protected]
|
|
||||||
Georg Sauthoff [email protected]
|
Georg Sauthoff [email protected]
|
||||||
George Neuner [email protected]
|
|
||||||
Gilles Espinasse [email protected]
|
|
||||||
Giorgos Pap [email protected]
|
|
||||||
Goran Uddeborg [email protected]
|
Goran Uddeborg [email protected]
|
||||||
Guido Trentalancia [email protected]
|
Guido Trentalancia [email protected]
|
||||||
H. Merijn Brand [email protected]
|
H. Merijn Brand [email protected]
|
||||||
Hans Åberg haberg[email protected]
|
Hans Aberg haberg@matematik.su.se
|
||||||
Horst Von Brand [email protected]
|
|
||||||
Jacob L. Mandelson [email protected]
|
|
||||||
Jan Nieuwenhuizen [email protected]
|
Jan Nieuwenhuizen [email protected]
|
||||||
Jannick [email protected]
|
|
||||||
Jeff Hammond [email protected]
|
|
||||||
Jerry Quinn [email protected]
|
|
||||||
Jesse Thilo [email protected]
|
Jesse Thilo [email protected]
|
||||||
Jim Kent [email protected]
|
Jim Kent [email protected]
|
||||||
Jim Meyering [email protected]
|
Jim Meyering [email protected]
|
||||||
Joel E. Denny joeldenny@joeldenny.org
|
Joel E. Denny jdenny@ces.clemson.edu
|
||||||
Johan van Selst [email protected]
|
|
||||||
John Horigan [email protected]
|
|
||||||
Jonathan Fabrizio [email protected]
|
|
||||||
Jonathan Nieder [email protected]
|
Jonathan Nieder [email protected]
|
||||||
Josh Soref [email protected]
|
|
||||||
Juan Manuel Guerrero [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
Karl Berry [email protected]
|
|
||||||
Kees Zeelenberg [email protected]
|
Kees Zeelenberg [email protected]
|
||||||
Keith Browne [email protected]
|
Keith Browne [email protected]
|
||||||
Ken Moffat [email protected]
|
|
||||||
Kiyoshi Kanazawa [email protected]
|
|
||||||
Lars Maier [email protected]
|
|
||||||
Lars Wendler [email protected]
|
|
||||||
László Várady [email protected]
|
|
||||||
Laurent Mascherpa [email protected]
|
Laurent Mascherpa [email protected]
|
||||||
Lie Yan [email protected]
|
|
||||||
Maarten De Braekeleer [email protected]
|
|
||||||
Magnus Fromreide [email protected]
|
Magnus Fromreide [email protected]
|
||||||
Marc Autret [email protected]
|
Marc Autret [email protected]
|
||||||
Marc Mendiola [email protected]
|
|
||||||
Marc Schönefeld [email protected]
|
|
||||||
Mark Boyall [email protected]
|
|
||||||
Marko Mäkelä [email protected]
|
|
||||||
Martin Blais [email protected]
|
|
||||||
Martin Jacobs [email protected]
|
Martin Jacobs [email protected]
|
||||||
Martin Mokrejs [email protected]
|
Martin Mokrejs [email protected]
|
||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
Matt Kraai [email protected]
|
Matt Kraai [email protected]
|
||||||
Matt Rosing [email protected]
|
Matt Rosing [email protected]
|
||||||
Maxim Prohorenko [email protected]
|
|
||||||
Michael Catanzaro [email protected]
|
|
||||||
Michael Felt [email protected]
|
|
||||||
Michael Hayes [email protected]
|
Michael Hayes [email protected]
|
||||||
Michael Raskin [email protected]
|
Michael Raskin [email protected]
|
||||||
Michał Majchrowicz [email protected]
|
|
||||||
Michel d'Hooge [email protected]
|
|
||||||
Michiel De Wilde [email protected]
|
|
||||||
Mickael Labau [email protected]
|
Mickael Labau [email protected]
|
||||||
Mike Castle [email protected]
|
Mike Castle [email protected]
|
||||||
Mike Frysinger [email protected]
|
|
||||||
Mike Sullivan [email protected]
|
|
||||||
Nate Guerin [email protected]
|
|
||||||
Neil Booth [email protected]
|
Neil Booth [email protected]
|
||||||
Nelson H. F. Beebe [email protected]
|
Nelson H. F. Beebe [email protected]
|
||||||
neok m4700 [email protected]
|
|
||||||
Nick Bowler [email protected]
|
|
||||||
Nicolas Bedon [email protected]
|
|
||||||
Nicolas Burrus [email protected]
|
Nicolas Burrus [email protected]
|
||||||
Nicolas Tisserand [email protected]
|
Nicolas Tisserand [email protected]
|
||||||
Nikita Popov [email protected]
|
|
||||||
Nikki Valen [email protected]
|
|
||||||
Noah Friedman [email protected]
|
Noah Friedman [email protected]
|
||||||
Odd Arild Olsen [email protected]
|
Odd Arild Olsen [email protected]
|
||||||
Oleg Smolsky [email protected]
|
Oleg Smolsky [email protected]
|
||||||
Oleksii Taran [email protected]
|
|
||||||
Oliver Mangold [email protected]
|
|
||||||
Paolo Bonzini [email protected]
|
Paolo Bonzini [email protected]
|
||||||
Paolo Simone Gasparello [email protected]
|
|
||||||
Pascal Bart [email protected]
|
Pascal Bart [email protected]
|
||||||
Patrice Dumas [email protected]
|
|
||||||
Paul Eggert [email protected]
|
Paul Eggert [email protected]
|
||||||
Paul Hilfinger [email protected]
|
Paul Hilfinger [email protected]
|
||||||
Per Allansson [email protected]
|
Per Allansson [email protected]
|
||||||
Peter Eisentraut [email protected]
|
|
||||||
Peter Fales [email protected]
|
Peter Fales [email protected]
|
||||||
Peter Hamorsky [email protected]
|
Peter Hamorsky [email protected]
|
||||||
Peter Simons [email protected]
|
|
||||||
Petr Machata [email protected]
|
|
||||||
Pho [email protected]
|
|
||||||
Piotr Gackiewicz [email protected]
|
Piotr Gackiewicz [email protected]
|
||||||
Piotr Marcińczyk [email protected]
|
|
||||||
Pramod Kumbhar [email protected]
|
|
||||||
Quentin Hocquet [email protected]
|
|
||||||
Quoc Peyrot [email protected]
|
Quoc Peyrot [email protected]
|
||||||
R Blake [email protected]
|
R Blake [email protected]
|
||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
Rich Wilson [email protected]
|
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
Rici Lake [email protected]
|
|
||||||
Rob Conde [email protected]
|
|
||||||
Rob Vermaas [email protected]
|
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
Robert Yang [email protected]
|
|
||||||
Roland Levillain [email protected]
|
|
||||||
Ryan [email protected]
|
|
||||||
Satya Kiran Popuri [email protected]
|
Satya Kiran Popuri [email protected]
|
||||||
Sebastian Setzer [email protected]
|
Sebastian Setzer [email protected]
|
||||||
Sebastien Fricker [email protected]
|
Sebastien Fricker [email protected]
|
||||||
Sébastien Villemot [email protected]
|
|
||||||
Sergei Steshenko [email protected]
|
Sergei Steshenko [email protected]
|
||||||
Shura [email protected]
|
Shura [email protected]
|
||||||
Simon Sobisch [email protected]
|
|
||||||
Stefano Lattarini [email protected]
|
|
||||||
Stephen Cameron [email protected]
|
|
||||||
Steve Murphy [email protected]
|
Steve Murphy [email protected]
|
||||||
Suhwan Song [email protected]
|
Summum Bonum [email protected]
|
||||||
Sum Wu [email protected]
|
|
||||||
Théophile Ranquet [email protected]
|
|
||||||
Thiru Ramakrishnan [email protected]
|
|
||||||
Thomas Jahns [email protected]
|
|
||||||
Thomas Petazzoni [email protected]
|
|
||||||
Tim Josling [email protected]
|
Tim Josling [email protected]
|
||||||
Tim Landscheidt [email protected]
|
|
||||||
Tim Van Holder [email protected]
|
Tim Van Holder [email protected]
|
||||||
Tobias Frost [email protected]
|
|
||||||
Todd Freed [email protected]
|
|
||||||
Tom Kramer [email protected]
|
|
||||||
Tom Lane [email protected]
|
Tom Lane [email protected]
|
||||||
Tom Tromey [email protected]
|
Tom Tromey [email protected]
|
||||||
Tomasz Kłoczko [email protected]
|
|
||||||
Tommy Nordgren [email protected]
|
Tommy Nordgren [email protected]
|
||||||
Troy A. Johnson [email protected]
|
Troy A. Johnson [email protected]
|
||||||
Tys Lefering [email protected]
|
Tys Lefering [email protected]
|
||||||
Uxio Prego [email protected]
|
|
||||||
Valentin Tolmer [email protected]
|
|
||||||
wcventure [email protected]
|
|
||||||
Victor Khomenko [email protected]
|
|
||||||
Victor Zverovich [email protected]
|
|
||||||
Vin Shelton [email protected]
|
Vin Shelton [email protected]
|
||||||
W.C.A. Wijngaards [email protected]
|
|
||||||
Wayne Green [email protected]
|
Wayne Green [email protected]
|
||||||
Wei Song [email protected]
|
|
||||||
Wojciech Polak [email protected]
|
|
||||||
Wolfgang S. Kechel [email protected]
|
|
||||||
Wolfgang Thaller [email protected]
|
|
||||||
Wolfram Wagner [email protected]
|
Wolfram Wagner [email protected]
|
||||||
Wwp [email protected]
|
Wwp [email protected]
|
||||||
xolodho [email protected]
|
|
||||||
Yuichiro Kaneko [email protected]
|
|
||||||
Yuriy Solodkyy [email protected]
|
|
||||||
Zack Weinberg [email protected]
|
Zack Weinberg [email protected]
|
||||||
江 祖铭 [email protected]
|
|
||||||
長田偉伸 [email protected]
|
|
||||||
马俊 [email protected]
|
|
||||||
|
|
||||||
Many people are not named here because we lost track of them. We
|
Many people are not named here because we lost track of them. We
|
||||||
thank them! Please, help us keeping this list up to date.
|
thank them! Please, help us keeping this list up to date.
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: text
|
mode: text
|
||||||
coding: utf-8
|
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
Copyright (C) 2000-2015, 2018-2022, 2025-2026 Free Software Foundation,
|
|
||||||
Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
|
||||||
|
|
||||||
This program 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
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|||||||
@@ -1,590 +1,90 @@
|
|||||||
* Soon
|
-*- outline -*-
|
||||||
** yyerror_range in GLR
|
|
||||||
It seems useless that it is based on glr_stack_item, it should be doable
|
|
||||||
with location only.
|
|
||||||
|
|
||||||
** scan-code
|
* Header guards
|
||||||
The default case is scanning char-per-char.
|
|
||||||
|
|
||||||
/* By default, grow the string obstack with the input. */
|
From Franc,ois: should we keep the directory part in the CPP guard?
|
||||||
.|\n STRING_GROW ();
|
|
||||||
|
|
||||||
make it more eager?
|
|
||||||
|
|
||||||
** Missing tests
|
* Yacc.c: CPP Macros
|
||||||
commit 2c294c132528ede23d8ae4959783a67e9ff05ac5
|
|
||||||
Author: Vincent Imbimbo <[email protected]>
|
|
||||||
Date: Sat Jan 23 13:25:18 2021 -0500
|
|
||||||
|
|
||||||
cex: fix state-item pruning
|
Do some people use YYPURE, YYLSP_NEEDED like we do in the test suite?
|
||||||
|
They should not: it is not documented. But if they need to, let's
|
||||||
|
find something clean (not like YYLSP_NEEDED...).
|
||||||
|
|
||||||
See https://lists.gnu.org/r/bug-bison/2021-01/msg00002.html
|
|
||||||
|
|
||||||
** pos_set_set
|
* Installation
|
||||||
The current approach is correct, but with poor performances. Bitsets need
|
|
||||||
to support 'assign' and 'shift'. And instead of extending POS_SET just for
|
|
||||||
the out-of-range new values, we need something like doubling the size.
|
|
||||||
|
|
||||||
** glr
|
* Documentation
|
||||||
There is no test with "Parse on stack %ld rejected by rule %d" in it.
|
Before releasing, make sure the documentation ("Understanding your
|
||||||
|
parser") refers to the current `output' format.
|
||||||
|
|
||||||
** yyrline etc.
|
* lalr1.cc
|
||||||
Clarify that rule numbers in the skeletons are 1-based.
|
** vector
|
||||||
|
Move to using vector, drop stack.hh.
|
||||||
|
|
||||||
** Macros in C++
|
** I18n
|
||||||
There are many macros that should obey api.prefix: YY_CPLUSPLUS, YY_MOVE,
|
Catch up with yacc.c.
|
||||||
etc.
|
|
||||||
|
|
||||||
** yyerrok in Java
|
|
||||||
And add tests in calc.at, to prepare work for D.
|
|
||||||
|
|
||||||
** YYERROR and yynerrs
|
|
||||||
We are missing some cases. Write a test case, and check all the skeletons.
|
|
||||||
|
|
||||||
** Cex
|
|
||||||
*** Improve gnulib
|
|
||||||
Don't do this (counterexample.c):
|
|
||||||
|
|
||||||
// This is the fastest way to get the tail node from the gl_list API.
|
|
||||||
gl_list_node_t
|
|
||||||
list_get_end (gl_list_t list)
|
|
||||||
{
|
|
||||||
gl_list_node_t sentinel = gl_list_add_last (list, NULL);
|
|
||||||
gl_list_node_t res = gl_list_previous_node (list, sentinel);
|
|
||||||
gl_list_remove_node (list, sentinel);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
*** Ambiguous rewriting
|
|
||||||
If the user is stupid enough to have equal rules, then the derivations are
|
|
||||||
harder to read:
|
|
||||||
|
|
||||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
|
||||||
2 exp: exp "+" exp .
|
|
||||||
3 exp: exp "+" exp .
|
|
||||||
Example exp "+" exp •
|
|
||||||
First derivation exp ::=[ exp "+" exp • ]
|
|
||||||
Example exp "+" exp •
|
|
||||||
Second derivation exp ::=[ exp "+" exp • ]
|
|
||||||
|
|
||||||
Do we care about this? In color, we use twice the same color here, but we
|
|
||||||
could try to use the same color for the same rule.
|
|
||||||
|
|
||||||
*** XML reports
|
|
||||||
Show the counterexamples. This is going to be really hard and/or painful.
|
|
||||||
Unless we play it dumb (little structure).
|
|
||||||
|
|
||||||
** Bistromathic
|
|
||||||
- How about not evaluating incomplete lines when the text is not finished
|
|
||||||
(as shells do).
|
|
||||||
|
|
||||||
** Questions
|
|
||||||
*** Java
|
|
||||||
- Should i18n be part of the Lexer? Currently it's a static method of
|
|
||||||
Lexer.
|
|
||||||
|
|
||||||
- is there a migration path that would allow to use TokenKinds in
|
|
||||||
yylex?
|
|
||||||
|
|
||||||
- define the tokens as an enum too.
|
|
||||||
|
|
||||||
- promote YYEOF rather than EOF.
|
|
||||||
|
|
||||||
** YYerror
|
|
||||||
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
|
||||||
|
|
||||||
should be updated to not use YYERRCODE. Returning an undef token is good
|
|
||||||
enough.
|
|
||||||
|
|
||||||
** Java
|
|
||||||
*** calc.at
|
|
||||||
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
|
||||||
|
|
||||||
** doc
|
|
||||||
I feel it's ugly to use the GNU style to declare functions in the doc. It
|
|
||||||
generates tons of white space in the page, and may contribute to bad page
|
|
||||||
breaks.
|
|
||||||
|
|
||||||
** consistency
|
|
||||||
token vs terminal.
|
|
||||||
|
|
||||||
** api.token.raw
|
|
||||||
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
|
||||||
used to report invalid lexemes.
|
|
||||||
|
|
||||||
** push parsers
|
|
||||||
Consider deprecating impure push parsers. They add a lot of complexity, for
|
|
||||||
a bad feature. On the other hand, that would make it much harder to sit
|
|
||||||
push parsers on top of pull parser. Which is currently not relevant, since
|
|
||||||
push parsers are measurably slower.
|
|
||||||
|
|
||||||
** %define parse.error formatted
|
|
||||||
How about pushing Bistromathic's yyreport_syntax_error as another standard
|
|
||||||
way to generate the error message, and leave to the user the task of
|
|
||||||
providing the message formats? Currently in bistro, it reads:
|
|
||||||
|
|
||||||
const char *
|
|
||||||
error_format_string (int argc)
|
|
||||||
{
|
|
||||||
switch (argc)
|
|
||||||
{
|
|
||||||
default: /* Avoid compiler warnings. */
|
|
||||||
case 0: return _("%@: syntax error");
|
|
||||||
case 1: return _("%@: syntax error: unexpected %u");
|
|
||||||
// TRANSLATORS: '%@' is a location in a file, '%u' is an
|
|
||||||
// "unexpected token", and '%0e', '%1e'... are expected tokens
|
|
||||||
// at this point.
|
|
||||||
//
|
|
||||||
// For instance on the expression "1 + * 2", you'd get
|
|
||||||
//
|
|
||||||
// 1.5: syntax error: expected - or ( or number or function or variable before *
|
|
||||||
case 2: return _("%@: syntax error: expected %0e before %u");
|
|
||||||
case 3: return _("%@: syntax error: expected %0e or %1e before %u");
|
|
||||||
case 4: return _("%@: syntax error: expected %0e or %1e or %2e before %u");
|
|
||||||
case 5: return _("%@: syntax error: expected %0e or %1e or %2e or %3e before %u");
|
|
||||||
case 6: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e before %u");
|
|
||||||
case 7: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e before %u");
|
|
||||||
case 8: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e or %6e before %u");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
The message would have to be generated in a string, and pushed to yyerror.
|
|
||||||
Which will be a pain in the neck in yacc.c.
|
|
||||||
|
|
||||||
If we want to do that, we should think very carefully about the syntax of
|
|
||||||
the format string.
|
|
||||||
|
|
||||||
** yyclearin does not invoke the lookahead token's %destructor
|
|
||||||
https://lists.gnu.org/r/bug-bison/2018-02/msg00000.html
|
|
||||||
Rici:
|
|
||||||
|
|
||||||
> Modifying yyclearin so that it calls yydestruct seems like the simplest
|
|
||||||
> solution to this issue, but it is conceivable that such a change would
|
|
||||||
> break programs which already perform some kind of workaround in order to
|
|
||||||
> destruct the lookahead symbol. So it might be necessary to use some kind of
|
|
||||||
> compatibility %define, or to create a new replacement macro with a
|
|
||||||
> different name such as yydiscardin.
|
|
||||||
>
|
|
||||||
> At a minimum, the fact that yyclearin does not invoke the %destructor
|
|
||||||
> should be highlighted in the documentation, since it is not at all obvious.
|
|
||||||
|
|
||||||
** Issues in i18n
|
|
||||||
|
|
||||||
Les catégories d'avertissements incluent :
|
|
||||||
conflicts-sr conflits S/R (activé par défaut)
|
|
||||||
conflicts-rr conflits R/R (activé par défaut)
|
|
||||||
dangling-alias l'alias chaîne n'est pas attaché à un symbole
|
|
||||||
deprecated construction obsolète
|
|
||||||
empty-rule règle vide sans %empty
|
|
||||||
midrule-values valeurs de règle intermédiaire non définies ou inutilisées
|
|
||||||
precedence priorité et associativité inutiles
|
|
||||||
yacc incompatibilités avec POSIX Yacc
|
|
||||||
other tous les autres avertissements (activé par défaut)
|
|
||||||
all tous les avertissements sauf « dangling-alias » et « yacc »
|
|
||||||
no-CATEGORY désactiver les avertissements dans CATEGORIE
|
|
||||||
none désactiver tous les avertissements
|
|
||||||
error[=CATEGORY] traiter les avertissements comme des erreurs
|
|
||||||
|
|
||||||
Line -1 and -3 should mention CATEGORIE, not CATEGORY.
|
|
||||||
|
|
||||||
* Bison 3.9
|
|
||||||
** Rewrite glr.cc (currently glr2.cc)
|
|
||||||
*** custom error messages
|
|
||||||
|
|
||||||
*** Remove jumps
|
|
||||||
We can probably replace setjmp/longjmp with exceptions. That would help
|
|
||||||
tremendously other languages such as D and Java that probably have no
|
|
||||||
similar feature. If we remove jumps, we probably no longer need _Noreturn,
|
|
||||||
so simplify `b4_attribute_define([noreturn])` into `b4_attribute_define`.
|
|
||||||
|
|
||||||
After discussing with Valentin, it was decided that it's better to stay with
|
|
||||||
jumps, since in some places exceptions are ruled out from C++.
|
|
||||||
|
|
||||||
*** Coding style
|
|
||||||
Move to our coding conventions. In particular names such as yy_glr_stack,
|
|
||||||
not yyGLRStack.
|
|
||||||
|
|
||||||
*** yydebug
|
|
||||||
It should be a member of the parser object, see lalr1.cc. Let the parser
|
|
||||||
object decide what the debug stream is, rather than open coding std::cerr.
|
|
||||||
|
|
||||||
*** Avoid pointers
|
|
||||||
There are many places where pointers should be replaced with references.
|
|
||||||
Some occurrences were fixed, but now some have improper names:
|
|
||||||
|
|
||||||
-yygetToken (int *yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser][]b4_pure_if([, glr_stack* yystackp])[]b4_user_formals[)
|
|
||||||
+yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser][]b4_pure_if([, glr_stack* yystackp])[]b4_user_formals[)
|
|
||||||
|
|
||||||
yycharp is no longer a Pointer. And yystackp should probably also be a reference.
|
|
||||||
|
|
||||||
*** parse.assert
|
|
||||||
Currently all the assertions are enabled. Once we are confident in glr2.cc,
|
|
||||||
let parse.assert use the same approach as in lalr1.cc.
|
|
||||||
|
|
||||||
*** debug_stream
|
|
||||||
Stop using std::cerr everywhere.
|
|
||||||
|
|
||||||
*** glr.c
|
|
||||||
When glr2.cc fully replaces glr.cc, get rid of the glr.cc scaffolding in
|
|
||||||
glr.c.
|
|
||||||
|
|
||||||
* Chains
|
|
||||||
** Unit rules / Injection rules (Akim Demaille)
|
|
||||||
Maybe we could expand unit rules (or "injections", see
|
|
||||||
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
|
||||||
transform
|
|
||||||
|
|
||||||
exp: arith | bool;
|
|
||||||
arith: exp '+' exp;
|
|
||||||
bool: exp '&' exp;
|
|
||||||
|
|
||||||
into
|
|
||||||
|
|
||||||
exp: exp '+' exp | exp '&' exp;
|
|
||||||
|
|
||||||
when there are no actions. This can significantly speed up some grammars.
|
|
||||||
I can't find the papers. In particular the book 'LR parsing: Theory and
|
|
||||||
Practice' is impossible to find, but according to 'Parsing Techniques: a
|
|
||||||
Practical Guide', it includes information about this issue. Does anybody
|
|
||||||
have it?
|
|
||||||
|
|
||||||
** clean up (Akim Demaille)
|
|
||||||
Do not work on these items now, as I (Akim) have branches with a lot of
|
|
||||||
changes in this area (hitting several files), and no desire to have to fix
|
|
||||||
conflicts. Addressing these items will happen after my branches have been
|
|
||||||
merged.
|
|
||||||
|
|
||||||
*** lalr.c
|
|
||||||
Introduce a goto struct, and use it in place of from_state/to_state.
|
|
||||||
Rename states1 as path, length as pathlen.
|
|
||||||
Introduce inline functions for things such as nullable[*rp - ntokens]
|
|
||||||
where we need to map from symbol number to nterm number.
|
|
||||||
|
|
||||||
There are probably a significant part of the relations management that
|
|
||||||
should be migrated on top of a bitsetv.
|
|
||||||
|
|
||||||
*** closure
|
|
||||||
It should probably take a "state*" instead of two arguments.
|
|
||||||
|
|
||||||
*** traces
|
|
||||||
The "automaton" and "set" categories are not so useful. We should probably
|
|
||||||
introduce lr(0) and lalr, just the way we have ielr categories. The
|
|
||||||
"closure" function is too verbose, it should probably have its own category.
|
|
||||||
|
|
||||||
"set" can still be used for summarizing the important sets. That would make
|
|
||||||
tests easy to maintain.
|
|
||||||
|
|
||||||
*** complain.*
|
|
||||||
Rename these guys as "diagnostics.*" (or "diagnose.*"), since that's the
|
|
||||||
name they have in GCC, clang, etc. Likewise for the complain_* series of
|
|
||||||
functions.
|
|
||||||
|
|
||||||
*** ritem
|
|
||||||
states/nstates, rules/nrules, ..., ritem/nritems
|
|
||||||
Fix the latter.
|
|
||||||
|
|
||||||
*** m4: slot, type, type_tag
|
|
||||||
The meaning of type_tag varies depending on api.value.type. We should avoid
|
|
||||||
that and using clear definitions with stable semantics.
|
|
||||||
|
|
||||||
* D programming language
|
|
||||||
There's a number of features that are missing, here sorted in _suggested_
|
|
||||||
order of implementation.
|
|
||||||
|
|
||||||
When copying code from other skeletons, keep the comments exactly as they
|
|
||||||
are. Keep the same variable names. If you change the wording in one place,
|
|
||||||
do it in the others too. In other words: make sure to keep the
|
|
||||||
maintenance *simple* by avoiding any gratuitous difference.
|
|
||||||
|
|
||||||
** CI
|
|
||||||
Check when gdc and ldc.
|
|
||||||
|
|
||||||
** GLR Parser
|
|
||||||
This is very ambitious. That's the final boss. There are currently no
|
|
||||||
"clean" implementation to get inspiration from.
|
|
||||||
|
|
||||||
glr.c is very clean but:
|
|
||||||
- is low-level C
|
|
||||||
- is a different skeleton from yacc.c
|
|
||||||
|
|
||||||
glr.cc is (currently) an ugly hack: a C++ shell around glr.c. Valentin
|
|
||||||
Tolmer is currently rewriting glr.cc to be clean C++, but he is not
|
|
||||||
finished. There will be a lot a common code between lalr1.cc and glr.cc, so
|
|
||||||
eventually I would like them to be fused into a single skeleton, supporting
|
|
||||||
both deterministic and generalized parsing.
|
|
||||||
|
|
||||||
It would be great for D to also support this.
|
|
||||||
|
|
||||||
The basic ideas of GLR are explained here:
|
|
||||||
|
|
||||||
https://www.codeproject.com/Articles/5259825/GLR-Parsing-in-Csharp-How-to-Use-The-Most-Powerful
|
|
||||||
|
|
||||||
* Better error messages
|
|
||||||
The users are not provided with enough tools to forge their error messages.
|
|
||||||
See for instance "Is there an option to change the message produced by
|
|
||||||
YYERROR_VERBOSE?" by Simon Sobisch, on bison-help.
|
|
||||||
|
|
||||||
See also
|
|
||||||
https://www.cs.tufts.edu/~nr/cs257/archive/clinton-jefferey/lr-error-messages.pdf
|
|
||||||
https://research.swtch.com/yyerror
|
|
||||||
http://gallium.inria.fr/~fpottier/publis/fpottier-reachability-cc2016.pdf
|
|
||||||
|
|
||||||
* Modernization
|
|
||||||
Fix data/skeletons/yacc.c so that it defines YYPTRDIFF_T properly for modern
|
|
||||||
and older C++ compilers. Currently the code defaults to defining it to
|
|
||||||
'long' for non-GCC compilers, but it should use the proper C++ magic to
|
|
||||||
define it to the same type as the C ptrdiff_t type.
|
|
||||||
|
|
||||||
* Completion
|
|
||||||
Several features are not available in all the back-ends.
|
|
||||||
|
|
||||||
- push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
|
|
||||||
- token constructors: Java, C, D (a bit difficult)
|
|
||||||
- glr: D, Java (super difficult)
|
|
||||||
|
|
||||||
* Bugs
|
|
||||||
** Autotest has quotation issues
|
|
||||||
tests/input.at:1730:AT_SETUP([%define errors])
|
|
||||||
|
|
||||||
->
|
|
||||||
|
|
||||||
$ ./tests/testsuite -l | grep errors | sed q
|
|
||||||
38: input.at:1730 errors
|
|
||||||
|
|
||||||
* Short term
|
|
||||||
** Better design for diagnostics
|
|
||||||
The current implementation of diagnostics is ad hoc, it grew organically.
|
|
||||||
It works as a series of calls to several functions, with dependency of the
|
|
||||||
latter calls on the former. For instance:
|
|
||||||
|
|
||||||
complain (&sym->location,
|
|
||||||
sym->content->status == needed ? complaint : Wother,
|
|
||||||
_("symbol %s is used, but is not defined as a token"
|
|
||||||
" and has no rules; did you mean %s?"),
|
|
||||||
quote_n (0, sym->tag),
|
|
||||||
quote_n (1, best->tag));
|
|
||||||
if (feature_flag & feature_caret)
|
|
||||||
location_caret_suggestion (sym->location, best->tag, stderr);
|
|
||||||
|
|
||||||
We should rewrite this in a more FP way:
|
|
||||||
|
|
||||||
1. build a rich structure that denotes the (complete) diagnostic.
|
|
||||||
"Complete" in the sense that it also contains the suggestions, the list
|
|
||||||
of possible matches, etc.
|
|
||||||
|
|
||||||
2. send this to the pretty-printing routine. The diagnostic structure
|
|
||||||
should be sufficient so that we can generate all the 'format' of
|
|
||||||
diagnostics, including the fixits.
|
|
||||||
|
|
||||||
If properly done, this diagnostic module can be detached from Bison and be
|
|
||||||
put in gnulib. It could be used, for instance, for errors caught by
|
|
||||||
xgettext.
|
|
||||||
|
|
||||||
There's certainly already something alike in GCC. At least that's the
|
|
||||||
impression I get from reading the "-fdiagnostics-format=FORMAT" part of this
|
|
||||||
page:
|
|
||||||
|
|
||||||
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
|
|
||||||
|
|
||||||
** Graphviz display code thoughts
|
|
||||||
The code for the --graph option is over two files: print_graph, and
|
|
||||||
graphviz. This is because Bison used to also produce VCG graphs, but since
|
|
||||||
this is no longer true, maybe we could consider these files for fusion.
|
|
||||||
|
|
||||||
An other consideration worth noting is that print_graph.c (correct me if I
|
|
||||||
am wrong) should contain generic functions, whereas graphviz.c and other
|
|
||||||
potential files should contain just the specific code for that output
|
|
||||||
format. It will probably prove difficult to tell if the implementation is
|
|
||||||
actually generic whilst only having support for a single format, but it
|
|
||||||
would be nice to keep stuff a bit tidier: right now, the construction of the
|
|
||||||
bitset used to show reductions is in the graphviz-specific code, and on the
|
|
||||||
opposite side we have some use of \l, which is graphviz-specific, in what
|
|
||||||
should be generic code.
|
|
||||||
|
|
||||||
Little effort seems to have been given to factoring these files and their
|
|
||||||
print{,-xml} counterpart. We would very much like to re-use the pretty format
|
|
||||||
of states from .output for the graphs, etc.
|
|
||||||
|
|
||||||
Since graphviz dies on medium-to-big grammars, maybe consider an other tool?
|
|
||||||
|
|
||||||
** push-parser
|
|
||||||
Check it too when checking the different kinds of parsers. And be
|
|
||||||
sure to check that the initial-action is performed once per parsing.
|
|
||||||
|
|
||||||
** m4 names
|
|
||||||
b4_shared_declarations is no longer what it is. Make it
|
|
||||||
b4_parser_declaration for instance.
|
|
||||||
|
|
||||||
** yychar in lalr1.cc
|
|
||||||
There is a large difference bw maint and master on the handling of
|
|
||||||
yychar (which was removed in lalr1.cc). See what needs to be
|
|
||||||
back-ported.
|
|
||||||
|
|
||||||
|
|
||||||
/* User semantic actions sometimes alter yychar, and that requires
|
|
||||||
that yytoken be updated with the new translation. We take the
|
|
||||||
approach of translating immediately before every use of yytoken.
|
|
||||||
One alternative is translating here after every semantic action,
|
|
||||||
but that translation would be missed if the semantic action
|
|
||||||
invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
|
|
||||||
yychar. In the case of YYABORT or YYACCEPT, an incorrect
|
|
||||||
destructor might then be invoked immediately. In the case of
|
|
||||||
YYERROR, subsequent parser actions might lead to an incorrect
|
|
||||||
destructor call or verbose syntax error message before the
|
|
||||||
lookahead is translated. */
|
|
||||||
|
|
||||||
/* Make sure we have latest lookahead translation. See comments at
|
|
||||||
user semantic actions for why this is necessary. */
|
|
||||||
yytoken = yytranslate_ (yychar);
|
|
||||||
|
|
||||||
|
|
||||||
** Get rid of fake #lines [Bison: ...]
|
|
||||||
Possibly as simple as checking whether the column number is nonnegative.
|
|
||||||
|
|
||||||
I have seen messages like the following from GCC.
|
|
||||||
|
|
||||||
<built-in>:0: fatal error: opening dependency file .deps/libltdl/argz.Tpo: No such file or directory
|
|
||||||
|
|
||||||
|
|
||||||
** Discuss about %printer/%destroy in the case of C++.
|
|
||||||
It would be very nice to provide the symbol classes with an operator<<
|
|
||||||
and a destructor. Unfortunately the syntax we have chosen for
|
|
||||||
%destroy and %printer make them hard to reuse. For instance, the user
|
|
||||||
is invited to write something like
|
|
||||||
|
|
||||||
%printer { debug_stream() << $$; } <my_type>;
|
|
||||||
|
|
||||||
which is hard to reuse elsewhere since it wants to use
|
|
||||||
"debug_stream()" to find the stream to use. The same applies to
|
|
||||||
%destroy: we told the user she could use the members of the Parser
|
|
||||||
class in the printers/destructors, which is not good for an operator<<
|
|
||||||
since it is no longer bound to a particular parser, it's just a
|
|
||||||
(standalone symbol).
|
|
||||||
|
|
||||||
* Various
|
|
||||||
** Rewrite glr.cc in C++ (Valentin Tolmer)
|
|
||||||
As a matter of fact, it would be very interesting to see how much we can
|
|
||||||
share between lalr1.cc and glr.cc. Most of the skeletons should be common.
|
|
||||||
It would be a very nice source of inspiration for the other languages.
|
|
||||||
|
|
||||||
Valentin Tolmer is working on this.
|
|
||||||
|
|
||||||
* From lalr1.cc to yacc.c
|
|
||||||
** Single stack
|
|
||||||
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
|
||||||
other improvements and also made it faster (probably because memory
|
|
||||||
management is performed once instead of three times). I suggest that
|
|
||||||
we do the same in yacc.c.
|
|
||||||
|
|
||||||
(Some time later): it's also very nice to have three stacks: it's more dense
|
|
||||||
as we don't lose bits to padding. For instance the typical stack for states
|
|
||||||
will use 8 bits, while it is likely to consume 32 bits in a struct.
|
|
||||||
|
|
||||||
We need trustworthy benchmarks for Bison, for all our backends. Akim has a
|
|
||||||
few things scattered around; we need to put them in the repo, and make them
|
|
||||||
more useful.
|
|
||||||
|
|
||||||
* Report
|
* Report
|
||||||
|
|
||||||
** Figures
|
** GLR
|
||||||
Some statistics about the grammar and the parser would be useful,
|
|
||||||
especially when asking the user to send some information about the
|
|
||||||
grammars she is working on. We should probably also include some
|
|
||||||
information about the variables (I'm not sure for instance we even
|
|
||||||
specify what LR variant was used).
|
|
||||||
|
|
||||||
** GLR
|
|
||||||
How would Paul like to display the conflicted actions? In particular,
|
How would Paul like to display the conflicted actions? In particular,
|
||||||
what when two reductions are possible on a given lookahead token, but one is
|
what when two reductions are possible on a given lookahead token, but one is
|
||||||
part of $default. Should we make the two reductions explicit, or just
|
part of $default. Should we make the two reductions explicit, or just
|
||||||
keep $default? See the following point.
|
keep $default? See the following point.
|
||||||
|
|
||||||
** Disabled Reductions
|
** Disabled Reductions
|
||||||
See 'tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
See `tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
||||||
what we want to do.
|
what we want to do.
|
||||||
|
|
||||||
** Documentation
|
** Documentation
|
||||||
Extend with error productions. The hard part will probably be finding
|
Extend with error productions. The hard part will probably be finding
|
||||||
the right rule so that a single state does not exhibit too many yet
|
the right rule so that a single state does not exhibit too many yet
|
||||||
undocumented ''features''. Maybe an empty action ought to be
|
undocumented ``features''. Maybe an empty action ought to be
|
||||||
presented too. Shall we try to make a single grammar with all these
|
presented too. Shall we try to make a single grammar with all these
|
||||||
features, or should we have several very small grammars?
|
features, or should we have several very small grammars?
|
||||||
|
|
||||||
|
** --report=conflict-path
|
||||||
|
Provide better assistance for understanding the conflicts by providing
|
||||||
|
a sample text exhibiting the (LALR) ambiguity. See the paper from
|
||||||
|
DeRemer and Penello: they already provide the algorithm.
|
||||||
|
|
||||||
|
** Statically check for potential ambiguities in GLR grammars. See
|
||||||
|
<http://www.i3s.unice.fr/~schmitz/papers.html#expamb> for an approach.
|
||||||
|
|
||||||
|
|
||||||
* Extensions
|
* Extensions
|
||||||
** More languages?
|
|
||||||
Well, only if there is really some demand for it.
|
|
||||||
|
|
||||||
*** PHP
|
** Labeling the symbols
|
||||||
https://github.com/scfc/bison-php/blob/master/data/lalr1.php
|
Have a look at the Lemon parser generator: instead of $1, $2 etc. they
|
||||||
|
can name the values. This is much more pleasant. For instance:
|
||||||
|
|
||||||
*** Python
|
exp (res): exp (a) '+' exp (b) { $res = $a + $b; };
|
||||||
https://lists.gnu.org/r/bison-patches/2013-09/msg00000.html and following
|
|
||||||
|
|
||||||
** Multiple start symbols
|
I love this. I have been bitten too often by the removal of the
|
||||||
Revert a70e75b8a41755ab96ab211a0ea111ac68a4aadd.
|
symbol, and forgetting to shift all the $n to $n-1. If you are
|
||||||
Revert tests: disable "Multistart reports".
|
unlucky, it compiles...
|
||||||
|
|
||||||
Would be very useful when parsing closely related languages. The idea is to
|
But instead of using $a etc., we can use regular variables. And
|
||||||
declare several start symbols, for instance
|
instead of using (), I propose to use `:' (again). Paul suggests
|
||||||
|
supporting `->' in addition to `:' to separate LHS and RHS. In other
|
||||||
|
words:
|
||||||
|
|
||||||
%start stmt expr
|
r:exp -> a:exp '+' b:exp { r = a + b; };
|
||||||
%%
|
|
||||||
stmt: ...
|
|
||||||
expr: ...
|
|
||||||
|
|
||||||
and to generate parse(), parse_stmt() and parse_expr(). Technically, the
|
That requires an significant improvement of the grammar parser. Using
|
||||||
above grammar would be transformed into
|
GLR would be nice. It also requires that Bison know the type of the
|
||||||
|
symbols (which will be useful for %include anyway). So we have some
|
||||||
|
time before...
|
||||||
|
|
||||||
%start yy_start
|
Note that there remains the problem of locations: `@r'?
|
||||||
%token YY_START_STMT YY_START_EXPR
|
|
||||||
%%
|
|
||||||
yy_start: YY_START_STMT stmt | YY_START_EXPR expr
|
|
||||||
|
|
||||||
so that there are no new conflicts in the grammar (as would undoubtedly
|
|
||||||
happen with yy_start: stmt | expr). Then adjust the skeletons so that this
|
|
||||||
initial token (YY_START_STMT, YY_START_EXPR) be shifted first in the
|
|
||||||
corresponding parse function.
|
|
||||||
|
|
||||||
*** Number of useless symbols
|
|
||||||
AT_TEST(
|
|
||||||
[[%start exp;
|
|
||||||
exp: exp;]],
|
|
||||||
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
|
||||||
input.y: warning: 2 rules useless in grammar [-Wother]
|
|
||||||
input.y:2.8-10: error: start symbol exp does not derive any sentence]])
|
|
||||||
|
|
||||||
We should say "1 nonterminal": the other one is $accept, which should not
|
|
||||||
participate in the count.
|
|
||||||
|
|
||||||
*** Tokens
|
|
||||||
Do we want to disallow terminal start symbols? The limitation is not
|
|
||||||
technical. Can it be useful to someone to "parse" a token?
|
|
||||||
|
|
||||||
** %include
|
|
||||||
This is a popular demand. We already made many changes in the parser that
|
|
||||||
should make this reasonably easy to implement.
|
|
||||||
|
|
||||||
Bruce Mardle <[email protected]>
|
|
||||||
https://lists.gnu.org/r/bison-patches/2015-09/msg00000.html
|
|
||||||
|
|
||||||
However, there are many other things to do before having such a feature,
|
|
||||||
because I don't want a % equivalent to #include (which we all learned to
|
|
||||||
hate). I want something that builds "modules" of grammars, and assembles
|
|
||||||
them together, paying attention to keep separate bits separated, in pseudo
|
|
||||||
name spaces.
|
|
||||||
|
|
||||||
** Push parsers
|
|
||||||
There is demand for push parsers in C++.
|
|
||||||
|
|
||||||
** Generate code instead of tables
|
|
||||||
This is certainly quite a lot of work. See
|
|
||||||
https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4539.
|
|
||||||
|
|
||||||
** $-1
|
** $-1
|
||||||
We should find a means to provide an access to values deep in the
|
We should find a means to provide an access to values deep in the
|
||||||
stack. For instance, instead of
|
stack. For instance, instead of
|
||||||
|
|
||||||
baz: qux { $$ = $<foo>-1 + $<bar>0 + $1; }
|
baz: qux { $$ = $<foo>-1 + $<bar>0 + $1; }
|
||||||
|
|
||||||
we should be able to have:
|
we should be able to have:
|
||||||
|
|
||||||
@@ -599,9 +99,8 @@ must be in the scanner: we must not parse what is in a switched off
|
|||||||
part of %if. Akim Demaille thinks it should be in the parser, so as
|
part of %if. Akim Demaille thinks it should be in the parser, so as
|
||||||
to avoid falling into another CPP mistake.
|
to avoid falling into another CPP mistake.
|
||||||
|
|
||||||
(Later): I'm sure there's actually good case for this. People who need that
|
** -D, --define-muscle NAME=VALUE
|
||||||
feature can use m4/cpp on top of Bison. I don't think it is worth the
|
To define muscles via cli. Or maybe support directly NAME=VALUE?
|
||||||
trouble in Bison itself.
|
|
||||||
|
|
||||||
** XML Output
|
** XML Output
|
||||||
There are couple of available extensions of Bison targeting some XML
|
There are couple of available extensions of Bison targeting some XML
|
||||||
@@ -618,28 +117,88 @@ XML output for GNU Bison and gcc
|
|||||||
XML output for GNU Bison
|
XML output for GNU Bison
|
||||||
http://yaxx.sourceforge.net/
|
http://yaxx.sourceforge.net/
|
||||||
|
|
||||||
|
* Unit rules
|
||||||
|
Maybe we could expand unit rules, i.e., transform
|
||||||
|
|
||||||
|
exp: arith | bool;
|
||||||
|
arith: exp '+' exp;
|
||||||
|
bool: exp '&' exp;
|
||||||
|
|
||||||
|
into
|
||||||
|
|
||||||
|
exp: exp '+' exp | exp '&' exp;
|
||||||
|
|
||||||
|
when there are no actions. This can significantly speed up some
|
||||||
|
grammars. I can't find the papers. In particular the book `LR
|
||||||
|
parsing: Theory and Practice' is impossible to find, but according to
|
||||||
|
`Parsing Techniques: a Practical Guide', it includes information about
|
||||||
|
this issue. Does anybody have it?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Documentation
|
||||||
|
|
||||||
|
** History/Bibliography
|
||||||
|
Some history of Bison and some bibliography would be most welcome.
|
||||||
|
Are there any Texinfo standards for bibliography?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Java, Fortran, etc.
|
||||||
|
|
||||||
|
|
||||||
* Coding system independence
|
* Coding system independence
|
||||||
Paul notes:
|
Paul notes:
|
||||||
|
|
||||||
Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is
|
Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is
|
||||||
255). It also assumes that the 8-bit character encoding is
|
255). It also assumes that the 8-bit character encoding is
|
||||||
the same for the invocation of 'bison' as it is for the
|
the same for the invocation of 'bison' as it is for the
|
||||||
invocation of 'cc', but this is not necessarily true when
|
invocation of 'cc', but this is not necessarily true when
|
||||||
people run bison on an ASCII host and then use cc on an EBCDIC
|
people run bison on an ASCII host and then use cc on an EBCDIC
|
||||||
host. I don't think these topics are worth our time
|
host. I don't think these topics are worth our time
|
||||||
addressing (unless we find a gung-ho volunteer for EBCDIC or
|
addressing (unless we find a gung-ho volunteer for EBCDIC or
|
||||||
PDP-10 ports :-) but they should probably be documented
|
PDP-10 ports :-) but they should probably be documented
|
||||||
somewhere.
|
somewhere.
|
||||||
|
|
||||||
More importantly, Bison does not currently allow NUL bytes in
|
More importantly, Bison does not currently allow NUL bytes in
|
||||||
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
||||||
the source code. This should get fixed.
|
the source code. This should get fixed.
|
||||||
|
|
||||||
* Broken options?
|
* --graph
|
||||||
|
Show reductions.
|
||||||
|
|
||||||
|
* Broken options ?
|
||||||
** %token-table
|
** %token-table
|
||||||
** Skeleton strategy
|
** Skeleton strategy
|
||||||
Must we keep %token-table?
|
Must we keep %token-table?
|
||||||
|
|
||||||
|
* src/print_graph.c
|
||||||
|
Find the best graph parameters.
|
||||||
|
|
||||||
|
* BTYacc
|
||||||
|
See if we can integrate backtracking in Bison. Charles-Henri de
|
||||||
|
Boysson <[email protected]> is working on this, and already has some
|
||||||
|
results. Vadim Maslow, the maintainer of BTYacc was contacted, and we
|
||||||
|
stay in touch with him. Adjusting the Bison grammar parser will be
|
||||||
|
needed to support some extra BTYacc features. This is less urgent.
|
||||||
|
|
||||||
|
** Keeping the conflicted actions
|
||||||
|
First, analyze the differences between byacc and btyacc (I'm referring
|
||||||
|
to the executables). Find where the conflicts are preserved.
|
||||||
|
|
||||||
|
** Compare with the GLR tables
|
||||||
|
See how isomorphic the way BTYacc and the way the GLR adjustments in
|
||||||
|
Bison are compatible. *As much as possible* one should try to use the
|
||||||
|
same implementation in the Bison executables. I insist: it should be
|
||||||
|
very feasible to use the very same conflict tables.
|
||||||
|
|
||||||
|
** Adjust the skeletons
|
||||||
|
Import the skeletons for C and C++.
|
||||||
|
|
||||||
|
** Improve the skeletons
|
||||||
|
Have them support yysymprint, yydestruct and so forth.
|
||||||
|
|
||||||
|
|
||||||
* Precedence
|
* Precedence
|
||||||
|
|
||||||
** Partial order
|
** Partial order
|
||||||
@@ -647,7 +206,56 @@ It is unfortunate that there is a total order for precedence. It
|
|||||||
makes it impossible to have modular precedence information. We should
|
makes it impossible to have modular precedence information. We should
|
||||||
move to partial orders (sounds like series/parallel orders to me).
|
move to partial orders (sounds like series/parallel orders to me).
|
||||||
|
|
||||||
This is a prerequisite for modules.
|
** Correlation b/w precedence and associativity
|
||||||
|
Also, I fail to understand why we have to assign the same
|
||||||
|
associativity to operators with the same precedence. For instance,
|
||||||
|
why can't I decide that the precedence of * and / is the same, but the
|
||||||
|
latter is nonassoc?
|
||||||
|
|
||||||
|
If there is really no profound motivation, we should find a new syntax
|
||||||
|
to allow specifying this.
|
||||||
|
|
||||||
|
** RR conflicts
|
||||||
|
See if we can use precedence between rules to solve RR conflicts. See
|
||||||
|
what POSIX says.
|
||||||
|
|
||||||
|
|
||||||
|
* $undefined
|
||||||
|
From Hans:
|
||||||
|
- If the Bison generated parser experiences an undefined number in the
|
||||||
|
character range, that character is written out in diagnostic messages, an
|
||||||
|
addition to the $undefined value.
|
||||||
|
|
||||||
|
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
||||||
|
|
||||||
|
|
||||||
|
* Default Action
|
||||||
|
From Hans:
|
||||||
|
- For use with my C++ parser, I transported the "switch (yyn)" statement
|
||||||
|
that Bison writes to the bison.simple skeleton file. This way, I can remove
|
||||||
|
the current default rule $$ = $1 implementation, which causes a double
|
||||||
|
assignment to $$ which may not be OK under C++, replacing it with a
|
||||||
|
"default:" part within the switch statement.
|
||||||
|
|
||||||
|
Note that the default rule $$ = $1, when typed, is perfectly OK under C,
|
||||||
|
but in the C++ implementation I made, this rule is different from
|
||||||
|
$<type_name>$ = $<type_name>1. I therefore think that one should implement
|
||||||
|
a Bison option where every typed default rule is explicitly written out
|
||||||
|
(same typed ruled can of course be grouped together).
|
||||||
|
|
||||||
|
Note: Robert Anisko handles this. He knows how to do it.
|
||||||
|
|
||||||
|
|
||||||
|
* Warnings
|
||||||
|
It would be nice to have warning support. See how Autoconf handles
|
||||||
|
them, it is fairly well described there. It would be very nice to
|
||||||
|
implement this in such a way that other programs could use
|
||||||
|
lib/warnings.[ch].
|
||||||
|
|
||||||
|
Don't work on this without first announcing you do, as I already have
|
||||||
|
thought about it, and know many of the components that can be used to
|
||||||
|
implement it.
|
||||||
|
|
||||||
|
|
||||||
* Pre and post actions.
|
* Pre and post actions.
|
||||||
From: Florian Krohm <[email protected]>
|
From: Florian Krohm <[email protected]>
|
||||||
@@ -680,48 +288,21 @@ to bison. If you're interested, I'll work on a patch.
|
|||||||
* Better graphics
|
* Better graphics
|
||||||
Equip the parser with a means to create the (visual) parse tree.
|
Equip the parser with a means to create the (visual) parse tree.
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
# LocalWords: Cex gnulib gl Bistromathic TokenKinds yylex enum YYEOF EOF
|
Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc.
|
||||||
# LocalWords: YYerror gettext af hb YYERRCODE undef calc FIXME dev yyerror
|
|
||||||
# LocalWords: Autoconf YYUNDEFTOK lexemes parsers Bistromathic's yyreport
|
|
||||||
# LocalWords: const argc yacc yyclearin lookahead destructor Rici incluent
|
|
||||||
# LocalWords: yydestruct yydiscardin catégories d'avertissements sr activé
|
|
||||||
# LocalWords: conflits défaut rr l'alias chaîne n'est attaché un symbole
|
|
||||||
# LocalWords: obsolète règle vide midrule valeurs de intermédiaire ou avec
|
|
||||||
# LocalWords: définies inutilisées priorité associativité inutiles POSIX
|
|
||||||
# LocalWords: incompatibilités tous les autres avertissements sauf dans rp
|
|
||||||
# LocalWords: désactiver CATEGORIE traiter comme des erreurs glr Akim bool
|
|
||||||
# LocalWords: Demaille arith lalr goto struct pathlen nullable ntokens lr
|
|
||||||
# LocalWords: nterm bitsetv ielr ritem nstates nrules nritems yysymbol EQ
|
|
||||||
# LocalWords: SymbolKind YYEMPTY YYUNDEF YYTNAME NUM yyntokens yytname sed
|
|
||||||
# LocalWords: nonterminals yykind yycode YYNAMES yynames init getName conv
|
|
||||||
# LocalWords: TokenKind ival yychar yylval yylexer Tolmer hoc
|
|
||||||
# LocalWords: Sobisch YYPTRDIFF ptrdiff Autotest toknum yytoknum
|
|
||||||
# LocalWords: sym Wother stderr FP fixits xgettext fdiagnostics Graphviz
|
|
||||||
# LocalWords: graphviz VCG bitset xml bw maint yytoken YYABORT deps
|
|
||||||
# LocalWords: YYACCEPT yytranslate nonnegative destructors yyerrlab repo
|
|
||||||
# LocalWords: backends stmt expr yy Mardle baz qux Vadim Maslow CPP cpp
|
|
||||||
# LocalWords: yydebug gcc UCHAR EBCDIC gung PDP NUL Pre Florian Krohm utf
|
|
||||||
# LocalWords: YYACT YYLLOC YYLSP yyval yyvsp yylen yyloc yylsp endif
|
|
||||||
# LocalWords: ispell american
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: outline
|
|
||||||
coding: utf-8
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2022, 2025-2026 Free
|
|
||||||
Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
This program is free software: you can redistribute it and/or modify
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
it under the terms of the GNU General Public License as published by
|
||||||
any later version published by the Free Software Foundation; with no
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
(at your option) any later version.
|
||||||
Texts. A copy of the license is included in the "GNU Free
|
|
||||||
Documentation License" file as part of this distribution.
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|||||||
-39
@@ -1,39 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Convenience script for regenerating all autogeneratable files that are
|
|
||||||
# omitted from the version control repository. In particular, this script
|
|
||||||
# also regenerates all aclocal.m4, config.h.in, Makefile.in, configure files
|
|
||||||
# with new versions of autoconf or automake.
|
|
||||||
|
|
||||||
# Copyright (C) 2003-2026 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Originally written by Paul Eggert. The canonical version of this
|
|
||||||
# script is maintained as top/autogen.sh in gnulib. However, to be
|
|
||||||
# useful to your package, you should place a copy of it under version
|
|
||||||
# control in the top-level directory of your package. The intent is
|
|
||||||
# that all customization can be done with a bootstrap.conf file also
|
|
||||||
# maintained in your version control; gnulib comes with a template
|
|
||||||
# build-aux/bootstrap.conf to get you started.
|
|
||||||
#
|
|
||||||
# Alternatively, you can use an autogen.sh script that is specific
|
|
||||||
# to your package.
|
|
||||||
|
|
||||||
me="$0"
|
|
||||||
medir=`dirname "$me"`
|
|
||||||
|
|
||||||
# Read the function library and the configuration.
|
|
||||||
. "$medir"/bootstrap-funclib.sh
|
|
||||||
|
|
||||||
autogen "$@"
|
|
||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Convenience script for fetching auxiliary files that are omitted from
|
|
||||||
# the version control repository of this package.
|
|
||||||
|
|
||||||
# Copyright (C) 2003-2026 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Originally written by Paul Eggert. The canonical version of this
|
|
||||||
# script is maintained as top/autopull.sh in gnulib. However, to be
|
|
||||||
# useful to your package, you should place a copy of it under version
|
|
||||||
# control in the top-level directory of your package. The intent is
|
|
||||||
# that all customization can be done with a bootstrap.conf file also
|
|
||||||
# maintained in your version control; gnulib comes with a template
|
|
||||||
# build-aux/bootstrap.conf to get you started.
|
|
||||||
#
|
|
||||||
# Alternatively, you can use an autopull.sh script that is specific
|
|
||||||
# to your package.
|
|
||||||
|
|
||||||
me="$0"
|
|
||||||
medir=`dirname "$me"`
|
|
||||||
|
|
||||||
# Read the function library and the configuration.
|
|
||||||
. "$medir"/bootstrap-funclib.sh
|
|
||||||
|
|
||||||
autopull "$@"
|
|
||||||
File diff suppressed because it is too large
Load Diff
+37
-96
@@ -1,7 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006-2015, 2018-2022, 2025-2026 Free Software
|
# Copyright (C) 2006-2010 Free Software Foundation, Inc.
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,113 +13,55 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
argmatch array-list assert assure attribute
|
announce-gen argmatch assert config-h c-strcase configmake dirname
|
||||||
bitsetv
|
error extensions fopen-safer gendocs getopt-gnu gettext
|
||||||
calloc-posix close closeout config-h c-strcase c-strtod
|
git-version-gen hash inttypes javacomp-script javaexec-script
|
||||||
configmake
|
maintainer-makefile malloc mbswidth obstack pipe quote quotearg
|
||||||
dirname
|
stdbool stpcpy strerror strtoul strverscmp unistd unistd-safer
|
||||||
error execute extensions
|
unlocked-io update-copyright unsetenv verify warnings xalloc
|
||||||
fopen-safer fstrcmp
|
xalloc-die xstrndup
|
||||||
getopt-gnu
|
|
||||||
gettext-h git-version-gen gitlog-to-changelog
|
|
||||||
gpl-3.0 intprops inttypes isnan javacomp-script
|
|
||||||
hash-map
|
|
||||||
javaexec-script
|
|
||||||
ldexpl
|
|
||||||
libtextstyle-optional
|
|
||||||
linked-list
|
|
||||||
malloc-gnu
|
|
||||||
mcel-prefer
|
|
||||||
mbfile mbswidth
|
|
||||||
obstack
|
|
||||||
obstack-printf
|
|
||||||
perror progname
|
|
||||||
quote quotearg
|
|
||||||
rbtreehash-list
|
|
||||||
readline
|
|
||||||
readme-release
|
|
||||||
realloc-posix
|
|
||||||
relocatable-prog relocatable-script
|
|
||||||
rename
|
|
||||||
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strverscmp
|
|
||||||
sys_ioctl
|
|
||||||
termios
|
|
||||||
timevar
|
|
||||||
unicodeio unistd unistd-safer unlink unlocked-io
|
|
||||||
update-copyright unsetenv verify
|
|
||||||
warnings
|
|
||||||
winsz-ioctl
|
|
||||||
winsz-termios
|
|
||||||
xalloc
|
|
||||||
xalloc-die
|
|
||||||
xconcat-filename
|
|
||||||
xhash
|
|
||||||
xlist
|
|
||||||
xmap xmemdup0
|
|
||||||
xstrndup
|
|
||||||
|
|
||||||
fprintf-posix printf-posix snprintf-posix sprintf-posix
|
|
||||||
vsnprintf-posix vsprintf-posix
|
|
||||||
'
|
'
|
||||||
|
|
||||||
checkout_only_file=README-hacking.md
|
|
||||||
|
|
||||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||||
--from-code=UTF-8\\\
|
--from-code=UTF-8\\\
|
||||||
--flag=asprintf:2:c-format\\\
|
--flag=asprintf:2:c-format\\\
|
||||||
--flag=complain:3:c-format\\\
|
--flag=complain:1:c-format --flag=complain_at:2:c-format\\\
|
||||||
--flag=complain_indent:4:c-format\\\
|
--flag=fatal:1:c-format --flag=fatal_at:2:c-format\\\
|
||||||
|
--flag=warn:1:c-format --flag=warn_at:2:c-format\\\
|
||||||
--flag=unexpected_end:2:c-format\\\
|
--flag=unexpected_end:2:c-format\\\
|
||||||
'
|
'
|
||||||
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
||||||
--keyword=YY_ \\\
|
--keyword=YY_ \\\
|
||||||
'
|
'
|
||||||
|
|
||||||
gnulib_tool_option_extras="\
|
# Gettext supplies these files, but we don't need them since
|
||||||
--automake-subdir\
|
# we don't have an intl subdirectory.
|
||||||
--automake-subdir-tests\
|
excluded_files='
|
||||||
--avoid=mbiterf\
|
m4/codeset.m4
|
||||||
--conditional-dependencies\
|
m4/glibc2.m4
|
||||||
--makefile-name=gnulib.mk\
|
m4/glibc21.m4
|
||||||
--po-base=gnulib-po\
|
m4/intdiv0.m4
|
||||||
--po-domain=bison\
|
m4/intl.m4
|
||||||
--symlink\
|
m4/intldir.m4
|
||||||
"
|
m4/intmax.m4
|
||||||
|
m4/inttypes_h.m4
|
||||||
|
m4/lcmessage.m4
|
||||||
|
m4/lock.m4
|
||||||
|
m4/longdouble.m4
|
||||||
|
m4/printf-posix.m4
|
||||||
|
m4/signed.m4
|
||||||
|
m4/size_max.m4
|
||||||
|
m4/uintmax_t.m4
|
||||||
|
m4/ulonglong.m4
|
||||||
|
m4/visibility.m4
|
||||||
|
m4/xsize.m4
|
||||||
|
'
|
||||||
|
|
||||||
gnulib_extra_files="$gnulib_extra_files build-aux/move-if-change"
|
# In directories like lib/, m4/, and po/, generate both these files because we
|
||||||
|
# still try to support CVS emulation.
|
||||||
gnulib_extra_files="$gnulib_extra_files build-aux/epsf.tex"
|
vc_ignore='.cvsignore .gitignore'
|
||||||
|
|
||||||
bootstrap_post_import_hook()
|
|
||||||
{
|
|
||||||
# Ensure that ChangeLog exists, for automake.
|
|
||||||
test -f ChangeLog || touch ChangeLog
|
|
||||||
}
|
|
||||||
|
|
||||||
bootstrap_epilogue()
|
|
||||||
{
|
|
||||||
# Make sure we don't need src/bison, which usually doesn't exist at
|
|
||||||
# the time of a bootstrap.
|
|
||||||
touch src/parse-gram.[ch]
|
|
||||||
|
|
||||||
perl -pi -e "s/\@PACKAGE\@/$package/g" README-release
|
|
||||||
|
|
||||||
# Bison currently uses Gettext 0.19, but the gnulib-po module
|
|
||||||
# imports files from more recent versions of Gettext that are not
|
|
||||||
# yet available widely enough (e.g., not in bionic, used by the CI).
|
|
||||||
# Work around this. Don't use autopoint, which sends some other
|
|
||||||
# files in the past.
|
|
||||||
cp po/Makefile.in.in gnulib-po
|
|
||||||
}
|
|
||||||
|
|
||||||
# Keep our bootstrap script in sync with gnulib's. If we ever need to
|
|
||||||
# maintain our own bootstrap script again, set this to false, remove
|
|
||||||
# the bootstrap entry from the file .x-update-copyright, and add any
|
|
||||||
# needed copyright years to the copyright statement in the bootstrap
|
|
||||||
# script.
|
|
||||||
bootstrap_sync=true
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
announce-gen
|
||||||
|
arg-nonnull.h
|
||||||
|
compile
|
||||||
|
config.guess
|
||||||
|
config.rpath
|
||||||
|
config.sub
|
||||||
|
depcomp
|
||||||
|
gendocs.sh
|
||||||
|
git-version-gen
|
||||||
|
install-sh
|
||||||
|
javacomp.sh.in
|
||||||
|
javaexec.sh.in
|
||||||
|
link-warning.h
|
||||||
|
mdate-sh
|
||||||
|
missing
|
||||||
|
texinfo.tex
|
||||||
|
update-copyright
|
||||||
|
useless-if-before-free
|
||||||
|
vc-list-files
|
||||||
|
warn-on-use.h
|
||||||
|
ylwrap
|
||||||
+5
-11
@@ -1,29 +1,23 @@
|
|||||||
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
/announce-gen
|
/announce-gen
|
||||||
|
/arg-nonnull.h
|
||||||
/compile
|
/compile
|
||||||
/config.guess
|
/config.guess
|
||||||
/config.libpath
|
|
||||||
/config.rpath
|
/config.rpath
|
||||||
/config.sub
|
/config.sub
|
||||||
/depcomp
|
/depcomp
|
||||||
/do-release-commit-and-tag
|
|
||||||
/epsf.tex
|
|
||||||
/gendocs.sh
|
/gendocs.sh
|
||||||
/git-version-gen
|
/git-version-gen
|
||||||
/gitlog-to-changelog
|
|
||||||
/gnu-web-doc-update
|
|
||||||
/gnupload
|
|
||||||
/install-reloc
|
|
||||||
/install-sh
|
/install-sh
|
||||||
/javacomp.sh.in
|
/javacomp.sh.in
|
||||||
/javaexec.sh.in
|
/javaexec.sh.in
|
||||||
/libtool-reloc
|
/link-warning.h
|
||||||
/mdate-sh
|
/mdate-sh
|
||||||
/missing
|
/missing
|
||||||
/reloc-ldflags
|
|
||||||
/relocatable.sh.in
|
|
||||||
/test-driver
|
|
||||||
/texinfo.tex
|
/texinfo.tex
|
||||||
/update-copyright
|
/update-copyright
|
||||||
/useless-if-before-free
|
/useless-if-before-free
|
||||||
/vc-list-files
|
/vc-list-files
|
||||||
|
/warn-on-use.h
|
||||||
/ylwrap
|
/ylwrap
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
# Copyright (C) 2012-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Valgrind suppression file for Bison.
|
|
||||||
|
|
||||||
{
|
|
||||||
Mac OS X initialization
|
|
||||||
Memcheck:Leak
|
|
||||||
fun:?alloc*
|
|
||||||
...
|
|
||||||
fun:*ImageLoader*
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
Mac OS X initialization
|
|
||||||
Memcheck:Leak
|
|
||||||
fun:?alloc*
|
|
||||||
...
|
|
||||||
fun:*dyld*
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
Mac OS X initialization
|
|
||||||
Memcheck:Leak
|
|
||||||
fun:?alloc*
|
|
||||||
...
|
|
||||||
fun:__CFInitialize
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
Mac OS X I/O buffer
|
|
||||||
Memcheck:Leak
|
|
||||||
fun:malloc
|
|
||||||
fun:__smakebuf
|
|
||||||
fun:__swsetup
|
|
||||||
fun:__sfvwrite
|
|
||||||
fun:fwrite
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
Mac OS X I/O buffer
|
|
||||||
Memcheck:Leak
|
|
||||||
fun:malloc
|
|
||||||
fun:__smakebuf
|
|
||||||
fun:__swsetup
|
|
||||||
fun:__swbuf
|
|
||||||
fun:putchar
|
|
||||||
}
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# mode: shell-script
|
|
||||||
# End:
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
# Copyright (C) 2012-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Valgrind suppression file for Bison.
|
|
||||||
|
|
||||||
# Travis Trusty, 2018-09-07.
|
|
||||||
{
|
|
||||||
libstdcxx_init
|
|
||||||
Memcheck:Leak
|
|
||||||
match-leak-kinds: reachable
|
|
||||||
fun:malloc
|
|
||||||
obj:/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
|
|
||||||
fun:call_init.part.0
|
|
||||||
fun:call_init
|
|
||||||
fun:_dl_init
|
|
||||||
obj:/lib/x86_64-linux-gnu/ld-2.19.so
|
|
||||||
}
|
|
||||||
|
|
||||||
# Linux prague 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015
|
|
||||||
# x86_64 GNU/Linux
|
|
||||||
{
|
|
||||||
Probably exception handling from G++ 5.1.
|
|
||||||
Memcheck:Leak
|
|
||||||
match-leak-kinds: reachable
|
|
||||||
fun:malloc
|
|
||||||
fun:pool
|
|
||||||
fun:__static_initialization_and_destruction_0
|
|
||||||
fun:_GLOBAL__sub_I_eh_alloc.cc
|
|
||||||
fun:call_init.part.0
|
|
||||||
fun:_dl_init
|
|
||||||
obj:/usr/lib/ld-2.21.so
|
|
||||||
}
|
|
||||||
|
|
||||||
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
|
|
||||||
# x86_64 GNU/Linux
|
|
||||||
{
|
|
||||||
index
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:index
|
|
||||||
fun:expand_dynamic_string_token
|
|
||||||
fun:_dl_map_object
|
|
||||||
fun:map_doit
|
|
||||||
fun:_dl_catch_error
|
|
||||||
fun:do_preload
|
|
||||||
fun:dl_main
|
|
||||||
fun:_dl_sysdep_start
|
|
||||||
fun:_dl_start
|
|
||||||
obj:/lib/ld-2.11.3.so
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
EXTRA_DIST = prev-version.txt cross-options.pl update-b4-copyright
|
||||||
+24
-77
@@ -1,104 +1,51 @@
|
|||||||
#! /usr/bin/env perl
|
#! /usr/bin/env perl
|
||||||
|
|
||||||
# Generate a release announcement message.
|
|
||||||
|
|
||||||
# Copyright (C) 2007-2022, 2025-2026 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# Written by Akim Demaille.
|
|
||||||
|
|
||||||
use warnings;
|
use warnings;
|
||||||
use 5.005;
|
use 5.005;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my %option;
|
my %option;
|
||||||
my %directive;
|
while (<>)
|
||||||
my $scanner = `grep -i '"%[a-z]' $ARGV[0]`;
|
|
||||||
$scanner =~ s/"\[-_\]"/-/g;
|
|
||||||
while (<STDIN>)
|
|
||||||
{
|
{
|
||||||
if (/^\s* # Initial spaces.
|
if (/^\s* # Initial spaces.
|
||||||
(?:(-\w),\s+)? # $1: $short: Possible short option.
|
(?:(-\w),\s+)? # $1: $short: Possible short option.
|
||||||
(--[-\w]+) # $2: $long: Mandatory long option.
|
(--[-\w]+) # $2: $long: Long option.
|
||||||
(\[?) # $3: $opt: '[' iff the argument is optional.
|
(\[?) # $3: $opt: '[' iff the argument is optional.
|
||||||
(?:=(\S+))? # $4: $arg: Possible argument name.
|
(?:=(\S+))? # $4: $arg: Possible argument name.
|
||||||
\s # Spaces.
|
\s # Spaces.
|
||||||
/x)
|
/x)
|
||||||
{
|
{
|
||||||
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
||||||
$short = '' if ! defined $short;
|
$short = defined $short ? '@option{' . $short . '}' : '';
|
||||||
$short = '-d' if $long eq '--defines' && ! $short;
|
if ($arg)
|
||||||
my $dir = '%' . substr($long, 2);
|
{
|
||||||
if (index ($scanner, "\"$dir\"") < 0)
|
|
||||||
{
|
|
||||||
if ($long eq '--force-define') { $dir = '%define'; }
|
|
||||||
else { $dir = ''; }
|
|
||||||
}
|
|
||||||
if ($arg)
|
|
||||||
{
|
|
||||||
# if $opt, $arg contains the closing ].
|
# if $opt, $arg contains the closing ].
|
||||||
substr ($arg, -1) = ''
|
substr ($arg, -1) = ''
|
||||||
if $opt eq '[';
|
if $opt eq '[';
|
||||||
|
$arg =~ s/^=//;
|
||||||
$arg = lc ($arg);
|
$arg = lc ($arg);
|
||||||
my $dir_arg = $arg;
|
# If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
|
||||||
# If the argument is complete (e.g., for --define[=NAME[=VALUE]]),
|
|
||||||
# put each word in @var, to build @var{name}[=@var{value}], not
|
# put each word in @var, to build @var{name}[=@var{value}], not
|
||||||
# @var{name[=value]}].
|
# @var{name[=value]}].
|
||||||
$arg =~ s/(\w+)/\@var{$1}/g;
|
$arg =~ s/(\w+)/\@var{$1}/g;
|
||||||
my $long_arg = "=$arg";
|
my $long_arg = "=$arg";
|
||||||
if ($opt eq '[') {
|
if ($opt eq '[') {
|
||||||
$long_arg = "[$long_arg]";
|
$long_arg = "[$long_arg]";
|
||||||
$arg = "[$arg]";
|
$arg = "[$arg]";
|
||||||
}
|
}
|
||||||
# For arguments of directives: this only works if all arguments
|
$option{"$long$long_arg"} = $short ? "$short $arg" : '';
|
||||||
# are strings and have the same syntax as on the command line.
|
}
|
||||||
if ($dir_arg eq 'name[=value]')
|
else
|
||||||
{
|
{
|
||||||
# -D/-F do not add quotes to the argument.
|
$option{"$long"} = "$short";
|
||||||
$dir_arg =
|
}
|
||||||
$dir eq "%define"
|
|
||||||
? '@var{name} [@var{value}]'
|
|
||||||
: '@var{name} ["@var{value}"]';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$dir_arg =~ s/(\w+)/\@var{"$1"}/g;
|
|
||||||
$dir_arg = '[' . $dir_arg . ']'
|
|
||||||
if $opt eq '[';
|
|
||||||
}
|
|
||||||
$long = "$long$long_arg";
|
|
||||||
$short = "$short $arg" if $short && $short ne '-d';
|
|
||||||
$dir = "$dir $dir_arg" if $dir;
|
|
||||||
}
|
|
||||||
$option{$long} = $short;
|
|
||||||
$directive{$long} = $dir;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $sep = '';
|
|
||||||
foreach my $long (sort keys %option)
|
foreach my $long (sort keys %option)
|
||||||
{
|
{
|
||||||
# Couldn't find a means to escape @ in the format (for @item, @tab), so
|
# Avoid trailing spaces.
|
||||||
# pass it as a literal to print.
|
printf ("\@item %-40s \@tab%s\n",
|
||||||
format STDOUT =
|
'@option{' . $long . '}',
|
||||||
@item @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @tab @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @tab @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
$option{$long} ? " $option{$long}" : "");
|
||||||
{
|
|
||||||
'@', '@option{' . $long . '}',
|
|
||||||
'@', $option{$long} ? ('@option{' . $option{$long} . '}') : '',
|
|
||||||
'@', $directive{$long} ? ('@code{' . $directive{$long} . '}') : ''
|
|
||||||
}
|
|
||||||
.
|
|
||||||
write;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
|
|
||||||
# option. It specifies what changes to make to each given SHA1's commit
|
|
||||||
# log and metadata, using Perl-eval'able expressions.
|
|
||||||
|
|
||||||
975bb564319aa4f4204c48aba265757ba207a80f
|
|
||||||
s/Edligner/Edlinger/;
|
|
||||||
|
|
||||||
0db2648930e3b6c376a539aabe368aade83ee29a
|
|
||||||
s/--flags/--feature/;
|
|
||||||
s/flag_flag/feature_flag/;
|
|
||||||
s/\bflag\b/feature/;
|
|
||||||
@@ -1,234 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Install Intel Parallel Studio on Travis CI
|
|
||||||
# https://github.com/nemequ/icc-travis
|
|
||||||
#
|
|
||||||
# Originally written for Squash <https://github.com/quixdb/squash> by
|
|
||||||
# Evan Nemerson. For documentation, bug reports, support requests,
|
|
||||||
# etc. please use <https://github.com/nemequ/icc-travis>.
|
|
||||||
#
|
|
||||||
# To the extent possible under law, the author(s) of this script have
|
|
||||||
# waived all copyright and related or neighboring rights to this work.
|
|
||||||
# See <https://creativecommons.org/publicdomain/zero/1.0/> for
|
|
||||||
# details.
|
|
||||||
|
|
||||||
# Tools - Not very useful in non-interactive mode.
|
|
||||||
COMPONENTS_VTUNE="intel-vtune-amplifier-xe-2016-cli__x86_64;intel-vtune-amplifier-xe-2016-common__noarch;intel-vtune-amplifier-xe-2016-cli-common__noarch;intel-vtune-amplifier-xe-2016-collector-64linux__x86_64;intel-vtune-amplifier-xe-2016-sep__noarch;intel-vtune-amplifier-xe-2016-gui-common__noarch;intel-vtune-amplifier-xe-2016-gui__x86_64;intel-vtune-amplifier-xe-2016-common-pset__noarch"
|
|
||||||
COMPONENTS_INSPECTOR="intel-inspector-xe-2016-cli__x86_64;intel-inspector-xe-2016-cli-common__noarch;intel-inspector-xe-2016-gui-common__noarch;intel-inspector-xe-2016-gui__x86_64;intel-inspector-xe-2016-cli-pset__noarch"
|
|
||||||
COMPONENTS_ADVISOR="intel-advisor-xe-2016-cli__x86_64;intel-advisor-xe-2016-cli-common__noarch;intel-advisor-xe-2016-gui-common__noarch;intel-advisor-xe-2016-gui__x86_64;intel-advisor-xe-2016-cli-pset__noarch"
|
|
||||||
COMPONENTS_GDB="intel-gdb-gt__x86_64;intel-gdb-gt-src__noarch;intel-gdb-gt-libelfdwarf__x86_64;intel-gdb-gt-devel__x86_64;intel-gdb-gt-common__noarch;intel-gdb-ps-cdt__x86_64;intel-gdb-ps-cdt-source__x86_64;intel-gdb-ps-mic__x86_64;intel-gdb-ps-mpm__x86_64;intel-gdb__x86_64;intel-gdb-source__noarch;intel-gdb-python-source__noarch;intel-gdb-common__noarch;intel-gdb-ps-common__noarch"
|
|
||||||
|
|
||||||
# Parallel libraries
|
|
||||||
COMPONENTS_MPI="intel-mpi-rt-core__x86_64;intel-mpi-rt-mic__x86_64;intel-mpi-sdk-core__x86_64;intel-mpi-sdk-mic__x86_64;intel-mpi-psxe__x86_64;intel-mpi-rt-psxe__x86_64"
|
|
||||||
COMPONENTS_TBB="intel-tbb-libs__noarch;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-tbb-source__noarch;intel-tbb-devel__noarch;intel-tbb-common__noarch;intel-tbb-ps-common__noarch;intel-tbb-psxe__noarch"
|
|
||||||
COMPONENTS_MKL="intel-mkl__x86_64;intel-mkl-ps__x86_64;intel-mkl-common__noarch;intel-mkl-ps-common__noarch;intel-mkl-devel__x86_64;intel-mkl-ps-mic-devel__x86_64;intel-mkl-ps-f95-devel__x86_64;intel-mkl-gnu-devel__x86_64;intel-mkl-ps-gnu-devel__x86_64;intel-mkl-ps-pgi-devel__x86_64;intel-mkl-sp2dp-devel__x86_64;intel-mkl-ps-cluster-devel__x86_64;intel-mkl-ps-cluster-common__noarch;intel-mkl-ps-f95-common__noarch;intel-mkl-ps-cluster__x86_64;intel-mkl-gnu__x86_64;intel-mkl-ps-gnu__x86_64;intel-mkl-ps-pgi__x86_64;intel-mkl-sp2dp__x86_64;intel-mkl-ps-mic__x86_64;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-mkl-psxe__noarch"
|
|
||||||
COMPONENTS_IPP="intel-ipp-l-common__noarch;intel-ipp-l-ps-common__noarch;intel-ipp-l-st__x86_64;intel-ipp-l-mt__x86_64;intel-ipp-l-st-devel__x86_64;intel-ipp-l-ps-st-devel__x86_64;intel-ipp-l-mt-devel__x86_64;intel-ipp-psxe__noarch"
|
|
||||||
COMPONENTS_IPP_CRYPTO="intel-crypto-ipp-st-devel__x86_64;intel-crypto-ipp-ps-st-devel__x86_64;intel-crypto-ipp-st__x86_64;intel-crypto-ipp-mt-devel__x86_64;intel-crypto-ipp-mt__x86_64;intel-crypto-ipp-ss-st-devel__x86_64;intel-crypto-ipp-common__noarch"
|
|
||||||
COMPONENTS_DAAL="intel-daal__x86_64;intel-daal-common__noarch"
|
|
||||||
|
|
||||||
# Compilers
|
|
||||||
COMPONENTS_OPENMP="intel-openmp-l-all__x86_64;intel-openmp-l-ps-mic__x86_64;intel-openmp-l-ps__x86_64;intel-openmp-l-ps-ss__x86_64;intel-openmp-l-all-devel__x86_64;intel-openmp-l-ps-mic-devel__x86_64;intel-openmp-l-ps-devel__x86_64;intel-openmp-l-ps-ss-devel__x86_64"
|
|
||||||
COMPONENTS_COMPILER_COMMON="intel-comp-l-all-vars__noarch;intel-comp-l-all-common;intel-comp-l-ps-common;intel-comp-l-all-devel;intel-comp-l-ps-ss-devel;intel-comp-l-ps-ss-wrapper;intel-comp-l-all-devel;intel-comp-l-ps-devel__x86_64;intel-comp-l-ps-ss-devel__x86_64;intel-psf-intel__x86_64;intel-icsxe-pset;intel-ipsf__noarch;intel-ccompxe__noarch;${COMPONENTS_OPENMP}"
|
|
||||||
COMPONENTS_IFORT="intel-ifort-l-ps__x86_64;intel-ifort-l-ps-vars__noarch;intel-ifort-l-ps-common__noarch;intel-ifort-l-ps-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
|
|
||||||
COMPONENTS_ICC="intel-icc-l-all__x86_64;intel-icc-l-ps-ss__x86_64;intel-icc-l-all-vars__noarch;intel-icc-l-all-common__noarch;intel-icc-l-ps-common__noarch;intel-icc-l-all-devel__x86_64;intel-icc-l-ps-devel__x86_64;intel-icc-l-ps-ss-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
|
|
||||||
|
|
||||||
DESTINATION="${HOME}/intel"
|
|
||||||
TEMPORARY_FILES="/tmp"
|
|
||||||
PHONE_INTEL="no"
|
|
||||||
COMPONENTS=""
|
|
||||||
|
|
||||||
add_components() {
|
|
||||||
if [ ! -z "${COMPONENTS}" ]; then
|
|
||||||
COMPONENTS="${COMPONENTS};$1"
|
|
||||||
else
|
|
||||||
COMPONENTS="$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
while [ $# != 0 ]; do
|
|
||||||
case "$1" in
|
|
||||||
"--dest")
|
|
||||||
DESTINATION="$(realpath "$2")"; shift
|
|
||||||
;;
|
|
||||||
"--tmpdir")
|
|
||||||
TEMPORARY_FILES="$2"; shift
|
|
||||||
;;
|
|
||||||
"--components")
|
|
||||||
shift
|
|
||||||
OLD_IFS="${IFS}"
|
|
||||||
IFS=","
|
|
||||||
for component in $1; do
|
|
||||||
case "$component" in
|
|
||||||
"icc")
|
|
||||||
add_components "${COMPONENTS_ICC}"
|
|
||||||
;;
|
|
||||||
"mpi")
|
|
||||||
add_components "${COMPONENTS_MPI}"
|
|
||||||
;;
|
|
||||||
"vtune")
|
|
||||||
add_components "${COMPONENTS_VTUNE}"
|
|
||||||
;;
|
|
||||||
"inspector")
|
|
||||||
add_components "${COMPONENTS_INSPECTOR}"
|
|
||||||
;;
|
|
||||||
"advisor")
|
|
||||||
add_components "${COMPONENTS_ADVISOR}"
|
|
||||||
;;
|
|
||||||
"tbb")
|
|
||||||
add_components "${COMPONENTS_TBB}"
|
|
||||||
;;
|
|
||||||
"ifort")
|
|
||||||
add_components "${COMPONENTS_IFORT}"
|
|
||||||
;;
|
|
||||||
"mkl")
|
|
||||||
add_components "${COMPONENTS_MKL}"
|
|
||||||
;;
|
|
||||||
"openmp")
|
|
||||||
# Noop, here for compatability. OpenMP is installed with icc and ifort now.
|
|
||||||
;;
|
|
||||||
"ipp")
|
|
||||||
add_components "${COMPONENTS_IPP}"
|
|
||||||
;;
|
|
||||||
"ipp-crypto")
|
|
||||||
add_components "${COMPONENTS_IPP_CRYPTO}"
|
|
||||||
;;
|
|
||||||
"gdb")
|
|
||||||
add_components "${COMPONENTS_GDB}"
|
|
||||||
;;
|
|
||||||
"daal")
|
|
||||||
add_components "${COMPONENTS_DAAL}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown component '$component'"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
IFS="${OLD_IFS}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized argument '$1'"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "${COMPONENTS}" ]; then
|
|
||||||
COMPONENTS="${COMPONENTS_ICC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
INSTALLER_SCRIPT="parallel_studio_xe_2016_update3_online.sh"
|
|
||||||
INSTALLER="${TEMPORARY_FILES}/${INSTALLER_SCRIPT}"
|
|
||||||
INSTALLER_URL="http://registrationcenter-download.intel.com/akdlm/irc_nas/9061/${INSTALLER_SCRIPT}"
|
|
||||||
SILENT_CFG="${TEMPORARY_FILES}/silent.cfg"
|
|
||||||
SUCCESS_INDICATOR="${TEMPORARY_FILES}/icc-travis-success"
|
|
||||||
|
|
||||||
if [ ! -e "${TEMPORARY_FILES}" ]; then
|
|
||||||
echo "${TEMPORARY_FILES} does not exist, creating..."
|
|
||||||
mkdir -p "${TEMPORARY_FILES}" || (sudo mkdir -p "${TEMPORARY_FILES}" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${DESTINATION}" ]; then
|
|
||||||
echo "${DESTINATION} does not exist, creating..."
|
|
||||||
mkdir -p "${DESTINATION}" || (sudo mkdir -p "${DESTINATION}" && sudo chown -R "${USER}:${USER}" "${DESTINATION}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${INSTALLER}" ]; then
|
|
||||||
wget -O "${INSTALLER}" "${INSTALLER_URL}" || exit 1
|
|
||||||
fi
|
|
||||||
chmod u+x "${INSTALLER}"
|
|
||||||
|
|
||||||
# See https://software.intel.com/en-us/articles/intel-composer-xe-2015-silent-installation-guide
|
|
||||||
echo "# Generated silent configuration file" > "${SILENT_CFG}"
|
|
||||||
echo "ACCEPT_EULA=accept" >> "${SILENT_CFG}"
|
|
||||||
echo "INSTALL_MODE=NONRPM" >> "${SILENT_CFG}"
|
|
||||||
echo "CONTINUE_WITH_OPTIONAL_ERROR=yes" >> "${SILENT_CFG}"
|
|
||||||
echo "PSET_INSTALL_DIR=${DESTINATION}" >> "${SILENT_CFG}"
|
|
||||||
echo "CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes" >> "${SILENT_CFG}"
|
|
||||||
echo "COMPONENTS=${COMPONENTS}" >> "${SILENT_CFG}"
|
|
||||||
echo "PSET_MODE=install" >> "${SILENT_CFG}"
|
|
||||||
echo "PHONEHOME_SEND_USAGE_DATA=${PHONE_INTEL}" >> "${SILENT_CFG}"
|
|
||||||
if [ "x" != "x${INTEL_SERIAL_NUMBER}" ]; then
|
|
||||||
echo "ACTIVATION_SERIAL_NUMBER=${INTEL_SERIAL_NUMBER}" >> "${SILENT_CFG}"
|
|
||||||
echo "ACTIVATION_TYPE=serial_number" >> "${SILENT_CFG}"
|
|
||||||
else
|
|
||||||
echo "ACTIVATION_TYPE=trial_lic" >> "${SILENT_CFG}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
attempt=1;
|
|
||||||
while [ $attempt -le 3 ]; do
|
|
||||||
if [ ! -e "${TEMPORARY_FILES}/parallel-studio-install-data" ]; then
|
|
||||||
mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" || (sudo mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
("${INSTALLER}" \
|
|
||||||
-t "${TEMPORARY_FILES}/parallel-studio-install-data" \
|
|
||||||
-s "${SILENT_CFG}" \
|
|
||||||
--cli-mode \
|
|
||||||
--user-mode && \
|
|
||||||
touch "${SUCCESS_INDICATOR}") &
|
|
||||||
|
|
||||||
# So Travis doesn't die in case of a long download/installation.
|
|
||||||
#
|
|
||||||
# NOTE: a watched script never terminates.
|
|
||||||
elapsed=0;
|
|
||||||
while kill -0 $! 2>/dev/null; do
|
|
||||||
sleep 1
|
|
||||||
elapsed=$(expr $elapsed + 1)
|
|
||||||
if [ $(expr $elapsed % 60) -eq 0 ]; then
|
|
||||||
mins_elapsed=$(expr $elapsed / 60)
|
|
||||||
if [ $mins_elapsed = 1 ]; then
|
|
||||||
minute_string="minute"
|
|
||||||
else
|
|
||||||
minute_string="minutes"
|
|
||||||
fi
|
|
||||||
echo "Still running... (about $(expr $elapsed / 60) ${minute_string} so far)."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -e "${SUCCESS_INDICATOR}" ]; then
|
|
||||||
echo "Installation failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
|
|
||||||
# Sometimes the installer returns successfully without actually
|
|
||||||
# installing anything. Let's try again…
|
|
||||||
echo "Installation attempt #${attempt} completed, but unable to find compilervars.sh."
|
|
||||||
find "${DESTINATION}"
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -vrf "${TEMPORARY_FILES}/parallel-studio-install-data"
|
|
||||||
echo "Trying again..."
|
|
||||||
|
|
||||||
attempt=$(expr $attempt + 1)
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
|
|
||||||
echo "Installation failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Apparently the installer drops the license file in a location it
|
|
||||||
# doesn't know to check.
|
|
||||||
ln -s "${DESTINATION}"/licenses ~/Licenses
|
|
||||||
|
|
||||||
# Add configuration information to ~/.bashrc. Unfortunately this will
|
|
||||||
# not be picked up automatically by Travis, so you'll still need to
|
|
||||||
# source ~/.bashrc in your .travis.yml
|
|
||||||
#
|
|
||||||
# Container-based builds include a `[ -z "$PS1" ] && return` near the
|
|
||||||
# beginning of the file, so appending won't work, we'll need to
|
|
||||||
# prepend.
|
|
||||||
echo "export INTEL_INSTALL_PATH=\"${DESTINATION}\"" >> ~/.bashrc-intel
|
|
||||||
echo ". \"\${INTEL_INSTALL_PATH}/bin/compilervars.sh\" intel64" >> ~/.bashrc-intel
|
|
||||||
echo "export LD_LIBRARY_PATH=\"\${INTEL_INSTALL_PATH}/ism/bin/intel64:\${INTEL_INSTALL_PATH}/lib/intel64_lin:\$LD_LIBRARY_PATH\"" >> ~/.bashrc-intel
|
|
||||||
echo "export PATH=\"\${INTEL_INSTALL_PATH}/bin:\$PATH\"" >> ~/.bashrc-intel
|
|
||||||
echo "function uninstall_intel_software {" >> ~/.bashrc-intel
|
|
||||||
echo " find \"\${INTEL_INSTALL_PATH}\" -name 'uninstall.sh' -not -path '*/ism/uninstall.sh' -exec {} -s \;" >> ~/.bashrc-intel
|
|
||||||
echo "}" >> ~/.bashrc-intel
|
|
||||||
cat ~/.bashrc >> ~/.bashrc-intel
|
|
||||||
mv ~/.bashrc-intel ~/.bashrc
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
## Copyright (C) 2000-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
## Foundation, Inc.
|
|
||||||
##
|
|
||||||
## This program 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
|
|
||||||
## (at your option) any later version.
|
|
||||||
##
|
|
||||||
## This program is distributed in the hope that it will be useful,
|
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
## GNU General Public License for more details.
|
|
||||||
##
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
build-aux/Darwin.valgrind \
|
|
||||||
build-aux/Linux.valgrind \
|
|
||||||
build-aux/cross-options.pl \
|
|
||||||
build-aux/epsf.tex \
|
|
||||||
build-aux/move-if-change \
|
|
||||||
build-aux/prev-version.txt \
|
|
||||||
build-aux/update-b4-copyright
|
|
||||||
@@ -3,9 +3,8 @@
|
|||||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
# Update b4_copyright invocations or b4_copyright_years definitions to
|
||||||
# include the current year.
|
# include the current year.
|
||||||
|
|
||||||
# Copyright (C) 2009-2015, 2018-2022, 2025-2026 Free Software
|
# Copyright (C) 2009-2010 Free Software Foundation, Inc.
|
||||||
# Foundation, Inc.
|
#
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 3, or (at your option)
|
# the Free Software Foundation; either version 3, or (at your option)
|
||||||
@@ -17,7 +16,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
||||||
|
|
||||||
# Copyright (C) 2010-2015, 2018-2022, 2025-2026 Free Software
|
# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
# Foundation, Inc.
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
#! /usr/bin/env python
|
|
||||||
|
|
||||||
# Update expectations in an Autotest test suite.
|
|
||||||
|
|
||||||
# Copyright (C) 2019-2022, 2025-2026 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# Written by Akim Demaille.
|
|
||||||
|
|
||||||
# usage:
|
|
||||||
#
|
|
||||||
# update-test _build/8d/tests/testsuite.dir/*/testsuite.log
|
|
||||||
#
|
|
||||||
# from your source tree.
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
|
|
||||||
def getargs():
|
|
||||||
p = argparse.ArgumentParser(description='Update test cases.')
|
|
||||||
opt = p.add_argument
|
|
||||||
opt('logs', metavar='log', nargs='+', type=str, default=None,
|
|
||||||
help='log files to process')
|
|
||||||
opt('-v', '--verbose', action='store_true',
|
|
||||||
help='Be verbose')
|
|
||||||
return p.parse_args()
|
|
||||||
|
|
||||||
args = getargs()
|
|
||||||
subst = dict()
|
|
||||||
|
|
||||||
|
|
||||||
def trace(*args_):
|
|
||||||
if args.verbose:
|
|
||||||
print(*args_)
|
|
||||||
|
|
||||||
|
|
||||||
def contents(file):
|
|
||||||
'''The contents of a file.'''
|
|
||||||
trace(file)
|
|
||||||
f = open(file)
|
|
||||||
return f.read()
|
|
||||||
|
|
||||||
|
|
||||||
def diff_to_re(match):
|
|
||||||
'''Convert a portion of patch into a regex substitution to perform.
|
|
||||||
No longer used, we now use the expected/effective parts.
|
|
||||||
'''
|
|
||||||
frm = []
|
|
||||||
to = []
|
|
||||||
is_diff = False
|
|
||||||
for l in match.group(1).splitlines():
|
|
||||||
print(l)
|
|
||||||
# t in [-+ ]
|
|
||||||
t = l[0]
|
|
||||||
l = l[1:]
|
|
||||||
if t in ['-', ' ']:
|
|
||||||
is_diff = True
|
|
||||||
frm.append(l)
|
|
||||||
if t in ['+', ' ']:
|
|
||||||
is_diff = True
|
|
||||||
to.append(l)
|
|
||||||
if is_diff:
|
|
||||||
# Do not run s//SOMETHING/g (with an emty pattern), that won't
|
|
||||||
# work well...
|
|
||||||
if frm == []:
|
|
||||||
trace("no from for", match.group(1))
|
|
||||||
return
|
|
||||||
frm = "\n".join(frm)
|
|
||||||
to = "\n".join(to)
|
|
||||||
subst[frm] = to
|
|
||||||
|
|
||||||
|
|
||||||
def update(at_file, logfile):
|
|
||||||
test = contents(at_file)
|
|
||||||
if os.path.isfile(logfile):
|
|
||||||
trace("LOG: ", logfile)
|
|
||||||
l = contents(logfile)
|
|
||||||
trace("LOG: ", l)
|
|
||||||
global subst
|
|
||||||
subst = {}
|
|
||||||
re.sub(r'(?:^@@.*\n)((?:^[-+ ].*\n)+)',
|
|
||||||
diff_to_re, l, flags = re.MULTILINE)
|
|
||||||
print(subst)
|
|
||||||
if subst:
|
|
||||||
# Turn "subst{frm} -> to" into a large RE.
|
|
||||||
frm = '|'.join([re.escape(x) for x in subst])
|
|
||||||
trace("FROM:", frm)
|
|
||||||
test = re.sub("(" + frm + ")",
|
|
||||||
lambda m: subst[m.group(1)],
|
|
||||||
test, flags=re.MULTILINE)
|
|
||||||
open(at_file, 'w').write(test)
|
|
||||||
|
|
||||||
|
|
||||||
def process(logfile):
|
|
||||||
log = contents(logfile)
|
|
||||||
# Look for the file to update.
|
|
||||||
m = re.search(r'^\d+\. ([\-\+\w]+\.at):\d+: ', log, re.MULTILINE)
|
|
||||||
if not m:
|
|
||||||
trace("no diff found:", logfile)
|
|
||||||
return
|
|
||||||
at_file = 'tests/' + m.group(1)
|
|
||||||
print(at_file)
|
|
||||||
update(at_file, logfile)
|
|
||||||
|
|
||||||
for logfile in args.logs:
|
|
||||||
trace("FILE:", logfile)
|
|
||||||
if os.path.isdir(logfile):
|
|
||||||
logfile = os.path.join(logfile, 'testsuite.log')
|
|
||||||
process(logfile)
|
|
||||||
@@ -1,179 +1,48 @@
|
|||||||
## Customize maint.mk -*- makefile -*-
|
# Customize maint.mk -*- makefile -*-
|
||||||
## Copyright (C) 2008-2015, 2018-2022, 2025-2026 Free Software
|
# Copyright (C) 2008-2010 Free Software Foundation, Inc.
|
||||||
## Foundation, Inc.
|
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
# 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.
|
# (at your option) any later version.
|
||||||
|
|
||||||
## This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
## GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
## You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Update version, then recompile so that tests/bison --version be
|
# It's useful to run maintainer-*check* targets during development, but we
|
||||||
# up-to-date, then compile our parser again with our up-to-date bison.
|
|
||||||
.PHONY: regen
|
|
||||||
regen: _version
|
|
||||||
$(MAKE) $(AM_MAKEFLAGS)
|
|
||||||
touch $(srcdir)/src/parse-gram.y
|
|
||||||
$(MAKE) $(AM_MAKEFLAGS)
|
|
||||||
|
|
||||||
# Used in maint.mk's web-manual rule
|
|
||||||
manual_title = The Yacc-compatible Parser Generator
|
|
||||||
gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
|
|
||||||
|
|
||||||
# By default, propagate -j from make to Bison's test suite.
|
|
||||||
TESTSUITEFLAGS = $(filter -j%,$(MAKEFLAGS))
|
|
||||||
|
|
||||||
# It's useful to run maintainer-check* targets during development, but we
|
|
||||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
||||||
# override the _is-dist-target from GNUmakefile so that maintainer-check*
|
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
|
||||||
# targets are filtered out.
|
# targets are filtered out.
|
||||||
_is-dist-target = $(filter-out %clean maintainer-check%, \
|
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
||||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
||||||
|
|
||||||
|
# Use alpha.gnu.org for alpha and beta releases.
|
||||||
|
# Use ftp.gnu.org for major releases.
|
||||||
|
gnu_ftp_host-alpha = alpha.gnu.org
|
||||||
|
gnu_ftp_host-beta = alpha.gnu.org
|
||||||
|
gnu_ftp_host-major = ftp.gnu.org
|
||||||
|
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
|
||||||
|
|
||||||
url_dir_list = \
|
url_dir_list = \
|
||||||
https://$(gnu_rel_host)/gnu/bison
|
ftp://$(gnu_rel_host)/gnu/bison
|
||||||
|
|
||||||
# Tests not to run as part of "make distcheck".
|
# Tests not to run as part of "make distcheck".
|
||||||
local-checks-to-skip = \
|
# Exclude changelog-check here so that there's less churn in ChangeLog
|
||||||
sc_immutable_NEWS \
|
# files -- otherwise, you'd need to have the upcoming version number
|
||||||
sc_indent
|
# at the top of the file for each `make distcheck' run.
|
||||||
|
local-checks-to-skip = changelog-check
|
||||||
|
|
||||||
# The local directory containing the checked-out copy of gnulib used in
|
# The local directory containing the checked-out copy of gnulib used in
|
||||||
# this release. Used solely to get a date for the "announcement" target.
|
# this release. Used solely to get a date for the "announcement" target.
|
||||||
gnulib_dir = $(srcdir)/gnulib
|
gnulib_dir = $(srcdir)/gnulib
|
||||||
|
|
||||||
bootstrap-tools = autoconf,automake,flex,gettext,gnulib
|
bootstrap-tools = autoconf,automake,flex,gnulib
|
||||||
|
|
||||||
announcement_Cc_ = \
|
|
||||||
[email protected], [email protected], \
|
|
||||||
[email protected]
|
|
||||||
|
|
||||||
update-copyright: update-b4-copyright update-package-copyright-year
|
update-copyright: update-b4-copyright update-package-copyright-year
|
||||||
update-copyright-env = \
|
update-copyright-env = \
|
||||||
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
||||||
|
|
||||||
|
|
||||||
## -------------------- ##
|
|
||||||
## More syntax-checks. ##
|
|
||||||
## -------------------- ##
|
|
||||||
|
|
||||||
# Indent only with spaces.
|
|
||||||
# Taken from Coreutils.
|
|
||||||
sc_prohibit_tab_based_indentation:
|
|
||||||
@prohibit='^ * ' \
|
|
||||||
halt='TAB in indentation; use only spaces' \
|
|
||||||
$(_sc_search_regexp)
|
|
||||||
|
|
||||||
# Prohibit the use of `...` in tests/. Use $(...) instead.
|
|
||||||
# Taken from Coreutils.
|
|
||||||
# Not ready for Bison yet.
|
|
||||||
#sc_prohibit_test_backticks:
|
|
||||||
# @prohibit='`' in_vc_files='^tests/' \
|
|
||||||
# halt='use $$(...), not `...` in tests/' \
|
|
||||||
# $(_sc_search_regexp)
|
|
||||||
|
|
||||||
# Enforce recommended preprocessor indentation style.
|
|
||||||
# Taken from Coreutils.
|
|
||||||
sc_preprocessor_indentation:
|
|
||||||
@if cppi --version >/dev/null 2>&1; then \
|
|
||||||
$(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
|
|
||||||
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
|
|
||||||
exit 1; }; \
|
|
||||||
else \
|
|
||||||
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
# Taken from Coreutils.
|
|
||||||
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
|
|
||||||
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
|
|
||||||
_pre_anchored = ^\($(_pre)\)
|
|
||||||
_comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
|
|
||||||
# help font-lock mode: '
|
|
||||||
|
|
||||||
# A sed expression that removes ANSI C and ISO C99 comments.
|
|
||||||
# Derived from the one in GNU gettext's 'moopp' preprocessor.
|
|
||||||
_sed_remove_comments = \
|
|
||||||
/[/][/*]/{ \
|
|
||||||
ta; \
|
|
||||||
:a; \
|
|
||||||
s,$(_pre_anchored)//.*,\1,; \
|
|
||||||
te; \
|
|
||||||
s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
|
|
||||||
ta; \
|
|
||||||
/^$(_pre)[/][*]/{ \
|
|
||||||
s,$(_pre_anchored)/[*].*,\1 ,; \
|
|
||||||
tu; \
|
|
||||||
:u; \
|
|
||||||
n; \
|
|
||||||
s,^\($(_comment_and_close),,; \
|
|
||||||
tv; \
|
|
||||||
s,^.*$$,,; \
|
|
||||||
bu; \
|
|
||||||
:v; \
|
|
||||||
}; \
|
|
||||||
:e; \
|
|
||||||
}
|
|
||||||
# Quote all single quotes.
|
|
||||||
_sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
|
||||||
# help font-lock mode: '
|
|
||||||
|
|
||||||
_space_before_paren_exempt =? \\n\\$$
|
|
||||||
_space_before_paren_exempt = \
|
|
||||||
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init))
|
|
||||||
# Ensure that there is a space before each open parenthesis in C code.
|
|
||||||
sc_space_before_open_paren:
|
|
||||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
|
||||||
fail=0; \
|
|
||||||
for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
|
|
||||||
sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
|
|
||||||
| grep -i '[[:alnum:]](' \
|
|
||||||
| grep -vE '$(_space_before_paren_exempt)' \
|
|
||||||
| grep . && { fail=1; echo "*** $$c"; }; \
|
|
||||||
done; \
|
|
||||||
test $$fail = 1 && \
|
|
||||||
{ echo '$(ME): the above files lack a space-before-open-paren' \
|
|
||||||
1>&2; exit 1; } || :; \
|
|
||||||
else :; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
## -------------------------- ##
|
|
||||||
## syntax-checks exceptions. ##
|
|
||||||
## -------------------------- ##
|
|
||||||
|
|
||||||
# po-check: we use gnulib-po, so we don't need/want them in our POTFILE.
|
|
||||||
generated_files =
|
|
||||||
|
|
||||||
exclude = \
|
|
||||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
|
||||||
|
|
||||||
$(call exclude, \
|
|
||||||
bindtextdomain=^lib/main.c$$ \
|
|
||||||
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
|
||||||
error_message_uppercase=etc/bench.pl.in$$ \
|
|
||||||
file_system=^doc/Doxyfile.in$$ \
|
|
||||||
po_check=^tests|(^po/POTFILES.in|.md)$$ \
|
|
||||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
|
||||||
program_name=^lib/main.c$$ \
|
|
||||||
prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
|
|
||||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
|
||||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
|
||||||
prohibit_atoi_atof=^(doc|etc|examples|tests)/ \
|
|
||||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
|
||||||
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
|
||||||
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
|
||||||
prohibit_strcmp=^doc/bison\.texi|examples|tests \
|
|
||||||
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|tests/input.at|Makefile$$ \
|
|
||||||
require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
|
||||||
require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
|
||||||
space_before_open_paren=^data/skeletons/ \
|
|
||||||
two_space_separator_in_usage=^(bootstrap|build-aux/install-icc.sh) \
|
|
||||||
unmarked_diagnostics=^(doc/bison.texi$$|tests/c\+\+\.at$$) \
|
|
||||||
)
|
|
||||||
|
|||||||
+292
@@ -0,0 +1,292 @@
|
|||||||
|
/* config.hin. Generated from configure.in by autoheader. */
|
||||||
|
|
||||||
|
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||||
|
systems. This function is required for `alloca.c' support on those systems.
|
||||||
|
*/
|
||||||
|
#undef CRAY_STACKSEG_END
|
||||||
|
|
||||||
|
/* Define if using `alloca.c'. */
|
||||||
|
#undef C_ALLOCA
|
||||||
|
|
||||||
|
/* Define to 1 if translation of program messages to the user's native
|
||||||
|
language is requested. */
|
||||||
|
#undef ENABLE_NLS
|
||||||
|
|
||||||
|
/* Define if you have `alloca', as a function or macro. */
|
||||||
|
#undef HAVE_ALLOCA
|
||||||
|
|
||||||
|
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||||
|
#undef HAVE_ALLOCA_H
|
||||||
|
|
||||||
|
/* Define if you have the <argz.h> header file. */
|
||||||
|
#undef HAVE_ARGZ_H
|
||||||
|
|
||||||
|
/* Define if you have the <ctype.h> header file. */
|
||||||
|
#undef HAVE_CTYPE_H
|
||||||
|
|
||||||
|
/* Define if backslash-a works in C strings. */
|
||||||
|
#undef HAVE_C_BACKSLASH_A
|
||||||
|
|
||||||
|
/* Define if you have the `dcgettext' function. */
|
||||||
|
#undef HAVE_DCGETTEXT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `memchr', and to 0 if you don't.
|
||||||
|
*/
|
||||||
|
#undef HAVE_DECL_MEMCHR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
|
||||||
|
*/
|
||||||
|
#undef HAVE_DECL_STPCPY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#undef HAVE_DECL_STRERROR_R
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strndup', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#undef HAVE_DECL_STRNDUP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#undef HAVE_DECL_STRNLEN
|
||||||
|
|
||||||
|
/* Define if the malloc check has been performed. */
|
||||||
|
#undef HAVE_DONE_WORKING_MALLOC_CHECK
|
||||||
|
|
||||||
|
/* Define if the realloc check has been performed. */
|
||||||
|
#undef HAVE_DONE_WORKING_REALLOC_CHECK
|
||||||
|
|
||||||
|
/* Define if you have the `doprnt' function. */
|
||||||
|
#undef HAVE_DOPRNT
|
||||||
|
|
||||||
|
/* Define if you have the `feof_unlocked' function. */
|
||||||
|
#undef HAVE_FEOF_UNLOCKED
|
||||||
|
|
||||||
|
/* Define if you have the `fgets_unlocked' function. */
|
||||||
|
#undef HAVE_FGETS_UNLOCKED
|
||||||
|
|
||||||
|
/* Define if you have the `getcwd' function. */
|
||||||
|
#undef HAVE_GETCWD
|
||||||
|
|
||||||
|
/* Define if you have the `getegid' function. */
|
||||||
|
#undef HAVE_GETEGID
|
||||||
|
|
||||||
|
/* Define if you have the `geteuid' function. */
|
||||||
|
#undef HAVE_GETEUID
|
||||||
|
|
||||||
|
/* Define if you have the `getgid' function. */
|
||||||
|
#undef HAVE_GETGID
|
||||||
|
|
||||||
|
/* Define if you have the `getpagesize' function. */
|
||||||
|
#undef HAVE_GETPAGESIZE
|
||||||
|
|
||||||
|
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||||
|
#undef HAVE_GETTEXT
|
||||||
|
|
||||||
|
/* Define if you have the `getuid' function. */
|
||||||
|
#undef HAVE_GETUID
|
||||||
|
|
||||||
|
/* Define if you have the iconv() function. */
|
||||||
|
#undef HAVE_ICONV
|
||||||
|
|
||||||
|
/* Define if you have the <inttypes.h> header file. */
|
||||||
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define if you have the `isascii' function. */
|
||||||
|
#undef HAVE_ISASCII
|
||||||
|
|
||||||
|
/* Define if you have the `iswprint' function. */
|
||||||
|
#undef HAVE_ISWPRINT
|
||||||
|
|
||||||
|
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||||
|
#undef HAVE_LANGINFO_CODESET
|
||||||
|
|
||||||
|
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||||
|
#undef HAVE_LC_MESSAGES
|
||||||
|
|
||||||
|
/* Define if you have the <limits.h> header file. */
|
||||||
|
#undef HAVE_LIMITS_H
|
||||||
|
|
||||||
|
/* Define if you have the <locale.h> header file. */
|
||||||
|
#undef HAVE_LOCALE_H
|
||||||
|
|
||||||
|
/* Define if you have the <malloc.h> header file. */
|
||||||
|
#undef HAVE_MALLOC_H
|
||||||
|
|
||||||
|
/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
|
||||||
|
#undef HAVE_MBRTOWC
|
||||||
|
|
||||||
|
/* Define if you have the `mbsinit' function. */
|
||||||
|
#undef HAVE_MBSINIT
|
||||||
|
|
||||||
|
/* Define if you have the `memchr' function. */
|
||||||
|
#undef HAVE_MEMCHR
|
||||||
|
|
||||||
|
/* Define if you have the <memory.h> header file. */
|
||||||
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define if you have the `mempcpy' function. */
|
||||||
|
#undef HAVE_MEMPCPY
|
||||||
|
|
||||||
|
/* Define if you have the `mkstemp' function. */
|
||||||
|
#undef HAVE_MKSTEMP
|
||||||
|
|
||||||
|
/* Define if you have a working `mmap' system call. */
|
||||||
|
#undef HAVE_MMAP
|
||||||
|
|
||||||
|
/* Define if you have the `munmap' function. */
|
||||||
|
#undef HAVE_MUNMAP
|
||||||
|
|
||||||
|
/* Define if you have the <nl_types.h> header file. */
|
||||||
|
#undef HAVE_NL_TYPES_H
|
||||||
|
|
||||||
|
/* Define if you have the `putenv' function. */
|
||||||
|
#undef HAVE_PUTENV
|
||||||
|
|
||||||
|
/* Define if you have the `setenv' function. */
|
||||||
|
#undef HAVE_SETENV
|
||||||
|
|
||||||
|
/* Define if you have the `setlocale' function. */
|
||||||
|
#undef HAVE_SETLOCALE
|
||||||
|
|
||||||
|
/* Define if you have the <stddef.h> header file. */
|
||||||
|
#undef HAVE_STDDEF_H
|
||||||
|
|
||||||
|
/* Define if you have the <stdint.h> header file. */
|
||||||
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
/* Define if you have the <stdlib.h> header file. */
|
||||||
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define if you have the `stpcpy' function. */
|
||||||
|
#undef HAVE_STPCPY
|
||||||
|
|
||||||
|
/* Define if you have the `strcasecmp' function. */
|
||||||
|
#undef HAVE_STRCASECMP
|
||||||
|
|
||||||
|
/* Define if you have the `strchr' function. */
|
||||||
|
#undef HAVE_STRCHR
|
||||||
|
|
||||||
|
/* Define if you have the `strdup' function. */
|
||||||
|
#undef HAVE_STRDUP
|
||||||
|
|
||||||
|
/* Define if you have the `strerror' function. */
|
||||||
|
#undef HAVE_STRERROR
|
||||||
|
|
||||||
|
/* Define if you have the `strerror_r' function. */
|
||||||
|
#undef HAVE_STRERROR_R
|
||||||
|
|
||||||
|
/* Define if you have the <strings.h> header file. */
|
||||||
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
/* Define if you have the <string.h> header file. */
|
||||||
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define if you have the `strndup' function. */
|
||||||
|
#undef HAVE_STRNDUP
|
||||||
|
|
||||||
|
/* Define if you have the `strnlen' function. */
|
||||||
|
#undef HAVE_STRNLEN
|
||||||
|
|
||||||
|
/* Define if you have the `strspn' function. */
|
||||||
|
#undef HAVE_STRSPN
|
||||||
|
|
||||||
|
/* Define if you have the `strtoul' function. */
|
||||||
|
#undef HAVE_STRTOUL
|
||||||
|
|
||||||
|
/* Define if you have the <sys/param.h> header file. */
|
||||||
|
#undef HAVE_SYS_PARAM_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define if you have the `tsearch' function. */
|
||||||
|
#undef HAVE_TSEARCH
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define if you have the `vprintf' function. */
|
||||||
|
#undef HAVE_VPRINTF
|
||||||
|
|
||||||
|
/* Define if you have the <wchar.h> header file. */
|
||||||
|
#undef HAVE_WCHAR_H
|
||||||
|
|
||||||
|
/* Define if you have the <wctype.h> header file. */
|
||||||
|
#undef HAVE_WCTYPE_H
|
||||||
|
|
||||||
|
/* Define to 1 if `strerror_r' returns a string. */
|
||||||
|
#undef HAVE_WORKING_STRERROR_R
|
||||||
|
|
||||||
|
/* Define if you have the `__argz_count' function. */
|
||||||
|
#undef HAVE___ARGZ_COUNT
|
||||||
|
|
||||||
|
/* Define if you have the `__argz_next' function. */
|
||||||
|
#undef HAVE___ARGZ_NEXT
|
||||||
|
|
||||||
|
/* Define if you have the `__argz_stringify' function. */
|
||||||
|
#undef HAVE___ARGZ_STRINGIFY
|
||||||
|
|
||||||
|
/* Define as const if the declaration of iconv() needs const. */
|
||||||
|
#undef ICONV_CONST
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#undef PACKAGE
|
||||||
|
|
||||||
|
/* Define if compiler has function prototypes */
|
||||||
|
#undef PROTOTYPES
|
||||||
|
|
||||||
|
/* If using the C implementation of alloca, define if you know the
|
||||||
|
direction of stack growth for your system; otherwise it will be
|
||||||
|
automatically deduced at run-time.
|
||||||
|
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||||
|
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||||
|
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||||
|
#undef STACK_DIRECTION
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
/* Version number of package */
|
||||||
|
#undef VERSION
|
||||||
|
|
||||||
|
/* Define if using the dmalloc debugging malloc package */
|
||||||
|
#undef WITH_DMALLOC
|
||||||
|
|
||||||
|
/* Define to 1 for GNU C library extensions. */
|
||||||
|
#undef _GNU_SOURCE
|
||||||
|
|
||||||
|
/* Define if on MINIX. */
|
||||||
|
#undef _MINIX
|
||||||
|
|
||||||
|
/* Define if the system does not provide POSIX.1 features except with this
|
||||||
|
defined. */
|
||||||
|
#undef _POSIX_1_SOURCE
|
||||||
|
|
||||||
|
/* Define if you need to in order for `stat' and other things to work. */
|
||||||
|
#undef _POSIX_SOURCE
|
||||||
|
|
||||||
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
|
||||||
|
if it is not supported. */
|
||||||
|
#undef inline
|
||||||
|
|
||||||
|
/* Define to rpl_malloc if the replacement function should be used. */
|
||||||
|
#undef malloc
|
||||||
|
|
||||||
|
/* Define to a type if <wchar.h> does not define. */
|
||||||
|
#undef mbstate_t
|
||||||
|
|
||||||
|
/* Define to `long' if <sys/types.h> does not define. */
|
||||||
|
#undef off_t
|
||||||
|
|
||||||
|
/* Define to rpl_realloc if the replacement function should be used. */
|
||||||
|
#undef realloc
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||||
|
#undef size_t
|
||||||
+81
-283
@@ -1,7 +1,6 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2015, 2018-2022, 2025-2026 Free Software
|
# Copyright (C) 2001-2010 Free Software Foundation, Inc.
|
||||||
# Foundation, Inc.
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,272 +13,99 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
AC_PREREQ([2.71])
|
# We have strange test case titles, so we need Autoconf 2.61 or better.
|
||||||
m4_pattern_forbid([^_?(gl_[A-Z]|AX_|BISON_)])
|
AC_PREREQ(2.61)
|
||||||
m4_pattern_allow([^BISON_USE_NLS$])
|
|
||||||
|
|
||||||
AC_INIT([GNU Bison],
|
AC_INIT([GNU Bison],
|
||||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||||
[[email protected]],
|
[[email protected]])
|
||||||
[],
|
AC_DEFINE([PACKAGE_COPYRIGHT_YEAR], [2010],
|
||||||
[https://www.gnu.org/software/bison/])
|
[The copyright year for this package])
|
||||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2026])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2010])
|
||||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
|
||||||
[The copyright year for this package])
|
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
# When we move to Automake 1.16, simplify examples/c/reccalc/local.mk.
|
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here:
|
||||||
# Our CI build the packages on Bionic, which has only Automake 1.15.
|
|
||||||
#
|
#
|
||||||
# We want gnits strictness only when rolling a stable release. For
|
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
|
||||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
#
|
||||||
# doesn't like that, so we let the underscore disable gnits. Between
|
# To avoid 1.11, we make 1.11.1 the minimum version.
|
||||||
# releases, we want to be able run make dist without being required to
|
#
|
||||||
# add a bogus NEWS entry. In that case, the version string
|
# We want gnits strictness only when rolling a formal release so that we can,
|
||||||
# automatically contains a dash, which we also let disable gnits.
|
# for example, run make dist at other times without being required to add a
|
||||||
AM_INIT_AUTOMAKE([1.15 dist-lzip dist-xz nostdinc
|
# bogus NEWS entry.
|
||||||
color-tests parallel-tests
|
AM_INIT_AUTOMAKE([1.11.1 dist-bzip2]
|
||||||
silent-rules]
|
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [-], [gnu], [gnu]))
|
||||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
|
||||||
[gnu], [gnits]))
|
|
||||||
AM_SILENT_RULES([yes])
|
|
||||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h])
|
|
||||||
|
|
||||||
# Checks for the compiler.
|
# Checks for the compiler.
|
||||||
AC_PROG_CC
|
AC_PROG_CC_STDC
|
||||||
AC_PROG_CXX
|
|
||||||
|
|
||||||
# Gnulib (early checks).
|
# Gnulib (early checks).
|
||||||
gl_EARLY
|
gl_EARLY
|
||||||
|
|
||||||
# Gnulib uses '#pragma GCC diagnostic push' to silence some
|
AC_ARG_ENABLE(gcc-warnings,
|
||||||
# warnings, but older gcc doesn't support this.
|
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
||||||
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
[case "${enableval}" in
|
||||||
[lv_cv_gcc_pragma_push_works], [
|
|
||||||
save_CFLAGS=$CFLAGS
|
|
||||||
CFLAGS='-Wunknown-pragmas -Werror'
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
]])],
|
|
||||||
[lv_cv_gcc_pragma_push_works=yes],
|
|
||||||
[lv_cv_gcc_pragma_push_works=no])
|
|
||||||
CFLAGS=$save_CFLAGS])
|
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
|
||||||
gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
|
|
||||||
BISON_CXXSTD([98])
|
|
||||||
BISON_CXXSTD([03])
|
|
||||||
BISON_CXXSTD([11])
|
|
||||||
BISON_CXXSTD([14])
|
|
||||||
BISON_CXXSTD([17])
|
|
||||||
BISON_CXXSTD([20])
|
|
||||||
BISON_CXXSTD([2b])
|
|
||||||
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
|
||||||
AM_CONDITIONAL([ENABLE_CXX14], [test x"$CXX14_CXXFLAGS" != x])
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([gcc-warnings],
|
|
||||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended).
|
|
||||||
Also, issue synclines from the examples/ to
|
|
||||||
the corresponding source in the Texinfo doc.],
|
|
||||||
[case $enable_gcc_warnings in
|
|
||||||
yes|no) ;;
|
yes|no) ;;
|
||||||
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
|
*) AC_MSG_ERROR([bad value ${enableval} for gcc-warnings option]) ;;
|
||||||
esac],
|
esac],
|
||||||
[enable_gcc_warnings=no])
|
[enableval=no])
|
||||||
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
if test "${enableval}" = yes; then
|
||||||
if test "$enable_gcc_warnings" = yes; then
|
|
||||||
# -Wno-tautological-constant-out-of-range-compare for Clang 3.3 and
|
|
||||||
# 3.4 on GNU/Linux that choke on intprops.h's INT_MULTIPLY_WRAPV,
|
|
||||||
# etc.
|
|
||||||
#
|
|
||||||
# ICC: -wr188
|
|
||||||
#
|
|
||||||
# 1669 warnings warnings_default =
|
|
||||||
# ../src/complain.c(318): error #188: enumerated type mixed with another type
|
|
||||||
# 1670 Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother;
|
|
||||||
# 1671 ^
|
|
||||||
# 1672
|
|
||||||
# 1673../src/complain.c(393): error #188: enumerated type mixed with another type
|
|
||||||
# 1674 warnings w = 1 << wbit;
|
|
||||||
# 1675 ^
|
|
||||||
#
|
|
||||||
# ICC: -wr3179
|
|
||||||
#
|
|
||||||
# char const *usefulness
|
|
||||||
# = rule_useless_in_grammar_p (&rules[r]) ? "useless-in-grammar"
|
|
||||||
# : rule_useless_in_parser_p (&rules[r]) ? "useless-in-parser"
|
|
||||||
# : "useful";
|
|
||||||
#
|
|
||||||
# gives
|
|
||||||
#
|
|
||||||
# error #3179: deprecated conversion of string literal to char* (should be const char*)
|
|
||||||
#
|
|
||||||
# ICC: -wr2259 (that's in C, in spite of what the error messages which seems to be about C++).
|
|
||||||
# error #2259: non-pointer conversion from "int" to "yybool={signed char}" may lose significant bits
|
|
||||||
# yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
|
|
||||||
# ^
|
|
||||||
warn_common='-Wall -Wextra
|
|
||||||
-Wcast-align -Wchar-subscripts
|
|
||||||
-fparse-all-comments -Wdocumentation
|
|
||||||
-Wformat -Wimplicit-fallthrough -Wmismatched-dealloc -Wnull-dereference
|
|
||||||
-Wno-sign-compare -Wno-tautological-constant-out-of-range-compare
|
|
||||||
-Wpointer-arith -Wshadow -Wstrict-aliasing
|
|
||||||
-Wunused-but-set-variable
|
|
||||||
-Wwrite-strings
|
|
||||||
-wr188 -wr2259 -wr3179'
|
|
||||||
warn_c='-Wbad-function-cast
|
|
||||||
-Wmissing-prototypes
|
|
||||||
-Wstrict-prototypes'
|
|
||||||
warn_cxx='-Wextra-semi -Wnoexcept -Wsubobject-linkage
|
|
||||||
-Wold-style-cast -Wundefined-func-template
|
|
||||||
-Wweak-vtables'
|
|
||||||
# Warnings for the test suite only.
|
|
||||||
#
|
|
||||||
# -fno-color-diagnostics: Clang's use of colors in the error
|
|
||||||
# messages is confusing the tests looking at the compiler's output
|
|
||||||
# (e.g., synclines.at).
|
|
||||||
#
|
|
||||||
# -Wno-keyword-macro: We use the "#define private public" dirty
|
|
||||||
# trick in the test suite to check some private implementation
|
|
||||||
# details for lalr1.cc.
|
|
||||||
warn_tests='-Wundef -pedantic -Wconversion
|
|
||||||
-Wdeprecated -Wsign-compare -Wsign-conversion
|
|
||||||
-Wtautological-constant-out-of-range-compare
|
|
||||||
-fno-color-diagnostics
|
|
||||||
-Wno-keyword-macro'
|
|
||||||
|
|
||||||
|
|
||||||
AC_LANG_PUSH([C])
|
|
||||||
# Clang supports many of GCC's -W options, but only issues warnings
|
|
||||||
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
|
||||||
# thinks the option is supported, and unknown options are then added
|
|
||||||
# to CFLAGS. But then, when -Werror is added in the test suite for
|
|
||||||
# instance, the warning about the unknown option turns into an
|
|
||||||
# error.
|
|
||||||
#
|
|
||||||
# This should be addressed by gnulib's gl_WARN_ADD, but in the
|
|
||||||
# meanwhile, turn warnings about unknown options into errors in
|
|
||||||
# CFLAGS, and restore CFLAGS after the tests.
|
|
||||||
save_CFLAGS=$CFLAGS
|
|
||||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
|
||||||
# Accept this warning only if it is not too touchy (e.g., clang 3.3
|
|
||||||
# and 3.4).
|
|
||||||
gl_WARN_ADD([-Wunreachable-code], [WARN_CFLAGS],
|
|
||||||
[AC_LANG_PROGRAM([],
|
|
||||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
|
||||||
for i in $warn_common $warn_c;
|
|
||||||
do
|
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
|
||||||
done
|
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||||
|
AC_SUBST([WERROR_CFLAGS])
|
||||||
# Warnings for the test suite, and maybe for bison if GCC is modern
|
gl_WARN_ADD([-Wall])
|
||||||
# enough.
|
gl_WARN_ADD([-Wextra -Wno-sign-compare])
|
||||||
test $lv_cv_gcc_pragma_push_works = yes &&
|
gl_WARN_ADD([-Wcast-align])
|
||||||
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
gl_WARN_ADD([-Wcast-qual])
|
||||||
|
gl_WARN_ADD([-Wformat])
|
||||||
|
gl_WARN_ADD([-Wpointer-arith])
|
||||||
|
gl_WARN_ADD([-Wwrite-strings])
|
||||||
|
AC_SUBST([WARN_CXXFLAGS], [$WARN_CFLAGS])
|
||||||
|
# The following warnings are not suitable for C++.
|
||||||
|
gl_WARN_ADD([-Wbad-function-cast])
|
||||||
|
gl_WARN_ADD([-Wmissing-declarations])
|
||||||
|
gl_WARN_ADD([-Wmissing-prototypes])
|
||||||
|
gl_WARN_ADD([-Wshadow])
|
||||||
|
gl_WARN_ADD([-Wstrict-prototypes])
|
||||||
|
AC_SUBST([WARN_CFLAGS])
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
for i in $warn_tests -Wincompatible-pointer-types;
|
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
||||||
do
|
WARN_CXXFLAGS_TEST="$WARN_CXXFLAGS $WARN_CFLAGS_TEST"
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS_TEST])
|
WARN_CFLAGS_TEST="$WARN_CFLAGS $WARN_CFLAGS_TEST"
|
||||||
done
|
AC_SUBST([WARN_CXXFLAGS_TEST])
|
||||||
CFLAGS=$save_CFLAGS
|
AC_SUBST([WARN_CFLAGS_TEST])
|
||||||
AC_LANG_POP([C])
|
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
|
||||||
|
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
|
||||||
save_CXXFLAGS=$CXXFLAGS
|
|
||||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
|
||||||
for i in $warn_common $warn_cxx;
|
|
||||||
do
|
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
|
||||||
done
|
|
||||||
# Accept this warning only if it is not too touchy (e.g., clang 3.3
|
|
||||||
# and 3.4).
|
|
||||||
gl_WARN_ADD([-Wunreachable-code], [WARN_CXXFLAGS],
|
|
||||||
[AC_LANG_PROGRAM([],
|
|
||||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
|
||||||
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
|
||||||
[AC_LANG_PROGRAM([], [nullptr])])
|
|
||||||
# Before GCC6, the pragmas don't work well enough to neutralize
|
|
||||||
# this warning.
|
|
||||||
gl_WARN_ADD([-Wuseless-cast], [WARN_CXXFLAGS],
|
|
||||||
[AC_LANG_PROGRAM([], [
|
|
||||||
#if defined __GNUC__ && ! defined __ICC && ! defined __clang__ && __GNUC__ < 6
|
|
||||||
syntax error
|
|
||||||
#endif
|
|
||||||
])])
|
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
|
||||||
# Warnings for the test suite only.
|
|
||||||
for i in $warn_tests;
|
|
||||||
do
|
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS_TEST])
|
|
||||||
done
|
|
||||||
# Too many compilers complain about Flex generated code.
|
|
||||||
gl_WARN_ADD([-Wno-error], [FLEX_SCANNER_CXXFLAGS])
|
|
||||||
# Clang++ deprecates compiling C.
|
|
||||||
gl_WARN_ADD([-Wno-deprecated], [WNO_DEPRECATED_CXXFLAGS])
|
|
||||||
CXXFLAGS=$save_CXXFLAGS
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
|
|
||||||
AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
|
|
||||||
AH_VERBATIM([FORTIFY_SOURCE],
|
|
||||||
[/* Enable compile-time and run-time bounds-checking, and some warnings,
|
|
||||||
without upsetting glibc 2.15+. */
|
|
||||||
#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
|
|
||||||
# define _FORTIFY_SOURCE 2
|
|
||||||
#endif
|
|
||||||
])
|
|
||||||
AC_DEFINE([GNULIB_PORTCHECK], [1], [Enable some gnulib portability checks.])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||||
BISON_C_COMPILER_POSIXLY_CORRECT
|
|
||||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
|
||||||
BISON_CXX_COMPILER_POSIXLY_CORRECT
|
|
||||||
|
|
||||||
# D.
|
|
||||||
AC_CHECK_PROGS([DC], [dmd])
|
|
||||||
AC_CHECK_PROGS([DCFLAGS], [-g])
|
|
||||||
AM_CONDITIONAL([ENABLE_D], [test x"$DC" != x])
|
|
||||||
|
|
||||||
# Java.
|
|
||||||
gt_JAVACOMP([1.7], [1.7])
|
|
||||||
gt_JAVAEXEC
|
|
||||||
AM_CONDITIONAL([ENABLE_JAVA], [test x"$CONF_JAVAC" != x && test x"$CONF_JAVA" != x])
|
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([yacc],
|
AC_ARG_ENABLE([yacc],
|
||||||
[AS_HELP_STRING([--disable-yacc],
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
[do not build a yacc command or an -ly library])],
|
[do not build a yacc command or an -ly library])],
|
||||||
, [enable_yacc=yes])
|
, [enable_yacc=yes])
|
||||||
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
case $enable_yacc in
|
||||||
AC_CONFIG_FILES([src/yacc], [chmod +x src/yacc])
|
yes)
|
||||||
|
YACC_SCRIPT=yacc
|
||||||
|
YACC_LIBRARY=liby.a;;
|
||||||
|
*)
|
||||||
|
YACC_SCRIPT=
|
||||||
|
YACC_LIBRARY=;;
|
||||||
|
esac
|
||||||
|
AC_SUBST([YACC_SCRIPT])
|
||||||
|
AC_SUBST([YACC_LIBRARY])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AM_MISSING_PROG([DOT], [dot])
|
|
||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
if ! "$LEX_IS_FLEX" || test "X$LEX" = X:; then
|
|
||||||
AC_MSG_WARN([bypassing lex because flex is required])
|
|
||||||
LEX=:
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT])
|
|
||||||
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
|
||||||
[$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT && test $bison_cv_cxx_works = yes])
|
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
AC_PROG_GNU_M4
|
||||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
||||||
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
||||||
supports -g, otherwise to "".])
|
supports -g, otherwise to "".])
|
||||||
AC_PATH_PROG([PERL], [perl])
|
|
||||||
AM_MISSING_PROG([HELP2MAN], [help2man])
|
AM_MISSING_PROG([HELP2MAN], [help2man])
|
||||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||||
AC_SUBST([XSLTPROC])
|
AC_SUBST([XSLTPROC])
|
||||||
@@ -294,19 +120,17 @@ AC_C_INLINE
|
|||||||
# gl_EARLY avoids some redundant checks.
|
# gl_EARLY avoids some redundant checks.
|
||||||
gl_INIT
|
gl_INIT
|
||||||
|
|
||||||
# We want ostream_printf and hyperlink support.
|
|
||||||
gl_LIBTEXTSTYLE_OPTIONAL([0.20.5])
|
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_CHECK_FUNCS_ONCE([setlocale])
|
AC_CHECK_FUNCS_ONCE([setlocale])
|
||||||
|
AM_WITH_DMALLOC
|
||||||
|
BISON_PREREQ_SUBPIPE
|
||||||
|
BISON_PREREQ_TIMEVAR
|
||||||
|
|
||||||
# Gettext.
|
# Gettext.
|
||||||
# We use gnulib, which is only guaranteed to work properly with the
|
# We've never tested with gettext versions before 0.15, so play it safe.
|
||||||
# latest Gettext.
|
|
||||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||||
AM_GNU_GETTEXT_VERSION([0.19])
|
AM_GNU_GETTEXT_VERSION([0.15])
|
||||||
BISON_I18N
|
BISON_I18N
|
||||||
AC_CONFIG_FILES([gnulib-po/Makefile.in])
|
|
||||||
|
|
||||||
# Internationalized parsers.
|
# Internationalized parsers.
|
||||||
AC_CONFIG_FILES([runtime-po/Makefile.in])
|
AC_CONFIG_FILES([runtime-po/Makefile.in])
|
||||||
@@ -319,54 +143,28 @@ AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
|||||||
|
|
||||||
# Initialize the test suite.
|
# Initialize the test suite.
|
||||||
AC_CONFIG_TESTDIR(tests)
|
AC_CONFIG_TESTDIR(tests)
|
||||||
AC_CONFIG_FILES([tests/atlocal])
|
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
|
||||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||||
|
|
||||||
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
||||||
# Use something simpler that $host_os to select our suppression file.
|
AC_PROG_CXX
|
||||||
uname=`uname`
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
case $VALGRIND:$uname in
|
|
||||||
'':*) ;;
|
|
||||||
*:Darwin)
|
|
||||||
# See README-hacking.md.
|
|
||||||
VALGRIND=;;
|
|
||||||
*:*)
|
|
||||||
suppfile=build-aux/$uname.valgrind
|
|
||||||
if test -f "$srcdir/$suppfile"; then
|
|
||||||
AC_SUBST([VALGRIND_OPTS_SUPPRESSION],
|
|
||||||
["--suppressions=\$(abs_top_srcdir)/$suppfile"])
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AC_MSG_CHECKING([Valgrind suppression file])
|
|
||||||
AC_MSG_RESULT([$suppfile])
|
|
||||||
|
|
||||||
# Whether we cannot run the compiled bison.
|
|
||||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
|
||||||
|
|
||||||
# Build bistromathic if we have the lib and both readline/readline.h
|
|
||||||
# and readline/history.h.
|
|
||||||
AM_CONDITIONAL([ENABLE_BISTROMATHIC],
|
|
||||||
[test "$gl_cv_lib_readline" != no &&
|
|
||||||
test "$ac_cv_header_readline_readline_h" = yes &&
|
|
||||||
test "$ac_cv_header_readline_history_h" = yes])
|
|
||||||
|
|
||||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
# Needed by tests/atlocal.in.
|
# Needed by tests/atlocal.in.
|
||||||
AC_SUBST([GCC])
|
AC_SUBST([GCC])
|
||||||
|
AC_SUBST([O0CFLAGS], [`echo $CFLAGS | sed 's/-O[[0-9]] *//'`])
|
||||||
|
AC_SUBST([O0CXXFLAGS], [`echo $CXXFLAGS | sed 's/-O[[0-9]] *//'`])
|
||||||
|
|
||||||
|
gt_JAVACOMP([1.3])
|
||||||
|
gt_JAVAEXEC
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
po/Makefile.in
|
build-aux/Makefile
|
||||||
doc/yacc.1])
|
po/Makefile.in
|
||||||
|
data/Makefile
|
||||||
# Fix LIBOBJS to give the Makefile the right file names. Otherwise
|
etc/Makefile
|
||||||
# compilation works, but with unexpected file names, so clean rules don't
|
examples/Makefile
|
||||||
# remove the actual files and distcheck fails.
|
examples/calc++/Makefile
|
||||||
AC_CONFIG_COMMANDS_PRE([
|
lib/Makefile src/Makefile
|
||||||
case $am__api_version in
|
doc/Makefile
|
||||||
1.14*|1.15*) gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, lib/, lib/lib_libbison_a-,g'`;;
|
doc/yacc.1])
|
||||||
*) gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, lib/, lib/libbison_a-,g'`;;
|
|
||||||
esac
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile.in
|
||||||
|
Makefile
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/Makefile.in
|
||||||
|
/Makefile
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
#! /bin/sh
|
## Copyright (C) 2002, 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# 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
|
||||||
@@ -13,34 +11,19 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cat >input <<EOF
|
dist_pkgdata_DATA = README bison.m4 \
|
||||||
1+2*3
|
c-skel.m4 c.m4 yacc.c glr.c \
|
||||||
EOF
|
c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc \
|
||||||
run 0 7
|
java-skel.m4 java.m4 lalr1.java
|
||||||
|
|
||||||
cat >input <<EOF
|
m4sugardir = $(pkgdatadir)/m4sugar
|
||||||
1
|
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4
|
||||||
2
|
|
||||||
3
|
|
||||||
EOF
|
|
||||||
run 0 '1
|
|
||||||
2
|
|
||||||
3'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
xsltdir = $(pkgdatadir)/xslt
|
||||||
(1+2) * 3
|
dist_xslt_DATA = \
|
||||||
EOF
|
xslt/bison.xsl \
|
||||||
run 0 9
|
xslt/xml2dot.xsl \
|
||||||
run -noerr 0 9 -p
|
xslt/xml2text.xsl \
|
||||||
|
xslt/xml2xhtml.xsl
|
||||||
cat >input <<EOF
|
|
||||||
(1+2) *
|
|
||||||
EOF
|
|
||||||
run 1 'err: 1.8-2.0: syntax error, unexpected end of line, expecting ( or number'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1 / (2 - 2)
|
|
||||||
EOF
|
|
||||||
run 1 'err: 1.1-11: error: division by zero'
|
|
||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
-*- outline -*-
|
||||||
|
|
||||||
|
This directory contains data needed by Bison.
|
||||||
|
|
||||||
|
* Skeletons
|
||||||
|
Bison skeletons: the general shapes of the different parser kinds,
|
||||||
|
that are specialized for specific grammars by the bison program.
|
||||||
|
|
||||||
|
Currently, the supported skeletons are:
|
||||||
|
|
||||||
|
- yacc.c
|
||||||
|
It used to be named bison.simple: it corresponds to C Yacc
|
||||||
|
compatible LALR(1) parsers.
|
||||||
|
|
||||||
|
- lalr1.cc
|
||||||
|
Produces a C++ parser class.
|
||||||
|
|
||||||
|
- lalr1.java
|
||||||
|
Produces a Java parser class.
|
||||||
|
|
||||||
|
- glr.c
|
||||||
|
A Generalized LR C parser based on Bison's LALR(1) tables.
|
||||||
|
|
||||||
|
- glr.cc
|
||||||
|
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
||||||
|
|
||||||
|
These skeletons are the only ones supported by the Bison team.
|
||||||
|
Because the interface between skeletons and the bison program is not
|
||||||
|
finished, *we are not bound to it*. In particular, Bison is not
|
||||||
|
mature enough for us to consider that ``foreign skeletons'' are
|
||||||
|
supported.
|
||||||
|
|
||||||
|
* m4sugar
|
||||||
|
This directory contains M4sugar, sort of an extended library for M4,
|
||||||
|
which is used by Bison to instantiate the skeletons.
|
||||||
|
|
||||||
|
* xslt
|
||||||
|
This directory contains XSLT programs that transform Bison's XML output
|
||||||
|
into various formats.
|
||||||
|
|
||||||
|
- bison.xsl
|
||||||
|
A library of routines used by the other XSLT programs.
|
||||||
|
|
||||||
|
- xml2dot.xsl
|
||||||
|
Conversion into GraphViz's dot format.
|
||||||
|
|
||||||
|
- xml2text.xsl
|
||||||
|
Conversion into text.
|
||||||
|
|
||||||
|
- xml2xhtml.xsl
|
||||||
|
Conversion into XHTML.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 2002, 2008-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-228
@@ -1,228 +0,0 @@
|
|||||||
This directory contains data needed by Bison.
|
|
||||||
|
|
||||||
# Directory Content
|
|
||||||
## Skeletons
|
|
||||||
Bison skeletons: the general shapes of the different parser kinds, that are
|
|
||||||
specialized for specific grammars by the bison program.
|
|
||||||
|
|
||||||
Currently, the supported skeletons are:
|
|
||||||
|
|
||||||
- yacc.c
|
|
||||||
It used to be named bison.simple: it corresponds to C Yacc
|
|
||||||
compatible LALR(1) parsers.
|
|
||||||
|
|
||||||
- lalr1.cc
|
|
||||||
Produces a C++ parser class.
|
|
||||||
|
|
||||||
- lalr1.java
|
|
||||||
Produces a Java parser class.
|
|
||||||
|
|
||||||
- glr.c
|
|
||||||
A Generalized LR C parser based on Bison's LALR(1) tables.
|
|
||||||
|
|
||||||
- glr.cc
|
|
||||||
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
|
||||||
|
|
||||||
These skeletons are the only ones supported by the Bison team. Because the
|
|
||||||
interface between skeletons and the bison program is not finished, *we are
|
|
||||||
not bound to it*. In particular, Bison is not mature enough for us to
|
|
||||||
consider that "foreign skeletons" are supported.
|
|
||||||
|
|
||||||
## m4sugar
|
|
||||||
This directory contains M4sugar, sort of an extended library for M4, which
|
|
||||||
is used by Bison to instantiate the skeletons.
|
|
||||||
|
|
||||||
## xslt
|
|
||||||
This directory contains XSLT programs that transform Bison's XML output into
|
|
||||||
various formats.
|
|
||||||
|
|
||||||
- bison.xsl
|
|
||||||
A library of routines used by the other XSLT programs.
|
|
||||||
|
|
||||||
- xml2dot.xsl
|
|
||||||
Conversion into GraphViz's dot format.
|
|
||||||
|
|
||||||
- xml2text.xsl
|
|
||||||
Conversion into text.
|
|
||||||
|
|
||||||
- xml2xhtml.xsl
|
|
||||||
Conversion into XHTML.
|
|
||||||
|
|
||||||
# Implementation Notes About the Skeletons
|
|
||||||
|
|
||||||
"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
|
|
||||||
executable with LR tables, facts about the symbols, etc. and they generate
|
|
||||||
the output (say parser.cc, parser.hh, location.hh, etc.). They are only in
|
|
||||||
charge of generating the parser and its auxiliary files, they do not
|
|
||||||
generate the XML output, the parser.output reports, nor the graphical
|
|
||||||
rendering.
|
|
||||||
|
|
||||||
The bits of information passing from bison to the backend is named
|
|
||||||
"muscles". Muscles are passed to M4 via its standard input: it's a set of
|
|
||||||
m4 definitions. To see them, use `--trace=muscles`.
|
|
||||||
|
|
||||||
Except for muscles, whose names are generated by bison, the skeletons have
|
|
||||||
no constraint at all on the macro names: there is no technical/theoretical
|
|
||||||
limitation, as long as you generate the output, you can do what you want.
|
|
||||||
However, of course, that would be a bad idea if, say, the C and C++
|
|
||||||
skeletons used different approaches and had completely different
|
|
||||||
implementations. That would be a maintenance nightmare.
|
|
||||||
|
|
||||||
Below, we document some of the macros that we use in several of the
|
|
||||||
skeletons. If you are to write a new skeleton, please, implement them for
|
|
||||||
your language. Overall, be sure to follow the same patterns as the existing
|
|
||||||
skeletons.
|
|
||||||
|
|
||||||
## Vocabulary
|
|
||||||
|
|
||||||
We use "formal arguments", or "formals" for short, to denote the declared
|
|
||||||
parameters of a function (e.g., `int argc, const char **argv`). Yes, this
|
|
||||||
is somewhat contradictory with `param` in the `%param` directives.
|
|
||||||
|
|
||||||
We use "effective arguments", or "args" for short, to denote the values
|
|
||||||
passed in function calls (e.g., `argc, argv`).
|
|
||||||
|
|
||||||
## Symbols
|
|
||||||
|
|
||||||
### `b4_symbol(NUM, FIELD)`
|
|
||||||
In order to unify the handling of the various aspects of symbols (tag, type
|
|
||||||
name, whether terminal, etc.), bison.exe defines one macro per (token,
|
|
||||||
field), where field can `has_id`, `id`, etc.: see
|
|
||||||
`prepare_symbol_definitions()` in `src/output.c`.
|
|
||||||
|
|
||||||
NUM can be:
|
|
||||||
- `empty` to denote the "empty" pseudo-symbol when it exists,
|
|
||||||
- `eof`, `error`, or `undef`
|
|
||||||
- a symbol number.
|
|
||||||
|
|
||||||
FIELD can be:
|
|
||||||
|
|
||||||
- `has_id`: 0 or 1
|
|
||||||
Whether the symbol has an `id`.
|
|
||||||
|
|
||||||
- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix)
|
|
||||||
If `has_id`, the name of the token kind (prefixed by api.token.prefix if
|
|
||||||
defined), otherwise empty. Guaranteed to be usable as a C identifier.
|
|
||||||
This is used to define the token kind (i.e., the enum used by the return
|
|
||||||
value of yylex). Should be named `token_kind`.
|
|
||||||
|
|
||||||
- `tag`: string
|
|
||||||
A human readable representation of the symbol. Can be `'foo'`,
|
|
||||||
`'foo.id'`, `'"foo"'` etc.
|
|
||||||
|
|
||||||
- `code`: integer
|
|
||||||
The token code associated to the token kind `id`.
|
|
||||||
The external number as used by yylex. Can be ASCII code when a character,
|
|
||||||
some number chosen by bison, or some user number in the case of `%token
|
|
||||||
FOO <NUM>`. Corresponds to `yychar` in `yacc.c`.
|
|
||||||
|
|
||||||
- `is_token`: 0 or 1
|
|
||||||
Whether this is a terminal symbol.
|
|
||||||
|
|
||||||
- `kind_base`: string (e.g., `YYSYMBOL_exp`, `YYSYMBOL_NUM`)
|
|
||||||
The base of the symbol kind, i.e., the enumerator of this symbol (token or
|
|
||||||
nonterminal) which is mapped to its `number`.
|
|
||||||
|
|
||||||
- `kind`: string
|
|
||||||
Same as `kind_base`, but possibly with a prefix in some languages. E.g.,
|
|
||||||
EOF's `kind_base` and `kind` are `YYSYMBOL_YYEOF` in C, but are
|
|
||||||
`S_YYEMPTY` and `symbol_kind::S_YYEMPTY` in C++.
|
|
||||||
|
|
||||||
- `number`: integer
|
|
||||||
The code associated to the `kind`.
|
|
||||||
The internal number (computed from the external number by yytranslate).
|
|
||||||
Corresponds to yytoken in yacc.c. This is the same number that serves as
|
|
||||||
key in b4_symbol(NUM, FIELD).
|
|
||||||
|
|
||||||
In bison, symbols are first assigned increasing numbers in order of
|
|
||||||
appearance (but tokens first, then nterms). After grammar reduction,
|
|
||||||
unused nterms are then renumbered to appear last (i.e., first tokens, then
|
|
||||||
used nterms and finally unused nterms). This final number NUM is the one
|
|
||||||
contained in this field, and it is the one used as key in `b4_symbol(NUM,
|
|
||||||
FIELD)`.
|
|
||||||
|
|
||||||
The code of the rule actions, however, is emitted before we know what
|
|
||||||
symbols are unused, so they use the original numbers. To avoid confusion,
|
|
||||||
they actually use "orig NUM" instead of just "NUM". bison also emits
|
|
||||||
definitions for `b4_symbol(orig NUM, number)` that map from original
|
|
||||||
numbers to the new ones. `b4_symbol` actually resolves `orig NUM` in the
|
|
||||||
other case, i.e., `b4_symbol(orig 42, tag)` would return the tag of the
|
|
||||||
symbols whose original number was 42.
|
|
||||||
|
|
||||||
- `has_type`: 0, 1
|
|
||||||
Whether has a semantic value.
|
|
||||||
|
|
||||||
- `type_tag`: string
|
|
||||||
When api.value.type=union, the generated name for the union member.
|
|
||||||
yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
|
||||||
|
|
||||||
- `type`: string
|
|
||||||
If it has a semantic value, its type tag, or, if variant are used,
|
|
||||||
its type.
|
|
||||||
In the case of api.value.type=union, type is the real type (e.g. int).
|
|
||||||
|
|
||||||
- `slot`: string
|
|
||||||
If it has a semantic value, the name of the union member (i.e., bounces to
|
|
||||||
either `type_tag` or `type`). It would be better to fix our mess and
|
|
||||||
always use `type` for the true type of the member, and `type_tag` for the
|
|
||||||
name of the union member.
|
|
||||||
|
|
||||||
- `has_printer`: 0, 1
|
|
||||||
- `printer`: string
|
|
||||||
- `printer_file`: string
|
|
||||||
- `printer_line`: integer
|
|
||||||
- `printer_loc`: location
|
|
||||||
If the symbol has a printer, everything about it.
|
|
||||||
|
|
||||||
- `has_destructor`, `destructor`, `destructor_file`, `destructor_line`, `destructor_loc`
|
|
||||||
Likewise.
|
|
||||||
|
|
||||||
### `b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])`
|
|
||||||
Expansion of $$, $1, $<TYPE-TAG>3, etc.
|
|
||||||
|
|
||||||
The semantic value from a given VAL.
|
|
||||||
- `VAL`: some semantic value storage (typically a union). e.g., `yylval`
|
|
||||||
- `SYMBOL-NUM`: the symbol number from which we extract the type tag.
|
|
||||||
- `TYPE-TAG`, the user forced the `<TYPE-TAG>`.
|
|
||||||
|
|
||||||
The result can be used safely, it is put in parens to avoid nasty precedence
|
|
||||||
issues.
|
|
||||||
|
|
||||||
### `b4_lhs_value(SYMBOL-NUM, [TYPE])`
|
|
||||||
Expansion of `$$` or `$<TYPE>$`, for symbol `SYMBOL-NUM`.
|
|
||||||
|
|
||||||
### `b4_rhs_data(RULE-LENGTH, POS)`
|
|
||||||
The data corresponding to the symbol `#POS`, where the current rule has
|
|
||||||
`RULE-LENGTH` symbols on RHS.
|
|
||||||
|
|
||||||
### `b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])`
|
|
||||||
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
|
|
||||||
on RHS.
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: markdown
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
|
||||||
|
|
||||||
This program 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
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
-->
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
/* Default styling rules for Bison when doing terminal output.
|
|
||||||
Copyright (C) 2019-2022, 2025-2026 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program 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
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* This is an experimental feature. The class names may change in the
|
|
||||||
future. */
|
|
||||||
|
|
||||||
/* Diagnostics. */
|
|
||||||
.warning { color: purple; }
|
|
||||||
.error { color: red; }
|
|
||||||
.note { color: cyan; }
|
|
||||||
|
|
||||||
.fixit-insert { color: green; }
|
|
||||||
|
|
||||||
/* Semantic values in Bison's own parser traces. */
|
|
||||||
.value { color: green; }
|
|
||||||
|
|
||||||
/* "Sections" in traces (--trace). */
|
|
||||||
.trace0 { color: green; }
|
|
||||||
|
|
||||||
/* Syntax error messages. */
|
|
||||||
.expected { color: green; }
|
|
||||||
.unexpected { color: red; }
|
|
||||||
|
|
||||||
|
|
||||||
/* Counterexamples. */
|
|
||||||
|
|
||||||
/* Cex: point in rule. */
|
|
||||||
.cex-dot { color: red; }
|
|
||||||
|
|
||||||
/* Cex: coloring various rules. */
|
|
||||||
.cex-0 { color: yellow; }
|
|
||||||
.cex-1 { color: green; }
|
|
||||||
.cex-2 { color: blue; }
|
|
||||||
.cex-3 { color: purple; }
|
|
||||||
.cex-4 { color: violet; }
|
|
||||||
.cex-5 { color: orange; }
|
|
||||||
.cex-6 { color: brown; }
|
|
||||||
.cex-7 { color: mauve; }
|
|
||||||
.cex-8 { color: #013220; } /* Dark green. */
|
|
||||||
.cex-9 { color: #e75480; } /* Dark pink. */
|
|
||||||
.cex-10 { color: cyan; }
|
|
||||||
.cex-11 { color: orange; }
|
|
||||||
|
|
||||||
/* Cex: derivation rewriting steps. */
|
|
||||||
.cex-step { font-style: italic; }
|
|
||||||
|
|
||||||
/* Cex: leaves of a derivation. */
|
|
||||||
.cex-leaf { font-weight: 600; }
|
|
||||||
+554
@@ -0,0 +1,554 @@
|
|||||||
|
-*- Autoconf -*-
|
||||||
|
|
||||||
|
# Language-independent M4 Macros for Bison.
|
||||||
|
# Copyright (C) 2002, 2004-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Identification. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
# b4_copyright(TITLE, YEARS)
|
||||||
|
# --------------------------
|
||||||
|
m4_define([b4_copyright],
|
||||||
|
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
|
||||||
|
|
||||||
|
b4_comment([$1
|
||||||
|
|
||||||
|
m4_text_wrap([Copyright (C) $2 Free Software Foundation, Inc.], [ ])
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.])
|
||||||
|
|
||||||
|
b4_comment([As a special exception, you may create a larger work that contains
|
||||||
|
part or all of the Bison parser skeleton and distribute that work
|
||||||
|
under terms of your choice, so long as that work isn't itself a
|
||||||
|
parser generator using the skeleton or a modified version thereof
|
||||||
|
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||||
|
the parser skeleton itself, you may (at your option) remove this
|
||||||
|
special exception, which will cause the skeleton and the resulting
|
||||||
|
Bison output files to be licensed under the GNU General Public
|
||||||
|
License without this special exception.
|
||||||
|
|
||||||
|
This special exception was added by the Free Software Foundation in
|
||||||
|
version 2.2 of Bison.])])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Error handling. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
# The following error handling macros print error directives that should not
|
||||||
|
# become arguments of other macro invocations since they would likely then be
|
||||||
|
# mangled. Thus, they print to stdout directly.
|
||||||
|
|
||||||
|
# b4_cat(TEXT)
|
||||||
|
# ------------
|
||||||
|
# Write TEXT to stdout. Precede the final newline with an @ so that it's
|
||||||
|
# escaped. For example:
|
||||||
|
#
|
||||||
|
# b4_cat([[@complain(invalid input@)]])
|
||||||
|
m4_define([b4_cat],
|
||||||
|
[m4_syscmd([cat <<'_m4eof'
|
||||||
|
]m4_bpatsubst(m4_dquote($1), [_m4eof], [_m4@`eof])[@
|
||||||
|
_m4eof
|
||||||
|
])dnl
|
||||||
|
m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
|
||||||
|
|
||||||
|
# b4_error(KIND, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# -------------------------------------------
|
||||||
|
# Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_error([[warn]], [[invalid value for `%s': %s]], [[foo]], [[3]])
|
||||||
|
m4_define([b4_error],
|
||||||
|
[b4_cat([[@]$1[(]$2[]]dnl
|
||||||
|
[m4_if([$#], [2], [],
|
||||||
|
[m4_foreach([b4_arg],
|
||||||
|
m4_dquote(m4_shift(m4_shift($@))),
|
||||||
|
[[@,]b4_arg])])[@)]])])
|
||||||
|
|
||||||
|
# b4_error_at(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# ----------------------------------------------------------
|
||||||
|
# Write @KIND_at(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_error_at([[complain]], [[input.y:2.3]], [[input.y:5.4]],
|
||||||
|
# [[invalid %s]], [[foo]])
|
||||||
|
m4_define([b4_error_at],
|
||||||
|
[b4_cat([[@]$1[_at(]$2[@,]$3[@,]$4[]]dnl
|
||||||
|
[m4_if([$#], [4], [],
|
||||||
|
[m4_foreach([b4_arg],
|
||||||
|
m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
|
||||||
|
[[@,]b4_arg])])[@)]])])
|
||||||
|
|
||||||
|
# b4_warn(FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# ------------------------------------
|
||||||
|
# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_warn([[invalid value for `%s': %s]], [[foo]], [[3]])
|
||||||
|
#
|
||||||
|
# As a simple test suite, this:
|
||||||
|
#
|
||||||
|
# m4_divert(-1)
|
||||||
|
# m4_define([asdf], [ASDF])
|
||||||
|
# m4_define([fsa], [FSA])
|
||||||
|
# m4_define([fdsa], [FDSA])
|
||||||
|
# b4_warn([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]])
|
||||||
|
# b4_warn([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]])
|
||||||
|
# b4_warn()
|
||||||
|
# b4_warn(1)
|
||||||
|
# b4_warn(1, 2)
|
||||||
|
#
|
||||||
|
# Should produce this without newlines:
|
||||||
|
#
|
||||||
|
# @warn([asdf), asdf]@,[fsa), fsa]@,[fdsa), fdsa]@)
|
||||||
|
# @warn(asdf), asdf@,fsa), fsa@,fdsa), fdsa@)
|
||||||
|
# @warn(@)
|
||||||
|
# @warn(1@)
|
||||||
|
# @warn(1@,2@)
|
||||||
|
m4_define([b4_warn],
|
||||||
|
[b4_error([[warn]], $@)])
|
||||||
|
|
||||||
|
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# ---------------------------------------------------
|
||||||
|
# Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]])
|
||||||
|
m4_define([b4_warn_at],
|
||||||
|
[b4_error_at([[warn]], $@)])
|
||||||
|
|
||||||
|
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# ----------------------------------------
|
||||||
|
# Write @complain(FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
|
#
|
||||||
|
# See b4_warn example.
|
||||||
|
m4_define([b4_complain],
|
||||||
|
[b4_error([[complain]], $@)])
|
||||||
|
|
||||||
|
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# -------------------------------------------------------
|
||||||
|
# Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
|
||||||
|
#
|
||||||
|
# See b4_warn_at example.
|
||||||
|
m4_define([b4_complain_at],
|
||||||
|
[b4_error_at([[complain]], $@)])
|
||||||
|
|
||||||
|
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# -------------------------------------
|
||||||
|
# Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to stdout and exit.
|
||||||
|
#
|
||||||
|
# See b4_warn example.
|
||||||
|
m4_define([b4_fatal],
|
||||||
|
[b4_error([[fatal]], $@)dnl
|
||||||
|
m4_exit(1)])
|
||||||
|
|
||||||
|
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
|
# ----------------------------------------------------
|
||||||
|
# Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout and exit.
|
||||||
|
#
|
||||||
|
# See b4_warn_at example.
|
||||||
|
m4_define([b4_fatal_at],
|
||||||
|
[b4_error_at([[fatal]], $@)dnl
|
||||||
|
m4_exit(1)])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Default values. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
|
||||||
|
m4_define_default([b4_pre_prologue], [])
|
||||||
|
m4_define_default([b4_post_prologue], [])
|
||||||
|
m4_define_default([b4_epilogue], [])
|
||||||
|
m4_define_default([b4_parse_param], [])
|
||||||
|
|
||||||
|
# The initial column and line.
|
||||||
|
m4_define_default([b4_location_initial_column], [1])
|
||||||
|
m4_define_default([b4_location_initial_line], [1])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------ ##
|
||||||
|
## Data Types. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
# b4_ints_in(INT1, INT2, LOW, HIGH)
|
||||||
|
# ---------------------------------
|
||||||
|
# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
|
||||||
|
m4_define([b4_ints_in],
|
||||||
|
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------ ##
|
||||||
|
## Decoding options. ##
|
||||||
|
## ------------------ ##
|
||||||
|
|
||||||
|
# b4_flag_if(FLAG, IF-TRUE, IF-FALSE)
|
||||||
|
# -----------------------------------
|
||||||
|
# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail.
|
||||||
|
m4_define([b4_flag_if],
|
||||||
|
[m4_case(b4_$1_flag,
|
||||||
|
[0], [$3],
|
||||||
|
[1], [$2],
|
||||||
|
[m4_fatal([invalid $1 value: ]$1)])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_define_flag_if(FLAG)
|
||||||
|
# -----------------------
|
||||||
|
# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the
|
||||||
|
# value of the Boolean FLAG.
|
||||||
|
m4_define([b4_define_flag_if],
|
||||||
|
[_b4_define_flag_if($[1], $[2], [$1])])
|
||||||
|
|
||||||
|
# _b4_define_flag_if($1, $2, FLAG)
|
||||||
|
# --------------------------------
|
||||||
|
# This macro works around the impossibility to define macros
|
||||||
|
# inside macros, because issuing `[$1]' is not possible in M4 :(.
|
||||||
|
# This sucks hard, GNU M4 should really provide M5 like $$1.
|
||||||
|
m4_define([_b4_define_flag_if],
|
||||||
|
[m4_if([$1$2], $[1]$[2], [],
|
||||||
|
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
||||||
|
m4_define([b4_$3_if],
|
||||||
|
[b4_flag_if([$3], [$1], [$2])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_FLAG_if(IF-TRUE, IF-FALSE)
|
||||||
|
# -----------------------------
|
||||||
|
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
||||||
|
b4_define_flag_if([defines]) # Whether headers are requested.
|
||||||
|
b4_define_flag_if([error_verbose]) # Whether error are verbose.
|
||||||
|
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
||||||
|
b4_define_flag_if([locations]) # Whether locations are tracked.
|
||||||
|
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
||||||
|
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------- ##
|
||||||
|
## Assigning token numbers. ##
|
||||||
|
## ------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## Synclines. ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
# b4_basename(NAME)
|
||||||
|
# -----------------
|
||||||
|
# Similar to POSIX basename; the differences don't matter here.
|
||||||
|
# Beware that NAME is not evaluated.
|
||||||
|
m4_define([b4_basename],
|
||||||
|
[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_syncline(LINE, FILE)
|
||||||
|
# -----------------------
|
||||||
|
m4_define([b4_syncline],
|
||||||
|
[b4_flag_if([synclines], [
|
||||||
|
b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
|
||||||
|
b4_sync_start([$1], [$2])])])
|
||||||
|
|
||||||
|
m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
|
||||||
|
m4_define([b4_sync_start], [b4_comment([Line $1 of $2])])
|
||||||
|
|
||||||
|
# b4_user_code(USER-CODE)
|
||||||
|
# -----------------------
|
||||||
|
# Emit code from the user, ending it with synclines.
|
||||||
|
m4_define([b4_user_code],
|
||||||
|
[$1
|
||||||
|
b4_syncline([@oline@], [@ofile@])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_define_user_code(MACRO)
|
||||||
|
# --------------------------
|
||||||
|
# From b4_MACRO, build b4_user_MACRO that includes the synclines.
|
||||||
|
m4_define([b4_define_user_code],
|
||||||
|
[m4_define([b4_user_$1],
|
||||||
|
[b4_user_code([b4_$1])])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_user_actions
|
||||||
|
# b4_user_initial_action
|
||||||
|
# b4_user_post_prologue
|
||||||
|
# b4_user_pre_prologue
|
||||||
|
# b4_user_stype
|
||||||
|
# ----------------------
|
||||||
|
# Macros that issue user code, ending with synclines.
|
||||||
|
b4_define_user_code([actions])
|
||||||
|
b4_define_user_code([initial_action])
|
||||||
|
b4_define_user_code([post_prologue])
|
||||||
|
b4_define_user_code([pre_prologue])
|
||||||
|
b4_define_user_code([stype])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
||||||
|
# --------------------------------------------------------
|
||||||
|
# Warn if any name of type WHAT is used by the user (as recorded in USER-LIST)
|
||||||
|
# but is not used by Bison (as recorded by macros in the namespace
|
||||||
|
# BISON-NAMESPACE).
|
||||||
|
#
|
||||||
|
# USER-LIST must expand to a list specifying all grammar occurrences of all
|
||||||
|
# names of type WHAT. Each item in the list must be a triplet specifying one
|
||||||
|
# occurrence: name, start boundary, and end boundary. Empty string names are
|
||||||
|
# fine. An empty list is fine.
|
||||||
|
#
|
||||||
|
# For example, to define b4_foo_user_names to be used for USER-LIST with three
|
||||||
|
# name occurrences and with correct quoting:
|
||||||
|
#
|
||||||
|
# m4_define([b4_foo_user_names],
|
||||||
|
# [[[[[[bar]], [[parser.y:1.7]], [[parser.y:1.16]]]],
|
||||||
|
# [[[[bar]], [[parser.y:5.7]], [[parser.y:5.16]]]],
|
||||||
|
# [[[[baz]], [[parser.y:8.7]], [[parser.y:8.16]]]]]])
|
||||||
|
#
|
||||||
|
# The macro BISON-NAMESPACE(bar) must be defined iff the name bar of type WHAT
|
||||||
|
# is used by Bison (in the front-end or in the skeleton). Empty string names
|
||||||
|
# are fine, but it would be ugly for Bison to actually use one.
|
||||||
|
#
|
||||||
|
# For example, to use b4_foo_bison_names for BISON-NAMESPACE and define that
|
||||||
|
# the names bar and baz are used by Bison:
|
||||||
|
#
|
||||||
|
# m4_define([b4_foo_bison_names(bar)])
|
||||||
|
# m4_define([b4_foo_bison_names(baz)])
|
||||||
|
#
|
||||||
|
# To invoke b4_check_user_names with TYPE foo, with USER-LIST
|
||||||
|
# b4_foo_user_names, with BISON-NAMESPACE b4_foo_bison_names, and with correct
|
||||||
|
# quoting:
|
||||||
|
#
|
||||||
|
# b4_check_user_names([[foo]], [b4_foo_user_names],
|
||||||
|
# [[b4_foo_bison_names]])
|
||||||
|
m4_define([b4_check_user_names],
|
||||||
|
[m4_foreach([b4_occurrence], $2,
|
||||||
|
[m4_pushdef([b4_occurrence], b4_occurrence)dnl
|
||||||
|
m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl
|
||||||
|
m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
|
||||||
|
m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl
|
||||||
|
m4_ifndef($3[(]m4_quote(b4_user_name)[)],
|
||||||
|
[b4_warn_at([b4_start], [b4_end],
|
||||||
|
[[%s `%s' is not used]],
|
||||||
|
[$1], [b4_user_name])])[]dnl
|
||||||
|
m4_popdef([b4_occurrence])dnl
|
||||||
|
m4_popdef([b4_user_name])dnl
|
||||||
|
m4_popdef([b4_start])dnl
|
||||||
|
m4_popdef([b4_end])dnl
|
||||||
|
])])
|
||||||
|
|
||||||
|
# b4_percent_define_get(VARIABLE)
|
||||||
|
# -------------------------------
|
||||||
|
# Mimic muscle_percent_define_get in ../src/muscle_tab.h exactly. That is, if
|
||||||
|
# the %define variable VARIABLE is defined, emit its value. Also, record
|
||||||
|
# Bison's usage of VARIABLE by defining
|
||||||
|
# b4_percent_define_bison_variables(VARIABLE).
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_percent_define_get([[foo]])
|
||||||
|
m4_define([b4_percent_define_get],
|
||||||
|
[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
|
||||||
|
m4_ifdef([b4_percent_define(]$1[)], [m4_indir([b4_percent_define(]$1[)])])])
|
||||||
|
|
||||||
|
# b4_percent_define_get_loc(VARIABLE)
|
||||||
|
# -----------------------------------
|
||||||
|
# Mimic muscle_percent_define_get_loc in ../src/muscle_tab.h exactly. That is,
|
||||||
|
# if the %define variable VARIABLE is undefined, complain fatally since that's
|
||||||
|
# a Bison or skeleton error. Otherwise, return its definition location in a
|
||||||
|
# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
||||||
|
# b4_fatal_at. Don't record this as a Bison usage of VARIABLE as there's no
|
||||||
|
# reason to suspect that the user-supplied value has yet influenced the output.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_complain_at(b4_percent_define_get_loc([[foo]]), [[invalid foo]])
|
||||||
|
m4_define([b4_percent_define_get_loc],
|
||||||
|
[m4_ifdef([b4_percent_define_loc(]$1[)],
|
||||||
|
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
|
||||||
|
b4_loc[]dnl
|
||||||
|
m4_popdef([b4_loc])],
|
||||||
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_get_loc]], [$1])])])
|
||||||
|
|
||||||
|
# b4_percent_define_get_syncline(VARIABLE)
|
||||||
|
# ----------------------------------------
|
||||||
|
# Mimic muscle_percent_define_get_syncline in ../src/muscle_tab.h exactly.
|
||||||
|
# That is, if the %define variable VARIABLE is undefined, complain fatally
|
||||||
|
# since that's a Bison or skeleton error. Otherwise, return its definition
|
||||||
|
# location as a b4_syncline invocation. Don't record this as a Bison usage of
|
||||||
|
# VARIABLE as there's no reason to suspect that the user-supplied value has yet
|
||||||
|
# influenced the output.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_percent_define_get_syncline([[foo]])
|
||||||
|
m4_define([b4_percent_define_get_syncline],
|
||||||
|
[m4_ifdef([b4_percent_define_syncline(]$1[)],
|
||||||
|
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
||||||
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_get_syncline]], [$1])])])
|
||||||
|
|
||||||
|
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
|
# ------------------------------------------------------
|
||||||
|
# Mimic muscle_percent_define_ifdef in ../src/muscle_tab.h exactly. That is,
|
||||||
|
# if the %define variable VARIABLE is defined, expand IF-TRUE, else expand
|
||||||
|
# IF-FALSE. Also, record Bison's usage of VARIABLE by defining
|
||||||
|
# b4_percent_define_bison_variables(VARIABLE).
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||||
|
m4_define([b4_percent_define_ifdef],
|
||||||
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
|
[m4_define([b4_percent_define_bison_variables(]$1[)])$2],
|
||||||
|
[$3])])
|
||||||
|
|
||||||
|
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
|
# --------------------------------------------------------
|
||||||
|
# Mimic muscle_percent_define_flag_if in ../src/muscle_tab.h exactly. That is,
|
||||||
|
# if the %define variable VARIABLE is defined to "" or "true", expand IF-TRUE.
|
||||||
|
# If it is defined to "false", expand IF-FALSE. Complain if it is undefined
|
||||||
|
# (a Bison or skeleton error since the default value should have been set
|
||||||
|
# already) or defined to any other value (possibly a user error). Also, record
|
||||||
|
# Bison's usage of VARIABLE by defining
|
||||||
|
# b4_percent_define_bison_variables(VARIABLE).
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_percent_define_flag_if([[foo]], [[it's true]], [[it's false]])
|
||||||
|
m4_define([b4_percent_define_flag_if],
|
||||||
|
[b4_percent_define_ifdef([$1],
|
||||||
|
[m4_case(b4_percent_define_get([$1]),
|
||||||
|
[], [$2], [true], [$2], [false], [$3],
|
||||||
|
[m4_expand_once([b4_complain_at(b4_percent_define_get_loc([$1]),
|
||||||
|
[[invalid value for %%define Boolean variable `%s']],
|
||||||
|
[$1])],
|
||||||
|
[[b4_percent_define_flag_if($1)]])])],
|
||||||
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_flag_if]], [$1])])])
|
||||||
|
|
||||||
|
# b4_percent_define_default(VARIABLE, DEFAULT)
|
||||||
|
# --------------------------------------------
|
||||||
|
# Mimic muscle_percent_define_default in ../src/muscle_tab.h exactly. That is,
|
||||||
|
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
||||||
|
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
||||||
|
# suspect that the value has yet influenced the output.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_percent_define_default([[foo]], [[default value]])
|
||||||
|
m4_define([b4_percent_define_default],
|
||||||
|
[m4_ifndef([b4_percent_define(]$1[)],
|
||||||
|
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||||
|
m4_define([b4_percent_define_loc(]$1[)],
|
||||||
|
[[[[<skeleton default value>:-1.-1]],
|
||||||
|
[[<skeleton default value>:-1.-1]]]])dnl
|
||||||
|
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
||||||
|
|
||||||
|
# b4_percent_define_check_values(VALUES)
|
||||||
|
# --------------------------------------
|
||||||
|
# Mimic muscle_percent_define_check_values in ../src/muscle_tab.h exactly
|
||||||
|
# except that the VALUES structure is more appropriate for M4. That is, VALUES
|
||||||
|
# is a list of sublists of strings. For each sublist, the first string is the
|
||||||
|
# name of a %define variable, and all remaining strings in that sublist are the
|
||||||
|
# valid values for that variable. Complain if such a variable is undefined (a
|
||||||
|
# Bison error since the default value should have been set already) or defined
|
||||||
|
# to any other value (possibly a user error). Don't record this as a Bison
|
||||||
|
# usage of the variable as there's no reason to suspect that the value has yet
|
||||||
|
# influenced the output.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# b4_percent_define_check_values([[[[foo]], [[foo-value1]], [[foo-value2]]]],
|
||||||
|
# [[[[bar]], [[bar-value1]]]])
|
||||||
|
m4_define([b4_percent_define_check_values],
|
||||||
|
[m4_foreach([b4_sublist], m4_quote($@),
|
||||||
|
[_b4_percent_define_check_values(b4_sublist)])])
|
||||||
|
|
||||||
|
m4_define([_b4_percent_define_check_values],
|
||||||
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
|
[m4_pushdef([b4_good_value], [0])dnl
|
||||||
|
m4_if($#, 1, [],
|
||||||
|
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
||||||
|
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
|
||||||
|
[m4_define([b4_good_value], [1])])])])dnl
|
||||||
|
m4_if(b4_good_value, [0],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
||||||
|
[[invalid value for %%define variable `%s': `%s']],
|
||||||
|
[$1],
|
||||||
|
m4_dquote(m4_indir([b4_percent_define(]$1[)])))])dnl
|
||||||
|
m4_popdef([b4_good_value])],
|
||||||
|
[b4_fatal([[undefined %%define variable `%s' passed to b4_percent_define_check_values]], [$1])])])
|
||||||
|
|
||||||
|
# b4_percent_code_get([QUALIFIER])
|
||||||
|
# --------------------------------
|
||||||
|
# If any %code blocks for QUALIFIER are defined, emit them beginning with a
|
||||||
|
# comment and ending with synclines and a newline. If QUALIFIER is not
|
||||||
|
# specified or empty, do this for the unqualified %code blocks. Also, record
|
||||||
|
# Bison's usage of QUALIFIER (if specified) by defining
|
||||||
|
# b4_percent_code_bison_qualifiers(QUALIFIER).
|
||||||
|
#
|
||||||
|
# For example, to emit any unqualified %code blocks followed by any %code
|
||||||
|
# blocks for the qualifier foo:
|
||||||
|
#
|
||||||
|
# b4_percent_code_get
|
||||||
|
# b4_percent_code_get([[foo]])
|
||||||
|
m4_define([b4_percent_code_get],
|
||||||
|
[m4_pushdef([b4_macro_name], [[b4_percent_code(]$1[)]])dnl
|
||||||
|
m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl
|
||||||
|
m4_ifdef(b4_macro_name,
|
||||||
|
[b4_comment([m4_if([$#], [0], [[Unqualified %code]],
|
||||||
|
[["%code ]$1["]])[ blocks.]])
|
||||||
|
b4_user_code([m4_indir(b4_macro_name)])
|
||||||
|
])dnl
|
||||||
|
m4_popdef([b4_macro_name])])
|
||||||
|
|
||||||
|
# b4_percent_code_ifdef(QUALIFIER, IF-TRUE, [IF-FALSE])
|
||||||
|
# -----------------------------------------------------
|
||||||
|
# If any %code blocks for QUALIFIER (or unqualified %code blocks if
|
||||||
|
# QUALIFIER is empty) are defined, expand IF-TRUE, else expand IF-FALSE.
|
||||||
|
# Also, record Bison's usage of QUALIFIER (if specified) by defining
|
||||||
|
# b4_percent_code_bison_qualifiers(QUALIFIER).
|
||||||
|
m4_define([b4_percent_code_ifdef],
|
||||||
|
[m4_ifdef([b4_percent_code(]$1[)],
|
||||||
|
[m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2],
|
||||||
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
|
## ----------------------------------------------------------- ##
|
||||||
|
## After processing the skeletons, check that all the user's ##
|
||||||
|
## %define variables and %code qualifiers were used by Bison. ##
|
||||||
|
## ----------------------------------------------------------- ##
|
||||||
|
|
||||||
|
m4_define([b4_check_user_names_wrap],
|
||||||
|
[m4_ifdef([b4_percent_]$1[_user_]$2[s],
|
||||||
|
[b4_check_user_names([[%]$1 $2],
|
||||||
|
[b4_percent_]$1[_user_]$2[s],
|
||||||
|
[[b4_percent_]$1[_bison_]$2[s]])])])
|
||||||
|
|
||||||
|
m4_wrap_lifo([
|
||||||
|
b4_check_user_names_wrap([[define]], [[variable]])
|
||||||
|
b4_check_user_names_wrap([[code]], [[qualifier]])
|
||||||
|
])
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# C++ skeleton dispatching for Bison.
|
# C++ skeleton dispatching for Bison.
|
||||||
|
# Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,12 +14,12 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
||||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.cc]])
|
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]])
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||||
|
|
||||||
m4_include(b4_used_skeleton)
|
m4_include(b4_used_skeleton)
|
||||||
+169
@@ -0,0 +1,169 @@
|
|||||||
|
-*- Autoconf -*-
|
||||||
|
|
||||||
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
|
# Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Default values. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
# Default parser class name.
|
||||||
|
b4_percent_define_default([[parser_class_name]], [[parser]])
|
||||||
|
b4_percent_define_default([[location_type]], [[location]])
|
||||||
|
b4_percent_define_default([[filename_type]], [[std::string]])
|
||||||
|
b4_percent_define_default([[namespace]], m4_defn([b4_prefix]))
|
||||||
|
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
||||||
|
b4_percent_define_default([[define_location_comparison]],
|
||||||
|
[m4_if(b4_percent_define_get([[filename_type]]),
|
||||||
|
[std::string], [[true]], [[false]])])
|
||||||
|
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## Namespace. ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
m4_define([b4_namespace_ref], [b4_percent_define_get([[namespace]])])
|
||||||
|
|
||||||
|
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
|
||||||
|
# would compile as an absolute reference with `parser' in the global namespace.
|
||||||
|
# b4_namespace_open would open an anonymous namespace and thus establish
|
||||||
|
# internal linkage. This would compile. However, it's cryptic, and internal
|
||||||
|
# linkage for the parser would be specified in all translation units that
|
||||||
|
# include the header, which is always generated. If we ever need to permit
|
||||||
|
# internal linkage somehow, surely we can find a cleaner approach.
|
||||||
|
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
|
[[namespace reference is empty]])])
|
||||||
|
|
||||||
|
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
||||||
|
# invalid b4_namepsace_ref that would be converted to a valid
|
||||||
|
# b4_namespace_open. The problem is that Bison doesn't always output
|
||||||
|
# b4_namespace_ref to uncommented code but should reserve the ability to do so
|
||||||
|
# in future releases without risking breaking any existing user grammars.
|
||||||
|
# Specifically, don't allow empty names as b4_namespace_open would just convert
|
||||||
|
# those into anonymous namespaces, and that might tempt some users.
|
||||||
|
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
|
[[namespace reference has consecutive "::"]])])
|
||||||
|
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
|
[[namespace reference has a trailing "::"]])])
|
||||||
|
|
||||||
|
m4_define([b4_namespace_open],
|
||||||
|
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
|
||||||
|
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
||||||
|
[^\(.\)[ ]*::], [\1])),
|
||||||
|
[::], [ { namespace ])[ {]])])
|
||||||
|
|
||||||
|
m4_define([b4_namespace_close],
|
||||||
|
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
|
||||||
|
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
||||||
|
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^][:]\)*],
|
||||||
|
[\1])),
|
||||||
|
[::\([^][:]\|:[^][:]\)*], [} ])[} // ]b4_namespace_ref])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -----------------------------------------------------
|
||||||
|
# Output the definition of the tokens as enums.
|
||||||
|
m4_define([b4_token_enums],
|
||||||
|
[/* Tokens. */
|
||||||
|
enum yytokentype {
|
||||||
|
m4_map_sep([ b4_token_enum], [,
|
||||||
|
],
|
||||||
|
[$@])
|
||||||
|
};
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## ----------------- ##
|
||||||
|
## Semantic Values. ##
|
||||||
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_lhs_value([TYPE])
|
||||||
|
# --------------------
|
||||||
|
# Expansion of $<TYPE>$.
|
||||||
|
m4_define([b4_lhs_value],
|
||||||
|
[(yyval[]m4_ifval([$1], [.$1]))])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
|
# --------------------------------------
|
||||||
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
|
# symbols on RHS.
|
||||||
|
m4_define([b4_rhs_value],
|
||||||
|
[(yysemantic_stack_@{($1) - ($2)@}m4_ifval([$3], [.$3]))])
|
||||||
|
|
||||||
|
# b4_lhs_location()
|
||||||
|
# -----------------
|
||||||
|
# Expansion of @$.
|
||||||
|
m4_define([b4_lhs_location],
|
||||||
|
[(yyloc)])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||||
|
# ---------------------------------
|
||||||
|
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||||
|
# on RHS.
|
||||||
|
m4_define([b4_rhs_location],
|
||||||
|
[(yylocation_stack_@{($1) - ($2)@})])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_decl
|
||||||
|
# -------------------
|
||||||
|
# Extra formal arguments of the constructor.
|
||||||
|
# Change the parameter names from "foo" into "foo_yyarg", so that
|
||||||
|
# there is no collision bw the user chosen attribute name, and the
|
||||||
|
# argument name in the constructor.
|
||||||
|
m4_define([b4_parse_param_decl],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
|
||||||
|
|
||||||
|
m4_define([b4_parse_param_decl_1],
|
||||||
|
[$1_yyarg])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_cons
|
||||||
|
# -------------------
|
||||||
|
# Extra initialisations of the constructor.
|
||||||
|
m4_define([b4_parse_param_cons],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[
|
||||||
|
b4_cc_constructor_calls(b4_parse_param)])])
|
||||||
|
m4_define([b4_cc_constructor_calls],
|
||||||
|
[m4_map_sep([b4_cc_constructor_call], [,
|
||||||
|
], [$@])])
|
||||||
|
m4_define([b4_cc_constructor_call],
|
||||||
|
[$2 ($2_yyarg)])
|
||||||
|
|
||||||
|
# b4_parse_param_vars
|
||||||
|
# -------------------
|
||||||
|
# Extra instance variables.
|
||||||
|
m4_define([b4_parse_param_vars],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[
|
||||||
|
/* User arguments. */
|
||||||
|
b4_cc_var_decls(b4_parse_param)])])
|
||||||
|
m4_define([b4_cc_var_decls],
|
||||||
|
[m4_map_sep([b4_cc_var_decl], [
|
||||||
|
], [$@])])
|
||||||
|
m4_define([b4_cc_var_decl],
|
||||||
|
[ $1;])
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# C skeleton dispatching for Bison.
|
# C skeleton dispatching for Bison.
|
||||||
|
# Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,12 +14,12 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
||||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[yacc.c]])
|
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[yacc.c]])
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||||
|
|
||||||
m4_include(b4_used_skeleton)
|
m4_include(b4_used_skeleton)
|
||||||
@@ -0,0 +1,476 @@
|
|||||||
|
-*- Autoconf -*-
|
||||||
|
|
||||||
|
# C M4 Macros for Bison.
|
||||||
|
# Copyright (C) 2002, 2004-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Identification. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
# b4_comment(TEXT)
|
||||||
|
# ----------------
|
||||||
|
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
||||||
|
], [
|
||||||
|
]) */])
|
||||||
|
|
||||||
|
# b4_identification
|
||||||
|
# -----------------
|
||||||
|
# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
|
||||||
|
# b4_pull_flag if they use the values of the %define variables api.pure or
|
||||||
|
# api.push_pull.
|
||||||
|
m4_define([b4_identification],
|
||||||
|
[[/* Identify Bison output. */
|
||||||
|
#define YYBISON 1
|
||||||
|
|
||||||
|
/* Bison version. */
|
||||||
|
#define YYBISON_VERSION "]b4_version["
|
||||||
|
|
||||||
|
/* Skeleton name. */
|
||||||
|
#define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
|
||||||
|
|
||||||
|
/* Pure parsers. */
|
||||||
|
#define YYPURE ]b4_pure_flag])[]m4_ifdef([b4_push_flag], [[
|
||||||
|
|
||||||
|
/* Push parsers. */
|
||||||
|
#define YYPUSH ]b4_push_flag])[]m4_ifdef([b4_pull_flag], [[
|
||||||
|
|
||||||
|
/* Pull parsers. */
|
||||||
|
#define YYPULL ]b4_pull_flag])[
|
||||||
|
|
||||||
|
/* Using locations. */
|
||||||
|
#define YYLSP_NEEDED ]b4_locations_flag[
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Default values. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
# If the %union is not named, its name is YYSTYPE.
|
||||||
|
m4_define_default([b4_union_name], [YYSTYPE])
|
||||||
|
|
||||||
|
# If the %name-prefix is not given, it is yy.
|
||||||
|
m4_define_default([b4_prefix], [yy])
|
||||||
|
|
||||||
|
## ------------------------ ##
|
||||||
|
## Pure/impure interfaces. ##
|
||||||
|
## ------------------------ ##
|
||||||
|
|
||||||
|
# b4_user_args
|
||||||
|
# ------------
|
||||||
|
m4_define([b4_user_args],
|
||||||
|
[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param
|
||||||
|
# --------------
|
||||||
|
# If defined, b4_parse_param arrives double quoted, but below we prefer
|
||||||
|
# it to be single quoted.
|
||||||
|
m4_define([b4_parse_param],
|
||||||
|
b4_parse_param)
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_for(DECL, FORMAL, BODY)
|
||||||
|
# ---------------------------------------
|
||||||
|
# Iterate over the user parameters, binding the declaration to DECL,
|
||||||
|
# the formal name to FORMAL, and evaluating the BODY.
|
||||||
|
m4_define([b4_parse_param_for],
|
||||||
|
[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
|
||||||
|
[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
|
||||||
|
m4_pushdef([$2], m4_shift($1_$2))dnl
|
||||||
|
$3[]dnl
|
||||||
|
m4_popdef([$2])dnl
|
||||||
|
m4_popdef([$1])dnl
|
||||||
|
])])
|
||||||
|
|
||||||
|
# b4_parse_param_use
|
||||||
|
# ------------------
|
||||||
|
# `YYUSE' all the parse-params.
|
||||||
|
m4_define([b4_parse_param_use],
|
||||||
|
[b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
||||||
|
])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------ ##
|
||||||
|
## Data Types. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
# b4_int_type(MIN, MAX)
|
||||||
|
# ---------------------
|
||||||
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
|
# MIN to MAX (included).
|
||||||
|
m4_define([b4_int_type],
|
||||||
|
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||||
|
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
||||||
|
|
||||||
|
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
|
||||||
|
b4_ints_in($@, [-32768], [32767]), [1], [short int],
|
||||||
|
|
||||||
|
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||||
|
|
||||||
|
[int])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_int_type_for(NAME)
|
||||||
|
# ---------------------
|
||||||
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
|
# `NAME_min' to `NAME_max' (included).
|
||||||
|
m4_define([b4_int_type_for],
|
||||||
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ---------##
|
||||||
|
## Values. ##
|
||||||
|
## ---------##
|
||||||
|
|
||||||
|
# b4_null
|
||||||
|
---------
|
||||||
|
# Return a null pointer constant. NULL infringes on the user name
|
||||||
|
# space in C, so use 0 rather than NULL.
|
||||||
|
m4_define([b4_null], [0])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------- ##
|
||||||
|
## Assigning token numbers. ##
|
||||||
|
## ------------------------- ##
|
||||||
|
|
||||||
|
# b4_token_define(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
|
# -----------------------------------------
|
||||||
|
# Output the definition of this token as #define.
|
||||||
|
m4_define([b4_token_define],
|
||||||
|
[#define $1 $2
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -------------------------------------------------------
|
||||||
|
# Output the definition of the tokens (if there are) as #defines.
|
||||||
|
m4_define([b4_token_defines],
|
||||||
|
[m4_if([$#$1], [1], [],
|
||||||
|
[/* Tokens. */
|
||||||
|
m4_map([b4_token_define], [$@])])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
|
# ---------------------------------------
|
||||||
|
# Output the definition of this token as an enum.
|
||||||
|
m4_define([b4_token_enum],
|
||||||
|
[$1 = $2])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -----------------------------------------------------
|
||||||
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
|
m4_define([b4_token_enums],
|
||||||
|
[m4_if([$#$1], [1], [],
|
||||||
|
[/* Tokens. */
|
||||||
|
#ifndef YYTOKENTYPE
|
||||||
|
# define YYTOKENTYPE
|
||||||
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
|
know about them. */
|
||||||
|
enum yytokentype {
|
||||||
|
m4_map_sep([ b4_token_enum], [,
|
||||||
|
],
|
||||||
|
[$@])
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -------------------------------------------------------------
|
||||||
|
# Output the definition of the tokens (if there are any) as enums and, if POSIX
|
||||||
|
# Yacc is enabled, as #defines.
|
||||||
|
m4_define([b4_token_enums_defines],
|
||||||
|
[b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], [])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## --------------------------------------------- ##
|
||||||
|
## Defining C functions in both K&R and ANSI-C. ##
|
||||||
|
## --------------------------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_modern_c
|
||||||
|
# -----------
|
||||||
|
# A predicate useful in #if to determine whether C is ancient or modern.
|
||||||
|
#
|
||||||
|
# If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
|
||||||
|
# as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
|
||||||
|
# reasons, but it defines __C99__FUNC__ so check that as well.
|
||||||
|
# Microsoft C normally doesn't define these macros, but it defines _MSC_VER.
|
||||||
|
# Consider a C++ compiler to be modern if it defines __cplusplus.
|
||||||
|
#
|
||||||
|
m4_define([b4_c_modern],
|
||||||
|
[[(defined __STDC__ || defined __C99__FUNC__ \
|
||||||
|
|| defined __cplusplus || defined _MSC_VER)]])
|
||||||
|
|
||||||
|
# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ----------------------------------------------------------
|
||||||
|
# Declare the function NAME.
|
||||||
|
m4_define([b4_c_function_def],
|
||||||
|
[#if b4_c_modern
|
||||||
|
b4_c_ansi_function_def($@)
|
||||||
|
#else
|
||||||
|
$2
|
||||||
|
$1 (b4_c_knr_formal_names(m4_shift2($@)))
|
||||||
|
b4_c_knr_formal_decls(m4_shift2($@))
|
||||||
|
#endif[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# Declare the function NAME in ANSI.
|
||||||
|
m4_define([b4_c_ansi_function_def],
|
||||||
|
[$2
|
||||||
|
$1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_ansi_formals([DECL1, NAME1], ...)
|
||||||
|
# --------------------------------------
|
||||||
|
# Output the arguments ANSI-C definition.
|
||||||
|
m4_define([b4_c_ansi_formals],
|
||||||
|
[m4_if([$#], [0], [void],
|
||||||
|
[$#$1], [1], [void],
|
||||||
|
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
||||||
|
|
||||||
|
m4_define([b4_c_ansi_formal],
|
||||||
|
[$1])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_knr_formal_names([DECL1, NAME1], ...)
|
||||||
|
# ------------------------------------------
|
||||||
|
# Output the argument names.
|
||||||
|
m4_define([b4_c_knr_formal_names],
|
||||||
|
[m4_map_sep([b4_c_knr_formal_name], [, ], [$@])])
|
||||||
|
|
||||||
|
m4_define([b4_c_knr_formal_name],
|
||||||
|
[$2])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_knr_formal_decls([DECL1, NAME1], ...)
|
||||||
|
# ------------------------------------------
|
||||||
|
# Output the K&R argument declarations.
|
||||||
|
m4_define([b4_c_knr_formal_decls],
|
||||||
|
[m4_map_sep([b4_c_knr_formal_decl],
|
||||||
|
[
|
||||||
|
],
|
||||||
|
[$@])])
|
||||||
|
|
||||||
|
m4_define([b4_c_knr_formal_decl],
|
||||||
|
[ $1;])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------------------------------------------ ##
|
||||||
|
## Declaring (prototyping) C functions in both K&R and ANSI-C. ##
|
||||||
|
## ------------------------------------------------------------ ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# -----------------------------------------------------------
|
||||||
|
# Declare the function NAME.
|
||||||
|
m4_define([b4_c_function_decl],
|
||||||
|
[#if defined __STDC__ || defined __cplusplus
|
||||||
|
b4_c_ansi_function_decl($@)
|
||||||
|
#else
|
||||||
|
$2 $1 ();
|
||||||
|
#endif[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# Declare the function NAME.
|
||||||
|
m4_define([b4_c_ansi_function_decl],
|
||||||
|
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## --------------------- ##
|
||||||
|
## Calling C functions. ##
|
||||||
|
## --------------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# -----------------------------------------------------------
|
||||||
|
# Call the function NAME with arguments NAME1, NAME2 etc.
|
||||||
|
m4_define([b4_c_function_call],
|
||||||
|
[$1 (b4_c_args(m4_shift2($@)))[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_args([DECL1, NAME1], ...)
|
||||||
|
# ------------------------------
|
||||||
|
# Output the arguments NAME1, NAME2...
|
||||||
|
m4_define([b4_c_args],
|
||||||
|
[m4_map_sep([b4_c_arg], [, ], [$@])])
|
||||||
|
|
||||||
|
m4_define([b4_c_arg],
|
||||||
|
[$2])
|
||||||
|
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## Synclines. ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
# b4_sync_start(LINE, FILE)
|
||||||
|
# -----------------------
|
||||||
|
m4_define([b4_sync_start], [[#]line $1 $2])
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## User actions. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
# b4_case(LABEL, STATEMENTS)
|
||||||
|
# --------------------------
|
||||||
|
m4_define([b4_case],
|
||||||
|
[ case $1:
|
||||||
|
$2
|
||||||
|
break;])
|
||||||
|
|
||||||
|
# b4_symbol_actions(FILENAME, LINENO,
|
||||||
|
# SYMBOL-TAG, SYMBOL-NUM,
|
||||||
|
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
||||||
|
# -------------------------------------------------
|
||||||
|
m4_define([b4_symbol_actions],
|
||||||
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
|
[m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl
|
||||||
|
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
||||||
|
case $4: /* $3 */
|
||||||
|
b4_syncline([$2], [$1])
|
||||||
|
$5;
|
||||||
|
b4_syncline([@oline@], [@ofile@])
|
||||||
|
break;
|
||||||
|
m4_popdef([b4_at_dollar])dnl
|
||||||
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
||||||
|
# -------------------------------------------
|
||||||
|
# Generate the "yydestruct" function, which declaration is issued using
|
||||||
|
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
||||||
|
# or "b4_c_function_def" for K&R.
|
||||||
|
m4_define_default([b4_yydestruct_generate],
|
||||||
|
[[/*-----------------------------------------------.
|
||||||
|
| Release the memory associated to this symbol. |
|
||||||
|
`-----------------------------------------------*/
|
||||||
|
|
||||||
|
/*ARGSUSED*/
|
||||||
|
]$1([yydestruct],
|
||||||
|
[static void],
|
||||||
|
[[const char *yymsg], [yymsg]],
|
||||||
|
[[int yytype], [yytype]],
|
||||||
|
[[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
|
||||||
|
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
|
||||||
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
|
{
|
||||||
|
YYUSE (yyvaluep);
|
||||||
|
]b4_locations_if([ YYUSE (yylocationp);
|
||||||
|
])dnl
|
||||||
|
b4_parse_param_use[]dnl
|
||||||
|
[
|
||||||
|
if (!yymsg)
|
||||||
|
yymsg = "Deleting";
|
||||||
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||||
|
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
|
||||||
|
# ------------------------------------------------
|
||||||
|
# Generate the "yy_symbol_print" function, which declaration is issued using
|
||||||
|
# FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
|
||||||
|
# or "b4_c_function_def" for K&R.
|
||||||
|
m4_define_default([b4_yy_symbol_print_generate],
|
||||||
|
[[
|
||||||
|
/*--------------------------------.
|
||||||
|
| Print this symbol on YYOUTPUT. |
|
||||||
|
`--------------------------------*/
|
||||||
|
|
||||||
|
/*ARGSUSED*/
|
||||||
|
]$1([yy_symbol_value_print],
|
||||||
|
[static void],
|
||||||
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
|
[[int yytype], [yytype]],
|
||||||
|
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||||
|
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||||
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
|
{
|
||||||
|
if (!yyvaluep)
|
||||||
|
return;
|
||||||
|
]b4_locations_if([ YYUSE (yylocationp);
|
||||||
|
])dnl
|
||||||
|
b4_parse_param_use[]dnl
|
||||||
|
[# ifdef YYPRINT
|
||||||
|
if (yytype < YYNTOKENS)
|
||||||
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||||
|
# else
|
||||||
|
YYUSE (yyoutput);
|
||||||
|
# endif
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------.
|
||||||
|
| Print this symbol on YYOUTPUT. |
|
||||||
|
`--------------------------------*/
|
||||||
|
|
||||||
|
]$1([yy_symbol_print],
|
||||||
|
[static void],
|
||||||
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
|
[[int yytype], [yytype]],
|
||||||
|
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||||
|
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
||||||
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
|
{
|
||||||
|
if (yytype < YYNTOKENS)
|
||||||
|
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
||||||
|
else
|
||||||
|
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
||||||
|
|
||||||
|
]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
|
||||||
|
YYFPRINTF (yyoutput, ": ");
|
||||||
|
])dnl
|
||||||
|
[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
|
||||||
|
b4_locations_if([, yylocationp])[]b4_user_args[);
|
||||||
|
YYFPRINTF (yyoutput, ")");
|
||||||
|
}]dnl
|
||||||
|
])
|
||||||
+2653
File diff suppressed because it is too large
Load Diff
+376
@@ -0,0 +1,376 @@
|
|||||||
|
-*- C -*-
|
||||||
|
|
||||||
|
# C++ GLR skeleton for Bison
|
||||||
|
# Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
# This skeleton produces a C++ class that encapsulates a C glr parser.
|
||||||
|
# This is in order to reduce the maintenance burden. The glr.c
|
||||||
|
# skeleton is clean and pure enough so that there are no real
|
||||||
|
# problems. The C++ interface is the same as that of lalr1.cc. In
|
||||||
|
# fact, glr.c can replace yacc.c without the user noticing any
|
||||||
|
# difference, and similarly for glr.cc replacing lalr1.cc.
|
||||||
|
#
|
||||||
|
# The passing of parse-params
|
||||||
|
#
|
||||||
|
# The additional arguments are stored as members of the parser
|
||||||
|
# object, yyparser. The C routines need to carry yyparser
|
||||||
|
# throughout the C parser; that easy: just let yyparser become an
|
||||||
|
# additional parse-param. But because the C++ skeleton needs to
|
||||||
|
# know the "real" original parse-param, we save them
|
||||||
|
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
||||||
|
# (and c.m4 strips one level of quotes). This is a PITA, and
|
||||||
|
# explains why there are so many levels of quotes.
|
||||||
|
#
|
||||||
|
# The locations
|
||||||
|
#
|
||||||
|
# We use location.cc just like lalr1.cc, but because glr.c stores
|
||||||
|
# the locations in a (C++) union, the position and location classes
|
||||||
|
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
||||||
|
# must not define "b4_location_constructors". As a consequence the
|
||||||
|
# user must initialize the first positions (in particular the
|
||||||
|
# filename member).
|
||||||
|
|
||||||
|
# We require a pure interface using locations.
|
||||||
|
m4_define([b4_locations_flag], [1])
|
||||||
|
m4_define([b4_pure_flag], [1])
|
||||||
|
|
||||||
|
# The header is mandatory.
|
||||||
|
b4_defines_if([],
|
||||||
|
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
|
m4_include(b4_pkgdatadir/[location.cc])
|
||||||
|
|
||||||
|
m4_define([b4_parser_class_name],
|
||||||
|
[b4_percent_define_get([[parser_class_name]])])
|
||||||
|
|
||||||
|
# Save the parse parameters.
|
||||||
|
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||||
|
|
||||||
|
|
||||||
|
# b4_yy_symbol_print_generate
|
||||||
|
# ---------------------------
|
||||||
|
# Bypass the default implementation to generate the "yy_symbol_print"
|
||||||
|
# and "yy_symbol_value_print" functions.
|
||||||
|
m4_define([b4_yy_symbol_print_generate],
|
||||||
|
[[
|
||||||
|
/*--------------------.
|
||||||
|
| Print this symbol. |
|
||||||
|
`--------------------*/
|
||||||
|
|
||||||
|
]b4_c_ansi_function_def([yy_symbol_print],
|
||||||
|
[static void],
|
||||||
|
[[FILE *], []],
|
||||||
|
[[int yytype], [yytype]],
|
||||||
|
[[const b4_namespace_ref::b4_parser_class_name::semantic_type *yyvaluep],
|
||||||
|
[yyvaluep]],
|
||||||
|
[[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp],
|
||||||
|
[yylocationp]],
|
||||||
|
b4_parse_param)[
|
||||||
|
{
|
||||||
|
]b4_parse_param_use[]dnl
|
||||||
|
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
# Declare yyerror.
|
||||||
|
m4_append([b4_post_prologue],
|
||||||
|
[b4_syncline([@oline@], [@ofile@])
|
||||||
|
|
||||||
|
b4_c_ansi_function_decl([yyerror],
|
||||||
|
[static void],
|
||||||
|
[[b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
|
||||||
|
b4_parse_param,
|
||||||
|
[[const char* msg], [msg]])])
|
||||||
|
|
||||||
|
|
||||||
|
# Define yyerror.
|
||||||
|
m4_append([b4_epilogue],
|
||||||
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
|
/*------------------.
|
||||||
|
| Report an error. |
|
||||||
|
`------------------*/
|
||||||
|
|
||||||
|
]b4_c_ansi_function_def([yyerror],
|
||||||
|
[static void],
|
||||||
|
[[b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
|
||||||
|
b4_parse_param,
|
||||||
|
[[const char* msg], [msg]])[
|
||||||
|
{
|
||||||
|
]b4_parse_param_use[]dnl
|
||||||
|
[ yyparser.error (*yylocationp, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
]dnl In this section, the parse param are the original parse_params.
|
||||||
|
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||||
|
[ /// Build a parser object.
|
||||||
|
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||||
|
:])[
|
||||||
|
#if YYDEBUG
|
||||||
|
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
||||||
|
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||||
|
#endif]b4_parse_param_cons[
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_parser_class_name::~b4_parser_class_name[ ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
]b4_parser_class_name[::parse ()
|
||||||
|
{
|
||||||
|
return ::yyparse (*this]b4_user_args[);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if YYDEBUG
|
||||||
|
/*--------------------.
|
||||||
|
| Print this symbol. |
|
||||||
|
`--------------------*/
|
||||||
|
|
||||||
|
inline void
|
||||||
|
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||||
|
const semantic_type* yyvaluep, const location_type* yylocationp)
|
||||||
|
{
|
||||||
|
/* Pacify ``unused variable'' warnings. */
|
||||||
|
YYUSE (yyvaluep);
|
||||||
|
YYUSE (yylocationp);
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
]b4_parser_class_name[::yy_symbol_print_ (int yytype,
|
||||||
|
const semantic_type* yyvaluep, const location_type* yylocationp)
|
||||||
|
{
|
||||||
|
*yycdebug_ << (yytype < YYNTOKENS ? "token" : "nterm")
|
||||||
|
<< ' ' << yytname[yytype] << " ("
|
||||||
|
<< *yylocationp << ": ";
|
||||||
|
yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
|
||||||
|
*yycdebug_ << ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream&
|
||||||
|
]b4_parser_class_name[::debug_stream () const
|
||||||
|
{
|
||||||
|
return *yycdebug_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
|
||||||
|
{
|
||||||
|
yycdebug_ = &o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
]b4_parser_class_name[::debug_level_type
|
||||||
|
]b4_parser_class_name[::debug_level () const
|
||||||
|
{
|
||||||
|
return yydebug_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
|
{
|
||||||
|
yydebug_ = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
]m4_popdef([b4_parse_param])dnl
|
||||||
|
b4_namespace_close[
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
# Let glr.c believe that the user arguments include the parser itself.
|
||||||
|
m4_ifset([b4_parse_param],
|
||||||
|
[m4_pushdef([b4_parse_param],
|
||||||
|
m4_dquote([[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]],]
|
||||||
|
m4_defn([b4_parse_param])))],
|
||||||
|
[m4_pushdef([b4_parse_param],
|
||||||
|
[[[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]]]])
|
||||||
|
])
|
||||||
|
m4_include(b4_pkgdatadir/[glr.c])
|
||||||
|
m4_popdef([b4_parse_param])
|
||||||
|
|
||||||
|
m4_divert_push(0)
|
||||||
|
@output(b4_spec_defines_file@)@
|
||||||
|
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||||
|
[2002-2006, 2009-2010])[
|
||||||
|
|
||||||
|
/* C++ GLR parser skeleton written by Akim Demaille. */
|
||||||
|
|
||||||
|
#ifndef PARSER_HEADER_H
|
||||||
|
# define PARSER_HEADER_H
|
||||||
|
|
||||||
|
]b4_percent_code_get([[requires]])[
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
/* Using locations. */
|
||||||
|
#define YYLSP_NEEDED ]b4_locations_flag[
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
class position;
|
||||||
|
class location;
|
||||||
|
]b4_namespace_close[
|
||||||
|
|
||||||
|
#include "location.hh"
|
||||||
|
|
||||||
|
/* Enabling traces. */
|
||||||
|
#ifndef YYDEBUG
|
||||||
|
# define YYDEBUG ]b4_debug_flag[
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||||
|
If N is 0, then set CURRENT to the empty location which ends
|
||||||
|
the previous symbol: RHS[0] (always defined). */
|
||||||
|
|
||||||
|
#ifndef YYLLOC_DEFAULT
|
||||||
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
|
do \
|
||||||
|
if (N) \
|
||||||
|
{ \
|
||||||
|
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
||||||
|
(Current).end = YYRHSLOC (Rhs, N).end; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
||||||
|
} \
|
||||||
|
while (/*CONSTCOND*/ 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
/// A Bison parser.
|
||||||
|
class ]b4_parser_class_name[
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/// Symbol semantic values.
|
||||||
|
#ifndef YYSTYPE
|
||||||
|
]m4_ifdef([b4_stype],
|
||||||
|
[ union semantic_type
|
||||||
|
{
|
||||||
|
b4_user_stype
|
||||||
|
};],
|
||||||
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[[ typedef int semantic_type;]],
|
||||||
|
[[ typedef YYSTYPE semantic_type;]])])[
|
||||||
|
#else
|
||||||
|
typedef YYSTYPE semantic_type;
|
||||||
|
#endif
|
||||||
|
/// Symbol locations.
|
||||||
|
typedef ]b4_percent_define_get([[location_type]])[ location_type;
|
||||||
|
/// Tokens.
|
||||||
|
struct token
|
||||||
|
{
|
||||||
|
]b4_token_enums(b4_tokens)[
|
||||||
|
};
|
||||||
|
/// Token type.
|
||||||
|
typedef token::yytokentype token_type;
|
||||||
|
|
||||||
|
/// Build a parser object.
|
||||||
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
|
virtual ~]b4_parser_class_name[ ();
|
||||||
|
|
||||||
|
/// Parse.
|
||||||
|
/// \returns 0 iff parsing succeeded.
|
||||||
|
virtual int parse ();
|
||||||
|
|
||||||
|
/// The current debugging stream.
|
||||||
|
std::ostream& debug_stream () const;
|
||||||
|
/// Set the current debugging stream.
|
||||||
|
void set_debug_stream (std::ostream &);
|
||||||
|
|
||||||
|
/// Type for debugging levels.
|
||||||
|
typedef int debug_level_type;
|
||||||
|
/// The current debugging level.
|
||||||
|
debug_level_type debug_level () const;
|
||||||
|
/// Set the current debugging level.
|
||||||
|
void set_debug_level (debug_level_type l);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Report a syntax error.
|
||||||
|
/// \param loc where the syntax error is found.
|
||||||
|
/// \param msg a description of the syntax error.
|
||||||
|
virtual void error (const location_type& loc, const std::string& msg);
|
||||||
|
private:
|
||||||
|
|
||||||
|
#if YYDEBUG
|
||||||
|
public:
|
||||||
|
/// \brief Report a symbol value on the debug stream.
|
||||||
|
/// \param yytype The token type.
|
||||||
|
/// \param yyvaluep Its semantic value.
|
||||||
|
/// \param yylocationp Its location.
|
||||||
|
virtual void yy_symbol_value_print_ (int yytype,
|
||||||
|
const semantic_type* yyvaluep,
|
||||||
|
const location_type* yylocationp);
|
||||||
|
/// \brief Report a symbol on the debug stream.
|
||||||
|
/// \param yytype The token type.
|
||||||
|
/// \param yyvaluep Its semantic value.
|
||||||
|
/// \param yylocationp Its location.
|
||||||
|
virtual void yy_symbol_print_ (int yytype,
|
||||||
|
const semantic_type* yyvaluep,
|
||||||
|
const location_type* yylocationp);
|
||||||
|
private:
|
||||||
|
/* Debugging. */
|
||||||
|
int yydebug_;
|
||||||
|
std::ostream* yycdebug_;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/// \brief Reclaim the memory associated to a symbol.
|
||||||
|
/// \param yymsg Why this token is reclaimed.
|
||||||
|
/// \param yytype The symbol type.
|
||||||
|
/// \param yyvaluep Its semantic value.
|
||||||
|
/// \param yylocationp Its location.
|
||||||
|
inline void yydestruct_ (const char* yymsg,
|
||||||
|
int yytype,
|
||||||
|
semantic_type* yyvaluep,
|
||||||
|
location_type* yylocationp);
|
||||||
|
|
||||||
|
]b4_parse_param_vars[
|
||||||
|
};
|
||||||
|
|
||||||
|
]dnl Redirections for glr.c.
|
||||||
|
b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||||
|
[b4_token_defines(b4_tokens)])
|
||||||
|
[
|
||||||
|
#ifndef YYSTYPE
|
||||||
|
# define YYSTYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
|
||||||
|
#endif
|
||||||
|
#ifndef YYLTYPE
|
||||||
|
# define YYLTYPE ]b4_namespace_ref[::]b4_parser_class_name[::location_type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
]b4_namespace_close[
|
||||||
|
|
||||||
|
]b4_percent_code_get([[provides]])[]dnl
|
||||||
|
|
||||||
|
[#endif /* ! defined PARSER_HEADER_H */]
|
||||||
|
m4_divert_pop(0)
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
-*- Autoconf -*-
|
-*- Autoconf -*-
|
||||||
|
|
||||||
# Java skeleton dispatching for Bison.
|
# Java skeleton dispatching for Bison.
|
||||||
|
# Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
|
||||||
# Copyright (C) 2007, 2009-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,12 +14,12 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
||||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.java]])
|
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.java]])
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||||
|
|
||||||
m4_include(b4_used_skeleton)
|
m4_include(b4_used_skeleton)
|
||||||
+303
@@ -0,0 +1,303 @@
|
|||||||
|
-*- Autoconf -*-
|
||||||
|
|
||||||
|
# Java language support for Bison
|
||||||
|
|
||||||
|
# Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
# b4_comment(TEXT)
|
||||||
|
# ----------------
|
||||||
|
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
||||||
|
], [
|
||||||
|
]) */])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_list2(LIST1, LIST2)
|
||||||
|
# --------------------------
|
||||||
|
# Join two lists with a comma if necessary.
|
||||||
|
m4_define([b4_list2],
|
||||||
|
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
||||||
|
# -------------------------------------------
|
||||||
|
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
||||||
|
# otherwise NOT.
|
||||||
|
m4_define([b4_percent_define_get3],
|
||||||
|
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||||
|
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_flag_value(BOOLEAN-FLAG)
|
||||||
|
# ---------------------------
|
||||||
|
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_public_if(TRUE, FALSE)
|
||||||
|
# -------------------------
|
||||||
|
b4_percent_define_default([[public]], [[false]])
|
||||||
|
m4_define([b4_public_if],
|
||||||
|
[b4_percent_define_flag_if([public], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_abstract_if(TRUE, FALSE)
|
||||||
|
# ---------------------------
|
||||||
|
b4_percent_define_default([[abstract]], [[false]])
|
||||||
|
m4_define([b4_abstract_if],
|
||||||
|
[b4_percent_define_flag_if([abstract], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_final_if(TRUE, FALSE)
|
||||||
|
# ---------------------------
|
||||||
|
b4_percent_define_default([[final]], [[false]])
|
||||||
|
m4_define([b4_final_if],
|
||||||
|
[b4_percent_define_flag_if([final], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_strictfp_if(TRUE, FALSE)
|
||||||
|
# ---------------------------
|
||||||
|
b4_percent_define_default([[strictfp]], [[false]])
|
||||||
|
m4_define([b4_strictfp_if],
|
||||||
|
[b4_percent_define_flag_if([strictfp], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_lexer_if(TRUE, FALSE)
|
||||||
|
# ------------------------
|
||||||
|
m4_define([b4_lexer_if],
|
||||||
|
[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_identification
|
||||||
|
# -----------------
|
||||||
|
m4_define([b4_identification],
|
||||||
|
[ /** Version number for the Bison executable that generated this parser. */
|
||||||
|
public static final String bisonVersion = "b4_version";
|
||||||
|
|
||||||
|
/** Name of the skeleton that generated this parser. */
|
||||||
|
public static final String bisonSkeleton = b4_skeleton;
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------ ##
|
||||||
|
## Data types. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
# b4_int_type(MIN, MAX)
|
||||||
|
# ---------------------
|
||||||
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
|
# MIN to MAX (included).
|
||||||
|
m4_define([b4_int_type],
|
||||||
|
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
||||||
|
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||||
|
[int])])
|
||||||
|
|
||||||
|
# b4_int_type_for(NAME)
|
||||||
|
# ---------------------
|
||||||
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
|
# `NAME_min' to `NAME_max' (included).
|
||||||
|
m4_define([b4_int_type_for],
|
||||||
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
|
# b4_null
|
||||||
|
# -------
|
||||||
|
m4_define([b4_null], [null])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------- ##
|
||||||
|
## Assigning token numbers. ##
|
||||||
|
## ------------------------- ##
|
||||||
|
|
||||||
|
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
|
# ---------------------------------------
|
||||||
|
# Output the definition of this token as an enum.
|
||||||
|
m4_define([b4_token_enum],
|
||||||
|
[ /** Token number, to be returned by the scanner. */
|
||||||
|
public static final int $1 = $2;
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -----------------------------------------------------
|
||||||
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
|
m4_define([b4_token_enums],
|
||||||
|
[m4_if([$#$1], [1], [],
|
||||||
|
[/* Tokens. */
|
||||||
|
m4_map([b4_token_enum], [$@])])
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4-case(ID, CODE)
|
||||||
|
# -----------------
|
||||||
|
# We need to fool Java's stupid unreachable code detection.
|
||||||
|
m4_define([b4_case], [ case $1:
|
||||||
|
if (yyn == $1)
|
||||||
|
$2;
|
||||||
|
break;
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Default values. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
||||||
|
b4_percent_define_default([[stype]], [[Object]])])
|
||||||
|
|
||||||
|
# %name-prefix
|
||||||
|
m4_define_default([b4_prefix], [[YY]])
|
||||||
|
|
||||||
|
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])])
|
||||||
|
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
|
||||||
|
|
||||||
|
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])])
|
||||||
|
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
||||||
|
|
||||||
|
b4_percent_define_default([[throws]], [])])
|
||||||
|
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
||||||
|
|
||||||
|
b4_percent_define_default([[location_type]], [Location])])
|
||||||
|
m4_define([b4_location_type], [b4_percent_define_get([[location_type]])])
|
||||||
|
|
||||||
|
b4_percent_define_default([[position_type]], [Position])])
|
||||||
|
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
|
||||||
|
|
||||||
|
|
||||||
|
## ----------------- ##
|
||||||
|
## Semantic Values. ##
|
||||||
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_lhs_value([TYPE])
|
||||||
|
# --------------------
|
||||||
|
# Expansion of $<TYPE>$.
|
||||||
|
m4_define([b4_lhs_value], [yyval])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
|
# --------------------------------------
|
||||||
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
|
# symbols on RHS.
|
||||||
|
#
|
||||||
|
# In this simple implementation, %token and %type have class names
|
||||||
|
# between the angle brackets.
|
||||||
|
m4_define([b4_rhs_value],
|
||||||
|
[(m4_ifval($3, [($3)])[](yystack.valueAt ($1-($2))))])
|
||||||
|
|
||||||
|
# b4_lhs_location()
|
||||||
|
# -----------------
|
||||||
|
# Expansion of @$.
|
||||||
|
m4_define([b4_lhs_location],
|
||||||
|
[(yyloc)])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||||
|
# ---------------------------------
|
||||||
|
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||||
|
# on RHS.
|
||||||
|
m4_define([b4_rhs_location],
|
||||||
|
[yystack.locationAt ($1-($2))])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_lex_param
|
||||||
|
# b4_parse_param
|
||||||
|
# --------------
|
||||||
|
# If defined, b4_lex_param arrives double quoted, but below we prefer
|
||||||
|
# it to be single quoted. Same for b4_parse_param.
|
||||||
|
|
||||||
|
# TODO: should be in bison.m4
|
||||||
|
m4_define_default([b4_lex_param], [[]]))
|
||||||
|
m4_define([b4_lex_param], b4_lex_param))
|
||||||
|
m4_define([b4_parse_param], b4_parse_param))
|
||||||
|
|
||||||
|
# b4_lex_param_decl
|
||||||
|
# -------------------
|
||||||
|
# Extra formal arguments of the constructor.
|
||||||
|
m4_define([b4_lex_param_decl],
|
||||||
|
[m4_ifset([b4_lex_param],
|
||||||
|
[b4_remove_comma([$1],
|
||||||
|
b4_param_decls(b4_lex_param))],
|
||||||
|
[$1])])
|
||||||
|
|
||||||
|
m4_define([b4_param_decls],
|
||||||
|
[m4_map([b4_param_decl], [$@])])
|
||||||
|
m4_define([b4_param_decl], [, $1])
|
||||||
|
|
||||||
|
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_decl
|
||||||
|
# -------------------
|
||||||
|
# Extra formal arguments of the constructor.
|
||||||
|
m4_define([b4_parse_param_decl],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[b4_remove_comma([$1],
|
||||||
|
b4_param_decls(b4_parse_param))],
|
||||||
|
[$1])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_lex_param_call
|
||||||
|
# -------------------
|
||||||
|
# Delegating the lexer parameters to the lexer constructor.
|
||||||
|
m4_define([b4_lex_param_call],
|
||||||
|
[m4_ifset([b4_lex_param],
|
||||||
|
[b4_remove_comma([$1],
|
||||||
|
b4_param_calls(b4_lex_param))],
|
||||||
|
[$1])])
|
||||||
|
m4_define([b4_param_calls],
|
||||||
|
[m4_map([b4_param_call], [$@])])
|
||||||
|
m4_define([b4_param_call], [, $2])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_cons
|
||||||
|
# -------------------
|
||||||
|
# Extra initialisations of the constructor.
|
||||||
|
m4_define([b4_parse_param_cons],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[b4_constructor_calls(b4_parse_param)])])
|
||||||
|
|
||||||
|
m4_define([b4_constructor_calls],
|
||||||
|
[m4_map([b4_constructor_call], [$@])])
|
||||||
|
m4_define([b4_constructor_call],
|
||||||
|
[this.$2 = $2;
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_parse_param_vars
|
||||||
|
# -------------------
|
||||||
|
# Extra instance variables.
|
||||||
|
m4_define([b4_parse_param_vars],
|
||||||
|
[m4_ifset([b4_parse_param],
|
||||||
|
[
|
||||||
|
/* User arguments. */
|
||||||
|
b4_var_decls(b4_parse_param)])])
|
||||||
|
|
||||||
|
m4_define([b4_var_decls],
|
||||||
|
[m4_map_sep([b4_var_decl], [
|
||||||
|
], [$@])])
|
||||||
|
m4_define([b4_var_decl],
|
||||||
|
[ protected final $1;])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# b4_maybe_throws(THROWS)
|
||||||
|
# -----------------------
|
||||||
|
# Expand to either an empty string or "throws THROWS".
|
||||||
|
m4_define([b4_maybe_throws],
|
||||||
|
[m4_ifval($1, [throws $1])])
|
||||||
+1156
File diff suppressed because it is too large
Load Diff
+881
@@ -0,0 +1,881 @@
|
|||||||
|
# Java skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
|
# Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[java.m4])
|
||||||
|
|
||||||
|
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java], [b4_skeleton])])
|
||||||
|
m4_ifval(m4_defn([b4_symbol_destructors]),
|
||||||
|
[b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])],
|
||||||
|
[])
|
||||||
|
|
||||||
|
m4_divert_push(0)dnl
|
||||||
|
@output(b4_parser_file_name@)@
|
||||||
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
|
[2007-2010])
|
||||||
|
|
||||||
|
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||||
|
])[/* First part of user declarations. */
|
||||||
|
]b4_pre_prologue
|
||||||
|
b4_percent_code_get([[imports]])
|
||||||
|
[/**
|
||||||
|
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
||||||
|
*
|
||||||
|
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
||||||
|
*/
|
||||||
|
]b4_public_if([public ])dnl
|
||||||
|
b4_abstract_if([abstract ])dnl
|
||||||
|
b4_final_if([final ])dnl
|
||||||
|
b4_strictfp_if([strictfp ])dnl
|
||||||
|
[class ]b4_parser_class_name[]dnl
|
||||||
|
b4_percent_define_get3([extends], [ extends ])dnl
|
||||||
|
b4_percent_define_get3([implements], [ implements ])[
|
||||||
|
{
|
||||||
|
]b4_identification[
|
||||||
|
|
||||||
|
/** True if verbose error messages are enabled. */
|
||||||
|
public boolean errorVerbose = ]b4_flag_value([error_verbose]);
|
||||||
|
|
||||||
|
b4_locations_if([[
|
||||||
|
/**
|
||||||
|
* A class defining a pair of positions. Positions, defined by the
|
||||||
|
* <code>]b4_position_type[</code> class, denote a point in the input.
|
||||||
|
* Locations represent a part of the input through the beginning
|
||||||
|
* and ending positions. */
|
||||||
|
public class ]b4_location_type[ {
|
||||||
|
/** The first, inclusive, position in the range. */
|
||||||
|
public ]b4_position_type[ begin;
|
||||||
|
|
||||||
|
/** The first position beyond the range. */
|
||||||
|
public ]b4_position_type[ end;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
||||||
|
* a given point.
|
||||||
|
* @@param loc The position at which the range is anchored. */
|
||||||
|
public ]b4_location_type[ (]b4_position_type[ loc) {
|
||||||
|
this.begin = this.end = loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
||||||
|
* @@param begin The first position included in the range.
|
||||||
|
* @@param end The first position beyond the range. */
|
||||||
|
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
||||||
|
this.begin = begin;
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print a representation of the location. For this to be correct,
|
||||||
|
* <code>]b4_position_type[</code> should override the <code>equals</code>
|
||||||
|
* method. */
|
||||||
|
public String toString () {
|
||||||
|
if (begin.equals (end))
|
||||||
|
return begin.toString ();
|
||||||
|
else
|
||||||
|
return begin.toString () + "-" + end.toString ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
[ /** Token returned by the scanner to signal the end of its input. */
|
||||||
|
public static final int EOF = 0;]
|
||||||
|
|
||||||
|
b4_token_enums(b4_tokens)
|
||||||
|
|
||||||
|
b4_locations_if([[
|
||||||
|
private ]b4_location_type[ yylloc (YYStack rhs, int n)
|
||||||
|
{
|
||||||
|
if (n > 0)
|
||||||
|
return new ]b4_location_type[ (rhs.locationAt (1).begin, rhs.locationAt (n).end);
|
||||||
|
else
|
||||||
|
return new ]b4_location_type[ (rhs.locationAt (0).end);
|
||||||
|
}]])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Communication interface between the scanner and the Bison-generated
|
||||||
|
* parser <tt>]b4_parser_class_name[</tt>.
|
||||||
|
*/
|
||||||
|
public interface Lexer {
|
||||||
|
]b4_locations_if([[/**
|
||||||
|
* Method to retrieve the beginning position of the last scanned token.
|
||||||
|
* @@return the position at which the last scanned token starts. */
|
||||||
|
]b4_position_type[ getStartPos ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to retrieve the ending position of the last scanned token.
|
||||||
|
* @@return the first position beyond the last scanned token. */
|
||||||
|
]b4_position_type[ getEndPos ();]])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to retrieve the semantic value of the last scanned token.
|
||||||
|
* @@return the semantic value of the last scanned token. */
|
||||||
|
]b4_yystype[ getLVal ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point for the scanner. Returns the token identifier corresponding
|
||||||
|
* to the next token and prepares to return the semantic value
|
||||||
|
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
||||||
|
* @@return the token identifier corresponding to the next token. */
|
||||||
|
int yylex () ]b4_maybe_throws([b4_lex_throws])[;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point for error reporting. Emits an error
|
||||||
|
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
|
||||||
|
*
|
||||||
|
* ]b4_locations_if([[@@param loc The location of the element to which the
|
||||||
|
* error message is related]])[
|
||||||
|
* @@param s The string for the error message. */
|
||||||
|
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
|
||||||
|
}
|
||||||
|
|
||||||
|
b4_lexer_if([[private class YYLexer implements Lexer {
|
||||||
|
]b4_percent_code_get([[lexer]])[
|
||||||
|
}
|
||||||
|
|
||||||
|
]])[/** The object doing lexical analysis for us. */
|
||||||
|
private Lexer yylexer;
|
||||||
|
]
|
||||||
|
b4_parse_param_vars
|
||||||
|
|
||||||
|
b4_lexer_if([[
|
||||||
|
/**
|
||||||
|
* Instantiates the Bison-generated parser.
|
||||||
|
*/
|
||||||
|
public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) {
|
||||||
|
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
||||||
|
]b4_parse_param_cons[
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates the Bison-generated parser.
|
||||||
|
* @@param yylexer The scanner that will supply tokens to the parser.
|
||||||
|
*/
|
||||||
|
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) {
|
||||||
|
this.yylexer = yylexer;
|
||||||
|
]b4_parse_param_cons[
|
||||||
|
}
|
||||||
|
|
||||||
|
private java.io.PrintStream yyDebugStream = System.err;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the <tt>PrintStream</tt> on which the debugging output is
|
||||||
|
* printed.
|
||||||
|
*/
|
||||||
|
public final java.io.PrintStream getDebugStream () { return yyDebugStream; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the <tt>PrintStream</tt> on which the debug output is printed.
|
||||||
|
* @@param s The stream that is used for debugging output.
|
||||||
|
*/
|
||||||
|
public final void setDebugStream(java.io.PrintStream s) { yyDebugStream = s; }
|
||||||
|
|
||||||
|
private int yydebug = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Answer the verbosity of the debugging output; 0 means that all kinds of
|
||||||
|
* output from the parser are suppressed.
|
||||||
|
*/
|
||||||
|
public final int getDebugLevel() { return yydebug; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the verbosity of the debugging output; 0 means that all kinds of
|
||||||
|
* output from the parser are suppressed.
|
||||||
|
* @@param level The verbosity level for debugging output.
|
||||||
|
*/
|
||||||
|
public final void setDebugLevel(int level) { yydebug = level; }
|
||||||
|
|
||||||
|
private final int yylex () ]b4_maybe_throws([b4_lex_throws]) [{
|
||||||
|
return yylexer.yylex ();
|
||||||
|
}
|
||||||
|
protected final void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s) {
|
||||||
|
yylexer.yyerror (]b4_locations_if([loc, ])[s);
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_locations_if([
|
||||||
|
protected final void yyerror (String s) {
|
||||||
|
yylexer.yyerror ((]b4_location_type[)null, s);
|
||||||
|
}
|
||||||
|
protected final void yyerror (]b4_position_type[ loc, String s) {
|
||||||
|
yylexer.yyerror (new ]b4_location_type[ (loc), s);
|
||||||
|
}])
|
||||||
|
|
||||||
|
[protected final void yycdebug (String s) {
|
||||||
|
if (yydebug > 0)
|
||||||
|
yyDebugStream.println (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class YYStack {
|
||||||
|
private int[] stateStack = new int[16];
|
||||||
|
]b4_locations_if([[private ]b4_location_type[[] locStack = new ]b4_location_type[[16];]])[
|
||||||
|
private ]b4_yystype[[] valueStack = new ]b4_yystype[[16];
|
||||||
|
|
||||||
|
public int size = 16;
|
||||||
|
public int height = -1;
|
||||||
|
|
||||||
|
public final void push (int state, ]b4_yystype[ value]dnl
|
||||||
|
b4_locations_if([, ]b4_location_type[ loc])[) {
|
||||||
|
height++;
|
||||||
|
if (size == height)
|
||||||
|
{
|
||||||
|
int[] newStateStack = new int[size * 2];
|
||||||
|
System.arraycopy (stateStack, 0, newStateStack, 0, height);
|
||||||
|
stateStack = newStateStack;
|
||||||
|
]b4_locations_if([[
|
||||||
|
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
||||||
|
System.arraycopy (locStack, 0, newLocStack, 0, height);
|
||||||
|
locStack = newLocStack;]])
|
||||||
|
|
||||||
|
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
||||||
|
System.arraycopy (valueStack, 0, newValueStack, 0, height);
|
||||||
|
valueStack = newValueStack;
|
||||||
|
|
||||||
|
size *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
stateStack[height] = state;
|
||||||
|
]b4_locations_if([[locStack[height] = loc;]])[
|
||||||
|
valueStack[height] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void pop () {
|
||||||
|
height--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void pop (int num) {
|
||||||
|
// Avoid memory leaks... garbage collection is a white lie!
|
||||||
|
if (num > 0) {
|
||||||
|
java.util.Arrays.fill (valueStack, height - num + 1, height, null);
|
||||||
|
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[
|
||||||
|
}
|
||||||
|
height -= num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int stateAt (int i) {
|
||||||
|
return stateStack[height - i];
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_locations_if([[public final ]b4_location_type[ locationAt (int i) {
|
||||||
|
return locStack[height - i];
|
||||||
|
}
|
||||||
|
|
||||||
|
]])[public final ]b4_yystype[ valueAt (int i) {
|
||||||
|
return valueStack[height - i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the state stack on the debug stream.
|
||||||
|
public void print (java.io.PrintStream out)
|
||||||
|
{
|
||||||
|
out.print ("Stack now");
|
||||||
|
|
||||||
|
for (int i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
out.print (' ');
|
||||||
|
out.print (stateStack[i]);
|
||||||
|
}
|
||||||
|
out.println ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returned by a Bison action in order to stop the parsing process and
|
||||||
|
* return success (<tt>true</tt>). */
|
||||||
|
public static final int YYACCEPT = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returned by a Bison action in order to stop the parsing process and
|
||||||
|
* return failure (<tt>false</tt>). */
|
||||||
|
public static final int YYABORT = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returned by a Bison action in order to start error recovery without
|
||||||
|
* printing an error message. */
|
||||||
|
public static final int YYERROR = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returned by a Bison action in order to print an error message and start
|
||||||
|
* error recovery. Formally deprecated in Bison 2.4.2's NEWS entry, where
|
||||||
|
* a plan to phase it out is discussed. */
|
||||||
|
public static final int YYFAIL = 3;
|
||||||
|
|
||||||
|
private static final int YYNEWSTATE = 4;
|
||||||
|
private static final int YYDEFAULT = 5;
|
||||||
|
private static final int YYREDUCE = 6;
|
||||||
|
private static final int YYERRLAB1 = 7;
|
||||||
|
private static final int YYRETURN = 8;
|
||||||
|
|
||||||
|
private int yyerrstatus_ = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether error recovery is being done. In this state, the parser
|
||||||
|
* reads token until it reaches a known state, and then restarts normal
|
||||||
|
* operation. */
|
||||||
|
public final boolean recovering ()
|
||||||
|
{
|
||||||
|
return yyerrstatus_ == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
||||||
|
{
|
||||||
|
]b4_yystype[ yyval;
|
||||||
|
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
||||||
|
|
||||||
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
|
`$$ = $1'. Otherwise, use the top of the stack.
|
||||||
|
|
||||||
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
|
This behavior is undocumented and Bison
|
||||||
|
users should not rely upon it. */
|
||||||
|
if (yylen > 0)
|
||||||
|
yyval = yystack.valueAt (yylen - 1);
|
||||||
|
else
|
||||||
|
yyval = yystack.valueAt (0);
|
||||||
|
|
||||||
|
yy_reduce_print (yyn, yystack);
|
||||||
|
|
||||||
|
switch (yyn)
|
||||||
|
{
|
||||||
|
]b4_user_actions[
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
||||||
|
|
||||||
|
yystack.pop (yylen);
|
||||||
|
yylen = 0;
|
||||||
|
|
||||||
|
/* Shift the result of the reduction. */
|
||||||
|
yyn = yyr1_[yyn];
|
||||||
|
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
||||||
|
if (0 <= yystate && yystate <= yylast_
|
||||||
|
&& yycheck_[yystate] == yystack.stateAt (0))
|
||||||
|
yystate = yytable_[yystate];
|
||||||
|
else
|
||||||
|
yystate = yydefgoto_[yyn - yyntokens_];
|
||||||
|
|
||||||
|
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
||||||
|
return YYNEWSTATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return YYSTR after stripping away unnecessary quotes and
|
||||||
|
backslashes, so that it's suitable for yyerror. The heuristic is
|
||||||
|
that double-quoting is unnecessary unless the string contains an
|
||||||
|
apostrophe, a comma, or backslash (other than backslash-backslash).
|
||||||
|
YYSTR is taken from yytname. */
|
||||||
|
private final String yytnamerr_ (String yystr)
|
||||||
|
{
|
||||||
|
if (yystr.charAt (0) == '"')
|
||||||
|
{
|
||||||
|
StringBuffer yyr = new StringBuffer ();
|
||||||
|
strip_quotes: for (int i = 1; i < yystr.length (); i++)
|
||||||
|
switch (yystr.charAt (i))
|
||||||
|
{
|
||||||
|
case '\'':
|
||||||
|
case ',':
|
||||||
|
break strip_quotes;
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
if (yystr.charAt(++i) != '\\')
|
||||||
|
break strip_quotes;
|
||||||
|
/* Fall through. */
|
||||||
|
default:
|
||||||
|
yyr.append (yystr.charAt (i));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '"':
|
||||||
|
return yyr.toString ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (yystr.equals ("$end"))
|
||||||
|
return "end of input";
|
||||||
|
|
||||||
|
return yystr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------.
|
||||||
|
| Print this symbol on YYOUTPUT. |
|
||||||
|
`--------------------------------*/
|
||||||
|
|
||||||
|
private void yy_symbol_print (String s, int yytype,
|
||||||
|
]b4_yystype[ yyvaluep]dnl
|
||||||
|
b4_locations_if([, Object yylocationp])[)
|
||||||
|
{
|
||||||
|
if (yydebug > 0)
|
||||||
|
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
|
||||||
|
+ yytname_[yytype] + " ("]b4_locations_if([
|
||||||
|
+ yylocationp + ": "])[
|
||||||
|
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse input from the scanner that was specified at object construction
|
||||||
|
* time. Return whether the end of the input was reached successfully.
|
||||||
|
*
|
||||||
|
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||||
|
* imply that there were no syntax errors.
|
||||||
|
*/
|
||||||
|
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
|
||||||
|
{
|
||||||
|
/// Lookahead and lookahead in internal form.
|
||||||
|
int yychar = yyempty_;
|
||||||
|
int yytoken = 0;
|
||||||
|
|
||||||
|
/* State. */
|
||||||
|
int yyn = 0;
|
||||||
|
int yylen = 0;
|
||||||
|
int yystate = 0;
|
||||||
|
|
||||||
|
YYStack yystack = new YYStack ();
|
||||||
|
|
||||||
|
/* Error handling. */
|
||||||
|
int yynerrs_ = 0;
|
||||||
|
]b4_locations_if([/// The location where the error started.
|
||||||
|
]b4_location_type[ yyerrloc = null;
|
||||||
|
|
||||||
|
/// ]b4_location_type[ of the lookahead.
|
||||||
|
]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);
|
||||||
|
|
||||||
|
/// @@$.
|
||||||
|
]b4_location_type[ yyloc;])
|
||||||
|
|
||||||
|
/// Semantic value of the lookahead.
|
||||||
|
b4_yystype[ yylval = null;
|
||||||
|
|
||||||
|
int yyresult;
|
||||||
|
|
||||||
|
yycdebug ("Starting parse\n");
|
||||||
|
yyerrstatus_ = 0;
|
||||||
|
|
||||||
|
]m4_ifdef([b4_initial_action], [
|
||||||
|
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
||||||
|
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
||||||
|
/* User initialization code. */
|
||||||
|
b4_user_initial_action
|
||||||
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
m4_popdef([b4_at_dollar])])dnl
|
||||||
|
|
||||||
|
[ /* Initialize the stack. */
|
||||||
|
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||||
|
|
||||||
|
int label = YYNEWSTATE;
|
||||||
|
for (;;)
|
||||||
|
switch (label)
|
||||||
|
{
|
||||||
|
/* New state. Unlike in the C/C++ skeletons, the state is already
|
||||||
|
pushed when we come here. */
|
||||||
|
case YYNEWSTATE:
|
||||||
|
yycdebug ("Entering state " + yystate + "\n");
|
||||||
|
if (yydebug > 0)
|
||||||
|
yystack.print (yyDebugStream);
|
||||||
|
|
||||||
|
/* Accept? */
|
||||||
|
if (yystate == yyfinal_)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* Take a decision. First try without lookahead. */
|
||||||
|
yyn = yypact_[yystate];
|
||||||
|
if (yyn == yypact_ninf_)
|
||||||
|
{
|
||||||
|
label = YYDEFAULT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read a lookahead token. */
|
||||||
|
if (yychar == yyempty_)
|
||||||
|
{
|
||||||
|
yycdebug ("Reading a token: ");
|
||||||
|
yychar = yylex ();]
|
||||||
|
b4_locations_if([[
|
||||||
|
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
||||||
|
yylexer.getEndPos ());]])
|
||||||
|
yylval = yylexer.getLVal ();[
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert token to internal form. */
|
||||||
|
if (yychar <= EOF)
|
||||||
|
{
|
||||||
|
yychar = yytoken = EOF;
|
||||||
|
yycdebug ("Now at end of input.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yytoken = yytranslate_ (yychar);
|
||||||
|
yy_symbol_print ("Next token is", yytoken,
|
||||||
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
|
detect an error, take that action. */
|
||||||
|
yyn += yytoken;
|
||||||
|
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
||||||
|
label = YYDEFAULT;
|
||||||
|
|
||||||
|
/* <= 0 means reduce or error. */
|
||||||
|
else if ((yyn = yytable_[yyn]) <= 0)
|
||||||
|
{
|
||||||
|
if (yyn == 0 || yyn == yytable_ninf_)
|
||||||
|
label = YYFAIL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yyn = -yyn;
|
||||||
|
label = YYREDUCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Shift the lookahead token. */
|
||||||
|
yy_symbol_print ("Shifting", yytoken,
|
||||||
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
|
|
||||||
|
/* Discard the token being shifted. */
|
||||||
|
yychar = yyempty_;
|
||||||
|
|
||||||
|
/* Count tokens shifted since error; after three, turn off error
|
||||||
|
status. */
|
||||||
|
if (yyerrstatus_ > 0)
|
||||||
|
--yyerrstatus_;
|
||||||
|
|
||||||
|
yystate = yyn;
|
||||||
|
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||||
|
label = YYNEWSTATE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------.
|
||||||
|
| yydefault -- do the default action for the current state. |
|
||||||
|
`-----------------------------------------------------------*/
|
||||||
|
case YYDEFAULT:
|
||||||
|
yyn = yydefact_[yystate];
|
||||||
|
if (yyn == 0)
|
||||||
|
label = YYFAIL;
|
||||||
|
else
|
||||||
|
label = YYREDUCE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*-----------------------------.
|
||||||
|
| yyreduce -- Do a reduction. |
|
||||||
|
`-----------------------------*/
|
||||||
|
case YYREDUCE:
|
||||||
|
yylen = yyr2_[yyn];
|
||||||
|
label = yyaction (yyn, yystack, yylen);
|
||||||
|
yystate = yystack.stateAt (0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*------------------------------------.
|
||||||
|
| yyerrlab -- here on detecting error |
|
||||||
|
`------------------------------------*/
|
||||||
|
case YYFAIL:
|
||||||
|
/* If not already recovering from an error, report this error. */
|
||||||
|
if (yyerrstatus_ == 0)
|
||||||
|
{
|
||||||
|
++yynerrs_;
|
||||||
|
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_locations_if([yyerrloc = yylloc;])[
|
||||||
|
if (yyerrstatus_ == 3)
|
||||||
|
{
|
||||||
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
|
error, discard it. */
|
||||||
|
|
||||||
|
if (yychar <= EOF)
|
||||||
|
{
|
||||||
|
/* Return failure if at end of input. */
|
||||||
|
if (yychar == EOF)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
yychar = yyempty_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
|
token. */
|
||||||
|
label = YYERRLAB1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*---------------------------------------------------.
|
||||||
|
| errorlab -- error raised explicitly by YYERROR. |
|
||||||
|
`---------------------------------------------------*/
|
||||||
|
case YYERROR:
|
||||||
|
|
||||||
|
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
||||||
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
|
this YYERROR. */
|
||||||
|
yystack.pop (yylen);
|
||||||
|
yylen = 0;
|
||||||
|
yystate = yystack.stateAt (0);
|
||||||
|
label = YYERRLAB1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------.
|
||||||
|
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||||
|
`-------------------------------------------------------------*/
|
||||||
|
case YYERRLAB1:
|
||||||
|
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
yyn = yypact_[yystate];
|
||||||
|
if (yyn != yypact_ninf_)
|
||||||
|
{
|
||||||
|
yyn += yyterror_;
|
||||||
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||||
|
{
|
||||||
|
yyn = yytable_[yyn];
|
||||||
|
if (0 < yyn)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
|
if (yystack.height == 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||||
|
yystack.pop ();
|
||||||
|
yystate = yystack.stateAt (0);
|
||||||
|
if (yydebug > 0)
|
||||||
|
yystack.print (yyDebugStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_locations_if([
|
||||||
|
/* Muck with the stack to setup for yylloc. */
|
||||||
|
yystack.push (0, null, yylloc);
|
||||||
|
yystack.push (0, null, yyerrloc);
|
||||||
|
yyloc = yylloc (yystack, 2);
|
||||||
|
yystack.pop (2);])[
|
||||||
|
|
||||||
|
/* Shift the error token. */
|
||||||
|
yy_symbol_print ("Shifting", yystos_[yyn],
|
||||||
|
yylval]b4_locations_if([, yyloc])[);
|
||||||
|
|
||||||
|
yystate = yyn;
|
||||||
|
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||||
|
label = YYNEWSTATE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Accept. */
|
||||||
|
case YYACCEPT:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* Abort. */
|
||||||
|
case YYABORT:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate an error message.
|
||||||
|
private String yysyntax_error (int yystate, int tok)
|
||||||
|
{
|
||||||
|
if (errorVerbose)
|
||||||
|
{
|
||||||
|
int yyn = yypact_[yystate];
|
||||||
|
if (yypact_ninf_ < yyn && yyn <= yylast_)
|
||||||
|
{
|
||||||
|
StringBuffer res;
|
||||||
|
|
||||||
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
|
YYCHECK. */
|
||||||
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
|
|
||||||
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
|
int count = 0;
|
||||||
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
|
++count;
|
||||||
|
|
||||||
|
// FIXME: This method of building the message is not compatible
|
||||||
|
// with internationalization.
|
||||||
|
res = new StringBuffer ("syntax error, unexpected ");
|
||||||
|
res.append (yytnamerr_ (yytname_[tok]));
|
||||||
|
if (count < 5)
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
|
if (yycheck_[x + yyn] == x && x != yyterror_)
|
||||||
|
{
|
||||||
|
res.append (count++ == 0 ? ", expecting " : " or ");
|
||||||
|
res.append (yytnamerr_ (yytname_[x]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res.toString ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "syntax error";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||||
|
STATE-NUM. */
|
||||||
|
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
||||||
|
private static final ]b4_int_type_for([b4_pact])[ yypact_[] =
|
||||||
|
{
|
||||||
|
]b4_pact[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
|
doesn't specify something else to do. Zero means the default is an
|
||||||
|
error. */
|
||||||
|
private static final ]b4_int_type_for([b4_defact])[ yydefact_[] =
|
||||||
|
{
|
||||||
|
]b4_defact[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPGOTO[NTERM-NUM]. */
|
||||||
|
private static final ]b4_int_type_for([b4_pgoto])[ yypgoto_[] =
|
||||||
|
{
|
||||||
|
]b4_pgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFGOTO[NTERM-NUM]. */
|
||||||
|
private static final ]b4_int_type_for([b4_defgoto])[
|
||||||
|
yydefgoto_[] =
|
||||||
|
{
|
||||||
|
]b4_defgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
|
positive, shift that token. If negative, reduce the rule which
|
||||||
|
number is the opposite. If zero, do what YYDEFACT says. */
|
||||||
|
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
||||||
|
private static final ]b4_int_type_for([b4_table])[
|
||||||
|
yytable_[] =
|
||||||
|
{
|
||||||
|
]b4_table[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYCHECK. */
|
||||||
|
private static final ]b4_int_type_for([b4_check])[
|
||||||
|
yycheck_[] =
|
||||||
|
{
|
||||||
|
]b4_check[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* STOS_[STATE-NUM] -- The (internal number of the) accessing
|
||||||
|
symbol of state STATE-NUM. */
|
||||||
|
private static final ]b4_int_type_for([b4_stos])[
|
||||||
|
yystos_[] =
|
||||||
|
{
|
||||||
|
]b4_stos[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
||||||
|
to YYLEX-NUM. */
|
||||||
|
private static final ]b4_int_type_for([b4_toknum])[
|
||||||
|
yytoken_number_[] =
|
||||||
|
{
|
||||||
|
]b4_toknum[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
|
private static final ]b4_int_type_for([b4_r1])[
|
||||||
|
yyr1_[] =
|
||||||
|
{
|
||||||
|
]b4_r1[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
|
private static final ]b4_int_type_for([b4_r2])[
|
||||||
|
yyr2_[] =
|
||||||
|
{
|
||||||
|
]b4_r2[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
|
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||||
|
private static final String yytname_[] =
|
||||||
|
{
|
||||||
|
]b4_tname[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
|
private static final ]b4_int_type_for([b4_rhs])[ yyrhs_[] =
|
||||||
|
{
|
||||||
|
]b4_rhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||||
|
YYRHS. */
|
||||||
|
private static final ]b4_int_type_for([b4_prhs])[ yyprhs_[] =
|
||||||
|
{
|
||||||
|
]b4_prhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||||
|
private static final ]b4_int_type_for([b4_rline])[ yyrline_[] =
|
||||||
|
{
|
||||||
|
]b4_rline[
|
||||||
|
};
|
||||||
|
|
||||||
|
// Report on the debug stream that the rule yyrule is going to be reduced.
|
||||||
|
private void yy_reduce_print (int yyrule, YYStack yystack)
|
||||||
|
{
|
||||||
|
if (yydebug == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int yylno = yyrline_[yyrule];
|
||||||
|
int yynrhs = yyr2_[yyrule];
|
||||||
|
/* Print the symbols being reduced, and their result. */
|
||||||
|
yycdebug ("Reducing stack by rule " + (yyrule - 1)
|
||||||
|
+ " (line " + yylno + "), ");
|
||||||
|
|
||||||
|
/* The symbols being reduced. */
|
||||||
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
|
yy_symbol_print (" $" + (yyi + 1) + " =",
|
||||||
|
yyrhs_[yyprhs_[yyrule] + yyi],
|
||||||
|
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
|
private static final ]b4_int_type_for([b4_translate])[ yytranslate_table_[] =
|
||||||
|
{
|
||||||
|
]b4_translate[
|
||||||
|
};
|
||||||
|
|
||||||
|
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
||||||
|
{
|
||||||
|
if (t >= 0 && t <= yyuser_token_number_max_)
|
||||||
|
return yytranslate_table_[t];
|
||||||
|
else
|
||||||
|
return yyundef_token_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int yylast_ = ]b4_last[;
|
||||||
|
private static final int yynnts_ = ]b4_nterms_number[;
|
||||||
|
private static final int yyempty_ = -2;
|
||||||
|
private static final int yyfinal_ = ]b4_final_state_number[;
|
||||||
|
private static final int yyterror_ = 1;
|
||||||
|
private static final int yyerrcode_ = 256;
|
||||||
|
private static final int yyntokens_ = ]b4_tokens_number[;
|
||||||
|
|
||||||
|
private static final int yyuser_token_number_max_ = ]b4_user_token_number_max[;
|
||||||
|
private static final int yyundef_token_ = ]b4_undef_token_number[;
|
||||||
|
|
||||||
|
]/* User implementation code. */
|
||||||
|
b4_percent_code_get[]dnl
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
b4_epilogue
|
||||||
|
m4_divert_pop(0)dnl
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
## Copyright (C) 2002, 2005-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
## Foundation, Inc.
|
|
||||||
|
|
||||||
## This program 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
|
|
||||||
## (at your option) any later version.
|
|
||||||
##
|
|
||||||
## This program is distributed in the hope that it will be useful,
|
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
## GNU General Public License for more details.
|
|
||||||
##
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
dist_pkgdata_DATA = \
|
|
||||||
data/README.md \
|
|
||||||
data/bison-default.css
|
|
||||||
|
|
||||||
skeletonsdir = $(pkgdatadir)/skeletons
|
|
||||||
dist_skeletons_DATA = \
|
|
||||||
data/skeletons/bison.m4 \
|
|
||||||
data/skeletons/c++-skel.m4 \
|
|
||||||
data/skeletons/c++.m4 \
|
|
||||||
data/skeletons/c-like.m4 \
|
|
||||||
data/skeletons/c-skel.m4 \
|
|
||||||
data/skeletons/c.m4 \
|
|
||||||
data/skeletons/glr.c \
|
|
||||||
data/skeletons/glr.cc \
|
|
||||||
data/skeletons/glr2.cc \
|
|
||||||
data/skeletons/java-skel.m4 \
|
|
||||||
data/skeletons/java.m4 \
|
|
||||||
data/skeletons/lalr1.cc \
|
|
||||||
data/skeletons/lalr1.java \
|
|
||||||
data/skeletons/location.cc \
|
|
||||||
data/skeletons/stack.hh \
|
|
||||||
data/skeletons/traceon.m4 \
|
|
||||||
data/skeletons/variant.hh \
|
|
||||||
data/skeletons/yacc.c
|
|
||||||
|
|
||||||
# Experimental support for the D language.
|
|
||||||
dist_skeletons_DATA += \
|
|
||||||
data/skeletons/d-skel.m4 \
|
|
||||||
data/skeletons/d.m4 \
|
|
||||||
data/skeletons/lalr1.d
|
|
||||||
|
|
||||||
m4sugardir = $(pkgdatadir)/m4sugar
|
|
||||||
dist_m4sugar_DATA = \
|
|
||||||
data/m4sugar/foreach.m4 \
|
|
||||||
data/m4sugar/m4sugar.m4
|
|
||||||
|
|
||||||
xsltdir = $(pkgdatadir)/xslt
|
|
||||||
dist_xslt_DATA = \
|
|
||||||
data/xslt/bison.xsl \
|
|
||||||
data/xslt/xml2dot.xsl \
|
|
||||||
data/xslt/xml2text.xsl \
|
|
||||||
data/xslt/xml2xhtml.xsl
|
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
|
# Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# We do want M4 expansion after # for CPP macros.
|
||||||
|
m4_changecom()
|
||||||
|
m4_divert_push(0)dnl
|
||||||
|
@output(b4_dir_prefix[]position.hh@)@
|
||||||
|
b4_copyright([Positions for Bison parsers in C++],
|
||||||
|
[2002-2007, 2009-2010])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file position.hh
|
||||||
|
** Define the ]b4_namespace_ref[::position class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BISON_POSITION_HH
|
||||||
|
# define BISON_POSITION_HH
|
||||||
|
|
||||||
|
# include <iostream>
|
||||||
|
# include <string>
|
||||||
|
# include <algorithm>
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
/// Abstract a position.
|
||||||
|
class position
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
]m4_ifdef([b4_location_constructors], [
|
||||||
|
/// Construct a position.
|
||||||
|
position ()
|
||||||
|
: filename (0), line (]b4_location_initial_line[), column (]b4_location_initial_column[)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
])[
|
||||||
|
/// Initialization.
|
||||||
|
inline void initialize (]b4_percent_define_get([[filename_type]])[* fn)
|
||||||
|
{
|
||||||
|
filename = fn;
|
||||||
|
line = ]b4_location_initial_line[;
|
||||||
|
column = ]b4_location_initial_column[;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \name Line and Column related manipulators
|
||||||
|
** \{ */
|
||||||
|
public:
|
||||||
|
/// (line related) Advance to the COUNT next lines.
|
||||||
|
inline void lines (int count = 1)
|
||||||
|
{
|
||||||
|
column = ]b4_location_initial_column[;
|
||||||
|
line += count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// (column related) Advance to the COUNT next columns.
|
||||||
|
inline void columns (int count = 1)
|
||||||
|
{
|
||||||
|
column = std::max (]b4_location_initial_column[u, column + count);
|
||||||
|
}
|
||||||
|
/** \} */
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// File name to which this position refers.
|
||||||
|
]b4_percent_define_get([[filename_type]])[* filename;
|
||||||
|
/// Current line number.
|
||||||
|
unsigned int line;
|
||||||
|
/// Current column number.
|
||||||
|
unsigned int column;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Add and assign a position.
|
||||||
|
inline const position&
|
||||||
|
operator+= (position& res, const int width)
|
||||||
|
{
|
||||||
|
res.columns (width);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add two position objects.
|
||||||
|
inline const position
|
||||||
|
operator+ (const position& begin, const int width)
|
||||||
|
{
|
||||||
|
position res = begin;
|
||||||
|
return res += width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add and assign a position.
|
||||||
|
inline const position&
|
||||||
|
operator-= (position& res, const int width)
|
||||||
|
{
|
||||||
|
return res += -width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add two position objects.
|
||||||
|
inline const position
|
||||||
|
operator- (const position& begin, const int width)
|
||||||
|
{
|
||||||
|
return begin + -width;
|
||||||
|
}
|
||||||
|
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||||
|
/// Compare two position objects.
|
||||||
|
inline bool
|
||||||
|
operator== (const position& pos1, const position& pos2)
|
||||||
|
{
|
||||||
|
return (pos1.line == pos2.line
|
||||||
|
&& pos1.column == pos2.column
|
||||||
|
&& (pos1.filename == pos2.filename
|
||||||
|
|| (pos1.filename && pos2.filename
|
||||||
|
&& *pos1.filename == *pos2.filename)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Compare two position objects.
|
||||||
|
inline bool
|
||||||
|
operator!= (const position& pos1, const position& pos2)
|
||||||
|
{
|
||||||
|
return !(pos1 == pos2);
|
||||||
|
}
|
||||||
|
]])[
|
||||||
|
/** \brief Intercept output stream redirection.
|
||||||
|
** \param ostr the destination output stream
|
||||||
|
** \param pos a reference to the position to redirect
|
||||||
|
*/
|
||||||
|
inline std::ostream&
|
||||||
|
operator<< (std::ostream& ostr, const position& pos)
|
||||||
|
{
|
||||||
|
if (pos.filename)
|
||||||
|
ostr << *pos.filename << ':';
|
||||||
|
return ostr << pos.line << '.' << pos.column;
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_namespace_close[
|
||||||
|
#endif // not BISON_POSITION_HH]
|
||||||
|
@output(b4_dir_prefix[]location.hh@)@
|
||||||
|
b4_copyright([Locations for Bison parsers in C++],
|
||||||
|
[2002-2007, 2009-2010])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file location.hh
|
||||||
|
** Define the ]b4_namespace_ref[::location class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BISON_LOCATION_HH
|
||||||
|
# define BISON_LOCATION_HH
|
||||||
|
|
||||||
|
# include <iostream>
|
||||||
|
# include <string>
|
||||||
|
# include "position.hh"
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
|
||||||
|
/// Abstract a location.
|
||||||
|
class location
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
]m4_ifdef([b4_location_constructors], [
|
||||||
|
/// Construct a location.
|
||||||
|
location ()
|
||||||
|
: begin (), end ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
])[
|
||||||
|
/// Initialization.
|
||||||
|
inline void initialize (]b4_percent_define_get([[filename_type]])[* fn)
|
||||||
|
{
|
||||||
|
begin.initialize (fn);
|
||||||
|
end = begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \name Line and Column related manipulators
|
||||||
|
** \{ */
|
||||||
|
public:
|
||||||
|
/// Reset initial location to final location.
|
||||||
|
inline void step ()
|
||||||
|
{
|
||||||
|
begin = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Extend the current location to the COUNT next columns.
|
||||||
|
inline void columns (unsigned int count = 1)
|
||||||
|
{
|
||||||
|
end += count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Extend the current location to the COUNT next lines.
|
||||||
|
inline void lines (unsigned int count = 1)
|
||||||
|
{
|
||||||
|
end.lines (count);
|
||||||
|
}
|
||||||
|
/** \} */
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Beginning of the located region.
|
||||||
|
position begin;
|
||||||
|
/// End of the located region.
|
||||||
|
position end;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Join two location objects to create a location.
|
||||||
|
inline const location operator+ (const location& begin, const location& end)
|
||||||
|
{
|
||||||
|
location res = begin;
|
||||||
|
res.end = end.end;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add two location objects.
|
||||||
|
inline const location operator+ (const location& begin, unsigned int width)
|
||||||
|
{
|
||||||
|
location res = begin;
|
||||||
|
res.columns (width);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add and assign a location.
|
||||||
|
inline location& operator+= (location& res, unsigned int width)
|
||||||
|
{
|
||||||
|
res.columns (width);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||||
|
/// Compare two location objects.
|
||||||
|
inline bool
|
||||||
|
operator== (const location& loc1, const location& loc2)
|
||||||
|
{
|
||||||
|
return loc1.begin == loc2.begin && loc1.end == loc2.end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Compare two location objects.
|
||||||
|
inline bool
|
||||||
|
operator!= (const location& loc1, const location& loc2)
|
||||||
|
{
|
||||||
|
return !(loc1 == loc2);
|
||||||
|
}
|
||||||
|
]])[
|
||||||
|
/** \brief Intercept output stream redirection.
|
||||||
|
** \param ostr the destination output stream
|
||||||
|
** \param loc a reference to the location to redirect
|
||||||
|
**
|
||||||
|
** Avoid duplicate information.
|
||||||
|
*/
|
||||||
|
inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
|
||||||
|
{
|
||||||
|
position last = loc.end - 1;
|
||||||
|
ostr << loc.begin;
|
||||||
|
if (last.filename
|
||||||
|
&& (!loc.begin.filename
|
||||||
|
|| *loc.begin.filename != *last.filename))
|
||||||
|
ostr << '-' << last;
|
||||||
|
else if (loc.begin.line != last.line)
|
||||||
|
ostr << '-' << last.line << '.' << last.column;
|
||||||
|
else if (loc.begin.column != last.column)
|
||||||
|
ostr << '-' << last.column;
|
||||||
|
return ostr;
|
||||||
|
}
|
||||||
|
|
||||||
|
]b4_namespace_close[
|
||||||
|
|
||||||
|
#endif // not BISON_LOCATION_HH]
|
||||||
|
m4_divert_pop(0)
|
||||||
|
m4_changecom([#])
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../submodules/autoconf/lib/m4sugar/foreach.m4
|
|
||||||
@@ -0,0 +1,400 @@
|
|||||||
|
# -*- Autoconf -*-
|
||||||
|
# This file is part of Autoconf.
|
||||||
|
# foreach-based replacements for recursive functions.
|
||||||
|
# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes
|
||||||
|
# GNU M4 1.6 by requiring more memory and macro expansions.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# As a special exception, the Free Software Foundation gives unlimited
|
||||||
|
# permission to copy, distribute and modify the configure scripts that
|
||||||
|
# are the output of Autoconf. You need not follow the terms of the GNU
|
||||||
|
# General Public License when using or distributing such scripts, even
|
||||||
|
# though portions of the text of Autoconf appear in them. The GNU
|
||||||
|
# General Public License (GPL) does govern all other use of the material
|
||||||
|
# that constitutes the Autoconf program.
|
||||||
|
#
|
||||||
|
# Certain portions of the Autoconf source text are designed to be copied
|
||||||
|
# (in certain cases, depending on the input) into the output of
|
||||||
|
# Autoconf. We call these the "data" portions. The rest of the Autoconf
|
||||||
|
# source text consists of comments plus executable code that decides which
|
||||||
|
# of the data portions to output in any given case. We call these
|
||||||
|
# comments and executable code the "non-data" portions. Autoconf never
|
||||||
|
# copies any of the non-data portions into its output.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of Autoconf
|
||||||
|
# released by the Free Software Foundation. When you make and
|
||||||
|
# distribute a modified version of Autoconf, you may extend this special
|
||||||
|
# exception to the GPL to apply to your modified version as well, *unless*
|
||||||
|
# your modified version has the potential to copy into its output some
|
||||||
|
# of the text that was the non-data portion of the version that you started
|
||||||
|
# with. (In other words, unless your change moves or copies text from
|
||||||
|
# the non-data portions to the data portions.) If your modification has
|
||||||
|
# such potential, you must delete any notice of this special exception
|
||||||
|
# to the GPL from your modified version.
|
||||||
|
#
|
||||||
|
# Written by Eric Blake.
|
||||||
|
#
|
||||||
|
|
||||||
|
# In M4 1.4.x, every byte of $@ is rescanned. This means that an
|
||||||
|
# algorithm on n arguments that recurses with one less argument each
|
||||||
|
# iteration will scan n * (n + 1) / 2 arguments, for O(n^2) time. In
|
||||||
|
# M4 1.6, this was fixed so that $@ is only scanned once, then
|
||||||
|
# back-references are made to information stored about the scan.
|
||||||
|
# Thus, n iterations need only scan n arguments, for O(n) time.
|
||||||
|
# Additionally, in M4 1.4.x, recursive algorithms did not clean up
|
||||||
|
# memory very well, requiring O(n^2) memory rather than O(n) for n
|
||||||
|
# iterations.
|
||||||
|
#
|
||||||
|
# This file is designed to overcome the quadratic nature of $@
|
||||||
|
# recursion by writing a variant of m4_foreach that uses m4_for rather
|
||||||
|
# than $@ recursion to operate on the list. This involves more macro
|
||||||
|
# expansions, but avoids the need to rescan a quadratic number of
|
||||||
|
# arguments, making these replacements very attractive for M4 1.4.x.
|
||||||
|
# On the other hand, in any version of M4, expanding additional macros
|
||||||
|
# costs additional time; therefore, in M4 1.6, where $@ recursion uses
|
||||||
|
# fewer macros, these replacements actually pessimize performance.
|
||||||
|
# Additionally, the use of $10 to mean the tenth argument violates
|
||||||
|
# POSIX; although all versions of m4 1.4.x support this meaning, a
|
||||||
|
# future m4 version may switch to take it as the first argument
|
||||||
|
# concatenated with a literal 0, so the implementations in this file
|
||||||
|
# are not future-proof. Thus, this file is conditionally included as
|
||||||
|
# part of m4_init(), only when it is detected that M4 probably has
|
||||||
|
# quadratic behavior (ie. it lacks the macro __m4_version__).
|
||||||
|
#
|
||||||
|
# Please keep this file in sync with m4sugar.m4.
|
||||||
|
|
||||||
|
# m4_foreach(VARIABLE, LIST, EXPRESSION)
|
||||||
|
# --------------------------------------
|
||||||
|
# Expand EXPRESSION assigning each value of the LIST to VARIABLE.
|
||||||
|
# LIST should have the form `item_1, item_2, ..., item_n', i.e. the
|
||||||
|
# whole list must *quoted*. Quote members too if you don't want them
|
||||||
|
# to be expanded.
|
||||||
|
#
|
||||||
|
# This version minimizes the number of times that $@ is evaluated by
|
||||||
|
# using m4_for to generate a boilerplate into VARIABLE then passing $@
|
||||||
|
# to that temporary macro. Thus, the recursion is done in m4_for
|
||||||
|
# without reparsing any user input, and is not quadratic. For an idea
|
||||||
|
# of how this works, note that m4_foreach(i,[1,2],[i]) defines i to be
|
||||||
|
# m4_define([$1],[$3])$2[]m4_define([$1],[$4])$2[]m4_popdef([i])
|
||||||
|
# then calls i([i],[i],[1],[2]).
|
||||||
|
m4_define([m4_foreach],
|
||||||
|
[m4_if([$2], [], [], [_$0([$1], [$3], $2)])])
|
||||||
|
|
||||||
|
m4_define([_m4_foreach],
|
||||||
|
[m4_define([$1], m4_pushdef([$1])_m4_for([$1], [3], [$#], [1],
|
||||||
|
[$0_([1], [2], _m4_defn([$1]))])[m4_popdef([$1])])m4_indir([$1], $@)])
|
||||||
|
|
||||||
|
m4_define([_m4_foreach_],
|
||||||
|
[[m4_define([$$1], [$$3])$$2[]]])
|
||||||
|
|
||||||
|
# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
|
||||||
|
# -----------------------------------------------------------
|
||||||
|
# Find the first VAL that SWITCH matches, and expand the corresponding
|
||||||
|
# IF-VAL. If there are no matches, expand DEFAULT.
|
||||||
|
#
|
||||||
|
# Use m4_for to create a temporary macro in terms of a boilerplate
|
||||||
|
# m4_if with final cleanup. If $# is even, we have DEFAULT; if it is
|
||||||
|
# odd, then rounding the last $# up in the temporary macro is
|
||||||
|
# harmless. For example, both m4_case(1,2,3,4,5) and
|
||||||
|
# m4_case(1,2,3,4,5,6) result in the intermediate _m4_case being
|
||||||
|
# m4_if([$1],[$2],[$3],[$1],[$4],[$5],_m4_popdef([_m4_case])[$6])
|
||||||
|
m4_define([m4_case],
|
||||||
|
[m4_if(m4_eval([$# <= 2]), [1], [$2],
|
||||||
|
[m4_pushdef([_$0], [m4_if(]m4_for([_m4_count], [2], m4_decr([$#]), [2],
|
||||||
|
[_$0_([1], _m4_count, m4_incr(_m4_count))])[_m4_popdef(
|
||||||
|
[_$0])]m4_dquote($m4_eval([($# + 1) & ~1]))[)])_$0($@)])])
|
||||||
|
|
||||||
|
m4_define([_m4_case_],
|
||||||
|
[[[$$1],[$$2],[$$3],]])
|
||||||
|
|
||||||
|
# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
|
||||||
|
# -----------------------------------------------------
|
||||||
|
# m4 equivalent of
|
||||||
|
#
|
||||||
|
# if (SWITCH =~ RE1)
|
||||||
|
# VAL1;
|
||||||
|
# elif (SWITCH =~ RE2)
|
||||||
|
# VAL2;
|
||||||
|
# elif ...
|
||||||
|
# ...
|
||||||
|
# else
|
||||||
|
# DEFAULT
|
||||||
|
#
|
||||||
|
# We build the temporary macro _m4_b:
|
||||||
|
# m4_define([_m4_b], _m4_defn([_m4_bmatch]))_m4_b([$1], [$2], [$3])...
|
||||||
|
# _m4_b([$1], [$m-1], [$m])_m4_b([], [], [$m+1]_m4_popdef([_m4_b]))
|
||||||
|
# then invoke m4_unquote(_m4_b($@)), for concatenation with later text.
|
||||||
|
m4_define([m4_bmatch],
|
||||||
|
[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
|
||||||
|
[$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
|
||||||
|
[$#], 2, [$2],
|
||||||
|
[m4_define([_m4_b], m4_pushdef([_m4_b])[m4_define([_m4_b],
|
||||||
|
_m4_defn([_$0]))]_m4_for([_m4_b], [3], m4_eval([($# + 1) / 2 * 2 - 1]),
|
||||||
|
[2], [_$0_([1], m4_decr(_m4_b), _m4_b)])[_m4_b([], [],]m4_dquote(
|
||||||
|
[$]m4_incr(_m4_b))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])])
|
||||||
|
|
||||||
|
m4_define([_m4_bmatch],
|
||||||
|
[m4_if(m4_bregexp([$1], [$2]), [-1], [], [[$3]m4_define([$0])])])
|
||||||
|
|
||||||
|
m4_define([_m4_bmatch_],
|
||||||
|
[[_m4_b([$$1], [$$2], [$$3])]])
|
||||||
|
|
||||||
|
|
||||||
|
# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT])
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
# Similar to m4_if, except that each TEST is expanded when encountered.
|
||||||
|
# If the expansion of TESTn matches the string VALn, the result is IF-VALn.
|
||||||
|
# The result is DEFAULT if no tests passed. This macro allows
|
||||||
|
# short-circuiting of expensive tests, where it pays to arrange quick
|
||||||
|
# filter tests to run first.
|
||||||
|
#
|
||||||
|
# m4_cond already guarantees either 3*n or 3*n + 1 arguments, 1 <= n.
|
||||||
|
# We only have to speed up _m4_cond, by building the temporary _m4_c:
|
||||||
|
# m4_define([_m4_c], _m4_defn([m4_unquote]))_m4_c([m4_if(($1), [($2)],
|
||||||
|
# [[$3]m4_define([_m4_c])])])_m4_c([m4_if(($4), [($5)],
|
||||||
|
# [[$6]m4_define([_m4_c])])])..._m4_c([m4_if(($m-2), [($m-1)],
|
||||||
|
# [[$m]m4_define([_m4_c])])])_m4_c([[$m+1]]_m4_popdef([_m4_c]))
|
||||||
|
# We invoke m4_unquote(_m4_c($@)), for concatenation with later text.
|
||||||
|
m4_define([_m4_cond],
|
||||||
|
[m4_define([_m4_c], m4_pushdef([_m4_c])[m4_define([_m4_c],
|
||||||
|
_m4_defn([m4_unquote]))]_m4_for([_m4_c], [2], m4_eval([$# / 3 * 3 - 1]), [3],
|
||||||
|
[$0_(m4_decr(_m4_c), _m4_c, m4_incr(_m4_c))])[_m4_c(]m4_dquote(m4_dquote(
|
||||||
|
[$]m4_eval([$# / 3 * 3 + 1])))[_m4_popdef([_m4_c]))])m4_unquote(_m4_c($@))])
|
||||||
|
|
||||||
|
m4_define([_m4_cond_],
|
||||||
|
[[_m4_c([m4_if(($$1), [($$2)], [[$$3]m4_define([_m4_c])])])]])
|
||||||
|
|
||||||
|
# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
|
||||||
|
# ----------------------------------------------------
|
||||||
|
# m4 equivalent of
|
||||||
|
#
|
||||||
|
# $_ = STRING;
|
||||||
|
# s/RE1/SUBST1/g;
|
||||||
|
# s/RE2/SUBST2/g;
|
||||||
|
# ...
|
||||||
|
#
|
||||||
|
# m4_bpatsubsts already validated an odd number of arguments; we only
|
||||||
|
# need to speed up _m4_bpatsubsts. To avoid nesting, we build the
|
||||||
|
# temporary _m4_p:
|
||||||
|
# m4_define([_m4_p], [$1])m4_define([_m4_p],
|
||||||
|
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$2], [$3]))m4_define([_m4_p],
|
||||||
|
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$4], [$5]))m4_define([_m4_p],...
|
||||||
|
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$m-1], [$m]))m4_unquote(
|
||||||
|
# _m4_defn([_m4_p])_m4_popdef([_m4_p]))
|
||||||
|
m4_define([_m4_bpatsubsts],
|
||||||
|
[m4_define([_m4_p], m4_pushdef([_m4_p])[m4_define([_m4_p],
|
||||||
|
]m4_dquote([$]1)[)]_m4_for([_m4_p], [3], [$#], [2], [$0_(m4_decr(_m4_p),
|
||||||
|
_m4_p)])[m4_unquote(_m4_defn([_m4_p])_m4_popdef([_m4_p]))])_m4_p($@)])
|
||||||
|
|
||||||
|
m4_define([_m4_bpatsubsts_],
|
||||||
|
[[m4_define([_m4_p],
|
||||||
|
m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$$1], [$$2]))]])
|
||||||
|
|
||||||
|
# m4_shiftn(N, ...)
|
||||||
|
# -----------------
|
||||||
|
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
|
||||||
|
#
|
||||||
|
# m4_shiftn already validated arguments; we only need to speed up
|
||||||
|
# _m4_shiftn. If N is 3, then we build the temporary _m4_s, defined as
|
||||||
|
# ,[$5],[$6],...,[$m]_m4_popdef([_m4_s])
|
||||||
|
# before calling m4_shift(_m4_s($@)).
|
||||||
|
m4_define([_m4_shiftn],
|
||||||
|
[m4_if(m4_incr([$1]), [$#], [], [m4_define([_m4_s],
|
||||||
|
m4_pushdef([_m4_s])_m4_for([_m4_s], m4_eval([$1 + 2]), [$#], [1],
|
||||||
|
[[,]m4_dquote([$]_m4_s)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])])
|
||||||
|
|
||||||
|
# m4_do(STRING, ...)
|
||||||
|
# ------------------
|
||||||
|
# This macro invokes all its arguments (in sequence, of course). It is
|
||||||
|
# useful for making your macros more structured and readable by dropping
|
||||||
|
# unnecessary dnl's and have the macros indented properly.
|
||||||
|
#
|
||||||
|
# Here, we use the temporary macro _m4_do, defined as
|
||||||
|
# $1[]$2[]...[]$n[]_m4_popdef([_m4_do])
|
||||||
|
m4_define([m4_do],
|
||||||
|
[m4_if([$#], [0], [],
|
||||||
|
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [1], [$#], [1],
|
||||||
|
[$_$0[[]]])[_m4_popdef([_$0])])_$0($@)])])
|
||||||
|
|
||||||
|
# m4_dquote_elt(ARGS)
|
||||||
|
# -------------------
|
||||||
|
# Return ARGS as an unquoted list of double-quoted arguments.
|
||||||
|
#
|
||||||
|
# m4_foreach to the rescue. It's easier to shift off the leading comma.
|
||||||
|
m4_define([m4_dquote_elt],
|
||||||
|
[m4_shift(m4_foreach([_m4_elt], [$@], [,m4_dquote(_m4_defn([_m4_elt]))]))])
|
||||||
|
|
||||||
|
# m4_reverse(ARGS)
|
||||||
|
# ----------------
|
||||||
|
# Output ARGS in reverse order.
|
||||||
|
#
|
||||||
|
# Invoke _m4_r($@) with the temporary _m4_r built as
|
||||||
|
# [$m], [$m-1], ..., [$2], [$1]_m4_popdef([_m4_r])
|
||||||
|
m4_define([m4_reverse],
|
||||||
|
[m4_if([$#], [0], [], [$#], [1], [[$1]],
|
||||||
|
[m4_define([_m4_r], m4_dquote([$$#])m4_pushdef([_m4_r])_m4_for([_m4_r],
|
||||||
|
m4_decr([$#]), [1], [-1],
|
||||||
|
[[, ]m4_dquote([$]_m4_r)])[_m4_popdef([_m4_r])])_m4_r($@)])])
|
||||||
|
|
||||||
|
|
||||||
|
# m4_map(MACRO, LIST)
|
||||||
|
# -------------------
|
||||||
|
# Invoke MACRO($1), MACRO($2) etc. where $1, $2... are the elements
|
||||||
|
# of LIST. $1, $2... must in turn be lists, appropriate for m4_apply.
|
||||||
|
#
|
||||||
|
# m4_map/m4_map_sep only execute once; the speedup comes in fixing
|
||||||
|
# _m4_map. The mismatch in () is intentional, since $1 supplies the
|
||||||
|
# opening `(' (but it sure looks odd!). Build the temporary _m4_m:
|
||||||
|
# $1, [$3])$1, [$4])...$1, [$m])_m4_popdef([_m4_m])
|
||||||
|
m4_define([_m4_map],
|
||||||
|
[m4_if([$#], [2], [],
|
||||||
|
[m4_define([_m4_m], m4_pushdef([_m4_m])_m4_for([_m4_m], [3], [$#], [1],
|
||||||
|
[$0_([1], _m4_m)])[_m4_popdef([_m4_m])])_m4_m($@)])])
|
||||||
|
|
||||||
|
m4_define([_m4_map_],
|
||||||
|
[[$$1, [$$2])]])
|
||||||
|
|
||||||
|
# m4_transform(EXPRESSION, ARG...)
|
||||||
|
# --------------------------------
|
||||||
|
# Expand EXPRESSION([ARG]) for each argument. More efficient than
|
||||||
|
# m4_foreach([var], [ARG...], [EXPRESSION(m4_defn([var]))])
|
||||||
|
#
|
||||||
|
# Invoke the temporary macro _m4_transform, defined as:
|
||||||
|
# $1([$2])[]$1([$3])[]...$1([$m])[]_m4_popdef([_m4_transform])
|
||||||
|
m4_define([m4_transform],
|
||||||
|
[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
|
||||||
|
[$#], [1], [],
|
||||||
|
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [2], [$#], [1],
|
||||||
|
[_$0_([1], _$0)])[_m4_popdef([_$0])])_$0($@)])])
|
||||||
|
|
||||||
|
m4_define([_m4_transform_],
|
||||||
|
[[$$1([$$2])[]]])
|
||||||
|
|
||||||
|
# m4_transform_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...)
|
||||||
|
# --------------------------------------------------------------
|
||||||
|
# Perform a pairwise grouping of consecutive ARGs, by expanding
|
||||||
|
# EXPRESSION([ARG1], [ARG2]). If there are an odd number of ARGs, the
|
||||||
|
# final argument is expanded with END-EXPR([ARGn]).
|
||||||
|
#
|
||||||
|
# Build the temporary macro _m4_transform_pair, with the $2([$m+1])
|
||||||
|
# only output if $# is odd:
|
||||||
|
# $1([$3], [$4])[]$1([$5], [$6])[]...$1([$m-1],
|
||||||
|
# [$m])[]m4_default([$2], [$1])([$m+1])[]_m4_popdef([_m4_transform_pair])
|
||||||
|
m4_define([m4_transform_pair],
|
||||||
|
[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
|
||||||
|
[$#], [1], [m4_fatal([$0: too few arguments: $#: $1])],
|
||||||
|
[$#], [2], [],
|
||||||
|
[$#], [3], [m4_default([$2], [$1])([$3])[]],
|
||||||
|
[m4_define([_$0], m4_pushdef([_$0])_m4_for([_$0], [3],
|
||||||
|
m4_eval([$# / 2 * 2 - 1]), [2], [_$0_([1], _$0, m4_incr(_$0))])_$0_end(
|
||||||
|
[1], [2], [$#])[_m4_popdef([_$0])])_$0($@)])])
|
||||||
|
|
||||||
|
m4_define([_m4_transform_pair_],
|
||||||
|
[[$$1([$$2], [$$3])[]]])
|
||||||
|
|
||||||
|
m4_define([_m4_transform_pair_end],
|
||||||
|
[m4_if(m4_eval([$3 & 1]), [1], [[m4_default([$$2], [$$1])([$$3])[]]])])
|
||||||
|
|
||||||
|
# m4_join(SEP, ARG1, ARG2...)
|
||||||
|
# ---------------------------
|
||||||
|
# Produce ARG1SEPARG2...SEPARGn. Avoid back-to-back SEP when a given ARG
|
||||||
|
# is the empty string. No expansion is performed on SEP or ARGs.
|
||||||
|
#
|
||||||
|
# Use a self-modifying separator, since we don't know how many
|
||||||
|
# arguments might be skipped before a separator is first printed, but
|
||||||
|
# be careful if the separator contains $. m4_foreach to the rescue.
|
||||||
|
m4_define([m4_join],
|
||||||
|
[m4_pushdef([_m4_sep], [m4_define([_m4_sep], _m4_defn([m4_echo]))])]dnl
|
||||||
|
[m4_foreach([_m4_arg], [m4_shift($@)],
|
||||||
|
[m4_ifset([_m4_arg], [_m4_sep([$1])_m4_defn([_m4_arg])])])]dnl
|
||||||
|
[_m4_popdef([_m4_sep])])
|
||||||
|
|
||||||
|
# m4_joinall(SEP, ARG1, ARG2...)
|
||||||
|
# ------------------------------
|
||||||
|
# Produce ARG1SEPARG2...SEPARGn. An empty ARG results in back-to-back SEP.
|
||||||
|
# No expansion is performed on SEP or ARGs.
|
||||||
|
#
|
||||||
|
# A bit easier than m4_join. m4_foreach to the rescue.
|
||||||
|
m4_define([m4_joinall],
|
||||||
|
[[$2]m4_if(m4_eval([$# <= 2]), [1], [],
|
||||||
|
[m4_foreach([_m4_arg], [m4_shift2($@)],
|
||||||
|
[[$1]_m4_defn([_m4_arg])])])])
|
||||||
|
|
||||||
|
# m4_list_cmp(A, B)
|
||||||
|
# -----------------
|
||||||
|
# Compare the two lists of integer expressions A and B.
|
||||||
|
#
|
||||||
|
# m4_list_cmp takes care of any side effects; we only override
|
||||||
|
# _m4_list_cmp_raw, where we can safely expand lists multiple times.
|
||||||
|
# First, insert padding so that both lists are the same length; the
|
||||||
|
# trailing +0 is necessary to handle a missing list. Next, create a
|
||||||
|
# temporary macro to perform pairwise comparisons until an inequality
|
||||||
|
# is found. For example, m4_list_cmp([1], [1,2]) creates _m4_cmp as
|
||||||
|
# m4_if(m4_eval([($1) != ($3)]), [1], [m4_cmp([$1], [$3])],
|
||||||
|
# m4_eval([($2) != ($4)]), [1], [m4_cmp([$2], [$4])],
|
||||||
|
# [0]_m4_popdef([_m4_cmp], [_m4_size]))
|
||||||
|
# then calls _m4_cmp([1+0], [0], [1], [2+0])
|
||||||
|
m4_define([_m4_list_cmp_raw],
|
||||||
|
[m4_if([$1], [$2], 0, [m4_pushdef(
|
||||||
|
[_m4_size])_m4_list_cmp($1+0_m4_list_pad(m4_count($1), m4_count($2)),
|
||||||
|
$2+0_m4_list_pad(m4_count($2), m4_count($1)))])])
|
||||||
|
|
||||||
|
m4_define([_m4_list_pad],
|
||||||
|
[m4_if(m4_eval($1 < $2), [1],
|
||||||
|
[_m4_for([_m4_size], m4_incr([$1]), [$2], [1], [,0])])])
|
||||||
|
|
||||||
|
m4_define([_m4_list_cmp],
|
||||||
|
[m4_define([_m4_size], m4_eval([$# >> 1]))]dnl
|
||||||
|
[m4_define([_m4_cmp], m4_pushdef([_m4_cmp])[m4_if(]_m4_for([_m4_cmp],
|
||||||
|
[1], _m4_size, [1], [$0_(_m4_cmp, m4_eval(_m4_cmp + _m4_size))])[
|
||||||
|
[0]_m4_popdef([_m4_cmp], [_m4_size]))])_m4_cmp($@)])
|
||||||
|
|
||||||
|
m4_define([_m4_list_cmp_],
|
||||||
|
[[m4_eval([($$1) != ($$2)]), [1], [m4_cmp([$$1], [$$2])],
|
||||||
|
]])
|
||||||
|
|
||||||
|
# m4_max(EXPR, ...)
|
||||||
|
# m4_min(EXPR, ...)
|
||||||
|
# -----------------
|
||||||
|
# Return the decimal value of the maximum (or minimum) in a series of
|
||||||
|
# integer expressions.
|
||||||
|
#
|
||||||
|
# m4_foreach to the rescue; we only need to replace _m4_minmax. Here,
|
||||||
|
# we need a temporary macro to track the best answer so far, so that
|
||||||
|
# the foreach expression is tractable.
|
||||||
|
m4_define([_m4_minmax],
|
||||||
|
[m4_pushdef([_m4_best], m4_eval([$2]))m4_foreach([_m4_arg], [m4_shift2($@)],
|
||||||
|
[m4_define([_m4_best], $1(_m4_best, _m4_defn([_m4_arg])))])]dnl
|
||||||
|
[_m4_best[]_m4_popdef([_m4_best])])
|
||||||
|
|
||||||
|
# m4_set_add_all(SET, VALUE...)
|
||||||
|
# -----------------------------
|
||||||
|
# Add each VALUE into SET. This is O(n) in the number of VALUEs, and
|
||||||
|
# can be faster than calling m4_set_add for each VALUE.
|
||||||
|
#
|
||||||
|
# m4_foreach to the rescue. If no deletions have occurred, then avoid
|
||||||
|
# the speed penalty of m4_set_add.
|
||||||
|
m4_define([m4_set_add_all],
|
||||||
|
[m4_if([$#], [0], [], [$#], [1], [],
|
||||||
|
[m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1])
|
||||||
|
+ m4_len(m4_foreach([_m4_arg], [m4_shift($@)],
|
||||||
|
m4_ifdef([_m4_set_cleanup($1)],
|
||||||
|
[[m4_set_add([$1], _m4_defn([_m4_arg]))]],
|
||||||
|
[[m4_ifdef([_m4_set([$1],]_m4_defn([_m4_arg])[)], [],
|
||||||
|
[m4_define([_m4_set([$1],]_m4_defn([_m4_arg])[)],
|
||||||
|
[1])m4_pushdef([_m4_set([$1])],
|
||||||
|
_m4_defn([_m4_arg]))-])]])))))])])
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../submodules/autoconf/lib/m4sugar/m4sugar.m4
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,778 +0,0 @@
|
|||||||
-*- Autoconf -*-
|
|
||||||
|
|
||||||
# C++ skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002-2022, 2025-2026 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Sanity checks, before defaults installed by c.m4.
|
|
||||||
b4_percent_define_ifdef([[api.value.union.name]],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
|
|
||||||
[named %union is invalid in C++])])
|
|
||||||
|
|
||||||
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c.m4])
|
|
||||||
|
|
||||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([api.parser.class], [code], [deprecated])
|
|
||||||
|
|
||||||
|
|
||||||
## ----- ##
|
|
||||||
## C++. ##
|
|
||||||
## ----- ##
|
|
||||||
|
|
||||||
# b4_comment(TEXT, [PREFIX])
|
|
||||||
# --------------------------
|
|
||||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_comment],
|
|
||||||
[_b4_comment([$1], [$2// ], [$2// ])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_inline(hh|cc)
|
|
||||||
# ----------------
|
|
||||||
# Expand to `inline\n ` if $1 is hh.
|
|
||||||
m4_define([b4_inline],
|
|
||||||
[m4_case([$1],
|
|
||||||
[cc], [],
|
|
||||||
[hh], [[inline
|
|
||||||
]],
|
|
||||||
[m4_fatal([$0: invalid argument: $1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_cxx_portability
|
|
||||||
# ------------------
|
|
||||||
m4_define([b4_cxx_portability],
|
|
||||||
[#if defined __cplusplus
|
|
||||||
# define YY_CPLUSPLUS __cplusplus
|
|
||||||
#else
|
|
||||||
# define YY_CPLUSPLUS 199711L
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Support move semantics when possible.
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
# define YY_MOVE std::move
|
|
||||||
# define YY_MOVE_OR_COPY move
|
|
||||||
# define YY_MOVE_REF(Type) Type&&
|
|
||||||
# define YY_RVREF(Type) Type&&
|
|
||||||
# define YY_COPY(Type) Type
|
|
||||||
#else
|
|
||||||
# define YY_MOVE
|
|
||||||
# define YY_MOVE_OR_COPY copy
|
|
||||||
# define YY_MOVE_REF(Type) Type&
|
|
||||||
# define YY_RVREF(Type) const Type&
|
|
||||||
# define YY_COPY(Type) const Type&
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Support noexcept when possible.
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
# define YY_NOEXCEPT noexcept
|
|
||||||
# define YY_NOTHROW
|
|
||||||
#else
|
|
||||||
# define YY_NOEXCEPT
|
|
||||||
# define YY_NOTHROW throw ()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Support constexpr when possible.
|
|
||||||
#if 201703 <= YY_CPLUSPLUS
|
|
||||||
# define YY_CONSTEXPR constexpr
|
|
||||||
#else
|
|
||||||
# define YY_CONSTEXPR
|
|
||||||
#endif[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## Default values. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
b4_percent_define_default([[api.parser.class]], [[parser]])
|
|
||||||
|
|
||||||
# Don't do that so that we remember whether we're using a user
|
|
||||||
# request, or the default value.
|
|
||||||
#
|
|
||||||
# b4_percent_define_default([[api.location.type]], [[location]])
|
|
||||||
|
|
||||||
b4_percent_define_default([[api.filename.type]], [[const std::string]])
|
|
||||||
# Make it a warning for those who used betas of Bison 3.0.
|
|
||||||
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
|
||||||
|
|
||||||
b4_percent_define_default([[define_location_comparison]],
|
|
||||||
[m4_if(b4_percent_define_get([[filename_type]]),
|
|
||||||
[std::string], [[true]], [[false]])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
|
||||||
## Namespace. ##
|
|
||||||
## ----------- ##
|
|
||||||
|
|
||||||
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
|
||||||
|
|
||||||
|
|
||||||
# Don't permit an empty b4_namespace_ref. Any '::parser::foo' appended to it
|
|
||||||
# would compile as an absolute reference with 'parser' in the global namespace.
|
|
||||||
# b4_namespace_open would open an anonymous namespace and thus establish
|
|
||||||
# internal linkage. This would compile. However, it's cryptic, and internal
|
|
||||||
# linkage for the parser would be specified in all translation units that
|
|
||||||
# include the header, which is always generated. If we ever need to permit
|
|
||||||
# internal linkage somehow, surely we can find a cleaner approach.
|
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
|
||||||
[[namespace reference is empty]])])
|
|
||||||
|
|
||||||
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
|
||||||
# invalid b4_namespace_ref that would be converted to a valid
|
|
||||||
# b4_namespace_open. The problem is that Bison doesn't always output
|
|
||||||
# b4_namespace_ref to uncommented code but should reserve the ability to do so
|
|
||||||
# in future releases without risking breaking any existing user grammars.
|
|
||||||
# Specifically, don't allow empty names as b4_namespace_open would just convert
|
|
||||||
# those into anonymous namespaces, and that might tempt some users.
|
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
|
||||||
[[namespace reference has consecutive "::"]])])
|
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
|
||||||
[[namespace reference has a trailing "::"]])])
|
|
||||||
|
|
||||||
m4_define([b4_namespace_open],
|
|
||||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])dnl
|
|
||||||
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
|
||||||
[^\(.\)[ ]*::], [\1])),
|
|
||||||
[::], [ { namespace ])[ {]])])
|
|
||||||
|
|
||||||
m4_define([b4_namespace_close],
|
|
||||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])dnl
|
|
||||||
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
|
||||||
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
|
|
||||||
[\1])),
|
|
||||||
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------- ##
|
|
||||||
## Token kinds. ##
|
|
||||||
## ------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
|
||||||
# --------------
|
|
||||||
# Output the definition of the token kinds.
|
|
||||||
m4_define([b4_token_enums],
|
|
||||||
[[enum token_kind_type
|
|
||||||
{
|
|
||||||
]b4_symbol([-2], [id])[ = -2,
|
|
||||||
]b4_symbol_foreach([b4_token_enum])dnl
|
|
||||||
[ };]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
|
||||||
## Symbol kinds. ##
|
|
||||||
## -------------- ##
|
|
||||||
|
|
||||||
# b4_declare_symbol_enum
|
|
||||||
# ----------------------
|
|
||||||
# The definition of the symbol internal numbers as an enum.
|
|
||||||
# Defining YYEMPTY here is important: it forces the compiler
|
|
||||||
# to use a signed type, which matters for yytoken.
|
|
||||||
m4_define([b4_declare_symbol_enum],
|
|
||||||
[[enum symbol_kind_type
|
|
||||||
{
|
|
||||||
YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens.
|
|
||||||
]b4_symbol(empty, kind_base)[ = -2,
|
|
||||||
]b4_symbol_foreach([ b4_symbol_enum])dnl
|
|
||||||
[ };]])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## Semantic Values. ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_declare
|
|
||||||
# ---------------------
|
|
||||||
# Declare value_type.
|
|
||||||
m4_define([b4_value_type_declare],
|
|
||||||
[b4_value_type_setup[]dnl
|
|
||||||
[ /// Symbol semantic values.
|
|
||||||
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
|
||||||
[code],
|
|
||||||
[[ typedef ]b4_percent_define_get([[api.value.type]])[ value_type;]],
|
|
||||||
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
|
||||||
[union\|union-directive],
|
|
||||||
[[ union value_type
|
|
||||||
{
|
|
||||||
]b4_user_union_members[
|
|
||||||
};]])])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_declare
|
|
||||||
# -----------------------
|
|
||||||
# Define the public types: token, semantic value, location, and so forth.
|
|
||||||
# Depending on %define token_lex, may be output in the header or source file.
|
|
||||||
m4_define([b4_public_types_declare],
|
|
||||||
[b4_glr2_cc_if(
|
|
||||||
[b4_value_type_declare],
|
|
||||||
[[#ifdef ]b4_api_PREFIX[STYPE
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# pragma GCC message "bison: do not #define ]b4_api_PREFIX[STYPE in C++, use %define api.value.type"
|
|
||||||
# endif
|
|
||||||
typedef ]b4_api_PREFIX[STYPE value_type;
|
|
||||||
#else
|
|
||||||
]b4_value_type_declare[
|
|
||||||
#endif
|
|
||||||
/// Backward compatibility (Bison 3.8).
|
|
||||||
typedef value_type semantic_type;
|
|
||||||
]])[]b4_locations_if([
|
|
||||||
/// Symbol locations.
|
|
||||||
typedef b4_percent_define_get([[api.location.type]],
|
|
||||||
[[location]]) location_type;])[
|
|
||||||
|
|
||||||
/// Syntax errors thrown from user actions.
|
|
||||||
struct syntax_error : std::runtime_error
|
|
||||||
{
|
|
||||||
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
|
||||||
: std::runtime_error (m)]b4_locations_if([
|
|
||||||
, location (l)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
syntax_error (const syntax_error& s)
|
|
||||||
: std::runtime_error (s.what ())]b4_locations_if([
|
|
||||||
, location (s.location)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
~syntax_error () YY_NOEXCEPT YY_NOTHROW;]b4_locations_if([
|
|
||||||
|
|
||||||
location_type location;])[
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Token kinds.
|
|
||||||
struct token
|
|
||||||
{
|
|
||||||
]b4_token_enums[]b4_glr2_cc_if([], [[
|
|
||||||
/// Backward compatibility alias (Bison 3.6).
|
|
||||||
typedef token_kind_type yytokentype;]])[
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Token kind, as returned by yylex.
|
|
||||||
typedef token::token_kind_type token_kind_type;]b4_glr2_cc_if([], [[
|
|
||||||
|
|
||||||
/// Backward compatibility alias (Bison 3.6).
|
|
||||||
typedef token_kind_type token_type;]])[
|
|
||||||
|
|
||||||
/// Symbol kinds.
|
|
||||||
struct symbol_kind
|
|
||||||
{
|
|
||||||
]b4_declare_symbol_enum[
|
|
||||||
};
|
|
||||||
|
|
||||||
/// (Internal) symbol kind.
|
|
||||||
typedef symbol_kind::symbol_kind_type symbol_kind_type;
|
|
||||||
|
|
||||||
/// The number of tokens.
|
|
||||||
static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_type_define
|
|
||||||
# ---------------------
|
|
||||||
# Define symbol_type, the external type for symbols used for symbol
|
|
||||||
# constructors.
|
|
||||||
m4_define([b4_symbol_type_define],
|
|
||||||
[[ /// A complete symbol.
|
|
||||||
///
|
|
||||||
/// Expects its Base type to provide access to the symbol kind
|
|
||||||
/// via kind ().
|
|
||||||
///
|
|
||||||
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
|
||||||
template <typename Base>
|
|
||||||
struct basic_symbol : Base
|
|
||||||
{
|
|
||||||
/// Alias to Base.
|
|
||||||
typedef Base super_type;
|
|
||||||
|
|
||||||
/// Default constructor.
|
|
||||||
basic_symbol () YY_NOEXCEPT
|
|
||||||
: value ()]b4_locations_if([
|
|
||||||
, location ()])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Move constructor.
|
|
||||||
basic_symbol (basic_symbol&& that)
|
|
||||||
: Base (std::move (that))
|
|
||||||
, value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
|
|
||||||
, location (std::move (that.location))])[
|
|
||||||
{]b4_variant_if([
|
|
||||||
b4_symbol_variant([this->kind ()], [value], [move],
|
|
||||||
[std::move (that.value)])
|
|
||||||
])[}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Copy constructor.
|
|
||||||
basic_symbol (const basic_symbol& that);]b4_variant_if([[
|
|
||||||
|
|
||||||
/// Constructors for typed symbols.
|
|
||||||
]b4_type_foreach([b4_basic_symbol_constructor_define], [
|
|
||||||
])], [[
|
|
||||||
/// Constructor for valueless symbols.
|
|
||||||
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
|
||||||
YY_MOVE_REF (location_type) l])[);
|
|
||||||
|
|
||||||
/// Constructor for symbols with semantic value.
|
|
||||||
basic_symbol (typename Base::kind_type t,
|
|
||||||
YY_RVREF (value_type) v]b4_locations_if([,
|
|
||||||
YY_RVREF (location_type) l])[);
|
|
||||||
]])[
|
|
||||||
/// Destroy the symbol.
|
|
||||||
~basic_symbol ()
|
|
||||||
{
|
|
||||||
clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Copy assignment.
|
|
||||||
basic_symbol& operator= (const basic_symbol& that)
|
|
||||||
{
|
|
||||||
Base::operator= (that);]b4_variant_if([[
|
|
||||||
]b4_symbol_variant([this->kind ()], [value], [copy],
|
|
||||||
[that.value])], [[
|
|
||||||
value = that.value]])[;]b4_locations_if([[
|
|
||||||
location = that.location;]])[
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Move assignment.
|
|
||||||
basic_symbol& operator= (basic_symbol&& that)
|
|
||||||
{
|
|
||||||
Base::operator= (std::move (that));]b4_variant_if([[
|
|
||||||
]b4_symbol_variant([this->kind ()], [value], [move],
|
|
||||||
[std::move (that.value)])], [[
|
|
||||||
value = std::move (that.value)]])[;]b4_locations_if([[
|
|
||||||
location = std::move (that.location);]])[
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Destroy contents, and record that is empty.
|
|
||||||
void clear () YY_NOEXCEPT
|
|
||||||
{]b4_variant_if([[
|
|
||||||
// User destructor.
|
|
||||||
symbol_kind_type yykind = this->kind ();
|
|
||||||
basic_symbol<Base>& yysym = *this;
|
|
||||||
(void) yysym;
|
|
||||||
switch (yykind)
|
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Value type destructor.
|
|
||||||
]b4_symbol_variant([[yykind]], [[value]], [[template destroy]])])[
|
|
||||||
Base::clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_parse_error_bmatch(
|
|
||||||
[custom\|detailed],
|
|
||||||
[[ /// The user-facing name of this symbol.
|
|
||||||
const char *name () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return ]b4_parser_class[::symbol_name (this->kind ());
|
|
||||||
}]],
|
|
||||||
[simple],
|
|
||||||
[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
|
||||||
/// The user-facing name of this symbol.
|
|
||||||
const char *name () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return ]b4_parser_class[::symbol_name (this->kind ());
|
|
||||||
}
|
|
||||||
#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
|
||||||
]],
|
|
||||||
[verbose],
|
|
||||||
[[ /// The user-facing name of this symbol.
|
|
||||||
std::string name () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return ]b4_parser_class[::symbol_name (this->kind ());
|
|
||||||
}]])[]b4_glr2_cc_if([], [[
|
|
||||||
|
|
||||||
/// Backward compatibility (Bison 3.6).
|
|
||||||
symbol_kind_type type_get () const YY_NOEXCEPT;]])[
|
|
||||||
|
|
||||||
/// Whether empty.
|
|
||||||
bool empty () const YY_NOEXCEPT;
|
|
||||||
|
|
||||||
/// Destructive move, \a s is emptied into this.
|
|
||||||
void move (basic_symbol& s);
|
|
||||||
|
|
||||||
/// The semantic value.
|
|
||||||
value_type value;]b4_locations_if([
|
|
||||||
|
|
||||||
/// The location.
|
|
||||||
location_type location;])[
|
|
||||||
|
|
||||||
private:
|
|
||||||
#if YY_CPLUSPLUS < 201103L
|
|
||||||
/// Assignment operator.
|
|
||||||
basic_symbol& operator= (const basic_symbol& that);
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Type access provider for token (enum) based symbols.
|
|
||||||
struct by_kind
|
|
||||||
{
|
|
||||||
/// The symbol kind as needed by the constructor.
|
|
||||||
typedef token_kind_type kind_type;
|
|
||||||
|
|
||||||
/// Default constructor.
|
|
||||||
by_kind () YY_NOEXCEPT;
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Move constructor.
|
|
||||||
by_kind (by_kind&& that) YY_NOEXCEPT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Copy constructor.
|
|
||||||
by_kind (const by_kind& that) YY_NOEXCEPT;
|
|
||||||
|
|
||||||
/// Constructor from (external) token numbers.
|
|
||||||
by_kind (kind_type t) YY_NOEXCEPT;
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Copy assignment.
|
|
||||||
by_kind& operator= (const by_kind& that);
|
|
||||||
|
|
||||||
/// Move assignment.
|
|
||||||
by_kind& operator= (by_kind&& that);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Record that this symbol is empty.
|
|
||||||
void clear () YY_NOEXCEPT;
|
|
||||||
|
|
||||||
/// Steal the symbol kind from \a that.
|
|
||||||
void move (by_kind& that);
|
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a type).
|
|
||||||
/// \a empty when empty.
|
|
||||||
symbol_kind_type kind () const YY_NOEXCEPT;]b4_glr2_cc_if([], [[
|
|
||||||
|
|
||||||
/// Backward compatibility (Bison 3.6).
|
|
||||||
symbol_kind_type type_get () const YY_NOEXCEPT;]])[
|
|
||||||
|
|
||||||
/// The symbol kind.
|
|
||||||
/// \a ]b4_symbol_prefix[YYEMPTY when empty.
|
|
||||||
symbol_kind_type kind_;
|
|
||||||
};]b4_glr2_cc_if([], [[
|
|
||||||
|
|
||||||
/// Backward compatibility for a private implementation detail (Bison 3.6).
|
|
||||||
typedef by_kind by_type;]])[
|
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
|
||||||
struct symbol_type : basic_symbol<by_kind>
|
|
||||||
{]b4_variant_if([[
|
|
||||||
/// Superclass.
|
|
||||||
typedef basic_symbol<by_kind> super_type;
|
|
||||||
|
|
||||||
/// Empty symbol.
|
|
||||||
symbol_type () YY_NOEXCEPT {}
|
|
||||||
|
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
|
||||||
]b4_type_foreach([_b4_symbol_constructor_define])dnl
|
|
||||||
])[};
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_define(hh|cc)
|
|
||||||
# -----------------------------
|
|
||||||
# Provide the implementation needed by the public types.
|
|
||||||
m4_define([b4_public_types_define],
|
|
||||||
[[ // basic_symbol.
|
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
|
|
||||||
: Base (that)
|
|
||||||
, value (]b4_variant_if([], [that.value]))b4_locations_if([
|
|
||||||
, location (that.location)])[
|
|
||||||
{]b4_variant_if([
|
|
||||||
b4_symbol_variant([this->kind ()], [value], [copy],
|
|
||||||
[YY_MOVE (that.value)])
|
|
||||||
])[}
|
|
||||||
|
|
||||||
]b4_variant_if([], [[
|
|
||||||
/// Constructor for valueless symbols.
|
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
|
||||||
[typename Base::kind_type t],
|
|
||||||
b4_locations_if([YY_MOVE_REF (location_type) l]))[)
|
|
||||||
: Base (t)
|
|
||||||
, value ()]b4_locations_if([
|
|
||||||
, location (l)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
|
||||||
[typename Base::kind_type t],
|
|
||||||
[YY_RVREF (value_type) v],
|
|
||||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
|
||||||
: Base (t)
|
|
||||||
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
|
||||||
, location (YY_MOVE (l))])[
|
|
||||||
{]b4_variant_if([[
|
|
||||||
(void) v;
|
|
||||||
]b4_symbol_variant([this->kind ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
|
||||||
|
|
||||||
]b4_glr2_cc_if([], [[
|
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class[::symbol_kind_type
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::type_get () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return this->kind ();
|
|
||||||
}
|
|
||||||
]])[
|
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
bool
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return this->kind () == ]b4_symbol(empty, kind)[;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
void
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::move (basic_symbol& s)
|
|
||||||
{
|
|
||||||
super_type::move (s);
|
|
||||||
]b4_variant_if([b4_symbol_variant([this->kind ()], [value], [move],
|
|
||||||
[YY_MOVE (s.value)])],
|
|
||||||
[value = YY_MOVE (s.value);])[]b4_locations_if([
|
|
||||||
location = YY_MOVE (s.location);])[
|
|
||||||
}
|
|
||||||
|
|
||||||
// by_kind.
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind () YY_NOEXCEPT
|
|
||||||
: kind_ (]b4_symbol(empty, kind)[)
|
|
||||||
{}
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (by_kind&& that) YY_NOEXCEPT
|
|
||||||
: kind_ (that.kind_)
|
|
||||||
{
|
|
||||||
that.clear ();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (const by_kind& that) YY_NOEXCEPT
|
|
||||||
: kind_ (that.kind_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (token_kind_type t) YY_NOEXCEPT
|
|
||||||
: kind_ (yytranslate_ (t))
|
|
||||||
{}
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
]b4_inline([$1])]b4_parser_class[::by_kind&
|
|
||||||
b4_parser_class[::by_kind::by_kind::operator= (const by_kind& that)
|
|
||||||
{
|
|
||||||
kind_ = that.kind_;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_inline([$1])]b4_parser_class[::by_kind&
|
|
||||||
b4_parser_class[::by_kind::by_kind::operator= (by_kind&& that)
|
|
||||||
{
|
|
||||||
kind_ = that.kind_;
|
|
||||||
that.clear ();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
|
||||||
]b4_parser_class[::by_kind::clear () YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
kind_ = ]b4_symbol(empty, kind)[;
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
|
||||||
]b4_parser_class[::by_kind::move (by_kind& that)
|
|
||||||
{
|
|
||||||
kind_ = that.kind_;
|
|
||||||
that.clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
|
||||||
]b4_parser_class[::by_kind::kind () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return kind_;
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_glr2_cc_if([], [[
|
|
||||||
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
|
||||||
]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return this->kind ();
|
|
||||||
}
|
|
||||||
]])[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_constructor_define
|
|
||||||
# ----------------------------
|
|
||||||
# Define make_FOO for all the token kinds.
|
|
||||||
# Use at class-level. Redefined in variant.hh.
|
|
||||||
m4_define([b4_token_constructor_define], [])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_yytranslate_define(cc|hh)
|
|
||||||
# ----------------------------
|
|
||||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
|
||||||
# sometimes in the cc file.
|
|
||||||
m4_define([b4_yytranslate_define],
|
|
||||||
[ b4_inline([$1])b4_parser_class[::symbol_kind_type
|
|
||||||
]b4_parser_class[::yytranslate_ (int t) YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
]b4_api_token_raw_if(
|
|
||||||
[[ return static_cast<symbol_kind_type> (t);]],
|
|
||||||
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
|
||||||
// TOKEN-NUM as returned by yylex.
|
|
||||||
static
|
|
||||||
const ]b4_int_type_for([b4_translate])[
|
|
||||||
translate_table[] =
|
|
||||||
{
|
|
||||||
]b4_translate[
|
|
||||||
};
|
|
||||||
// Last valid token kind.
|
|
||||||
const int code_max = ]b4_code_max[;
|
|
||||||
|
|
||||||
if (t <= 0)
|
|
||||||
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
|
||||||
else if (t <= code_max)
|
|
||||||
return static_cast <symbol_kind_type> (translate_table[t]);
|
|
||||||
else
|
|
||||||
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_value([TYPE])
|
|
||||||
# --------------------
|
|
||||||
m4_define([b4_lhs_value],
|
|
||||||
[b4_symbol_value([yyval], [$1])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, [TYPE])
|
|
||||||
# --------------------------------------
|
|
||||||
# FIXME: Dead code.
|
|
||||||
m4_define([b4_rhs_value],
|
|
||||||
[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_location()
|
|
||||||
# -----------------
|
|
||||||
# Expansion of @$.
|
|
||||||
m4_define([b4_lhs_location],
|
|
||||||
[(yyloc)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, POS)
|
|
||||||
# ---------------------------------
|
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
|
||||||
# on RHS.
|
|
||||||
m4_define([b4_rhs_location],
|
|
||||||
[(yylocation_stack_@{($1) - ($2)@})])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_decl
|
|
||||||
# -------------------
|
|
||||||
# Extra formal arguments of the constructor.
|
|
||||||
# Change the parameter names from "foo" into "foo_yyarg", so that
|
|
||||||
# there is no collision bw the user chosen attribute name, and the
|
|
||||||
# argument name in the constructor.
|
|
||||||
m4_define([b4_parse_param_decl],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
|
|
||||||
|
|
||||||
m4_define([b4_parse_param_decl_1],
|
|
||||||
[$1_yyarg])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_cons
|
|
||||||
# -------------------
|
|
||||||
# Extra initialisations of the constructor.
|
|
||||||
m4_define([b4_parse_param_cons],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[
|
|
||||||
b4_cc_constructor_calls(b4_parse_param)])])
|
|
||||||
m4_define([b4_cc_constructor_calls],
|
|
||||||
[m4_map_sep([b4_cc_constructor_call], [,
|
|
||||||
], [$@])])
|
|
||||||
m4_define([b4_cc_constructor_call],
|
|
||||||
[$2 ($2_yyarg)])
|
|
||||||
|
|
||||||
# b4_parse_param_vars
|
|
||||||
# -------------------
|
|
||||||
# Extra instance variables.
|
|
||||||
m4_define([b4_parse_param_vars],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[
|
|
||||||
// User arguments.
|
|
||||||
b4_cc_var_decls(b4_parse_param)])])
|
|
||||||
m4_define([b4_cc_var_decls],
|
|
||||||
[m4_map_sep([b4_cc_var_decl], [
|
|
||||||
], [$@])])
|
|
||||||
m4_define([b4_cc_var_decl],
|
|
||||||
[ $1;])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
|
||||||
## Values. ##
|
|
||||||
## ---------##
|
|
||||||
|
|
||||||
# b4_yylloc_default_define
|
|
||||||
# ------------------------
|
|
||||||
# Define YYLLOC_DEFAULT.
|
|
||||||
m4_define([b4_yylloc_default_define],
|
|
||||||
[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
|
||||||
If N is 0, then set CURRENT to the empty location which ends
|
|
||||||
the previous symbol: RHS[0] (always defined). */
|
|
||||||
|
|
||||||
# ifndef YYLLOC_DEFAULT
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
|
||||||
do \
|
|
||||||
if (N) \
|
|
||||||
{ \
|
|
||||||
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
|
||||||
(Current).end = YYRHSLOC (Rhs, N).end; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
|
||||||
} \
|
|
||||||
while (false)
|
|
||||||
# endif
|
|
||||||
]])
|
|
||||||
|
|
||||||
## -------- ##
|
|
||||||
## Checks. ##
|
|
||||||
## -------- ##
|
|
||||||
|
|
||||||
b4_token_ctor_if([b4_variant_if([],
|
|
||||||
[b4_fatal_at(b4_percent_define_get_loc(api.token.constructor),
|
|
||||||
[cannot use '%s' without '%s'],
|
|
||||||
[%define api.token.constructor],
|
|
||||||
[%define api.value.type variant]))])])
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
-*- Autoconf -*-
|
|
||||||
|
|
||||||
# Common code for C-like languages (C, C++, Java, etc.)
|
|
||||||
|
|
||||||
# Copyright (C) 2012-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
|
||||||
# --------------------------------------
|
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
|
||||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
|
||||||
# Turn "*/" in TEXT into "* /" so that we don't unexpectedly close
|
|
||||||
# the comments before its end.
|
|
||||||
#
|
|
||||||
# Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([_b4_comment],
|
|
||||||
[$2[]b4_gsub(m4_expand([$1]),
|
|
||||||
[[*]/], [*\\/],
|
|
||||||
[/[*]], [/\\*],
|
|
||||||
[
|
|
||||||
\(.\)], [
|
|
||||||
$3\1])$4])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_comment(TEXT, [PREFIX])
|
|
||||||
# --------------------------
|
|
||||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_comment],
|
|
||||||
[_b4_comment([$1], [$2/* ], [$2 ], [ */])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_dollar_dollar(VALUE, SYMBOL-NUM, FIELD, DEFAULT-FIELD)
|
|
||||||
# ----------------------------------------------------------
|
|
||||||
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
|
|
||||||
# otherwise just VALUE. Be sure to pass "(VALUE)" if VALUE is a
|
|
||||||
# pointer.
|
|
||||||
m4_define([_b4_dollar_dollar],
|
|
||||||
[b4_symbol_value([$1],
|
|
||||||
[$2],
|
|
||||||
m4_if([$3], [[]],
|
|
||||||
[[$4]], [[$3]]))])
|
|
||||||
|
|
||||||
# b4_dollar_pushdef(VALUE-POINTER, SYMBOL-NUM, [TYPE_TAG], LOCATION)
|
|
||||||
# b4_dollar_popdef
|
|
||||||
# ------------------------------------------------------------------
|
|
||||||
# Define b4_dollar_dollar for VALUE-POINTER and DEFAULT-FIELD,
|
|
||||||
# and b4_at_dollar for LOCATION.
|
|
||||||
m4_define([b4_dollar_pushdef],
|
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
|
||||||
[_b4_dollar_dollar([$1], [$2], m4_dquote($][1), [$3])])dnl
|
|
||||||
m4_pushdef([b4_at_dollar], [$4])dnl
|
|
||||||
])
|
|
||||||
m4_define([b4_dollar_popdef],
|
|
||||||
[m4_popdef([b4_at_dollar])dnl
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])
|
|
||||||
-1125
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
|||||||
-*- Autoconf -*-
|
|
||||||
|
|
||||||
# D skeleton dispatching for Bison.
|
|
||||||
|
|
||||||
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
b4_glr_if( [b4_complain([%%glr-parser not supported for D])])
|
|
||||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])])
|
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.d]])
|
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
|
||||||
|
|
||||||
m4_include(b4_used_skeleton)
|
|
||||||
@@ -1,627 +0,0 @@
|
|||||||
-*- Autoconf -*-
|
|
||||||
|
|
||||||
# D language support for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action(SYMBOL-NUM, ACTION)
|
|
||||||
# ------------------------------------
|
|
||||||
# Run the action ACTION ("destructor" or "printer") for SYMBOL-NUM.
|
|
||||||
m4_define([b4_symbol_action],
|
|
||||||
[b4_symbol_if([$1], [has_$2],
|
|
||||||
[b4_dollar_pushdef([yyval],
|
|
||||||
[$1],
|
|
||||||
[],
|
|
||||||
[yyloc])dnl
|
|
||||||
_b4_symbol_case([$1])[]dnl
|
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
|
|
||||||
b4_symbol([$1], [$2])
|
|
||||||
b4_syncline([@oline@], [@ofile@])dnl
|
|
||||||
break;
|
|
||||||
|
|
||||||
b4_dollar_popdef[]dnl
|
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_use(EXPR)
|
|
||||||
# ------------
|
|
||||||
# Pacify the compiler about some maybe unused value.
|
|
||||||
m4_define([b4_use],
|
|
||||||
[])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_sync_start(LINE, FILE)
|
|
||||||
# -------------------------
|
|
||||||
m4_define([b4_sync_start], [[#]line $1 $2])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_list2(LIST1, LIST2)
|
|
||||||
# ----------------------
|
|
||||||
# Join two lists with a comma if necessary.
|
|
||||||
m4_define([b4_list2],
|
|
||||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
|
||||||
# -------------------------------------------
|
|
||||||
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
|
||||||
# otherwise NOT.
|
|
||||||
m4_define([b4_percent_define_get3],
|
|
||||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
|
||||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
|
||||||
|
|
||||||
# b4_percent_define_if_get2(ARG1, ARG2, DEF, NOT)
|
|
||||||
# -----------------------------------------------
|
|
||||||
# Expand to the value of DEF if ARG1 or ARG2 are %define'ed,
|
|
||||||
# otherwise NOT.
|
|
||||||
m4_define([b4_percent_define_if_get2],
|
|
||||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
|
||||||
[$3], [m4_ifval(m4_quote(b4_percent_define_get([$2])),
|
|
||||||
[$3], [$4])])])
|
|
||||||
|
|
||||||
# b4_percent_define_class_before_interface(CLASS, INTERFACE)
|
|
||||||
# ----------------------------------------------------------
|
|
||||||
# Expand to a ', ' if both a class and an interface have been %define'ed
|
|
||||||
m4_define([b4_percent_define_class_before_interface],
|
|
||||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
|
||||||
[m4_ifval(m4_quote(b4_percent_define_get([$2])),
|
|
||||||
[, ])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_flag_value(BOOLEAN-FLAG)
|
|
||||||
# ---------------------------
|
|
||||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parser_class_declaration
|
|
||||||
# ---------------------------
|
|
||||||
# The declaration of the parser class ("class YYParser"), with all its
|
|
||||||
# qualifiers/annotations.
|
|
||||||
b4_percent_define_default([[api.parser.abstract]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.final]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.public]], [[false]])
|
|
||||||
|
|
||||||
m4_define([b4_parser_class_declaration],
|
|
||||||
[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.public], [public ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
|
||||||
[class ]b4_parser_class[]dnl
|
|
||||||
b4_percent_define_if_get2([api.parser.extends], [api.parser.implements], [ : ])dnl
|
|
||||||
b4_percent_define_get([api.parser.extends])dnl
|
|
||||||
b4_percent_define_class_before_interface([api.parser.extends], [api.parser.implements])dnl
|
|
||||||
b4_percent_define_get([api.parser.implements])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lexer_if(TRUE, FALSE)
|
|
||||||
# ------------------------
|
|
||||||
m4_define([b4_lexer_if],
|
|
||||||
[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_position_type_if(TRUE, FALSE)
|
|
||||||
# --------------------------------
|
|
||||||
m4_define([b4_position_type_if],
|
|
||||||
[b4_percent_define_ifdef([[position_type]], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_location_type_if(TRUE, FALSE)
|
|
||||||
# --------------------------------
|
|
||||||
m4_define([b4_location_type_if],
|
|
||||||
[b4_percent_define_ifdef([[location_type]], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_identification
|
|
||||||
# -----------------
|
|
||||||
m4_define([b4_identification],
|
|
||||||
[[/** Version number for the Bison executable that generated this parser. */
|
|
||||||
public static immutable string yy_bison_version = "]b4_version_string[";
|
|
||||||
|
|
||||||
/** Name of the skeleton that generated this parser. */
|
|
||||||
public static immutable string yy_bison_skeleton = ]b4_skeleton[;
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
|
||||||
## Data types. ##
|
|
||||||
## ------------ ##
|
|
||||||
|
|
||||||
# b4_int_type(MIN, MAX)
|
|
||||||
# ---------------------
|
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
|
||||||
# MIN to MAX (included).
|
|
||||||
m4_define([b4_int_type],
|
|
||||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
|
||||||
[int])])
|
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
|
||||||
# ---------------------
|
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
|
||||||
# `NAME_min' to `NAME_max' (included).
|
|
||||||
m4_define([b4_int_type_for],
|
|
||||||
[b4_int_type($1_min, $1_max)])
|
|
||||||
|
|
||||||
# b4_null
|
|
||||||
# -------
|
|
||||||
m4_define([b4_null], [null])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
|
|
||||||
#-----------------------------------------------------
|
|
||||||
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
|
||||||
m4_define([b4_integral_parser_table_define],
|
|
||||||
[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
|
|
||||||
private static immutable b4_int_type_for([$2])[[]] yy$1_ =
|
|
||||||
@{
|
|
||||||
$2
|
|
||||||
@};dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------- ##
|
|
||||||
## Token kinds. ##
|
|
||||||
## ------------- ##
|
|
||||||
|
|
||||||
m4_define([b4_symbol(-2, id)], [[YYEMPTY]])
|
|
||||||
b4_percent_define_default([[api.token.raw]], [[true]])
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
|
||||||
# ---------------------------------------
|
|
||||||
# Output the definition of this token as an enum.
|
|
||||||
m4_define([b4_token_enum],
|
|
||||||
[b4_token_format([ %s = %s,
|
|
||||||
], [$1])])
|
|
||||||
|
|
||||||
# b4_token_enums
|
|
||||||
# --------------
|
|
||||||
# Output the definition of the tokens as enums.
|
|
||||||
m4_define([b4_token_enums],
|
|
||||||
[/* Token kinds. */
|
|
||||||
public enum TokenKind {
|
|
||||||
]b4_symbol(empty, id)[ = -2,
|
|
||||||
b4_symbol_foreach([b4_token_enum])dnl
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_symbol_translate(STRING)
|
|
||||||
# ---------------------------
|
|
||||||
# Used by "bison" in the array of symbol names to mark those that
|
|
||||||
# require translation.
|
|
||||||
m4_define([b4_symbol_translate],
|
|
||||||
[[_($1)]])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_token_constructor_define(SYMBOL-NUM)
|
|
||||||
# ----------------------------------------
|
|
||||||
# Define Symbol.FOO for SYMBOL-NUM.
|
|
||||||
m4_define([_b4_token_constructor_define],
|
|
||||||
[b4_token_visible_if([$1],
|
|
||||||
[[
|
|
||||||
static auto ]b4_symbol([$1], [id])[(]b4_symbol_if([$1], [has_type],
|
|
||||||
[b4_union_if([b4_symbol([$1], [type]],
|
|
||||||
[[typeof(YYSemanticType.]b4_symbol([$1], [type])[]])) [val]])dnl
|
|
||||||
[]b4_locations_if([b4_symbol_if([$1], [has_type], [[, ]])[Location l]])[)
|
|
||||||
{
|
|
||||||
return Symbol(TokenKind.]b4_symbol([$1], [id])[]b4_symbol_if([$1], [has_type],
|
|
||||||
[[, val]])[]b4_locations_if([[, l]])[);
|
|
||||||
}]])])
|
|
||||||
|
|
||||||
# b4_token_constructor_define
|
|
||||||
# ---------------------------
|
|
||||||
# Define Symbol.FOO for each token kind FOO.
|
|
||||||
m4_define([b4_token_constructor_define],
|
|
||||||
[[
|
|
||||||
/* Implementation of token constructors for each symbol type visible to
|
|
||||||
* the user. The code generates static methods that have the same names
|
|
||||||
* as the TokenKinds.
|
|
||||||
*/]b4_symbol_foreach([_b4_token_constructor_define])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
## -------------- ##
|
|
||||||
## Symbol kinds. ##
|
|
||||||
## -------------- ##
|
|
||||||
|
|
||||||
# b4_symbol_kind(NUM)
|
|
||||||
# -------------------
|
|
||||||
m4_define([b4_symbol_kind],
|
|
||||||
[SymbolKind.b4_symbol_kind_base($@)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_enum(SYMBOL-NUM)
|
|
||||||
# --------------------------
|
|
||||||
# Output the definition of this symbol as an enum.
|
|
||||||
m4_define([b4_symbol_enum],
|
|
||||||
[m4_format([ %-30s %s],
|
|
||||||
m4_format([[%s = %s,]],
|
|
||||||
b4_symbol([$1], [kind_base]),
|
|
||||||
[$1]),
|
|
||||||
[b4_symbol_tag_comment([$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_symbol_enum
|
|
||||||
# ----------------------
|
|
||||||
# The definition of the symbol internal numbers as an enum.
|
|
||||||
# Defining YYEMPTY here is important: it forces the compiler
|
|
||||||
# to use a signed type, which matters for yytoken.
|
|
||||||
m4_define([b4_declare_symbol_enum],
|
|
||||||
[[ /* Symbol kinds. */
|
|
||||||
struct SymbolKind
|
|
||||||
{
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
]b4_symbol(empty, kind_base)[ = -2, /* No symbol. */
|
|
||||||
]b4_symbol_foreach([b4_symbol_enum])dnl
|
|
||||||
[ }
|
|
||||||
|
|
||||||
private int yycode_;
|
|
||||||
alias yycode_ this;
|
|
||||||
|
|
||||||
this(int code)
|
|
||||||
{
|
|
||||||
yycode_ = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return YYSTR after stripping away unnecessary quotes and
|
|
||||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
|
||||||
that double-quoting is unnecessary unless the string contains an
|
|
||||||
apostrophe, a comma, or backslash (other than backslash-backslash).
|
|
||||||
YYSTR is taken from yytname. */
|
|
||||||
final void toString(void delegate(const(char)[]) sink) const
|
|
||||||
{
|
|
||||||
immutable string[] yy_sname = @{
|
|
||||||
]b4_symbol_names[
|
|
||||||
@};]b4_has_translations_if([[
|
|
||||||
/* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
|
|
||||||
internationalizable. */
|
|
||||||
immutable ]b4_int_type_for([b4_translatable])[[] yytranslatable = @{
|
|
||||||
]b4_translatable[
|
|
||||||
@};]])[
|
|
||||||
|
|
||||||
sink.formattedWrite!"%s"(yy_sname[yycode_]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_case(ID, CODE, [COMMENTS])
|
|
||||||
# -----------------------------
|
|
||||||
m4_define([b4_case], [ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
|
||||||
$2
|
|
||||||
break;])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## Default values. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
|
||||||
b4_percent_define_default([[stype]], [[YYSemanticType]])])
|
|
||||||
|
|
||||||
# %name-prefix
|
|
||||||
m4_define_default([b4_prefix], [[YY]])
|
|
||||||
|
|
||||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])])
|
|
||||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
|
||||||
|
|
||||||
#b4_percent_define_default([[location_type]], [Location])])
|
|
||||||
m4_define([b4_location_type], b4_percent_define_ifdef([[location_type]],[b4_percent_define_get([[location_type]])],[YYLocation]))
|
|
||||||
|
|
||||||
#b4_percent_define_default([[position_type]], [Position])])
|
|
||||||
m4_define([b4_position_type], b4_percent_define_ifdef([[position_type]],[b4_percent_define_get([[position_type]])],[YYPosition]))
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## api.value.type. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------- #
|
|
||||||
# api.value.type=union. #
|
|
||||||
# ---------------------- #
|
|
||||||
|
|
||||||
# b4_symbol_type_register(SYMBOL-NUM)
|
|
||||||
# -----------------------------------
|
|
||||||
# Symbol SYMBOL-NUM has a type (for union) instead of a type-tag.
|
|
||||||
# Extend the definition of %union's body (b4_union_members) with a
|
|
||||||
# field of that type, and extend the symbol's "type" field to point to
|
|
||||||
# the field name, instead of the type name.
|
|
||||||
m4_define([b4_symbol_type_register],
|
|
||||||
[m4_define([b4_symbol($1, type_tag)],
|
|
||||||
[b4_symbol_if([$1], [has_id],
|
|
||||||
[b4_symbol([$1], [id])],
|
|
||||||
[yykind_[]b4_symbol([$1], [number])])])dnl
|
|
||||||
m4_append([b4_union_members],
|
|
||||||
m4_expand([m4_format([ %-40s %s],
|
|
||||||
m4_expand([b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]),
|
|
||||||
[b4_symbol_tag_comment([$1])])]))
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_type_define_tag(SYMBOL1-NUM, ...)
|
|
||||||
# ------------------------------------
|
|
||||||
# For the batch of symbols SYMBOL1-NUM... (which all have the same
|
|
||||||
# type), enhance the %union definition for each of them, and set
|
|
||||||
# there "type" field to the field tag name, instead of the type name.
|
|
||||||
m4_define([b4_type_define_tag],
|
|
||||||
[b4_symbol_if([$1], [has_type],
|
|
||||||
[m4_map([b4_symbol_type_register], [$@])])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value_union(VAL, SYMBOL-NUM, [TYPE])
|
|
||||||
# ----------------------------------------------
|
|
||||||
# Same of b4_symbol_value, but when api.value.type=union.
|
|
||||||
m4_define([b4_symbol_value_union],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
[(*($3*)(&$1))],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[($1.b4_symbol([$2], [type_tag]))],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_setup_union
|
|
||||||
# -------------------------
|
|
||||||
# Setup support for api.value.type=union. Symbols are defined with a
|
|
||||||
# type instead of a union member name: build the corresponding union,
|
|
||||||
# and give the symbols their tag.
|
|
||||||
m4_define([b4_value_type_setup_union],
|
|
||||||
[m4_define([b4_union_members])
|
|
||||||
b4_type_foreach([b4_type_define_tag])
|
|
||||||
m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_value_type_setup_keyword
|
|
||||||
# ----------------------------
|
|
||||||
# api.value.type is defined with a keyword/string syntax. Check if
|
|
||||||
# that is properly defined, and prepare its use.
|
|
||||||
m4_define([_b4_value_type_setup_keyword],
|
|
||||||
[b4_percent_define_check_values([[[[api.value.type]],
|
|
||||||
[[none]],
|
|
||||||
[[union]],
|
|
||||||
[[union-directive]],
|
|
||||||
[[yystype]]]])dnl
|
|
||||||
m4_case(b4_percent_define_get([[api.value.type]]),
|
|
||||||
[union], [b4_value_type_setup_union])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_setup
|
|
||||||
# -------------------
|
|
||||||
# Check if api.value.type is properly defined, and possibly prepare
|
|
||||||
# its use.
|
|
||||||
b4_define_silent([b4_value_type_setup],
|
|
||||||
[
|
|
||||||
# Define default value.
|
|
||||||
b4_percent_define_ifdef([[api.value.type]], [],
|
|
||||||
[# %union => api.value.type=union-directive
|
|
||||||
m4_ifdef([b4_union_members],
|
|
||||||
[m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [union-directive])],
|
|
||||||
[# no tag seen => api.value.type={int}
|
|
||||||
m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[m4_define([b4_percent_define_kind(api.value.type)], [code])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [int])],
|
|
||||||
[# otherwise api.value.type=yystype
|
|
||||||
m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [yystype])])])])
|
|
||||||
|
|
||||||
# Set up.
|
|
||||||
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
|
||||||
[keyword], [_b4_value_type_setup_keyword])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## Semantic Values. ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
|
||||||
# ----------------------------------------------
|
|
||||||
# See README. FIXME: factor in c-like?
|
|
||||||
m4_define([b4_symbol_value],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
[($1.$3)],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[($1.b4_symbol([$2], [type]))],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
|
||||||
# --------------------------------
|
|
||||||
# See README.
|
|
||||||
m4_define([b4_lhs_value],
|
|
||||||
[b4_symbol_value([yyval], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
|
||||||
# --------------------------------------------------
|
|
||||||
# See README.
|
|
||||||
#
|
|
||||||
# In this simple implementation, %token and %type have class names
|
|
||||||
# between the angle brackets.
|
|
||||||
m4_define([b4_rhs_value],
|
|
||||||
[b4_symbol_value([(yystack.valueAt (b4_subtract([$1], [$2])))], [$3], [$4])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_location()
|
|
||||||
# -----------------
|
|
||||||
# Expansion of @$.
|
|
||||||
m4_define([b4_lhs_location],
|
|
||||||
[(yyloc)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, POS)
|
|
||||||
# ---------------------------------
|
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
|
||||||
# on RHS.
|
|
||||||
m4_define([b4_rhs_location],
|
|
||||||
[yystack.locationAt (b4_subtract($@))])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param
|
|
||||||
# b4_parse_param
|
|
||||||
# --------------
|
|
||||||
# If defined, b4_lex_param arrives double quoted, but below we prefer
|
|
||||||
# it to be single quoted. Same for b4_parse_param.
|
|
||||||
|
|
||||||
# TODO: should be in bison.m4
|
|
||||||
m4_define_default([b4_lex_param], [[]]))
|
|
||||||
m4_define([b4_lex_param], b4_lex_param))
|
|
||||||
m4_define([b4_parse_param], b4_parse_param))
|
|
||||||
|
|
||||||
# b4_lex_param_decl
|
|
||||||
# -------------------
|
|
||||||
# Extra formal arguments of the constructor.
|
|
||||||
m4_define([b4_lex_param_decl],
|
|
||||||
[m4_ifset([b4_lex_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_decls(b4_lex_param))],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
m4_define([b4_param_decls],
|
|
||||||
[m4_map([b4_param_decl], [$@])])
|
|
||||||
m4_define([b4_param_decl], [, $1])
|
|
||||||
|
|
||||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_decl
|
|
||||||
# -------------------
|
|
||||||
# Extra formal arguments of the constructor.
|
|
||||||
m4_define([b4_parse_param_decl],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_decls(b4_parse_param))],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param_call
|
|
||||||
# -------------------
|
|
||||||
# Delegating the lexer parameters to the lexer constructor.
|
|
||||||
m4_define([b4_lex_param_call],
|
|
||||||
[m4_ifset([b4_lex_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_calls(b4_lex_param))],
|
|
||||||
[$1])])
|
|
||||||
m4_define([b4_param_calls],
|
|
||||||
[m4_map([b4_param_call], [$@])])
|
|
||||||
m4_define([b4_param_call], [, $2])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_cons
|
|
||||||
# -------------------
|
|
||||||
# Extra initialisations of the constructor.
|
|
||||||
m4_define([b4_parse_param_cons],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[b4_constructor_calls(b4_parse_param)])])
|
|
||||||
|
|
||||||
m4_define([b4_constructor_calls],
|
|
||||||
[m4_map([b4_constructor_call], [$@])])
|
|
||||||
m4_define([b4_constructor_call],
|
|
||||||
[this.$2 = $2;
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_vars
|
|
||||||
# -------------------
|
|
||||||
# Extra instance variables.
|
|
||||||
m4_define([b4_parse_param_vars],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[
|
|
||||||
/* User arguments. */
|
|
||||||
b4_var_decls(b4_parse_param)])])
|
|
||||||
|
|
||||||
m4_define([b4_var_decls],
|
|
||||||
[m4_map_sep([b4_var_decl], [
|
|
||||||
], [$@])])
|
|
||||||
m4_define([b4_var_decl],
|
|
||||||
[ protected $1;])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_declare
|
|
||||||
# -----------------------
|
|
||||||
# Define the public types: token, semantic value, location, and so forth.
|
|
||||||
# Depending on %define token_lex, may be output in the header or source file.
|
|
||||||
m4_define([b4_public_types_declare],
|
|
||||||
[[
|
|
||||||
alias Symbol = ]b4_parser_class[.Symbol;
|
|
||||||
alias Value = ]b4_yystype[;]b4_locations_if([[
|
|
||||||
alias Location = ]b4_location_type[;
|
|
||||||
alias Position = ]b4_position_type[;]b4_push_if([[
|
|
||||||
alias PUSH_MORE = ]b4_parser_class[.YYPUSH_MORE;
|
|
||||||
alias ABORT = ]b4_parser_class[.YYABORT;
|
|
||||||
alias ACCEPT = ]b4_parser_class[.YYACCEPT;]])[]])[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_define
|
|
||||||
# ----------------------------------
|
|
||||||
# Create Symbol struct constructors for all the visible types.
|
|
||||||
m4_define([b4_basic_symbol_constructor_define],
|
|
||||||
[b4_token_visible_if([$1],
|
|
||||||
[[ this(TokenKind token]b4_symbol_if([$1], [has_type],
|
|
||||||
[[, ]b4_union_if([], [[typeof(YYSemanticType.]])b4_symbol([$1], [type])dnl
|
|
||||||
[]b4_union_if([], [[) ]])[ val]])[]b4_locations_if([[, Location loc]])[)
|
|
||||||
{
|
|
||||||
kind = yytranslate_(token);]b4_union_if([b4_symbol_if([$1], [has_type], [[
|
|
||||||
static foreach (member; __traits(allMembers, YYSemanticType))
|
|
||||||
{
|
|
||||||
static if (is(typeof(mixin("value_." ~ member)) == ]b4_symbol([$1], [type])[))
|
|
||||||
{
|
|
||||||
mixin("value_." ~ member ~ " = val;");
|
|
||||||
}
|
|
||||||
}]])], [b4_symbol_if([$1], [has_type], [[
|
|
||||||
value_.]b4_symbol([$1], [type])[ = val;]])])[]b4_locations_if([
|
|
||||||
location_ = loc;])[
|
|
||||||
}
|
|
||||||
]])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_type_define
|
|
||||||
# ---------------------
|
|
||||||
# Define symbol_type, the external type for symbols used for symbol
|
|
||||||
# constructors.
|
|
||||||
m4_define([b4_symbol_type_define],
|
|
||||||
[[
|
|
||||||
/**
|
|
||||||
* A complete symbol
|
|
||||||
*/
|
|
||||||
struct Symbol
|
|
||||||
{
|
|
||||||
private SymbolKind kind;
|
|
||||||
private Value value_;]b4_locations_if([[
|
|
||||||
private Location location_;]])[
|
|
||||||
|
|
||||||
]b4_type_foreach([b4_basic_symbol_constructor_define])[
|
|
||||||
SymbolKind token() { return kind; }
|
|
||||||
Value value() { return value_; }]b4_locations_if([[
|
|
||||||
Location location() { return location_; }]])[
|
|
||||||
]b4_token_ctor_if([b4_token_constructor_define])[
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,398 +0,0 @@
|
|||||||
# C++ GLR skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
# This skeleton produces a C++ class that encapsulates a C glr parser.
|
|
||||||
# This is in order to reduce the maintenance burden. The glr.c
|
|
||||||
# skeleton is clean and pure enough so that there are no real
|
|
||||||
# problems. The C++ interface is the same as that of lalr1.cc. In
|
|
||||||
# fact, glr.c can replace yacc.c without the user noticing any
|
|
||||||
# difference, and similarly for glr.cc replacing lalr1.cc.
|
|
||||||
#
|
|
||||||
# The passing of parse-params
|
|
||||||
#
|
|
||||||
# The additional arguments are stored as members of the parser
|
|
||||||
# object, yyparser. The C routines need to carry yyparser
|
|
||||||
# throughout the C parser; that's easy: make yyparser an
|
|
||||||
# additional parse-param. But because the C++ skeleton needs to
|
|
||||||
# know the "real" original parse-param, we save them
|
|
||||||
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
|
||||||
# (and c.m4 strips one level of quotes). This is a PITA, and
|
|
||||||
# explains why there are so many levels of quotes.
|
|
||||||
#
|
|
||||||
# The locations
|
|
||||||
#
|
|
||||||
# We use location.cc just like lalr1.cc, but because glr.c stores
|
|
||||||
# the locations in a union, the position and location classes
|
|
||||||
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
|
||||||
# must not define "b4_location_constructors". As a consequence the
|
|
||||||
# user must initialize the first positions (in particular the
|
|
||||||
# filename member).
|
|
||||||
|
|
||||||
# We require a pure interface.
|
|
||||||
m4_define([b4_pure_flag], [1])
|
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c++.m4])
|
|
||||||
b4_bison_locations_if([m4_include(b4_skeletonsdir/[location.cc])])
|
|
||||||
|
|
||||||
m4_define([b4_parser_class],
|
|
||||||
[b4_percent_define_get([[api.parser.class]])])
|
|
||||||
|
|
||||||
# Save the parse parameters.
|
|
||||||
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
|
||||||
|
|
||||||
# b4_parse_param_wrap
|
|
||||||
# -------------------
|
|
||||||
# New ones.
|
|
||||||
m4_ifset([b4_parse_param],
|
|
||||||
[m4_define([b4_parse_param_wrap],
|
|
||||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]],]
|
|
||||||
m4_defn([b4_parse_param]))],
|
|
||||||
[m4_define([b4_parse_param_wrap],
|
|
||||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_yy_symbol_print_define
|
|
||||||
# -------------------------
|
|
||||||
# Bypass the default implementation to generate the "yy_symbol_print"
|
|
||||||
# and "yy_symbol_value_print" functions.
|
|
||||||
m4_define([b4_yy_symbol_print_define],
|
|
||||||
[[/*--------------------.
|
|
||||||
| Print this symbol. |
|
|
||||||
`--------------------*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken,
|
|
||||||
const ]b4_namespace_ref::b4_parser_class[::value_type *yyvaluep]b4_locations_if([[,
|
|
||||||
const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[)
|
|
||||||
{
|
|
||||||
]b4_parse_param_use[]dnl
|
|
||||||
[ yyparser.yy_symbol_print_ (yytoken, yyvaluep]b4_locations_if([, yylocationp])[);
|
|
||||||
}
|
|
||||||
]])[
|
|
||||||
|
|
||||||
# Hijack the initial action to initialize the locations.
|
|
||||||
]b4_bison_locations_if([m4_define([b4_initial_action],
|
|
||||||
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
|
||||||
m4_defn([b4_initial_action])]))])[
|
|
||||||
|
|
||||||
# Hijack the post prologue to declare yyerror.
|
|
||||||
]m4_append([b4_post_prologue],
|
|
||||||
[b4_syncline([@oline@], [@ofile@])dnl
|
|
||||||
[static void
|
|
||||||
yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
|
|
||||||
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
|
||||||
])[const char* msg);]])[
|
|
||||||
|
|
||||||
# Inserted before the epilogue to define implementations (yyerror, parser member
|
|
||||||
# functions etc.).
|
|
||||||
]m4_define([b4_glr_cc_pre_epilogue],
|
|
||||||
[b4_syncline([@oline@], [@ofile@])dnl
|
|
||||||
[
|
|
||||||
/*------------------.
|
|
||||||
| Report an error. |
|
|
||||||
`------------------*/
|
|
||||||
|
|
||||||
static void
|
|
||||||
yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
|
|
||||||
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
|
||||||
])[const char* msg)
|
|
||||||
{
|
|
||||||
]b4_parse_param_use[]dnl
|
|
||||||
[ yyparser.error (]b4_locations_if([[*yylocationp, ]])[msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
]dnl In this section, the parse params are the original parse_params.
|
|
||||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|
||||||
[ /// Build a parser object.
|
|
||||||
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
|
||||||
:])[
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
|
||||||
]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
|
||||||
#endif]b4_parse_param_cons[
|
|
||||||
{}
|
|
||||||
|
|
||||||
]b4_parser_class::~b4_parser_class[ ()
|
|
||||||
{}
|
|
||||||
|
|
||||||
]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
|
|
||||||
{}
|
|
||||||
|
|
||||||
int
|
|
||||||
]b4_parser_class[::operator() ()
|
|
||||||
{
|
|
||||||
return parse ();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
]b4_parser_class[::parse ()
|
|
||||||
{
|
|
||||||
return ::yy_parse_impl (*this]b4_user_args[);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
|
||||||
/*--------------------.
|
|
||||||
| Print this symbol. |
|
|
||||||
`--------------------*/
|
|
||||||
|
|
||||||
void
|
|
||||||
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
|
||||||
const value_type* yyvaluep]b4_locations_if([[,
|
|
||||||
const location_type* yylocationp]])[) const
|
|
||||||
{]b4_locations_if([[
|
|
||||||
YY_USE (yylocationp);]])[
|
|
||||||
YY_USE (yyvaluep);
|
|
||||||
std::ostream& yyo = debug_stream ();
|
|
||||||
std::ostream& yyoutput = yyo;
|
|
||||||
YY_USE (yyoutput);
|
|
||||||
]b4_symbol_actions([printer])[
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
|
||||||
const value_type* yyvaluep]b4_locations_if([[,
|
|
||||||
const location_type* yylocationp]])[) const
|
|
||||||
{
|
|
||||||
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
|
||||||
<< ' ' << yysymbol_name (yykind) << " ("]b4_locations_if([[
|
|
||||||
<< *yylocationp << ": "]])[;
|
|
||||||
yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
|
||||||
*yycdebug_ << ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream&
|
|
||||||
]b4_parser_class[::debug_stream () const
|
|
||||||
{
|
|
||||||
return *yycdebug_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
]b4_parser_class[::set_debug_stream (std::ostream& o)
|
|
||||||
{
|
|
||||||
yycdebug_ = &o;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
]b4_parser_class[::debug_level_type
|
|
||||||
]b4_parser_class[::debug_level () const
|
|
||||||
{
|
|
||||||
return yydebug;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
]b4_parser_class[::set_debug_level (debug_level_type l)
|
|
||||||
{
|
|
||||||
// Actually, it is yydebug which is really used.
|
|
||||||
yydebug = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
]m4_popdef([b4_parse_param])dnl
|
|
||||||
b4_namespace_close[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
m4_define([b4_define_symbol_kind],
|
|
||||||
[m4_format([#define %-15s %s],
|
|
||||||
b4_symbol($][1, kind_base),
|
|
||||||
b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol($1, kind_base))
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_glr_cc_setup
|
|
||||||
# ---------------
|
|
||||||
# Setup redirections for glr.c: Map the names used in c.m4 to the ones used
|
|
||||||
# in c++.m4.
|
|
||||||
m4_define([b4_glr_cc_setup],
|
|
||||||
[[]b4_attribute_define[
|
|
||||||
]b4_null_define[
|
|
||||||
|
|
||||||
// This skeleton is based on C, yet compiles it as C++.
|
|
||||||
// So expect warnings about C style casts.
|
|
||||||
#if defined __clang__ && 306 <= __clang_major__ * 100 + __clang_minor__
|
|
||||||
# pragma clang diagnostic ignored "-Wold-style-cast"
|
|
||||||
#elif defined __GNUC__ && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
|
|
||||||
# pragma GCC diagnostic ignored "-Wold-style-cast"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// On MacOS, PTRDIFF_MAX is defined as long long, which Clang's
|
|
||||||
// -pedantic reports as being a C++11 extension.
|
|
||||||
#if defined __APPLE__ && YY_CPLUSPLUS < 201103L \
|
|
||||||
&& defined __clang__ && 4 <= __clang_major__
|
|
||||||
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef ]b4_symbol(empty, [id])[
|
|
||||||
#define ]b4_symbol(empty, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(empty, [id])[
|
|
||||||
#undef ]b4_symbol(eof, [id])[
|
|
||||||
#define ]b4_symbol(eof, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(eof, [id])[
|
|
||||||
#undef ]b4_symbol(error, [id])[
|
|
||||||
#define ]b4_symbol(error, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(error, [id])[
|
|
||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
|
||||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::value_type
|
|
||||||
#endif
|
|
||||||
#ifndef ]b4_api_PREFIX[LTYPE
|
|
||||||
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t;
|
|
||||||
|
|
||||||
// Expose C++ symbol kinds to C.
|
|
||||||
]b4_define_symbol_kind(-2)dnl
|
|
||||||
b4_symbol_foreach([b4_define_symbol_kind])])[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
m4_define([b4_undef_symbol_kind],
|
|
||||||
[[#undef ]b4_symbol($1, kind_base)[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_glr_cc_cleanup
|
|
||||||
# -----------------
|
|
||||||
# Remove redirections for glr.c.
|
|
||||||
m4_define([b4_glr_cc_cleanup],
|
|
||||||
[[#undef ]b4_symbol(empty, [id])[
|
|
||||||
#undef ]b4_symbol(eof, [id])[
|
|
||||||
#undef ]b4_symbol(error, [id])[
|
|
||||||
|
|
||||||
]b4_undef_symbol_kind(-2)dnl
|
|
||||||
b4_symbol_foreach([b4_undef_symbol_kind])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_shared_declarations(hh|cc)
|
|
||||||
# -----------------------------
|
|
||||||
# Declaration that might either go into the header (if --header, $1 = hh)
|
|
||||||
# or in the implementation file.
|
|
||||||
m4_define([b4_shared_declarations],
|
|
||||||
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|
||||||
b4_percent_code_get([[requires]])[
|
|
||||||
#include <iostream>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
]b4_cxx_portability[
|
|
||||||
]m4_ifdef([b4_location_include],
|
|
||||||
[[# include ]b4_location_include])[
|
|
||||||
]b4_variant_if([b4_variant_includes])[
|
|
||||||
|
|
||||||
// Whether we are compiled with exception support.
|
|
||||||
#ifndef YY_EXCEPTIONS
|
|
||||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
|
||||||
# define YY_EXCEPTIONS 0
|
|
||||||
# else
|
|
||||||
# define YY_EXCEPTIONS 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_YYDEBUG_define[
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
|
|
||||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
|
||||||
[b4_location_define])])[
|
|
||||||
|
|
||||||
/// A Bison parser.
|
|
||||||
class ]b4_parser_class[
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
]b4_public_types_declare[
|
|
||||||
|
|
||||||
/// Build a parser object.
|
|
||||||
]b4_parser_class[ (]b4_parse_param_decl[);
|
|
||||||
virtual ~]b4_parser_class[ ();
|
|
||||||
|
|
||||||
/// Parse. An alias for parse ().
|
|
||||||
/// \returns 0 iff parsing succeeded.
|
|
||||||
int operator() ();
|
|
||||||
|
|
||||||
/// Parse.
|
|
||||||
/// \returns 0 iff parsing succeeded.
|
|
||||||
virtual int parse ();
|
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
|
||||||
/// The current debugging stream.
|
|
||||||
std::ostream& debug_stream () const;
|
|
||||||
/// Set the current debugging stream.
|
|
||||||
void set_debug_stream (std::ostream &);
|
|
||||||
|
|
||||||
/// Type for debugging levels.
|
|
||||||
typedef int debug_level_type;
|
|
||||||
/// The current debugging level.
|
|
||||||
debug_level_type debug_level () const;
|
|
||||||
/// Set the current debugging level.
|
|
||||||
void set_debug_level (debug_level_type l);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Report a syntax error.]b4_locations_if([[
|
|
||||||
/// \param loc where the syntax error is found.]])[
|
|
||||||
/// \param msg a description of the syntax error.
|
|
||||||
virtual void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg);
|
|
||||||
|
|
||||||
# if ]b4_api_PREFIX[DEBUG
|
|
||||||
public:
|
|
||||||
/// \brief Report a symbol value on the debug stream.
|
|
||||||
/// \param yykind The symbol kind.
|
|
||||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
|
||||||
/// \param yylocationp Its location.]])[
|
|
||||||
virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
|
|
||||||
const value_type* yyvaluep]b4_locations_if([[,
|
|
||||||
const location_type* yylocationp]])[) const;
|
|
||||||
/// \brief Report a symbol on the debug stream.
|
|
||||||
/// \param yykind The symbol kind.
|
|
||||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
|
||||||
/// \param yylocationp Its location.]])[
|
|
||||||
virtual void yy_symbol_print_ (symbol_kind_type yykind,
|
|
||||||
const value_type* yyvaluep]b4_locations_if([[,
|
|
||||||
const location_type* yylocationp]])[) const;
|
|
||||||
private:
|
|
||||||
/// Debug stream.
|
|
||||||
std::ostream* yycdebug_;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_parse_param_vars[
|
|
||||||
};
|
|
||||||
|
|
||||||
]b4_namespace_close[
|
|
||||||
|
|
||||||
]b4_percent_code_get([[provides]])[
|
|
||||||
]m4_popdef([b4_parse_param])dnl
|
|
||||||
])[
|
|
||||||
|
|
||||||
]b4_header_if(
|
|
||||||
[b4_output_begin([b4_spec_header_file])
|
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|
||||||
[2002-2015, 2018-2022, 2025-2026])[
|
|
||||||
// C++ GLR parser skeleton written by Akim Demaille.
|
|
||||||
|
|
||||||
]b4_disclaimer[
|
|
||||||
]b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
|
||||||
]b4_shared_declarations[
|
|
||||||
]b4_cpp_guard_close([b4_spec_mapped_header_file])[
|
|
||||||
]b4_output_end])
|
|
||||||
|
|
||||||
# Let glr.c (and b4_shared_declarations) believe that the user
|
|
||||||
# arguments include the parser itself.
|
|
||||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_wrap]))
|
|
||||||
m4_include(b4_skeletonsdir/[glr.c])
|
|
||||||
m4_popdef([b4_parse_param])
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,503 +0,0 @@
|
|||||||
-*- Autoconf -*-
|
|
||||||
|
|
||||||
# Java language support for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_list2(LIST1, LIST2)
|
|
||||||
# ----------------------
|
|
||||||
# Join two lists with a comma if necessary.
|
|
||||||
m4_define([b4_list2],
|
|
||||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
|
||||||
# -------------------------------------------
|
|
||||||
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
|
||||||
# otherwise NOT.
|
|
||||||
m4_define([b4_percent_define_get3],
|
|
||||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
|
||||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_flag_value(BOOLEAN-FLAG)
|
|
||||||
# ---------------------------
|
|
||||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parser_class_declaration
|
|
||||||
# ---------------------------
|
|
||||||
# The declaration of the parser class ("class YYParser"), with all its
|
|
||||||
# qualifiers/annotations.
|
|
||||||
b4_percent_define_default([[api.parser.abstract]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.final]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.public]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.strictfp]], [[false]])
|
|
||||||
|
|
||||||
m4_define([b4_parser_class_declaration],
|
|
||||||
[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.public], [public ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.strictfp], [strictfp ])dnl
|
|
||||||
[class ]b4_parser_class[]dnl
|
|
||||||
b4_percent_define_get3([api.parser.extends], [ extends ])dnl
|
|
||||||
b4_percent_define_get3([api.parser.implements], [ implements ])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lexer_if(TRUE, FALSE)
|
|
||||||
# ------------------------
|
|
||||||
m4_define([b4_lexer_if],
|
|
||||||
[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_identification
|
|
||||||
# -----------------
|
|
||||||
m4_define([b4_identification],
|
|
||||||
[[ /** Version number for the Bison executable that generated this parser. */
|
|
||||||
public static final String bisonVersion = "]b4_version_string[";
|
|
||||||
|
|
||||||
/** Name of the skeleton that generated this parser. */
|
|
||||||
public static final String bisonSkeleton = ]b4_skeleton[;
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
|
||||||
## Data types. ##
|
|
||||||
## ------------ ##
|
|
||||||
|
|
||||||
# b4_int_type(MIN, MAX)
|
|
||||||
# ---------------------
|
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
|
||||||
# MIN to MAX (included).
|
|
||||||
m4_define([b4_int_type],
|
|
||||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
|
||||||
[int])])
|
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
|
||||||
# ---------------------
|
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
|
||||||
# 'NAME_min' to 'NAME_max' (included).
|
|
||||||
m4_define([b4_int_type_for],
|
|
||||||
[b4_int_type($1_min, $1_max)])
|
|
||||||
|
|
||||||
# b4_null
|
|
||||||
# -------
|
|
||||||
m4_define([b4_null], [null])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT)
|
|
||||||
# -------------------------------------------------------
|
|
||||||
# We use intermediate functions (e.g., yypact_init) to work around the
|
|
||||||
# 64KB limit for JVM methods. See
|
|
||||||
# https://lists.gnu.org/r/help-bison/2008-11/msg00004.html.
|
|
||||||
m4_define([b4_typed_parser_table_define],
|
|
||||||
[m4_ifval([$4], [b4_comment([$4])
|
|
||||||
])dnl
|
|
||||||
[private static final ]$1[[] yy$2_ = yy$2_init();
|
|
||||||
private static final ]$1[[] yy$2_init()
|
|
||||||
{
|
|
||||||
return new ]$1[[]
|
|
||||||
{
|
|
||||||
]$3[
|
|
||||||
};
|
|
||||||
}]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
|
|
||||||
#-----------------------------------------------------
|
|
||||||
m4_define([b4_integral_parser_table_define],
|
|
||||||
[b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------- ##
|
|
||||||
## Token kinds. ##
|
|
||||||
## ------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NUM)
|
|
||||||
# ------------------------
|
|
||||||
# Output the definition of this token as an enum.
|
|
||||||
m4_define([b4_token_enum],
|
|
||||||
[b4_token_visible_if([$1],
|
|
||||||
[m4_format([[ /** Token %s, to be returned by the scanner. */
|
|
||||||
static final int %s = %s%s;
|
|
||||||
]],
|
|
||||||
b4_symbol([$1], [tag]),
|
|
||||||
b4_symbol([$1], [id]),
|
|
||||||
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])))])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
|
||||||
# --------------
|
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
|
||||||
m4_define([b4_token_enums],
|
|
||||||
[b4_any_token_visible_if([ /* Token kinds. */
|
|
||||||
b4_symbol_foreach([b4_token_enum])])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
|
||||||
## Symbol kinds. ##
|
|
||||||
## -------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_kind(NUM)
|
|
||||||
# -------------------
|
|
||||||
m4_define([b4_symbol_kind],
|
|
||||||
[SymbolKind.b4_symbol_kind_base($@)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_enum(SYMBOL-NUM)
|
|
||||||
# --------------------------
|
|
||||||
# Output the definition of this symbol as an enum.
|
|
||||||
m4_define([b4_symbol_enum],
|
|
||||||
[m4_format([ %-30s %s],
|
|
||||||
m4_format([[%s(%s)%s]],
|
|
||||||
b4_symbol([$1], [kind_base]),
|
|
||||||
[$1],
|
|
||||||
m4_if([$1], b4_last_symbol, [[;]], [[,]])),
|
|
||||||
[b4_symbol_tag_comment([$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_symbol_enum
|
|
||||||
# ----------------------
|
|
||||||
# The definition of the symbol internal numbers as an enum.
|
|
||||||
m4_define([b4_declare_symbol_enum],
|
|
||||||
[[ public enum SymbolKind
|
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_enum])[
|
|
||||||
|
|
||||||
private final int yycode_;
|
|
||||||
|
|
||||||
SymbolKind (int n) {
|
|
||||||
this.yycode_ = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final SymbolKind[] values_ = {
|
|
||||||
]m4_map_args_sep([b4_symbol_kind(], [)], [,
|
|
||||||
], b4_symbol_numbers)[
|
|
||||||
};
|
|
||||||
|
|
||||||
static final SymbolKind get(int code) {
|
|
||||||
return values_[code];
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getCode() {
|
|
||||||
return this.yycode_;
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_parse_error_bmatch(
|
|
||||||
[simple\|verbose],
|
|
||||||
[[ /* Return YYSTR after stripping away unnecessary quotes and
|
|
||||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
|
||||||
that double-quoting is unnecessary unless the string contains an
|
|
||||||
apostrophe, a comma, or backslash (other than backslash-backslash).
|
|
||||||
YYSTR is taken from yytname. */
|
|
||||||
private static String yytnamerr_(String yystr)
|
|
||||||
{
|
|
||||||
if (yystr.charAt (0) == '"')
|
|
||||||
{
|
|
||||||
StringBuffer yyr = new StringBuffer();
|
|
||||||
strip_quotes: for (int i = 1; i < yystr.length(); i++)
|
|
||||||
switch (yystr.charAt(i))
|
|
||||||
{
|
|
||||||
case '\'':
|
|
||||||
case ',':
|
|
||||||
break strip_quotes;
|
|
||||||
|
|
||||||
case '\\':
|
|
||||||
if (yystr.charAt(++i) != '\\')
|
|
||||||
break strip_quotes;
|
|
||||||
/* Fall through. */
|
|
||||||
default:
|
|
||||||
yyr.append(yystr.charAt(i));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '"':
|
|
||||||
return yyr.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return yystr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
|
||||||
First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */
|
|
||||||
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
|
||||||
|
|
||||||
/* The user-facing name of this symbol. */
|
|
||||||
public final String getName() {
|
|
||||||
return yytnamerr_(yytname_[yycode_]);
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
[custom\|detailed],
|
|
||||||
[[ /* YYNAMES_[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
|
||||||
First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */
|
|
||||||
]b4_typed_parser_table_define([String], [names], [b4_symbol_names])[
|
|
||||||
|
|
||||||
/* The user-facing name of this symbol. */
|
|
||||||
public final String getName() {
|
|
||||||
return yynames_[yycode_];
|
|
||||||
}]])[
|
|
||||||
};
|
|
||||||
]])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_case(ID, CODE, [COMMENTS])
|
|
||||||
# -----------------------------
|
|
||||||
# We need to fool Java's stupid unreachable code detection.
|
|
||||||
m4_define([b4_case],
|
|
||||||
[ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
|
||||||
if (yyn == $1)
|
|
||||||
$2;
|
|
||||||
break;
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_predicate_case(LABEL, CONDITIONS)
|
|
||||||
# ------------------------------------
|
|
||||||
m4_define([b4_predicate_case],
|
|
||||||
[ case $1:
|
|
||||||
if (! ($2)) YYERROR;
|
|
||||||
break;
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## -------- ##
|
|
||||||
## Checks. ##
|
|
||||||
## -------- ##
|
|
||||||
|
|
||||||
b4_percent_define_check_kind([[api.value.type]], [code], [deprecated])
|
|
||||||
|
|
||||||
b4_percent_define_check_kind([[annotations]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[extends]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[implements]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[init_throws]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[lex_throws]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[api.parser.class]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## Default values. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
|
|
||||||
b4_percent_define_default([[api.value.type]], [[Object]])
|
|
||||||
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
|
||||||
|
|
||||||
# b4_api_prefix, b4_api_PREFIX
|
|
||||||
# ----------------------------
|
|
||||||
# Corresponds to %define api.prefix
|
|
||||||
b4_percent_define_default([[api.prefix]], [[YY]])
|
|
||||||
m4_define([b4_api_prefix],
|
|
||||||
[b4_percent_define_get([[api.prefix]])])
|
|
||||||
m4_define([b4_api_PREFIX],
|
|
||||||
[m4_toupper(b4_api_prefix)])
|
|
||||||
|
|
||||||
# b4_prefix
|
|
||||||
# ---------
|
|
||||||
# If the %name-prefix is not given, it is api.prefix.
|
|
||||||
m4_define_default([b4_prefix], [b4_api_prefix])
|
|
||||||
|
|
||||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])
|
|
||||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
|
||||||
|
|
||||||
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
|
|
||||||
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
|
||||||
|
|
||||||
b4_percent_define_default([[throws]], [])
|
|
||||||
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
|
||||||
|
|
||||||
b4_percent_define_default([[init_throws]], [])
|
|
||||||
m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
|
|
||||||
|
|
||||||
b4_percent_define_default([[api.location.type]], [Location])
|
|
||||||
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
|
|
||||||
|
|
||||||
b4_percent_define_default([[api.position.type]], [Position])
|
|
||||||
m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## Semantic Values. ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_translate(STRING)
|
|
||||||
# ---------------------------
|
|
||||||
# Used by "bison" in the array of symbol names to mark those that
|
|
||||||
# require translation.
|
|
||||||
m4_define([b4_symbol_translate],
|
|
||||||
[[i18n($1)]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_trans(STRING)
|
|
||||||
# ----------------
|
|
||||||
# Translate a string if i18n is enabled. Avoid collision with b4_translate.
|
|
||||||
m4_define([b4_trans],
|
|
||||||
[b4_has_translations_if([i18n($1)], [$1])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
|
||||||
# ----------------------------------------------
|
|
||||||
# See README.
|
|
||||||
m4_define([b4_symbol_value],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
[(($3)($1))],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[((b4_symbol([$2], [type]))($1))],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_value([SYMBOL-NUM], [TYPE])
|
|
||||||
# ----------------------------------
|
|
||||||
# See README.
|
|
||||||
m4_define([b4_lhs_value], [yyval])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_data(RULE-LENGTH, POS)
|
|
||||||
# -----------------------------
|
|
||||||
# See README.
|
|
||||||
m4_define([b4_rhs_data],
|
|
||||||
[yystack.valueAt (b4_subtract($@))])
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
|
||||||
# --------------------------------------------------
|
|
||||||
# See README.
|
|
||||||
#
|
|
||||||
# In this simple implementation, %token and %type have class names
|
|
||||||
# between the angle brackets.
|
|
||||||
m4_define([b4_rhs_value],
|
|
||||||
[b4_symbol_value([b4_rhs_data([$1], [$2])], [$3], [$4])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_location()
|
|
||||||
# -----------------
|
|
||||||
# Expansion of @$.
|
|
||||||
m4_define([b4_lhs_location],
|
|
||||||
[(yyloc)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, POS)
|
|
||||||
# ---------------------------------
|
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
|
||||||
# on RHS.
|
|
||||||
m4_define([b4_rhs_location],
|
|
||||||
[yystack.locationAt (b4_subtract($@))])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param
|
|
||||||
# b4_parse_param
|
|
||||||
# --------------
|
|
||||||
# If defined, b4_lex_param arrives double quoted, but below we prefer
|
|
||||||
# it to be single quoted. Same for b4_parse_param.
|
|
||||||
|
|
||||||
# TODO: should be in bison.m4
|
|
||||||
m4_define_default([b4_lex_param], [[]])
|
|
||||||
m4_define([b4_lex_param], b4_lex_param)
|
|
||||||
m4_define([b4_parse_param], b4_parse_param)
|
|
||||||
|
|
||||||
# b4_lex_param_decl
|
|
||||||
# -----------------
|
|
||||||
# Extra formal arguments of the constructor.
|
|
||||||
m4_define([b4_lex_param_decl],
|
|
||||||
[m4_ifset([b4_lex_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_decls(b4_lex_param))],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
m4_define([b4_param_decls],
|
|
||||||
[m4_map([b4_param_decl], [$@])])
|
|
||||||
m4_define([b4_param_decl], [, $1])
|
|
||||||
|
|
||||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_decl
|
|
||||||
# -------------------
|
|
||||||
# Extra formal arguments of the constructor.
|
|
||||||
m4_define([b4_parse_param_decl],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_decls(b4_parse_param))],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param_call
|
|
||||||
# -----------------
|
|
||||||
# Delegating the lexer parameters to the lexer constructor.
|
|
||||||
m4_define([b4_lex_param_call],
|
|
||||||
[m4_ifset([b4_lex_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_calls(b4_lex_param))],
|
|
||||||
[$1])])
|
|
||||||
m4_define([b4_param_calls],
|
|
||||||
[m4_map([b4_param_call], [$@])])
|
|
||||||
m4_define([b4_param_call], [, $2])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_cons
|
|
||||||
# -------------------
|
|
||||||
# Extra initialisations of the constructor.
|
|
||||||
m4_define([b4_parse_param_cons],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[b4_constructor_calls(b4_parse_param)])])
|
|
||||||
|
|
||||||
m4_define([b4_constructor_calls],
|
|
||||||
[m4_map([b4_constructor_call], [$@])])
|
|
||||||
m4_define([b4_constructor_call],
|
|
||||||
[this.$2 = $2;
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_vars
|
|
||||||
# -------------------
|
|
||||||
# Extra instance variables.
|
|
||||||
m4_define([b4_parse_param_vars],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[
|
|
||||||
/* User arguments. */
|
|
||||||
b4_var_decls(b4_parse_param)])])
|
|
||||||
|
|
||||||
m4_define([b4_var_decls],
|
|
||||||
[m4_map_sep([b4_var_decl], [
|
|
||||||
], [$@])])
|
|
||||||
m4_define([b4_var_decl],
|
|
||||||
[ protected final $1;])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_maybe_throws(THROWS)
|
|
||||||
# -----------------------
|
|
||||||
# Expand to either an empty string or "throws THROWS".
|
|
||||||
m4_define([b4_maybe_throws],
|
|
||||||
[m4_ifval($1, [ throws $1])])
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,381 +0,0 @@
|
|||||||
# C++ skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
|
||||||
[2002-2015, 2018-2022, 2025-2026])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_location_file
|
|
||||||
# ----------------
|
|
||||||
# Name of the file containing the position/location class,
|
|
||||||
# if we want this file.
|
|
||||||
b4_percent_define_check_file([b4_location_file],
|
|
||||||
[[api.location.file]],
|
|
||||||
b4_header_if([[location.hh]]))
|
|
||||||
|
|
||||||
# b4_location_include
|
|
||||||
# -------------------
|
|
||||||
# If location.hh is to be generated, the name under which should it be
|
|
||||||
# included.
|
|
||||||
#
|
|
||||||
# b4_location_path
|
|
||||||
# ----------------
|
|
||||||
# The path to use for the CPP guard.
|
|
||||||
m4_ifdef([b4_location_file],
|
|
||||||
[m4_define([b4_location_include],
|
|
||||||
[b4_percent_define_get([[api.location.include]],
|
|
||||||
["b4_location_file"])])
|
|
||||||
m4_define([b4_location_path],
|
|
||||||
b4_percent_define_get([[api.location.include]],
|
|
||||||
["b4_mapped_dir_prefix[]b4_location_file"]))
|
|
||||||
m4_define([b4_location_path],
|
|
||||||
m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2)))
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_position_file
|
|
||||||
# ----------------
|
|
||||||
# Name of the file containing the position class, if we want this file.
|
|
||||||
b4_header_if(
|
|
||||||
[b4_required_version_if(
|
|
||||||
[30200], [],
|
|
||||||
[m4_ifdef([b4_location_file],
|
|
||||||
[m4_define([b4_position_file], [position.hh])])])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_location_define
|
|
||||||
# ------------------
|
|
||||||
# Define the position and location classes.
|
|
||||||
m4_define([b4_location_define],
|
|
||||||
[[ /// A point in a source file.
|
|
||||||
class position
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// Type for file name.
|
|
||||||
typedef ]b4_percent_define_get([[api.filename.type]])[ filename_type;
|
|
||||||
/// Type for line and column numbers.
|
|
||||||
typedef int counter_type;
|
|
||||||
]m4_ifdef([b4_location_constructors], [[
|
|
||||||
/// Construct a position.
|
|
||||||
explicit position (filename_type* f = YY_NULLPTR,
|
|
||||||
counter_type l = ]b4_location_initial_line[,
|
|
||||||
counter_type c = ]b4_location_initial_column[)
|
|
||||||
: filename (f)
|
|
||||||
, line (l)
|
|
||||||
, column (c)
|
|
||||||
{}
|
|
||||||
|
|
||||||
]])[
|
|
||||||
/// Initialization.
|
|
||||||
void initialize (filename_type* fn = YY_NULLPTR,
|
|
||||||
counter_type l = ]b4_location_initial_line[,
|
|
||||||
counter_type c = ]b4_location_initial_column[)
|
|
||||||
{
|
|
||||||
filename = fn;
|
|
||||||
line = l;
|
|
||||||
column = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \name Line and Column related manipulators
|
|
||||||
** \{ */
|
|
||||||
/// (line related) Advance to the COUNT next lines.
|
|
||||||
void lines (counter_type count = 1)
|
|
||||||
{
|
|
||||||
if (count)
|
|
||||||
{
|
|
||||||
column = ]b4_location_initial_column[;
|
|
||||||
line = add_ (line, count, ]b4_location_initial_line[);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// (column related) Advance to the COUNT next columns.
|
|
||||||
void columns (counter_type count = 1)
|
|
||||||
{
|
|
||||||
column = add_ (column, count, ]b4_location_initial_column[);
|
|
||||||
}
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
/// File name to which this position refers.
|
|
||||||
filename_type* filename;
|
|
||||||
/// Current line number.
|
|
||||||
counter_type line;
|
|
||||||
/// Current column number.
|
|
||||||
counter_type column;
|
|
||||||
|
|
||||||
private:
|
|
||||||
/// Compute max (min, lhs+rhs).
|
|
||||||
static counter_type add_ (counter_type lhs, counter_type rhs, counter_type min)
|
|
||||||
{
|
|
||||||
return lhs + rhs < min ? min : lhs + rhs;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Add \a width columns, in place.
|
|
||||||
inline position&
|
|
||||||
operator+= (position& res, position::counter_type width)
|
|
||||||
{
|
|
||||||
res.columns (width);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Add \a width columns.
|
|
||||||
inline position
|
|
||||||
operator+ (position res, position::counter_type width)
|
|
||||||
{
|
|
||||||
return res += width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Subtract \a width columns, in place.
|
|
||||||
inline position&
|
|
||||||
operator-= (position& res, position::counter_type width)
|
|
||||||
{
|
|
||||||
return res += -width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Subtract \a width columns.
|
|
||||||
inline position
|
|
||||||
operator- (position res, position::counter_type width)
|
|
||||||
{
|
|
||||||
return res -= width;
|
|
||||||
}
|
|
||||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
|
||||||
/// Compare two position objects.
|
|
||||||
inline bool
|
|
||||||
operator== (const position& pos1, const position& pos2)
|
|
||||||
{
|
|
||||||
return (pos1.line == pos2.line
|
|
||||||
&& pos1.column == pos2.column
|
|
||||||
&& (pos1.filename == pos2.filename
|
|
||||||
|| (pos1.filename && pos2.filename
|
|
||||||
&& *pos1.filename == *pos2.filename)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compare two position objects.
|
|
||||||
inline bool
|
|
||||||
operator!= (const position& pos1, const position& pos2)
|
|
||||||
{
|
|
||||||
return !(pos1 == pos2);
|
|
||||||
}
|
|
||||||
]])[
|
|
||||||
/** \brief Intercept output stream redirection.
|
|
||||||
** \param ostr the destination output stream
|
|
||||||
** \param pos a reference to the position to redirect
|
|
||||||
*/
|
|
||||||
template <typename YYChar>
|
|
||||||
std::basic_ostream<YYChar>&
|
|
||||||
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
|
||||||
{
|
|
||||||
if (pos.filename)
|
|
||||||
ostr << *pos.filename << ':';
|
|
||||||
return ostr << pos.line << '.' << pos.column;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Two points in a source file.
|
|
||||||
class location
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// Type for file name.
|
|
||||||
typedef position::filename_type filename_type;
|
|
||||||
/// Type for line and column numbers.
|
|
||||||
typedef position::counter_type counter_type;
|
|
||||||
]m4_ifdef([b4_location_constructors], [
|
|
||||||
/// Construct a location from \a b to \a e.
|
|
||||||
location (const position& b, const position& e)
|
|
||||||
: begin (b)
|
|
||||||
, end (e)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/// Construct a 0-width location in \a p.
|
|
||||||
explicit location (const position& p = position ())
|
|
||||||
: begin (p)
|
|
||||||
, end (p)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
|
||||||
explicit location (filename_type* f,
|
|
||||||
counter_type l = ]b4_location_initial_line[,
|
|
||||||
counter_type c = ]b4_location_initial_column[)
|
|
||||||
: begin (f, l, c)
|
|
||||||
, end (f, l, c)
|
|
||||||
{}
|
|
||||||
|
|
||||||
])[
|
|
||||||
/// Initialization.
|
|
||||||
void initialize (filename_type* f = YY_NULLPTR,
|
|
||||||
counter_type l = ]b4_location_initial_line[,
|
|
||||||
counter_type c = ]b4_location_initial_column[)
|
|
||||||
{
|
|
||||||
begin.initialize (f, l, c);
|
|
||||||
end = begin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \name Line and Column related manipulators
|
|
||||||
** \{ */
|
|
||||||
public:
|
|
||||||
/// Reset initial location to final location.
|
|
||||||
void step ()
|
|
||||||
{
|
|
||||||
begin = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next columns.
|
|
||||||
void columns (counter_type count = 1)
|
|
||||||
{
|
|
||||||
end += count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next lines.
|
|
||||||
void lines (counter_type count = 1)
|
|
||||||
{
|
|
||||||
end.lines (count);
|
|
||||||
}
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
/// Beginning of the located region.
|
|
||||||
position begin;
|
|
||||||
/// End of the located region.
|
|
||||||
position end;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Join two locations, in place.
|
|
||||||
inline location&
|
|
||||||
operator+= (location& res, const location& end)
|
|
||||||
{
|
|
||||||
res.end = end.end;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Join two locations.
|
|
||||||
inline location
|
|
||||||
operator+ (location res, const location& end)
|
|
||||||
{
|
|
||||||
return res += end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Add \a width columns to the end position, in place.
|
|
||||||
inline location&
|
|
||||||
operator+= (location& res, location::counter_type width)
|
|
||||||
{
|
|
||||||
res.columns (width);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Add \a width columns to the end position.
|
|
||||||
inline location
|
|
||||||
operator+ (location res, location::counter_type width)
|
|
||||||
{
|
|
||||||
return res += width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Subtract \a width columns to the end position, in place.
|
|
||||||
inline location&
|
|
||||||
operator-= (location& res, location::counter_type width)
|
|
||||||
{
|
|
||||||
return res += -width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Subtract \a width columns to the end position.
|
|
||||||
inline location
|
|
||||||
operator- (location res, location::counter_type width)
|
|
||||||
{
|
|
||||||
return res -= width;
|
|
||||||
}
|
|
||||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
|
||||||
/// Compare two location objects.
|
|
||||||
inline bool
|
|
||||||
operator== (const location& loc1, const location& loc2)
|
|
||||||
{
|
|
||||||
return loc1.begin == loc2.begin && loc1.end == loc2.end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compare two location objects.
|
|
||||||
inline bool
|
|
||||||
operator!= (const location& loc1, const location& loc2)
|
|
||||||
{
|
|
||||||
return !(loc1 == loc2);
|
|
||||||
}
|
|
||||||
]])[
|
|
||||||
/** \brief Intercept output stream redirection.
|
|
||||||
** \param ostr the destination output stream
|
|
||||||
** \param loc a reference to the location to redirect
|
|
||||||
**
|
|
||||||
** Avoid duplicate information.
|
|
||||||
*/
|
|
||||||
template <typename YYChar>
|
|
||||||
std::basic_ostream<YYChar>&
|
|
||||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
|
||||||
{
|
|
||||||
location::counter_type end_col
|
|
||||||
= 0 < loc.end.column ? loc.end.column - 1 : 0;
|
|
||||||
ostr << loc.begin;
|
|
||||||
if (loc.end.filename
|
|
||||||
&& (!loc.begin.filename
|
|
||||||
|| *loc.begin.filename != *loc.end.filename))
|
|
||||||
ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col;
|
|
||||||
else if (loc.begin.line < loc.end.line)
|
|
||||||
ostr << '-' << loc.end.line << '.' << end_col;
|
|
||||||
else if (loc.begin.column < end_col)
|
|
||||||
ostr << '-' << end_col;
|
|
||||||
return ostr;
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
m4_ifdef([b4_position_file], [[
|
|
||||||
]b4_output_begin([b4_dir_prefix], [b4_position_file])[
|
|
||||||
]b4_generated_by[
|
|
||||||
// Starting with Bison 3.2, this file is useless: the structure it
|
|
||||||
// used to define is now defined in "]b4_location_file[".
|
|
||||||
//
|
|
||||||
// To get rid of this file:
|
|
||||||
// 1. add '%require "3.2"' (or newer) to your grammar file
|
|
||||||
// 2. remove references to this file from your build system
|
|
||||||
// 3. if you used to include it, include "]b4_location_file[" instead.
|
|
||||||
|
|
||||||
#include ]b4_location_include[
|
|
||||||
]b4_output_end[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
m4_ifdef([b4_location_file], [[
|
|
||||||
]b4_output_begin([b4_dir_prefix], [b4_location_file])[
|
|
||||||
]b4_copyright([Locations for Bison parsers in C++])[
|
|
||||||
/**
|
|
||||||
** \file ]b4_location_path[
|
|
||||||
** Define the ]b4_namespace_ref[::location class.
|
|
||||||
*/
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_location_path])[
|
|
||||||
|
|
||||||
# include <iostream>
|
|
||||||
# include <string>
|
|
||||||
|
|
||||||
]b4_null_define[
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
|
||||||
]b4_location_define[
|
|
||||||
]b4_namespace_close[
|
|
||||||
]b4_cpp_guard_close([b4_location_path])[
|
|
||||||
]b4_output_end[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
m4_popdef([b4_copyright_years])
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
# C++ skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
# b4_stack_file
|
|
||||||
# -------------
|
|
||||||
# Name of the file containing the stack class, if we want this file.
|
|
||||||
b4_header_if([b4_required_version_if([30200], [],
|
|
||||||
[m4_define([b4_stack_file], [stack.hh])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_stack_define
|
|
||||||
# ---------------
|
|
||||||
m4_define([b4_stack_define],
|
|
||||||
[[ /// A stack with random access from its top.
|
|
||||||
template <typename T, typename S = std::vector<T> >
|
|
||||||
class stack
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Hide our reversed order.
|
|
||||||
typedef typename S::iterator iterator;
|
|
||||||
typedef typename S::const_iterator const_iterator;
|
|
||||||
typedef typename S::size_type size_type;
|
|
||||||
typedef typename std::ptrdiff_t index_type;
|
|
||||||
|
|
||||||
stack (size_type n = 200) YY_NOEXCEPT
|
|
||||||
: seq_ (n)
|
|
||||||
{}
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Non copyable.
|
|
||||||
stack (const stack&) = delete;
|
|
||||||
/// Non copyable.
|
|
||||||
stack& operator= (const stack&) = delete;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Random access.
|
|
||||||
///
|
|
||||||
/// Index 0 returns the topmost element.
|
|
||||||
const T&
|
|
||||||
operator[] (index_type i) const
|
|
||||||
{
|
|
||||||
return seq_[size_type (size () - 1 - i)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Random access.
|
|
||||||
///
|
|
||||||
/// Index 0 returns the topmost element.
|
|
||||||
T&
|
|
||||||
operator[] (index_type i)
|
|
||||||
{
|
|
||||||
return seq_[size_type (size () - 1 - i)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Steal the contents of \a t.
|
|
||||||
///
|
|
||||||
/// Close to move-semantics.
|
|
||||||
void
|
|
||||||
push (YY_MOVE_REF (T) t)
|
|
||||||
{
|
|
||||||
seq_.push_back (T ());
|
|
||||||
operator[] (0).move (t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pop elements from the stack.
|
|
||||||
void
|
|
||||||
pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
for (; 0 < n; --n)
|
|
||||||
seq_.pop_back ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pop all elements from the stack.
|
|
||||||
void
|
|
||||||
clear () YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
seq_.clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Number of elements on the stack.
|
|
||||||
index_type
|
|
||||||
size () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return index_type (seq_.size ());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Iterator on top of the stack (going downwards).
|
|
||||||
const_iterator
|
|
||||||
begin () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return seq_.begin ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bottom of the stack.
|
|
||||||
const_iterator
|
|
||||||
end () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return seq_.end ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Present a slice of the top of a stack.
|
|
||||||
class slice
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
slice (const stack& stack, index_type range) YY_NOEXCEPT
|
|
||||||
: stack_ (stack)
|
|
||||||
, range_ (range)
|
|
||||||
{}
|
|
||||||
|
|
||||||
const T&
|
|
||||||
operator[] (index_type i) const
|
|
||||||
{
|
|
||||||
return stack_[range_ - i];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
const stack& stack_;
|
|
||||||
index_type range_;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
#if YY_CPLUSPLUS < 201103L
|
|
||||||
/// Non copyable.
|
|
||||||
stack (const stack&);
|
|
||||||
/// Non copyable.
|
|
||||||
stack& operator= (const stack&);
|
|
||||||
#endif
|
|
||||||
/// The wrapped container.
|
|
||||||
S seq_;
|
|
||||||
};
|
|
||||||
]])
|
|
||||||
|
|
||||||
m4_ifdef([b4_stack_file],
|
|
||||||
[b4_output_begin([b4_dir_prefix], [b4_stack_file])[
|
|
||||||
]b4_generated_by[
|
|
||||||
// Starting with Bison 3.2, this file is useless: the structure it
|
|
||||||
// used to define is now defined with the parser itself.
|
|
||||||
//
|
|
||||||
// To get rid of this file:
|
|
||||||
// 1. add '%require "3.2"' (or newer) to your grammar file
|
|
||||||
// 2. remove references to this file from your build system.
|
|
||||||
]b4_output_end[
|
|
||||||
]])
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
dnl GNU M4 treats -dV in a position-independent manner.
|
|
||||||
m4_debugmode(V)m4_traceon()dnl
|
|
||||||
@@ -1,526 +0,0 @@
|
|||||||
# C++ skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
|
|
||||||
# Foundation, Inc.
|
|
||||||
|
|
||||||
# This program 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
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
|
||||||
## variant. ##
|
|
||||||
## --------- ##
|
|
||||||
|
|
||||||
# b4_assert
|
|
||||||
# ---------
|
|
||||||
# The name of YY_ASSERT.
|
|
||||||
m4_define([b4_assert],
|
|
||||||
[b4_api_PREFIX[]_ASSERT])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
|
|
||||||
# ------------------------------------------------
|
|
||||||
# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
|
|
||||||
# YYTYPE.
|
|
||||||
m4_define([b4_symbol_variant],
|
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
|
||||||
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
|
||||||
switch ($1)
|
|
||||||
{
|
|
||||||
b4_type_foreach([_b4_type_action])[]dnl
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_char_sizeof_counter
|
|
||||||
# -----------------------
|
|
||||||
# A counter used by _b4_char_sizeof_dummy to create fresh symbols.
|
|
||||||
m4_define([_b4_char_sizeof_counter],
|
|
||||||
[0])
|
|
||||||
|
|
||||||
# _b4_char_sizeof_dummy
|
|
||||||
# ---------------------
|
|
||||||
# At each call return a new C++ identifier.
|
|
||||||
m4_define([_b4_char_sizeof_dummy],
|
|
||||||
[m4_define([_b4_char_sizeof_counter], m4_incr(_b4_char_sizeof_counter))dnl
|
|
||||||
dummy[]_b4_char_sizeof_counter])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_char_sizeof(SYMBOL-NUMS)
|
|
||||||
# ---------------------------
|
|
||||||
# To be mapped on the list of type names to produce:
|
|
||||||
#
|
|
||||||
# char dummy1[sizeof (type_name_1)];
|
|
||||||
# char dummy2[sizeof (type_name_2)];
|
|
||||||
#
|
|
||||||
# for defined type names.
|
|
||||||
m4_define([b4_char_sizeof],
|
|
||||||
[b4_symbol_if([$1], [has_type],
|
|
||||||
[
|
|
||||||
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
|
||||||
char _b4_char_sizeof_dummy@{sizeof (b4_symbol([$1], [type]))@};
|
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_variant_includes
|
|
||||||
# -------------------
|
|
||||||
# The needed includes for variants support.
|
|
||||||
m4_define([b4_variant_includes],
|
|
||||||
[b4_parse_assert_if([[#include <typeinfo>
|
|
||||||
#ifndef ]b4_assert[
|
|
||||||
# include <cassert>
|
|
||||||
# define ]b4_assert[ assert
|
|
||||||
#endif
|
|
||||||
]])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## -------------------------- ##
|
|
||||||
## Adjustments for variants. ##
|
|
||||||
## -------------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_declare
|
|
||||||
# ---------------------
|
|
||||||
# Define value_type.
|
|
||||||
m4_define([b4_value_type_declare],
|
|
||||||
[[ /// A buffer to store and retrieve objects.
|
|
||||||
///
|
|
||||||
/// Sort of a variant, but does not keep track of the nature
|
|
||||||
/// of the stored data, since that knowledge is available
|
|
||||||
/// via the current parser state.
|
|
||||||
class value_type
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// Type of *this.
|
|
||||||
typedef value_type self_type;
|
|
||||||
|
|
||||||
/// Empty construction.
|
|
||||||
value_type () YY_NOEXCEPT
|
|
||||||
: yyraw_ ()]b4_parse_assert_if([
|
|
||||||
, yytypeid_ (YY_NULLPTR)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
/// Construct and fill.
|
|
||||||
template <typename T>
|
|
||||||
value_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
|
||||||
: yytypeid_ (&typeid (T))])[
|
|
||||||
{]b4_parse_assert_if([[
|
|
||||||
]b4_assert[ (sizeof (T) <= size);]])[
|
|
||||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Non copyable.
|
|
||||||
value_type (const self_type&) = delete;
|
|
||||||
/// Non copyable.
|
|
||||||
self_type& operator= (const self_type&) = delete;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Destruction, allowed only if empty.
|
|
||||||
~value_type () YY_NOEXCEPT
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
]b4_assert[ (!yytypeid_);
|
|
||||||
])[}
|
|
||||||
|
|
||||||
# if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
|
||||||
template <typename T, typename... U>
|
|
||||||
T&
|
|
||||||
emplace (U&&... u)
|
|
||||||
{]b4_parse_assert_if([[
|
|
||||||
]b4_assert[ (!yytypeid_);
|
|
||||||
]b4_assert[ (sizeof (T) <= size);
|
|
||||||
yytypeid_ = & typeid (T);]])[
|
|
||||||
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
|
||||||
}
|
|
||||||
# else
|
|
||||||
/// Instantiate an empty \a T in here.
|
|
||||||
template <typename T>
|
|
||||||
T&
|
|
||||||
emplace ()
|
|
||||||
{]b4_parse_assert_if([[
|
|
||||||
]b4_assert[ (!yytypeid_);
|
|
||||||
]b4_assert[ (sizeof (T) <= size);
|
|
||||||
yytypeid_ = & typeid (T);]])[
|
|
||||||
return *new (yyas_<T> ()) T ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
|
||||||
template <typename T>
|
|
||||||
T&
|
|
||||||
emplace (const T& t)
|
|
||||||
{]b4_parse_assert_if([[
|
|
||||||
]b4_assert[ (!yytypeid_);
|
|
||||||
]b4_assert[ (sizeof (T) <= size);
|
|
||||||
yytypeid_ = & typeid (T);]])[
|
|
||||||
return *new (yyas_<T> ()) T (t);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/// Instantiate an empty \a T in here.
|
|
||||||
/// Obsolete, use emplace.
|
|
||||||
template <typename T>
|
|
||||||
T&
|
|
||||||
build ()
|
|
||||||
{
|
|
||||||
return emplace<T> ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
|
||||||
/// Obsolete, use emplace.
|
|
||||||
template <typename T>
|
|
||||||
T&
|
|
||||||
build (const T& t)
|
|
||||||
{
|
|
||||||
return emplace<T> (t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Accessor to a built \a T.
|
|
||||||
template <typename T>
|
|
||||||
T&
|
|
||||||
as () YY_NOEXCEPT
|
|
||||||
{]b4_parse_assert_if([[
|
|
||||||
]b4_assert[ (yytypeid_);
|
|
||||||
]b4_assert[ (*yytypeid_ == typeid (T));
|
|
||||||
]b4_assert[ (sizeof (T) <= size);]])[
|
|
||||||
return *yyas_<T> ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Const accessor to a built \a T (for %printer).
|
|
||||||
template <typename T>
|
|
||||||
const T&
|
|
||||||
as () const YY_NOEXCEPT
|
|
||||||
{]b4_parse_assert_if([[
|
|
||||||
]b4_assert[ (yytypeid_);
|
|
||||||
]b4_assert[ (*yytypeid_ == typeid (T));
|
|
||||||
]b4_assert[ (sizeof (T) <= size);]])[
|
|
||||||
return *yyas_<T> ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Swap the content with \a that, of same type.
|
|
||||||
///
|
|
||||||
/// Both variants must be built beforehand, because swapping the actual
|
|
||||||
/// data requires reading it (with as()), and this is not possible on
|
|
||||||
/// unconstructed variants: it would require some dynamic testing, which
|
|
||||||
/// should not be the variant's responsibility.
|
|
||||||
/// Swapping between built and (possibly) non-built is done with
|
|
||||||
/// self_type::move ().
|
|
||||||
template <typename T>
|
|
||||||
void
|
|
||||||
swap (self_type& that) YY_NOEXCEPT
|
|
||||||
{]b4_parse_assert_if([[
|
|
||||||
]b4_assert[ (yytypeid_);
|
|
||||||
]b4_assert[ (*yytypeid_ == *that.yytypeid_);]])[
|
|
||||||
std::swap (as<T> (), that.as<T> ());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Move the content of \a that to this.
|
|
||||||
///
|
|
||||||
/// Destroys \a that.
|
|
||||||
template <typename T>
|
|
||||||
void
|
|
||||||
move (self_type& that)
|
|
||||||
{
|
|
||||||
# if 201103L <= YY_CPLUSPLUS
|
|
||||||
emplace<T> (std::move (that.as<T> ()));
|
|
||||||
# else
|
|
||||||
emplace<T> ();
|
|
||||||
swap<T> (that);
|
|
||||||
# endif
|
|
||||||
that.destroy<T> ();
|
|
||||||
}
|
|
||||||
|
|
||||||
# if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Move the content of \a that to this.
|
|
||||||
template <typename T>
|
|
||||||
void
|
|
||||||
move (self_type&& that)
|
|
||||||
{
|
|
||||||
emplace<T> (std::move (that.as<T> ()));
|
|
||||||
that.destroy<T> ();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Copy the content of \a that to this.
|
|
||||||
template <typename T>
|
|
||||||
void
|
|
||||||
copy (const self_type& that)
|
|
||||||
{
|
|
||||||
emplace<T> (that.as<T> ());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Destroy the stored \a T.
|
|
||||||
template <typename T>
|
|
||||||
void
|
|
||||||
destroy ()
|
|
||||||
{
|
|
||||||
as<T> ().~T ();]b4_parse_assert_if([
|
|
||||||
yytypeid_ = YY_NULLPTR;])[
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
#if YY_CPLUSPLUS < 201103L
|
|
||||||
/// Non copyable.
|
|
||||||
value_type (const self_type&);
|
|
||||||
/// Non copyable.
|
|
||||||
self_type& operator= (const self_type&);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Accessor to raw memory as \a T.
|
|
||||||
template <typename T>
|
|
||||||
T*
|
|
||||||
yyas_ () YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
void *yyp = yyraw_;
|
|
||||||
return static_cast<T*> (yyp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Const accessor to raw memory as \a T.
|
|
||||||
template <typename T>
|
|
||||||
const T*
|
|
||||||
yyas_ () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
const void *yyp = yyraw_;
|
|
||||||
return static_cast<const T*> (yyp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An auxiliary type to compute the largest semantic type.
|
|
||||||
union union_type
|
|
||||||
{]b4_type_foreach([b4_char_sizeof])[ };
|
|
||||||
|
|
||||||
/// The size of the largest semantic type.
|
|
||||||
enum { size = sizeof (union_type) };
|
|
||||||
|
|
||||||
/// A buffer to store semantic values.
|
|
||||||
union
|
|
||||||
{
|
|
||||||
/// Strongest alignment constraints.
|
|
||||||
long double yyalign_me_;
|
|
||||||
/// A buffer large enough to store any of the semantic values.
|
|
||||||
char yyraw_[size];
|
|
||||||
};]b4_parse_assert_if([
|
|
||||||
|
|
||||||
/// Whether the content is built: if defined, the name of the stored type.
|
|
||||||
const std::type_info *yytypeid_;])[
|
|
||||||
};
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# How the semantic value is extracted when using variants.
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, SYMBOL-NUM, [TYPE])
|
|
||||||
# ----------------------------------------
|
|
||||||
# See README.
|
|
||||||
m4_define([b4_symbol_value],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
[$1.as< $3 > ()],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[$1.as < b4_symbol([$2], [type]) > ()],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
|
|
||||||
# -------------------------------------------------
|
|
||||||
# Same as b4_symbol_value, but used in a template method.
|
|
||||||
m4_define([b4_symbol_value_template],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
[$1.template as< $3 > ()],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[$1.template as < b4_symbol([$2], [type]) > ()],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------- ##
|
|
||||||
## make_SYMBOL. ##
|
|
||||||
## ------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_includes_tokens(SYMBOL-NUM...)
|
|
||||||
# ----------------------------------
|
|
||||||
# Expands to non-empty iff one of the SYMBOL-NUM denotes
|
|
||||||
# a token.
|
|
||||||
m4_define([_b4_is_token],
|
|
||||||
[b4_symbol_if([$1], [is_token], [1])])
|
|
||||||
m4_define([_b4_includes_tokens],
|
|
||||||
[m4_map([_b4_is_token], [$@])])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_token_maker_define(SYMBOL-NUM)
|
|
||||||
# ----------------------------------
|
|
||||||
# Declare make_SYMBOL for SYMBOL-NUM. Use at class-level.
|
|
||||||
m4_define([_b4_token_maker_define],
|
|
||||||
[b4_token_visible_if([$1],
|
|
||||||
[#if 201103L <= YY_CPLUSPLUS
|
|
||||||
static
|
|
||||||
symbol_type
|
|
||||||
make_[]_b4_symbol([$1], [id]) (b4_join(
|
|
||||||
b4_symbol_if([$1], [has_type],
|
|
||||||
[b4_symbol([$1], [type]) v]),
|
|
||||||
b4_locations_if([location_type l])))
|
|
||||||
{
|
|
||||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
|
||||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
|
||||||
b4_locations_if([std::move (l)])));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static
|
|
||||||
symbol_type
|
|
||||||
make_[]_b4_symbol([$1], [id]) (b4_join(
|
|
||||||
b4_symbol_if([$1], [has_type],
|
|
||||||
[const b4_symbol([$1], [type])& v]),
|
|
||||||
b4_locations_if([const location_type& l])))
|
|
||||||
{
|
|
||||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
|
||||||
b4_locations_if([l])));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_kind(SYMBOL-NUM)
|
|
||||||
# -------------------------
|
|
||||||
# Some tokens don't have an ID.
|
|
||||||
m4_define([b4_token_kind],
|
|
||||||
[b4_symbol_if([$1], [has_id],
|
|
||||||
[token::b4_symbol([$1], [id])],
|
|
||||||
[b4_symbol([$1], [code])])])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_tok_in(SYMBOL-NUM, ...)
|
|
||||||
# ---------------------------
|
|
||||||
# See b4_tok_in below. The SYMBOL-NUMs... are tokens only.
|
|
||||||
#
|
|
||||||
# We iterate over the tokens to group them by "range" of token numbers (not
|
|
||||||
# symbols numbers!).
|
|
||||||
#
|
|
||||||
# b4_fst is the start of that range.
|
|
||||||
# b4_prev is the previous value.
|
|
||||||
# b4_val is the current value.
|
|
||||||
# If b4_val is the successor of b4_prev in token numbers, update the latter,
|
|
||||||
# otherwise emit the code for range b4_fst .. b4_prev.
|
|
||||||
# $1 is also used as a terminator in the foreach, but it will not be printed.
|
|
||||||
#
|
|
||||||
m4_define([_b4_tok_in],
|
|
||||||
[m4_pushdef([b4_prev], [$1])dnl
|
|
||||||
m4_pushdef([b4_fst], [$1])dnl
|
|
||||||
m4_pushdef([b4_sep], [])dnl
|
|
||||||
m4_foreach([b4_val], m4_dquote(m4_shift($@, $1)),
|
|
||||||
[m4_if(b4_symbol(b4_val, [code]), m4_eval(b4_symbol(b4_prev, [code]) + 1), [],
|
|
||||||
[b4_sep[]m4_if(b4_fst, b4_prev,
|
|
||||||
[tok == b4_token_kind(b4_fst)],
|
|
||||||
[(b4_token_kind(b4_fst) <= tok && tok <= b4_token_kind(b4_prev))])[]dnl
|
|
||||||
m4_define([b4_fst], b4_val)dnl
|
|
||||||
m4_define([b4_sep], [
|
|
||||||
|| ])])dnl
|
|
||||||
m4_define([b4_prev], b4_val)])dnl
|
|
||||||
m4_popdef([b4_sep])dnl
|
|
||||||
m4_popdef([b4_fst])dnl
|
|
||||||
m4_popdef([b4_prev])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_filter_tokens(SYMBOL-NUM, ...)
|
|
||||||
# ----------------------------------
|
|
||||||
# Expand as the list of tokens amongst SYMBOL-NUM.
|
|
||||||
m4_define([_b4_filter_tokens],
|
|
||||||
[m4_pushdef([b4_sep])dnl
|
|
||||||
m4_foreach([b4_val], [$@],
|
|
||||||
[b4_symbol_if(b4_val, [is_token], [b4_sep[]b4_val[]m4_define([b4_sep], [,])])])dnl
|
|
||||||
m4_popdef([b4_sep])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_tok_in(SYMBOL-NUM, ...)
|
|
||||||
# ---------------------------
|
|
||||||
# A C++ conditional that checks that `tok` is a member of this list of symbol
|
|
||||||
# numbers.
|
|
||||||
m4_define([b4_tok_in],
|
|
||||||
[_$0(_b4_filter_tokens($@))])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_symbol_constructor_define(SYMBOL-NUM...)
|
|
||||||
# --------------------------------------------
|
|
||||||
# Define a symbol_type constructor common to all the SYMBOL-NUM (they
|
|
||||||
# have the same type). Use at class-level.
|
|
||||||
m4_define([_b4_symbol_constructor_define],
|
|
||||||
[m4_ifval(_b4_includes_tokens($@),
|
|
||||||
[[#if 201103L <= YY_CPLUSPLUS
|
|
||||||
symbol_type (]b4_join(
|
|
||||||
[int tok],
|
|
||||||
b4_symbol_if([$1], [has_type],
|
|
||||||
[b4_symbol([$1], [type]) v]),
|
|
||||||
b4_locations_if([location_type l]))[)
|
|
||||||
: super_type (]b4_join([token_kind_type (tok)],
|
|
||||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
|
||||||
b4_locations_if([std::move (l)]))[)
|
|
||||||
#else
|
|
||||||
symbol_type (]b4_join(
|
|
||||||
[int tok],
|
|
||||||
b4_symbol_if([$1], [has_type],
|
|
||||||
[const b4_symbol([$1], [type])& v]),
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: super_type (]b4_join([token_kind_type (tok)],
|
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
|
||||||
b4_locations_if([l]))[)
|
|
||||||
#endif
|
|
||||||
{]b4_parse_assert_if([[
|
|
||||||
#if !defined _MSC_VER || defined __clang__
|
|
||||||
]b4_assert[ (]b4_tok_in($@)[);
|
|
||||||
#endif
|
|
||||||
]])[}
|
|
||||||
]])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_define(SYMBOL-NUM)
|
|
||||||
# ----------------------------------------------
|
|
||||||
# Generate a constructor for basic_symbol from given type.
|
|
||||||
m4_define([b4_basic_symbol_constructor_define],
|
|
||||||
[[#if 201103L <= YY_CPLUSPLUS
|
|
||||||
basic_symbol (]b4_join(
|
|
||||||
[typename Base::kind_type t],
|
|
||||||
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
|
|
||||||
b4_locations_if([location_type&& l]))[)
|
|
||||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
|
||||||
, value (std::move (v))])[]b4_locations_if([
|
|
||||||
, location (std::move (l))])[
|
|
||||||
{}
|
|
||||||
#else
|
|
||||||
basic_symbol (]b4_join(
|
|
||||||
[typename Base::kind_type t],
|
|
||||||
b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
|
||||||
, value (v)])[]b4_locations_if([
|
|
||||||
, location (l)])[
|
|
||||||
{}
|
|
||||||
#endif
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_constructor_define
|
|
||||||
# ---------------------------
|
|
||||||
# Define the overloaded versions of make_FOO for all the token kinds.
|
|
||||||
m4_define([b4_token_constructor_define],
|
|
||||||
[ // Implementation of make_symbol for each token kind.
|
|
||||||
b4_symbol_foreach([_b4_token_maker_define])])
|
|
||||||
File diff suppressed because it is too large
Load Diff
+3
-16
@@ -3,8 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
bison.xsl - common templates for Bison XSLT.
|
bison.xsl - common templates for Bison XSLT.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
|
Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -19,12 +18,12 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:bison="https://www.gnu.org/software/bison/">
|
xmlns:bison="http://www.gnu.org/software/bison/">
|
||||||
|
|
||||||
<xsl:key
|
<xsl:key
|
||||||
name="bison:symbolByName"
|
name="bison:symbolByName"
|
||||||
@@ -91,16 +90,4 @@
|
|||||||
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="space">
|
|
||||||
<xsl:param name="repeat">0</xsl:param>
|
|
||||||
<xsl:param name="fill" select="' '"/>
|
|
||||||
<xsl:if test="number($repeat) >= 1">
|
|
||||||
<xsl:call-template name="space">
|
|
||||||
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
|
||||||
<xsl:with-param name="fill" select="$fill"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:value-of select="$fill"/>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
+29
-225
@@ -3,8 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
|
Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -19,14 +18,14 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Written by Wojciech Polak <polak@gnu.org>.
|
Written by Wojciech Polak <polak@gnu.org>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:bison="https://www.gnu.org/software/bison/">
|
xmlns:bison="http://www.gnu.org/software/bison/">
|
||||||
|
|
||||||
<xsl:import href="bison.xsl"/>
|
<xsl:import href="bison.xsl"/>
|
||||||
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
||||||
@@ -36,31 +35,11 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="bison-xml-report">
|
<xsl:template match="bison-xml-report">
|
||||||
<xsl:text>// Generated by GNU Bison </xsl:text>
|
<xsl:apply-templates select="automaton"/>
|
||||||
<xsl:value-of select="@version"/>
|
|
||||||
<xsl:text>. </xsl:text>
|
|
||||||
<xsl:text>// Report bugs to <</xsl:text>
|
|
||||||
<xsl:value-of select="@bug-report"/>
|
|
||||||
<xsl:text>>. </xsl:text>
|
|
||||||
<xsl:text>// Home page: <</xsl:text>
|
|
||||||
<xsl:value-of select="@url"/>
|
|
||||||
<xsl:text>>. </xsl:text>
|
|
||||||
<xsl:apply-templates select="automaton">
|
|
||||||
<xsl:with-param name="filename" select="filename"/>
|
|
||||||
</xsl:apply-templates>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="automaton">
|
<xsl:template match="automaton">
|
||||||
<xsl:param name="filename"/>
|
<xsl:text>digraph Automaton { </xsl:text>
|
||||||
<xsl:text>digraph "</xsl:text>
|
|
||||||
<xsl:call-template name="escape">
|
|
||||||
<xsl:with-param name="subject" select="$filename"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:text>" {
|
|
||||||
node [fontname = courier, shape = box, colorscheme = paired6]
|
|
||||||
edge [fontname = courier]
|
|
||||||
|
|
||||||
</xsl:text>
|
|
||||||
<xsl:apply-templates select="state"/>
|
<xsl:apply-templates select="state"/>
|
||||||
<xsl:text>} </xsl:text>
|
<xsl:text>} </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -69,87 +48,11 @@
|
|||||||
<xsl:call-template name="output-node">
|
<xsl:call-template name="output-node">
|
||||||
<xsl:with-param name="number" select="@number"/>
|
<xsl:with-param name="number" select="@number"/>
|
||||||
<xsl:with-param name="label">
|
<xsl:with-param name="label">
|
||||||
|
<xsl:value-of select="@number"/>
|
||||||
<xsl:apply-templates select="itemset/item"/>
|
<xsl:apply-templates select="itemset/item"/>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:apply-templates select="actions/transitions"/>
|
<xsl:apply-templates select="actions/transitions"/>
|
||||||
<xsl:apply-templates select="actions/reductions">
|
|
||||||
<xsl:with-param name="staten">
|
|
||||||
<xsl:value-of select="@number"/>
|
|
||||||
</xsl:with-param>
|
|
||||||
</xsl:apply-templates>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="actions/reductions">
|
|
||||||
<xsl:param name="staten"/>
|
|
||||||
<xsl:for-each select='reduction'>
|
|
||||||
<!-- These variables are needed because the current context can't be
|
|
||||||
referred to directly in XPath expressions. -->
|
|
||||||
<xsl:variable name="rul">
|
|
||||||
<xsl:value-of select="@rule"/>
|
|
||||||
</xsl:variable>
|
|
||||||
<xsl:variable name="ena">
|
|
||||||
<xsl:value-of select="@enabled"/>
|
|
||||||
</xsl:variable>
|
|
||||||
<!-- The foreach's body is protected by this, so that we are actually
|
|
||||||
going to iterate once per reduction rule, and not per lookahead. -->
|
|
||||||
<xsl:if test='not(preceding-sibling::*[@rule=$rul and @enabled=$ena])'>
|
|
||||||
<xsl:variable name="rule">
|
|
||||||
<xsl:choose>
|
|
||||||
<!-- The acceptation state is referred to as 'accept' in the XML, but
|
|
||||||
just as '0' in the DOT. -->
|
|
||||||
<xsl:when test="@rule='accept'">
|
|
||||||
<xsl:text>0</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="@rule"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
|
|
||||||
<!-- The edge's beginning -->
|
|
||||||
<xsl:call-template name="reduction-edge-start">
|
|
||||||
<xsl:with-param name="state" select="$staten"/>
|
|
||||||
<xsl:with-param name="rule" select="$rule"/>
|
|
||||||
<xsl:with-param name="enabled" select="@enabled"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
|
|
||||||
<!-- The edge's tokens -->
|
|
||||||
<!-- Don't show labels for the default action. In other cases, there will
|
|
||||||
always be at least one token, so 'label="[]"' will not occur. -->
|
|
||||||
<xsl:if test='$rule!=0 and not(../reduction[@enabled=$ena and @rule=$rule and @symbol="$default"])'>
|
|
||||||
<xsl:text>label="[</xsl:text>
|
|
||||||
<xsl:for-each select='../reduction[@enabled=$ena and @rule=$rule]'>
|
|
||||||
<xsl:call-template name="escape">
|
|
||||||
<xsl:with-param name="subject" select="@symbol"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:if test="position() != last ()">
|
|
||||||
<xsl:text>, </xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:for-each>
|
|
||||||
<xsl:text>]", </xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
|
|
||||||
<!-- The edge's end -->
|
|
||||||
<xsl:text>style=solid] </xsl:text>
|
|
||||||
|
|
||||||
<!-- The diamond representing the reduction -->
|
|
||||||
<xsl:call-template name="reduction-node">
|
|
||||||
<xsl:with-param name="state" select="$staten"/>
|
|
||||||
<xsl:with-param name="rule" select="$rule"/>
|
|
||||||
<xsl:with-param name="color">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test='@enabled="true"'>
|
|
||||||
<xsl:text>3</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text>5</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:with-param>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:for-each>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="actions/transitions">
|
<xsl:template match="actions/transitions">
|
||||||
@@ -157,56 +60,23 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
<xsl:param name="prev-rule-number"
|
|
||||||
select="preceding-sibling::item[1]/@rule-number"/>
|
|
||||||
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
||||||
<xsl:with-param name="dot" select="@dot"/>
|
<xsl:with-param name="point" select="@point"/>
|
||||||
<xsl:with-param name="num" select="@rule-number"/>
|
|
||||||
<xsl:with-param name="prev-lhs"
|
|
||||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
|
||||||
/>
|
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
<xsl:apply-templates select="lookaheads"/>
|
<xsl:apply-templates select="lookaheads"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="rule">
|
<xsl:template match="rule">
|
||||||
<xsl:param name="dot"/>
|
<xsl:param name="point"/>
|
||||||
<xsl:param name="num"/>
|
|
||||||
<xsl:param name="prev-lhs"/>
|
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:choose>
|
<xsl:value-of select="lhs"/>
|
||||||
<xsl:when test="$num < 10">
|
<xsl:text> -></xsl:text>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:if test="$point = 0">
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="$num < 100">
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text></xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
<xsl:value-of select="$num"/>
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$prev-lhs = lhs[text()]">
|
|
||||||
<xsl:call-template name="lpad">
|
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="lhs"/>
|
|
||||||
<xsl:text>:</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
<xsl:if test="$dot = 0">
|
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<!-- RHS -->
|
|
||||||
<xsl:for-each select="rhs/symbol|rhs/empty">
|
<xsl:for-each select="rhs/symbol|rhs/empty">
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:if test="$dot = position()">
|
<xsl:if test="$point = position()">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
@@ -217,12 +87,10 @@
|
|||||||
<xsl:value-of select="."/>
|
<xsl:value-of select="."/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty"/>
|
||||||
<xsl:text> %empty</xsl:text>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
<xsl:text> [</xsl:text>
|
<xsl:text>[</xsl:text>
|
||||||
<xsl:apply-templates select="symbol"/>
|
<xsl:apply-templates select="symbol"/>
|
||||||
<xsl:text>]</xsl:text>
|
<xsl:text>]</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -234,70 +102,26 @@
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="reduction-edge-start">
|
|
||||||
<xsl:param name="state"/>
|
|
||||||
<xsl:param name="rule"/>
|
|
||||||
<xsl:param name="enabled"/>
|
|
||||||
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:value-of select="$state"/>
|
|
||||||
<xsl:text> -> "</xsl:text>
|
|
||||||
<xsl:value-of select="$state"/>
|
|
||||||
<xsl:text>R</xsl:text>
|
|
||||||
<xsl:value-of select="$rule"/>
|
|
||||||
<xsl:if test='$enabled = "false"'>
|
|
||||||
<xsl:text>d</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:text>" [</xsl:text>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="reduction-node">
|
|
||||||
<xsl:param name="state"/>
|
|
||||||
<xsl:param name="rule"/>
|
|
||||||
<xsl:param name="color"/>
|
|
||||||
|
|
||||||
<xsl:text> "</xsl:text>
|
|
||||||
<xsl:value-of select="$state"/>
|
|
||||||
<xsl:text>R</xsl:text>
|
|
||||||
<xsl:value-of select="$rule"/>
|
|
||||||
<xsl:if test="$color = 5">
|
|
||||||
<xsl:text>d</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:text>" [label="</xsl:text>
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$rule = 0">
|
|
||||||
<xsl:text>Acc", fillcolor=1</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text>R</xsl:text>
|
|
||||||
<xsl:value-of select="$rule"/>
|
|
||||||
<xsl:text>", fillcolor=</xsl:text>
|
|
||||||
<xsl:value-of select="$color"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
<xsl:text>, shape=diamond, style=filled] </xsl:text>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="transition">
|
<xsl:template match="transition">
|
||||||
<xsl:call-template name="output-edge">
|
<xsl:call-template name="output-edge">
|
||||||
<xsl:with-param name="src" select="../../../@number"/>
|
<xsl:with-param name="src" select="../../../@number"/>
|
||||||
<xsl:with-param name="dst" select="@state"/>
|
<xsl:with-param name="dst" select="@state"/>
|
||||||
<xsl:with-param name="style">
|
<xsl:with-param name="style">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@symbol = 'error'">
|
<xsl:when test="@symbol = 'error'">
|
||||||
<xsl:text>dotted</xsl:text>
|
<xsl:text>dotted</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type = 'shift'">
|
<xsl:when test="@type = 'shift'">
|
||||||
<xsl:text>solid</xsl:text>
|
<xsl:text>solid</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:text>dashed</xsl:text>
|
<xsl:text>dashed</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="label">
|
<xsl:with-param name="label">
|
||||||
<xsl:if test="not(@symbol = 'error')">
|
<xsl:if test="not(@symbol = 'error')">
|
||||||
<xsl:value-of select="@symbol"/>
|
<xsl:value-of select="@symbol"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
@@ -309,13 +133,10 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="$number"/>
|
<xsl:value-of select="$number"/>
|
||||||
<xsl:text> [label="</xsl:text>
|
<xsl:text> [label="</xsl:text>
|
||||||
<xsl:text>State </xsl:text>
|
|
||||||
<xsl:value-of select="$number"/>
|
|
||||||
<xsl:text>\n</xsl:text>
|
|
||||||
<xsl:call-template name="escape">
|
<xsl:call-template name="escape">
|
||||||
<xsl:with-param name="subject" select="$label"/>
|
<xsl:with-param name="subject" select="$label"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:text>\l"] </xsl:text>
|
<xsl:text>"] </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="output-edge">
|
<xsl:template name="output-edge">
|
||||||
@@ -356,7 +177,7 @@
|
|||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="search" select="' '"/>
|
<xsl:with-param name="search" select="' '"/>
|
||||||
<xsl:with-param name="replace" select="'\l'"/>
|
<xsl:with-param name="replace" select="'\n'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
@@ -375,28 +196,11 @@
|
|||||||
<xsl:with-param name="search" select="$search"/>
|
<xsl:with-param name="search" select="$search"/>
|
||||||
<xsl:with-param name="replace" select="$replace"/>
|
<xsl:with-param name="replace" select="$replace"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$subject"/>
|
<xsl:value-of select="$subject"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="lpad">
|
|
||||||
<xsl:param name="str" select="''"/>
|
|
||||||
<xsl:param name="pad" select="0"/>
|
|
||||||
<xsl:variable name="diff" select="$pad - string-length($str)" />
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$diff < 0">
|
|
||||||
<xsl:value-of select="$str"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:call-template name="space">
|
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:value-of select="$str"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
+52
-44
@@ -3,8 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2text.xsl - transform Bison XML Report into plain text.
|
xml2text.xsl - transform Bison XML Report into plain text.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
|
Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -19,14 +18,14 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Written by Wojciech Polak <polak@gnu.org>.
|
Written by Wojciech Polak <polak@gnu.org>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:bison="https://www.gnu.org/software/bison/">
|
xmlns:bison="http://www.gnu.org/software/bison/">
|
||||||
|
|
||||||
<xsl:import href="bison.xsl"/>
|
<xsl:import href="bison.xsl"/>
|
||||||
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
||||||
@@ -53,7 +52,7 @@
|
|||||||
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
||||||
<xsl:text>Nonterminals useless in grammar </xsl:text>
|
<xsl:text>Nonterminals useless in grammar </xsl:text>
|
||||||
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
@@ -66,7 +65,7 @@
|
|||||||
<xsl:text>Terminals unused in grammar </xsl:text>
|
<xsl:text>Terminals unused in grammar </xsl:text>
|
||||||
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
||||||
<xsl:sort select="@symbol-number" data-type="number"/>
|
<xsl:sort select="@symbol-number" data-type="number"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
@@ -137,7 +136,6 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="terminal">
|
<xsl:template match="terminal">
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:call-template name="line-wrap">
|
<xsl:call-template name="line-wrap">
|
||||||
<xsl:with-param name="first-line-length">
|
<xsl:with-param name="first-line-length">
|
||||||
@@ -150,9 +148,6 @@
|
|||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="line-length" select="66" />
|
<xsl:with-param name="line-length" select="66" />
|
||||||
<xsl:with-param name="text">
|
<xsl:with-param name="text">
|
||||||
<xsl:if test="string-length(@type) != 0">
|
|
||||||
<xsl:value-of select="concat(' <', @type, '>')"/>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
||||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||||
<xsl:value-of select="concat(' ', @number)"/>
|
<xsl:value-of select="concat(' ', @number)"/>
|
||||||
@@ -162,18 +157,14 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="nonterminal">
|
<xsl:template match="nonterminal">
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:if test="string-length(@type) != 0">
|
|
||||||
<xsl:value-of select="concat(' <', @type, '>')"/>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:variable name="output">
|
<xsl:variable name="output">
|
||||||
<xsl:call-template name="line-wrap">
|
<xsl:call-template name="line-wrap">
|
||||||
<xsl:with-param name="line-length" select="66" />
|
<xsl:with-param name="line-length" select="66" />
|
||||||
<xsl:with-param name="text">
|
<xsl:with-param name="text">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||||
<xsl:text>on@left:</xsl:text>
|
<xsl:text>on@left:</xsl:text>
|
||||||
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
||||||
@@ -182,7 +173,7 @@
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="key('bison:ruleByRhs', @name)">
|
<xsl:if test="key('bison:ruleByRhs', @name)">
|
||||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text>, </xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:text>on@right:</xsl:text>
|
<xsl:text>on@right:</xsl:text>
|
||||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||||
@@ -239,7 +230,7 @@
|
|||||||
<xsl:template match="automaton/state">
|
<xsl:template match="automaton/state">
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:text>State </xsl:text>
|
<xsl:text>state </xsl:text>
|
||||||
<xsl:value-of select="@number"/>
|
<xsl:value-of select="@number"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="itemset/item">
|
<xsl:apply-templates select="itemset/item">
|
||||||
@@ -262,9 +253,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="transition[@type = $type]">
|
<xsl:apply-templates select="transition[@type = $type]">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -275,9 +266,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="error">
|
<xsl:apply-templates select="error">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="error"/>
|
<xsl:with-param name="node" select="error"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -288,9 +279,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="reduction">
|
<xsl:apply-templates select="reduction">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="reduction"/>
|
<xsl:with-param name="node" select="reduction"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -299,7 +290,7 @@
|
|||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:param name="prev-rule-number"
|
<xsl:param name="prev-rule-number"
|
||||||
select="preceding-sibling::item[1]/@rule-number"/>
|
select="preceding-sibling::item[1]/@rule-number"/>
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="key('bison:ruleByNumber', current()/@rule-number)"
|
select="key('bison:ruleByNumber', current()/@rule-number)"
|
||||||
>
|
>
|
||||||
@@ -309,7 +300,7 @@
|
|||||||
name="prev-lhs"
|
name="prev-lhs"
|
||||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||||
/>
|
/>
|
||||||
<xsl:with-param name="dot" select="@dot"/>
|
<xsl:with-param name="point" select="@point"/>
|
||||||
<xsl:with-param name="lookaheads">
|
<xsl:with-param name="lookaheads">
|
||||||
<xsl:apply-templates select="lookaheads"/>
|
<xsl:apply-templates select="lookaheads"/>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
@@ -320,7 +311,7 @@
|
|||||||
<xsl:param name="itemset"/>
|
<xsl:param name="itemset"/>
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:param name="prev-lhs"/>
|
<xsl:param name="prev-lhs"/>
|
||||||
<xsl:param name="dot"/>
|
<xsl:param name="point"/>
|
||||||
<xsl:param name="lookaheads"/>
|
<xsl:param name="lookaheads"/>
|
||||||
|
|
||||||
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
||||||
@@ -338,14 +329,14 @@
|
|||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
@@ -356,12 +347,17 @@
|
|||||||
|
|
||||||
<!-- RHS -->
|
<!-- RHS -->
|
||||||
<xsl:for-each select="rhs/*">
|
<xsl:for-each select="rhs/*">
|
||||||
<xsl:if test="position() = $dot + 1">
|
<xsl:if test="position() = $point + 1">
|
||||||
<xsl:text> •</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
||||||
<xsl:if test="position() = last() and position() = $dot">
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:text> •</xsl:text>
|
</xsl:if>
|
||||||
|
<xsl:if test="$itemset != 'true'">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="position() = last() and position() = $point">
|
||||||
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:if test="$lookaheads">
|
<xsl:if test="$lookaheads">
|
||||||
@@ -377,7 +373,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty">
|
||||||
<xsl:text> %empty</xsl:text>
|
<xsl:text> /* empty */</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
@@ -446,7 +442,7 @@
|
|||||||
<xsl:value-of select="@rule"/>
|
<xsl:value-of select="@rule"/>
|
||||||
<xsl:text> (</xsl:text>
|
<xsl:text> (</xsl:text>
|
||||||
<xsl:value-of
|
<xsl:value-of
|
||||||
select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"/>
|
select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"/>
|
||||||
<xsl:text>)</xsl:text>
|
<xsl:text>)</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
@@ -483,9 +479,9 @@
|
|||||||
<xsl:variable name="longest">
|
<xsl:variable name="longest">
|
||||||
<xsl:for-each select="$node">
|
<xsl:for-each select="$node">
|
||||||
<xsl:sort data-type="number" select="string-length(@symbol)"
|
<xsl:sort data-type="number" select="string-length(@symbol)"
|
||||||
order="descending"/>
|
order="descending"/>
|
||||||
<xsl:if test="position() = 1">
|
<xsl:if test="position() = 1">
|
||||||
<xsl:value-of select="string-length(@symbol)"/>
|
<xsl:value-of select="string-length(@symbol)"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
@@ -502,7 +498,7 @@
|
|||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:call-template name="space">
|
<xsl:call-template name="space">
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:value-of select="$str"/>
|
<xsl:value-of select="$str"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
@@ -520,12 +516,24 @@
|
|||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$str"/>
|
<xsl:value-of select="$str"/>
|
||||||
<xsl:call-template name="space">
|
<xsl:call-template name="space">
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="space">
|
||||||
|
<xsl:param name="repeat">0</xsl:param>
|
||||||
|
<xsl:param name="fill" select="' '"/>
|
||||||
|
<xsl:if test="number($repeat) >= 1">
|
||||||
|
<xsl:call-template name="space">
|
||||||
|
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
||||||
|
<xsl:with-param name="fill" select="$fill"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:value-of select="$fill"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="line-wrap">
|
<xsl:template name="line-wrap">
|
||||||
<xsl:param name="line-length"/> <!-- required -->
|
<xsl:param name="line-length"/> <!-- required -->
|
||||||
<xsl:param name="first-line-length" select="$line-length"/>
|
<xsl:param name="first-line-length" select="$line-length"/>
|
||||||
|
|||||||
+127
-148
@@ -3,8 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
|
Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||||
Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Written by Wojciech Polak <polak@gnu.org>.
|
Written by Wojciech Polak <polak@gnu.org>.
|
||||||
-->
|
-->
|
||||||
@@ -27,38 +26,37 @@
|
|||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns="http://www.w3.org/1999/xhtml"
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
xmlns:bison="https://www.gnu.org/software/bison/">
|
xmlns:bison="http://www.gnu.org/software/bison/">
|
||||||
|
|
||||||
<xsl:import href="bison.xsl"/>
|
<xsl:import href="bison.xsl"/>
|
||||||
|
|
||||||
<xsl:output method="xml" encoding="UTF-8"
|
<xsl:output method="xml" encoding="UTF-8"
|
||||||
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
|
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
|
||||||
indent="yes"/>
|
indent="yes"/>
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
|
||||||
<title>
|
<title>
|
||||||
<xsl:value-of select="bison-xml-report/filename"/>
|
<xsl:value-of select="bison-xml-report/filename"/>
|
||||||
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
|
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
|
||||||
</title>
|
</title>
|
||||||
<style type="text/css"><![CDATA[
|
<style type="text/css"><![CDATA[
|
||||||
body {
|
body {
|
||||||
font-family: "Nimbus Sans L", Arial, sans-serif;
|
font-family: "Nimbus Sans L", Arial, sans-serif;
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
a:link {
|
a:link {
|
||||||
color: #1f00ff;
|
color: #1f00ff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:visited {
|
a:visited {
|
||||||
color: #1f00ff;
|
color: #1f00ff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
#menu a {
|
#menu a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
@@ -76,7 +74,7 @@
|
|||||||
ol.lower-alpha {
|
ol.lower-alpha {
|
||||||
list-style-type: lower-alpha;
|
list-style-type: lower-alpha;
|
||||||
}
|
}
|
||||||
.dot {
|
.point {
|
||||||
color: #cc0000;
|
color: #cc0000;
|
||||||
}
|
}
|
||||||
#footer {
|
#footer {
|
||||||
@@ -89,7 +87,7 @@
|
|||||||
<xsl:apply-templates select="bison-xml-report"/>
|
<xsl:apply-templates select="bison-xml-report"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<div id="footer"><hr />This document was generated using
|
<div id="footer"><hr />This document was generated using
|
||||||
<a href="https://www.gnu.org/software/bison/" title="GNU Bison">
|
<a href="http://www.gnu.org/software/bison/" title="GNU Bison">
|
||||||
GNU Bison <xsl:value-of select="/bison-xml-report/@version"/></a>
|
GNU Bison <xsl:value-of select="/bison-xml-report/@version"/></a>
|
||||||
XML Automaton Report.<br />
|
XML Automaton Report.<br />
|
||||||
<!-- default copying notice -->
|
<!-- default copying notice -->
|
||||||
@@ -111,21 +109,21 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="#reductions">Reductions</a>
|
<a href="#reductions">Reductions</a>
|
||||||
<ul class="lower-alpha">
|
<ul class="lower-alpha">
|
||||||
<li><a href="#nonterminals_useless_in_grammar">Nonterminals useless in grammar</a></li>
|
<li><a href="#nonterminals_useless_in_grammar">Nonterminals useless in grammar</a></li>
|
||||||
<li><a href="#terminals_unused_in_grammar">Terminals unused in grammar</a></li>
|
<li><a href="#terminals_unused_in_grammar">Terminals unused in grammar</a></li>
|
||||||
<li><a href="#rules_useless_in_grammar">Rules useless in grammar</a></li>
|
<li><a href="#rules_useless_in_grammar">Rules useless in grammar</a></li>
|
||||||
<xsl:if test="grammar/rules/rule[@usefulness='useless-in-parser']">
|
<xsl:if test="grammar/rules/rule[@usefulness='useless-in-parser']">
|
||||||
<li><a href="#rules_useless_in_parser">Rules useless in parser due to conflicts</a></li>
|
<li><a href="#rules_useless_in_parser">Rules useless in parser due to conflicts</a></li>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#conflicts">Conflicts</a></li>
|
<li><a href="#conflicts">Conflicts</a></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#grammar">Grammar</a>
|
<a href="#grammar">Grammar</a>
|
||||||
<ul class="lower-alpha">
|
<ul class="lower-alpha">
|
||||||
<li><a href="#grammar">Itemset</a></li>
|
<li><a href="#grammar">Itemset</a></li>
|
||||||
<li><a href="#terminals">Terminal symbols</a></li>
|
<li><a href="#terminals">Terminal symbols</a></li>
|
||||||
<li><a href="#nonterminals">Nonterminal symbols</a></li>
|
<li><a href="#nonterminals">Nonterminal symbols</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#automaton">Automaton</a></li>
|
<li><a href="#automaton">Automaton</a></li>
|
||||||
@@ -156,9 +154,9 @@
|
|||||||
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
||||||
<p class="pre">
|
<p class="pre">
|
||||||
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</p>
|
</p>
|
||||||
@@ -175,9 +173,9 @@
|
|||||||
<p class="pre">
|
<p class="pre">
|
||||||
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
||||||
<xsl:sort select="@symbol-number" data-type="number"/>
|
<xsl:sort select="@symbol-number" data-type="number"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</p>
|
</p>
|
||||||
@@ -228,7 +226,6 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<p class="pre">
|
<p class="pre">
|
||||||
<xsl:call-template name="style-rule-set">
|
<xsl:call-template name="style-rule-set">
|
||||||
<xsl:with-param name="anchor" select="'true'" />
|
|
||||||
<xsl:with-param
|
<xsl:with-param
|
||||||
name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
|
name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
|
||||||
/>
|
/>
|
||||||
@@ -240,11 +237,9 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="style-rule-set">
|
<xsl:template name="style-rule-set">
|
||||||
<xsl:param name="anchor"/>
|
|
||||||
<xsl:param name="rule-set"/>
|
<xsl:param name="rule-set"/>
|
||||||
<xsl:for-each select="$rule-set">
|
<xsl:for-each select="$rule-set">
|
||||||
<xsl:apply-templates select=".">
|
<xsl:apply-templates select=".">
|
||||||
<xsl:with-param name="anchor" select="$anchor"/>
|
|
||||||
<xsl:with-param name="pad" select="'3'"/>
|
<xsl:with-param name="pad" select="'3'"/>
|
||||||
<xsl:with-param name="prev-lhs">
|
<xsl:with-param name="prev-lhs">
|
||||||
<xsl:if test="position()>1">
|
<xsl:if test="position()>1">
|
||||||
@@ -310,10 +305,9 @@
|
|||||||
<xsl:text> Terminals, with rules where they appear</xsl:text>
|
<xsl:text> Terminals, with rules where they appear</xsl:text>
|
||||||
</h3>
|
</h3>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<ul>
|
<p class="pre">
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:apply-templates select="terminal"/>
|
<xsl:apply-templates select="terminal"/>
|
||||||
</ul>
|
</p>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
@@ -323,64 +317,41 @@
|
|||||||
<xsl:text> Nonterminals, with rules where they appear</xsl:text>
|
<xsl:text> Nonterminals, with rules where they appear</xsl:text>
|
||||||
</h3>
|
</h3>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<ul>
|
<p class="pre">
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="nonterminal[@usefulness!='useless-in-grammar']"
|
select="nonterminal[@usefulness!='useless-in-grammar']"
|
||||||
/>
|
/>
|
||||||
</ul>
|
</p>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="terminal">
|
<xsl:template match="terminal">
|
||||||
<xsl:text> </xsl:text>
|
<b><xsl:value-of select="@name"/></b>
|
||||||
<li>
|
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
||||||
<b><xsl:value-of select="@name"/></b>
|
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||||
<xsl:if test="string-length(@type) != 0">
|
<xsl:apply-templates select="." mode="number-link"/>
|
||||||
<xsl:value-of select="concat(' <', @type, '>')"/>
|
</xsl:for-each>
|
||||||
</xsl:if>
|
|
||||||
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
|
||||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
|
||||||
<xsl:apply-templates select="." mode="number-link"/>
|
|
||||||
</xsl:for-each>
|
|
||||||
</li>
|
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="nonterminal">
|
<xsl:template match="nonterminal">
|
||||||
<xsl:text> </xsl:text>
|
<b><xsl:value-of select="@name"/></b>
|
||||||
<li>
|
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
||||||
<b><xsl:value-of select="@name"/></b>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:if test="string-length(@type) != 0">
|
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||||
<xsl:value-of select="concat(' <', @type, '>')"/>
|
<xsl:text>on left:</xsl:text>
|
||||||
|
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
||||||
|
<xsl:apply-templates select="." mode="number-link"/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="key('bison:ruleByRhs', @name)">
|
||||||
|
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
<xsl:text>on right:</xsl:text>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||||
<ul>
|
<xsl:apply-templates select="." mode="number-link"/>
|
||||||
<xsl:text> </xsl:text>
|
</xsl:for-each>
|
||||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
</xsl:if>
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<li>
|
|
||||||
<xsl:text>on left:</xsl:text>
|
|
||||||
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
|
||||||
<xsl:apply-templates select="." mode="number-link"/>
|
|
||||||
</xsl:for-each>
|
|
||||||
</li>
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="key('bison:ruleByRhs', @name)">
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<li>
|
|
||||||
<xsl:text>on right:</xsl:text>
|
|
||||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
|
||||||
<xsl:apply-templates select="." mode="number-link"/>
|
|
||||||
</xsl:for-each>
|
|
||||||
</li>
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
</ul>
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
</li>
|
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
@@ -410,10 +381,10 @@
|
|||||||
<h3>
|
<h3>
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="name">
|
<xsl:attribute name="name">
|
||||||
<xsl:value-of select="concat('state_', @number)"/>
|
<xsl:value-of select="concat('state_', @number)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</a>
|
</a>
|
||||||
<xsl:text>State </xsl:text>
|
<xsl:text>state </xsl:text>
|
||||||
<xsl:value-of select="@number"/>
|
<xsl:value-of select="@number"/>
|
||||||
</h3>
|
</h3>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
@@ -439,9 +410,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="transition[@type = $type]">
|
<xsl:apply-templates select="transition[@type = $type]">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -452,9 +423,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="error">
|
<xsl:apply-templates select="error">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="error"/>
|
<xsl:with-param name="node" select="error"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -465,9 +436,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="reduction">
|
<xsl:apply-templates select="reduction">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="reduction"/>
|
<xsl:with-param name="node" select="reduction"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -476,7 +447,7 @@
|
|||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:param name="prev-rule-number"
|
<xsl:param name="prev-rule-number"
|
||||||
select="preceding-sibling::item[1]/@rule-number"/>
|
select="preceding-sibling::item[1]/@rule-number"/>
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="key('bison:ruleByNumber', current()/@rule-number)"
|
select="key('bison:ruleByNumber', current()/@rule-number)"
|
||||||
>
|
>
|
||||||
@@ -485,68 +456,71 @@
|
|||||||
<xsl:with-param name="prev-lhs"
|
<xsl:with-param name="prev-lhs"
|
||||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||||
/>
|
/>
|
||||||
<xsl:with-param name="dot" select="@dot"/>
|
<xsl:with-param name="point" select="@point"/>
|
||||||
<xsl:with-param name="lookaheads">
|
<xsl:with-param name="lookaheads">
|
||||||
<xsl:apply-templates select="lookaheads"/>
|
<xsl:apply-templates select="lookaheads"/>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!--
|
|
||||||
anchor = 'true': define as an <a> anchor.
|
|
||||||
itemset = 'true': show the items.
|
|
||||||
-->
|
|
||||||
<xsl:template match="rule">
|
<xsl:template match="rule">
|
||||||
<xsl:param name="anchor"/>
|
|
||||||
<xsl:param name="itemset"/>
|
<xsl:param name="itemset"/>
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:param name="prev-lhs"/>
|
<xsl:param name="prev-lhs"/>
|
||||||
<xsl:param name="dot"/>
|
<xsl:param name="point"/>
|
||||||
<xsl:param name="lookaheads"/>
|
<xsl:param name="lookaheads"/>
|
||||||
|
|
||||||
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
|
<xsl:if test="$itemset != 'true'">
|
||||||
|
<a>
|
||||||
|
<xsl:attribute name="name">
|
||||||
|
<xsl:value-of select="concat('rule_', @number)"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
</a>
|
||||||
|
</xsl:if>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
|
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$anchor = 'true'">
|
<xsl:when test="$itemset = 'true'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="name">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('rule_', @number)"/>
|
<xsl:value-of select="concat('#rule_', @number)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="string(@number)"/>
|
<xsl:with-param name="str" select="string(@number)"/>
|
||||||
<xsl:with-param name="pad" select="number($pad)"/>
|
<xsl:with-param name="pad" select="number($pad)"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</a>
|
</a>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<a>
|
<xsl:call-template name="lpad">
|
||||||
<xsl:attribute name="href">
|
<xsl:with-param name="str" select="string(@number)"/>
|
||||||
<xsl:value-of select="concat('#rule_', @number)"/>
|
<xsl:with-param name="pad" select="number($pad)"/>
|
||||||
</xsl:attribute>
|
</xsl:call-template>
|
||||||
<xsl:call-template name="lpad">
|
|
||||||
<xsl:with-param name="str" select="string(@number)"/>
|
|
||||||
<xsl:with-param name="pad" select="number($pad)"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</a>
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
|
|
||||||
<!-- LHS -->
|
<!-- LHS -->
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$prev-lhs = lhs[text()]">
|
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
||||||
|
<xsl:call-template name="lpad">
|
||||||
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<span class="i">
|
<span class="i">
|
||||||
<xsl:value-of select="lhs"/>
|
<xsl:value-of select="lhs"/>
|
||||||
</span>
|
</span>
|
||||||
<xsl:text> →</xsl:text>
|
<xsl:text> →</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
@@ -554,14 +528,19 @@ itemset = 'true': show the items.
|
|||||||
|
|
||||||
<!-- RHS -->
|
<!-- RHS -->
|
||||||
<xsl:for-each select="rhs/*">
|
<xsl:for-each select="rhs/*">
|
||||||
<xsl:if test="position() = $dot + 1">
|
<xsl:if test="position() = $point + 1">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="dot">•</span>
|
<span class="point">.</span>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
||||||
<xsl:if test="position() = last() and position() = $dot">
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$itemset != 'true'">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="position() = last() and position() = $point">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="dot">•</span>
|
<span class="point">.</span>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:if test="$lookaheads">
|
<xsl:if test="$lookaheads">
|
||||||
@@ -584,7 +563,7 @@ itemset = 'true': show the items.
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty">
|
||||||
<xsl:text> %empty</xsl:text>
|
<xsl:text> ε</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
@@ -610,18 +589,18 @@ itemset = 'true': show the items.
|
|||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@type = 'shift'">
|
<xsl:when test="@type = 'shift'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('#state_', @state)"/>
|
<xsl:value-of select="concat('#state_', @state)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:value-of select="concat('shift, and go to state ', @state)"/>
|
<xsl:value-of select="concat('shift, and go to state ', @state)"/>
|
||||||
</a>
|
</a>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type = 'goto'">
|
<xsl:when test="@type = 'goto'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('#state_', @state)"/>
|
<xsl:value-of select="concat('#state_', @state)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:value-of select="concat('go to state ', @state)"/>
|
<xsl:value-of select="concat('go to state ', @state)"/>
|
||||||
</a>
|
</a>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
@@ -658,10 +637,10 @@ itemset = 'true': show the items.
|
|||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('#rule_', @rule)"/>
|
<xsl:value-of select="concat('#rule_', @rule)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:value-of select="concat('reduce using rule ', @rule)"/>
|
<xsl:value-of select="concat('reduce using rule ', @rule)"/>
|
||||||
</a>
|
</a>
|
||||||
<xsl:text> (</xsl:text>
|
<xsl:text> (</xsl:text>
|
||||||
<xsl:value-of
|
<xsl:value-of
|
||||||
@@ -708,9 +687,9 @@ itemset = 'true': show the items.
|
|||||||
<xsl:variable name="longest">
|
<xsl:variable name="longest">
|
||||||
<xsl:for-each select="$node">
|
<xsl:for-each select="$node">
|
||||||
<xsl:sort data-type="number" select="string-length(@symbol)"
|
<xsl:sort data-type="number" select="string-length(@symbol)"
|
||||||
order="descending"/>
|
order="descending"/>
|
||||||
<xsl:if test="position() = 1">
|
<xsl:if test="position() = 1">
|
||||||
<xsl:value-of select="string-length(@symbol)"/>
|
<xsl:value-of select="string-length(@symbol)"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
@@ -727,7 +706,7 @@ itemset = 'true': show the items.
|
|||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:call-template name="space">
|
<xsl:call-template name="space">
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:value-of select="$str"/>
|
<xsl:value-of select="$str"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
@@ -745,7 +724,7 @@ itemset = 'true': show the items.
|
|||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$str"/>
|
<xsl:value-of select="$str"/>
|
||||||
<xsl:call-template name="space">
|
<xsl:call-template name="space">
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|||||||
+1750
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
|||||||
|
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||||
|
# Requires GNU sed
|
||||||
|
|
||||||
|
## Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
top_srcdir = ..
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
all: README
|
||||||
|
|
||||||
|
README: README.in $(top_srcdir)/configure
|
||||||
|
PACKAGE=`grep "^[ ]*PACKAGE=" $(top_srcdir)/configure | sed -e 's/^[ ]*PACKAGE=//' -e s/[\"\']//g`; \
|
||||||
|
VERSION=`grep "^[ ]*VERSION=" $(top_srcdir)/configure | sed -e 's/^[ ]*VERSION=//' -e s/[\"\']//g`; \
|
||||||
|
package_version=`echo "$${VERSION}" | sed 's/\.//g'`; \
|
||||||
|
tree_version=`echo "$${VERSION}" | sed 's/\.//2g'`; \
|
||||||
|
sed \
|
||||||
|
-e "s/@V@/$${PACKAGE}-$${VERSION}/g" \
|
||||||
|
-e "s/@VERSION@/$${VERSION}/g" \
|
||||||
|
-e "s/@PACKAGE_VERSION@/$$package_version/g" \
|
||||||
|
-e "s/@TREE_VERSION@/$$tree_version/g" \
|
||||||
|
$(srcdir)/README.in > t-$@
|
||||||
|
mv t-$@ $@
|
||||||
+195
@@ -0,0 +1,195 @@
|
|||||||
|
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||||
|
|
||||||
|
Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
1.: DJGPP specific changes.
|
||||||
|
=======================
|
||||||
|
|
||||||
|
The DJGPP port of Bison offers LFN and SFN support depending on which
|
||||||
|
OS it is running. If LFN support is available or not is determinated at
|
||||||
|
run time. If LFN support is available (DOS session under Win9X, Win2K,
|
||||||
|
WinXP, etc.) the standard posix file name extensions will be used.
|
||||||
|
These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN
|
||||||
|
support is available (plain DOS), then the standard MSDOS short file
|
||||||
|
names will be used. These are: y_tab.c, y_tab.h, y.out, etc.
|
||||||
|
It should be noticed that this bison version needs the m4 program as
|
||||||
|
back end to generate the parser file (y.tab.c etc.) from the skeleton
|
||||||
|
files. This implies that m4 must always be installed to get bison
|
||||||
|
working. m4 will use a couple of m4 scripts that will be installed in
|
||||||
|
/dev/env/DJDIR/share/bison and shall not be removed.
|
||||||
|
It should also be noticed that the skeleton files bison.simple and
|
||||||
|
bison.hairy are no longer supported. This applies also to the environ-
|
||||||
|
ment variables BISON_HAIRY and BISON_SIMPLE. Those variables are *no*
|
||||||
|
longer honored at all.
|
||||||
|
The kind of skeleton file bison.hairy is no longer supported at all.
|
||||||
|
The skeleton file bison.simple is now called yacc.c and is an m4 script.
|
||||||
|
The other two skeleton files supported by this bison version are glr.c
|
||||||
|
and lalr1.cc. The first one is a generalized LR C parser based on
|
||||||
|
Bison's LALR(1) tables and the second one is a experimental C++ parser
|
||||||
|
class.
|
||||||
|
As has been told before, bison uses m4 to generate the parser file.
|
||||||
|
This is done by forking and using pipes for the IPC. MSDOS does not
|
||||||
|
support this functionality so this has been reproduced in the usual
|
||||||
|
way by redirecting stdin and stdout of bison and m4 to temporary files
|
||||||
|
and processing these files in sequence.
|
||||||
|
It should be noticed that due to the great amount of file names that do
|
||||||
|
not cleanly map to 8.3 file names, you will need an OS with LFN support
|
||||||
|
to configure and compile the sources. On Win98 this implies that the
|
||||||
|
generation of numeric tails for 8.3 file name aliases must be enabled
|
||||||
|
or the compilation will fail.
|
||||||
|
|
||||||
|
|
||||||
|
Please **read** the docs.
|
||||||
|
|
||||||
|
|
||||||
|
2.: Installing the binary package.
|
||||||
|
==============================
|
||||||
|
|
||||||
|
2.1.: Copy the binary distribution into the top DJGPP installation directory,
|
||||||
|
just unzip it preserving the directory structure running *ONE* of the
|
||||||
|
following commands:
|
||||||
|
unzip32 bsn@[email protected] or
|
||||||
|
djtarx bsn@[email protected] or
|
||||||
|
pkunzip -d bsn@[email protected]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
3.: Building the binaries from sources.
|
||||||
|
===================================
|
||||||
|
|
||||||
|
3.1.: Create a temporary directory and copy the source package into the
|
||||||
|
directory. If you download the source distribution from one of the
|
||||||
|
DJGPP sites, just unzip it preserving the directory structure
|
||||||
|
running *ONE* of the following commands:
|
||||||
|
unzip32 bsn@[email protected] or
|
||||||
|
djtarx bsn@[email protected] or
|
||||||
|
pkunzip -d bsn@[email protected]
|
||||||
|
and proceed to the paragraph 3.3, below.
|
||||||
|
|
||||||
|
3.2.: Source distributions downloaded from one of the GNU FTP sites need
|
||||||
|
some more work to unpack, if LFN support is not available. If LFN is
|
||||||
|
available then you can extract the source files from the archive with
|
||||||
|
any unzip program and proceed to the paragraph 3.3, below. Any file
|
||||||
|
name issue will be handled by the the DJGPP configuration files.
|
||||||
|
To unpack the source distribution on SFN systems, first, you MUST use
|
||||||
|
the `djunpack' batch file to unzip the package. That is because some
|
||||||
|
file names in the official distributions need to be changed to avoid
|
||||||
|
problems on the various platforms supported by DJGPP.
|
||||||
|
`djunpack' invokes the `djtar' program (that is part of the basic DJGPP
|
||||||
|
development kit) to rename these files on the fly given a file with
|
||||||
|
name mappings; the distribution includes a file `djgpp/fnchange.lst'
|
||||||
|
with the necessary mappings. So you need first to retrieve that batch
|
||||||
|
file, and then invoke it to unpack the distribution. Here's how:
|
||||||
|
|
||||||
|
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||||
|
djunpack bison-@[email protected]
|
||||||
|
|
||||||
|
(The name of the distribution archive and the leading directory of the
|
||||||
|
path to `djunpack.bat' in the distribution will be different for
|
||||||
|
versions of Bison other than @VERSION@.)
|
||||||
|
|
||||||
|
If the argument to `djunpack.bat' include leading directories, it MUST
|
||||||
|
be given with the DOS-style backslashes; Unix-style forward slashes
|
||||||
|
will NOT work.
|
||||||
|
|
||||||
|
If the distribution comes as a .tar.bz2 archive, and your version of
|
||||||
|
`djtar' doesn't support bzip2 decompression, you need to unpack it as
|
||||||
|
follows:
|
||||||
|
|
||||||
|
bnzip2 bison-@[email protected]
|
||||||
|
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||||
|
djunpack bison-@[email protected]
|
||||||
|
|
||||||
|
3.3.: To build the binaries you will need the following binary packages:
|
||||||
|
djdev203.zip (or a later but NOT a prior version)
|
||||||
|
bsh204b.zip (or a later but NOT a prior version)
|
||||||
|
gccNNNb.zip, gppNNN.zip, bnuNNNb.zip, makNNNb.zip, filNNNb.zip,
|
||||||
|
perlNNNb.zip, shlNNNb.zip, txtNNNb.zip, txiNNNb.zip, grepNNNb.zip,
|
||||||
|
sedNNNb.zip and m4NNN.zip
|
||||||
|
|
||||||
|
If you want to run the check you will need also:
|
||||||
|
difNNNb.zip
|
||||||
|
|
||||||
|
NNN represents the latest version number of the binary packages. All
|
||||||
|
this packages can be found in the /v2gnu directory of any
|
||||||
|
ftp.delorie.com mirror.
|
||||||
|
You will need bsh204b.zip or later and *NOT* a prior version or
|
||||||
|
the build will fail. The same applies to djdev203.zip. Please note
|
||||||
|
that Bison requires m4-144b.zip or later to work properly.
|
||||||
|
|
||||||
|
3.4.: If for some reason you want to reconfigure the package cd into the top
|
||||||
|
srcdir (bison-@TREE_VERSION@) and run the following commands:
|
||||||
|
del djgpp\config.cache
|
||||||
|
make clean
|
||||||
|
djgpp\config
|
||||||
|
|
||||||
|
Please note that you *MUST* delete the config.cache file in the djgpp
|
||||||
|
subdir or you will not really reconfigure the sources because the
|
||||||
|
configuration informations will be read from the cache file instead
|
||||||
|
of being newly computed.
|
||||||
|
To build the programs in a directory other than where the sources are,
|
||||||
|
you must add the parameter that specifies the source directory,
|
||||||
|
e.g:
|
||||||
|
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||||
|
|
||||||
|
Lets assume you want to build the binaries in a directory placed on a
|
||||||
|
different drive (z:\build in this case) from where the sources are,
|
||||||
|
then you will run the following commands:
|
||||||
|
z:
|
||||||
|
md \build
|
||||||
|
cd \build
|
||||||
|
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||||
|
|
||||||
|
The order of the options and the srcdir option does not matter. You
|
||||||
|
*MUST* use forward slashes to specify the source directory.
|
||||||
|
|
||||||
|
The batch file will set same environment variables, make MSDOS specific
|
||||||
|
modifications to the Makefile.in's and supply all other needed options
|
||||||
|
to the configure script.
|
||||||
|
|
||||||
|
3.5.: To compile the package run from the top srcdir the command:
|
||||||
|
make
|
||||||
|
|
||||||
|
3.6.: Now you can run the tests if you like. From the top srcdir run the
|
||||||
|
command:
|
||||||
|
make check
|
||||||
|
|
||||||
|
No test should fail but the tests #131 (Doxygen Public Documentation)
|
||||||
|
and #132 (Doxygen Private Documentation) will be skipped. Please note
|
||||||
|
that the testsuite only works with LFN available. On plain DOS, most
|
||||||
|
of the tests will fail due to invalid DOS names.
|
||||||
|
|
||||||
|
3.7.: To install the binaries, header, library, catalogs, and info docs
|
||||||
|
run the following command from the top srcdir:
|
||||||
|
make install
|
||||||
|
|
||||||
|
This will install the products into your DJGPP installation tree given
|
||||||
|
by the default prefix "/dev/env/DJDIR". If you prefer to install them
|
||||||
|
into some other directory you will have to set prefix to the appropiate
|
||||||
|
value:
|
||||||
|
make install prefix=z:/some/other/place
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Send GNU bison specific bug reports to <[email protected]>.
|
||||||
|
Send suggestions and bug reports concerning the DJGPP port to
|
||||||
|
comp.os.msdos.djgpp or <[email protected]>.
|
||||||
|
|
||||||
|
|
||||||
|
Enjoy.
|
||||||
|
|
||||||
|
Guerrero, Juan Manuel <[email protected]>
|
||||||
@@ -0,0 +1,547 @@
|
|||||||
|
@echo off
|
||||||
|
Rem Configure Bison for DJGPP.
|
||||||
|
|
||||||
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
|
||||||
|
Rem Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
Rem the Free Software Foundation, either version 3 of the License, or
|
||||||
|
Rem (at your option) any later version.
|
||||||
|
Rem
|
||||||
|
Rem This program is distributed in the hope that it will be useful,
|
||||||
|
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
Rem GNU General Public License for more details.
|
||||||
|
Rem
|
||||||
|
Rem You should have received a copy of the GNU General Public License
|
||||||
|
Rem along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
echo Configuring Bison for DJGPP v2.x...
|
||||||
|
|
||||||
|
Rem The SmallEnv tests protect against fixed and too small size
|
||||||
|
Rem of the environment in stock DOS shell.
|
||||||
|
|
||||||
|
Rem Find out if NLS is wanted or not,
|
||||||
|
Rem if dependency-tracking is wanted or not,
|
||||||
|
Rem if caching is wanted or not
|
||||||
|
Rem and where the sources are.
|
||||||
|
Rem We always default to NLS support,
|
||||||
|
Rem no dependency tracking
|
||||||
|
Rem and to in place configuration.
|
||||||
|
set ARGS=
|
||||||
|
set NLS=enabled
|
||||||
|
if not "%NLS%" == "enabled" goto SmallEnv
|
||||||
|
set CACHING=enabled
|
||||||
|
if not "%CACHING%" == "enabled" goto SmallEnv
|
||||||
|
set DEPENDENCY_TRACKING=disabled
|
||||||
|
if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
|
||||||
|
set LIBICONV_PREFIX=disabled
|
||||||
|
if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
|
||||||
|
set LIBINTL_PREFIX=disabled
|
||||||
|
if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
|
||||||
|
set HTML=enabled
|
||||||
|
if not "%HTML%" == "enabled" goto SmallEnv
|
||||||
|
set XSRC=.
|
||||||
|
if not "%XSRC%" == "." goto SmallEnv
|
||||||
|
|
||||||
|
Rem Loop over all arguments.
|
||||||
|
Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
|
||||||
|
Rem All other arguments are stored into ARGS.
|
||||||
|
:ArgLoop
|
||||||
|
if "%1" == "nls" goto NextArgument
|
||||||
|
if "%1" == "NLS" goto NextArgument
|
||||||
|
if "%1" == "no-nls" goto NoNLS
|
||||||
|
if "%1" == "no-NLS" goto NoNLS
|
||||||
|
if "%1" == "NO-NLS" goto NoNLS
|
||||||
|
goto CachingOption
|
||||||
|
:NoNLS
|
||||||
|
if "%1" == "no-nls" set NLS=disabled
|
||||||
|
if "%1" == "no-NLS" set NLS=disabled
|
||||||
|
if "%1" == "NO-NLS" set NLS=disabled
|
||||||
|
if not "%NLS%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:CachingOption
|
||||||
|
if "%1" == "cache" goto NextArgument
|
||||||
|
if "%1" == "CACHE" goto NextArgument
|
||||||
|
if "%1" == "no-cache" goto NoCaching
|
||||||
|
if "%1" == "no-CACHE" goto NoCaching
|
||||||
|
if "%1" == "NO-CACHE" goto NoCaching
|
||||||
|
goto DependencyOption
|
||||||
|
:NoCaching
|
||||||
|
if "%1" == "no-cache" set CACHING=disabled
|
||||||
|
if "%1" == "no-CACHE" set CACHING=disabled
|
||||||
|
if "%1" == "NO-CACHE" set CACHING=disabled
|
||||||
|
if not "%CACHING%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:DependencyOption
|
||||||
|
if "%1" == "no-dep" goto NextArgument
|
||||||
|
if "%1" == "no-DEP" goto NextArgument
|
||||||
|
if "%1" == "NO-DEP" goto NextArgument
|
||||||
|
if "%1" == "dep" goto DependecyTraking
|
||||||
|
if "%1" == "DEP" goto DependecyTraking
|
||||||
|
goto LibiconvPrefixOption
|
||||||
|
:DependecyTraking
|
||||||
|
if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
|
||||||
|
if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
|
||||||
|
if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:LibiconvPrefixOption
|
||||||
|
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||||
|
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "libiconvprefix" goto WithLibiconvPrefix
|
||||||
|
if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
|
||||||
|
goto LibintlPrefixOption
|
||||||
|
:WithLibiconvPrefix
|
||||||
|
if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled
|
||||||
|
if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled
|
||||||
|
if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:LibintlPrefixOption
|
||||||
|
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||||
|
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "libintlprefix" goto _WithLibintlPrefix
|
||||||
|
if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
|
||||||
|
goto HTMLOption
|
||||||
|
:_WithLibintlPrefix
|
||||||
|
if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled
|
||||||
|
if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled
|
||||||
|
if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
|
||||||
|
:HTMLOption
|
||||||
|
if "%1" == "withhtml" goto NextArgument
|
||||||
|
if "%1" == "withHTML" goto NextArgument
|
||||||
|
if "%1" == "WITHHTML" goto NextArgument
|
||||||
|
if "%1" == "withouthtml" goto _WithoutHTML
|
||||||
|
if "%1" == "withoutHTML" goto _WithoutHTML
|
||||||
|
if "%1" == "WITHOUTHTML" goto _WithoutHTML
|
||||||
|
goto SrcDirOption
|
||||||
|
:_WithoutHTML
|
||||||
|
if "%1" == "withouthtml" set HTML=disabled
|
||||||
|
if "%1" == "withoutHTML" set HTML=disabled
|
||||||
|
if "%1" == "WITHOUTHTML" set HTML=disabled
|
||||||
|
if not "%HTML%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:SrcDirOption
|
||||||
|
echo %1 | grep -q "/"
|
||||||
|
if errorlevel 1 goto CollectArgument
|
||||||
|
set XSRC=%1
|
||||||
|
if not "%XSRC%" == "%1" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:CollectArgument
|
||||||
|
set _ARGS=%ARGS% %1
|
||||||
|
if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv
|
||||||
|
echo %_ARGS% | grep -q "[^ ]"
|
||||||
|
if not errorlevel 0 set ARGS=%_ARGS%
|
||||||
|
set _ARGS=
|
||||||
|
:NextArgument
|
||||||
|
shift
|
||||||
|
if not "%1" == "" goto ArgLoop
|
||||||
|
|
||||||
|
Rem Create an arguments file for the configure script.
|
||||||
|
echo --srcdir=%XSRC% > args
|
||||||
|
if "%CACHING%" == "enabled" echo --cache-file=%XSRC%/djgpp/config.cache >> args
|
||||||
|
if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable-dependency-tracking >> args
|
||||||
|
if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> args
|
||||||
|
if "%LIBICONV_PREFIX%" == "enabled" echo --with-libiconv-prefix >> args
|
||||||
|
if "%LIBICONV_PREFIX%" == "disabled" echo --without-libiconv-prefix >> args
|
||||||
|
if "%LIBINTL_PREFIX%" == "enabled" echo --with-libintl-prefix >> args
|
||||||
|
if "%LIBINTL_PREFIX%" == "disabled" echo --without-libintl-prefix >> args
|
||||||
|
if "%HTML%" == "enabled" echo --enable-html >> args
|
||||||
|
if "%HTML%" == "disabled" echo --disable-html >> args
|
||||||
|
if not "%ARGS%" == "" echo %ARGS% >> args
|
||||||
|
set ARGS=
|
||||||
|
set CACHING=
|
||||||
|
set DEPENDENCY_TRACKING=
|
||||||
|
set LIBICONV_PREFIX=
|
||||||
|
set LIBINTL_PREFIX=
|
||||||
|
set HTML=
|
||||||
|
|
||||||
|
if "%XSRC%" == "." goto InPlace
|
||||||
|
|
||||||
|
:NotInPlace
|
||||||
|
redir -e /dev/null update %XSRC%/configure.org ./configure
|
||||||
|
test -f ./configure
|
||||||
|
if errorlevel 1 update %XSRC%/configure ./configure
|
||||||
|
|
||||||
|
:InPlace
|
||||||
|
Rem Update configuration files
|
||||||
|
echo Updating configuration scripts...
|
||||||
|
test -f ./configure.org
|
||||||
|
if errorlevel 1 update configure configure.org
|
||||||
|
sed -f %XSRC%/djgpp/config.sed configure.org > configure
|
||||||
|
if errorlevel 1 goto SedError
|
||||||
|
|
||||||
|
Rem Make sure they have a config.site file
|
||||||
|
set CONFIG_SITE=%XSRC%/djgpp/config.site
|
||||||
|
if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
|
||||||
|
|
||||||
|
Rem inttypes_.h and inttypes.h map to the same 8.3 alias.
|
||||||
|
test -f %XSRC%/lib/inttypes_.h
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/lib/inttypes_.h %XSRC%/lib/_inttypes.h
|
||||||
|
|
||||||
|
Rem Make sure crucial file names are not munged by unpacking
|
||||||
|
test -f %XSRC%/po/Makefile.in.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.inin %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.in_in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile_in.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.inin %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in_in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile_in.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/data/c++.m4
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/data/c++.m4 %XSRC%/data/cxx.m4
|
||||||
|
test -f %XSRC%/data/cxx.m4
|
||||||
|
if errorlevel 1 mv -f %XSRC%/data/cpp.m4 %XSRC%/data/cxx.m4
|
||||||
|
test -f %XSRC%/data/c++-skel.m4
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/data/c++-skel.m4 %XSRC%/data/cxx-skel.m4
|
||||||
|
test -f %XSRC%/data/cxx-skel.m4
|
||||||
|
if errorlevel 1 mv -f %XSRC%/data/cpp-skel.m4 %XSRC%/data/cxx-skel.m4
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.shin %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh_in %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh.in %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.shin %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh_in %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec_sh.in %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/doc/yacc.1.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/doc/yacc.1.in %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/doc/yacc.1-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/doc/yacc.1 %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/doc/yacc.1-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/doc/yacc.1in %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/doc/yacc.1-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/doc/yacc.1_in %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/doc/yacc.1-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/doc/yacc_1.in %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/etc/bench.pl.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/etc/bench.pl.in %XSRC%/etc/bench.pl-in
|
||||||
|
test -f %XSRC%/etc/bench.pl-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/etc/bench.pl %XSRC%/etc/bench.pl-in
|
||||||
|
test -f %XSRC%/etc/bench.pl-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/etc/bench.plin %XSRC%/etc/bench.pl-in
|
||||||
|
test -f %XSRC%/etc/bench.pl-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/etc/bench.pl_in %XSRC%/etc/bench.pl-in
|
||||||
|
test -f %XSRC%/etc/bench.pl-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/etc/bench_pl.in %XSRC%/etc/bench.pl-in
|
||||||
|
|
||||||
|
:scan_gram_c_Test
|
||||||
|
test -f %XSRC%/src/c-scan-gram.c
|
||||||
|
if not errorlevel 1 goto scan_skel_c_Test
|
||||||
|
test -f %XSRC%/src/scan-gram-c.c
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/src/scan-gram-c.c %XSRC%/src/c-scan-gram.c
|
||||||
|
:scan_skel_c_Test
|
||||||
|
test -f %XSRC%/src/c-scan-skel.c
|
||||||
|
if not errorlevel 1 goto FixFiles
|
||||||
|
test -f %XSRC%/src/scan-skel-c.c
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/src/scan-skel-c.c %XSRC%/src/c-scan-skel.c
|
||||||
|
|
||||||
|
:FixFiles
|
||||||
|
Rem Fix data/lalr1.cc and data/location.cc to reflect the renaming of c++.m4
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/lalr1.cc > lalr1.cc
|
||||||
|
if errorlevel 1 goto lalr1_ccFileError
|
||||||
|
mv ./lalr1.cc %XSRC%/data/lalr1.cc
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/location.cc > location.cc
|
||||||
|
if errorlevel 1 goto location_ccFileError
|
||||||
|
mv ./location.cc %XSRC%/data/location.cc
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/glr.cc > glr.cc
|
||||||
|
if errorlevel 1 goto glr_ccFileError
|
||||||
|
mv ./glr.cc %XSRC%/data/glr.cc
|
||||||
|
|
||||||
|
Rem Fix src/getargs.c to reflect the renaming of c++-skel.m4
|
||||||
|
sed "s/c++-skel\.m4/cxx-skel.m4/" %XSRC%/src/getargs.c > getargs.c
|
||||||
|
if errorlevel 1 goto getargs_cFileError
|
||||||
|
mv ./getargs.c %XSRC%/src/getargs.c
|
||||||
|
|
||||||
|
Rem Define DJGPP specific defs in config.hin
|
||||||
|
echo Editing config.hin...
|
||||||
|
test -f %XSRC%/lib/config_h.org
|
||||||
|
if errorlevel 1 update %XSRC%/lib/config.hin %XSRC%/lib/config_h.org
|
||||||
|
sed -f %XSRC%/djgpp/config_h.sed %XSRC%/lib/config_h.org > config.hin
|
||||||
|
if errorlevel 1 goto SedError2
|
||||||
|
mv -f config.hin %XSRC%/lib/config.hin
|
||||||
|
|
||||||
|
|
||||||
|
Rem Fixing ilicit testsuite file name.
|
||||||
|
test -f %XSRC%/tests/c++.at
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
|
||||||
|
|
||||||
|
test -f %XSRC%/tests/testsuite.org
|
||||||
|
if errorlevel 1 update %XSRC%/tests/testsuite %XSRC%/tests/testsuite.org
|
||||||
|
sed -f %XSRC%/djgpp/testsuite.sed %XSRC%/tests/testsuite.org > testsuite.tmp
|
||||||
|
if errorlevel 1 goto SedError3
|
||||||
|
mv -f ./testsuite.tmp %XSRC%/tests/testsuite
|
||||||
|
|
||||||
|
Rem Fixing ilicit calc++ file names in the calc++ directory.
|
||||||
|
test -d %XSRC%/examples/calc++
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
|
||||||
|
test -d %XSRC%/examples/calcxx
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcpp %XSRC%/examples/calcxx
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-scanner.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-scanner.ll
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-driver.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-driver.hh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.hh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.stamp
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.yy
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
|
||||||
|
Rem Fixing #include lines in calcxx files.
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx.cc > calcxx.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.cc > calcxx-driver.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.hh > calcxx-driver.hh
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.cc > calcxx-parser.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.hh > calcxx-parser.hh
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.yy > calcxx-parser.yy
|
||||||
|
:if errorlevel 1 goto calcxxFileError
|
||||||
|
:mv ./calcxx-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.cc > calcxx-scanner.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.ll > calcxx-scanner.ll
|
||||||
|
:if errorlevel 1 goto calcxxFileError
|
||||||
|
:mv ./calcxx-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
sed "s/calc++/calcxx/" %XSRC%/examples/calcxx/test > test
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./test %XSRC%/examples/calcxx/test
|
||||||
|
|
||||||
|
|
||||||
|
Rem Fixing the scanner files to make file names 8.3 valid.
|
||||||
|
Rem Use only if you want to change the scan-gram.l and scan-skel.l files.
|
||||||
|
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-gram.l > scan-gram.l
|
||||||
|
: if errorlevel 1 goto ScannerFileError
|
||||||
|
: mv ./scan-gram.l %XSRC%/src/scan-gram.l
|
||||||
|
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-skel.l > scan-skel.l
|
||||||
|
: if errorlevel 1 goto ScannerFileError
|
||||||
|
: mv ./scan-skel.l %XSRC%/src/scan-skel.l
|
||||||
|
|
||||||
|
|
||||||
|
Rem This is required because DOS/Windows are case-insensitive
|
||||||
|
Rem to file names, and "make install" will do nothing if Make
|
||||||
|
Rem finds a file called `install'.
|
||||||
|
if exist INSTALL ren INSTALL INSTALL.txt
|
||||||
|
|
||||||
|
Rem Set SHELL to a sane default or some configure tests stop working
|
||||||
|
Rem if the package is configured across partitions.
|
||||||
|
if not "%SHELL%" == "" goto HomeName
|
||||||
|
set SHELL=/bin/sh
|
||||||
|
if not "%SHELL%" == "/bin/sh" goto SmallEnv
|
||||||
|
echo No SHELL found in the environment, using default value
|
||||||
|
|
||||||
|
:HomeName
|
||||||
|
Rem Set HOME to a sane default so configure stops complaining.
|
||||||
|
if not "%HOME%" == "" goto HostName
|
||||||
|
set HOME=%XSRC%/djgpp
|
||||||
|
if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
|
||||||
|
echo No HOME found in the environment, using default value
|
||||||
|
|
||||||
|
:HostName
|
||||||
|
Rem Set HOSTNAME so it shows in config.status
|
||||||
|
if not "%HOSTNAME%" == "" goto hostdone
|
||||||
|
if "%windir%" == "" goto msdos
|
||||||
|
set OS=MS-Windows
|
||||||
|
if not "%OS%" == "MS-Windows" goto SmallEnv
|
||||||
|
goto haveos
|
||||||
|
:msdos
|
||||||
|
set OS=MS-DOS
|
||||||
|
if not "%OS%" == "MS-DOS" goto SmallEnv
|
||||||
|
:haveos
|
||||||
|
if not "%USERNAME%" == "" goto haveuname
|
||||||
|
if not "%USER%" == "" goto haveuser
|
||||||
|
echo No USERNAME and no USER found in the environment, using default values
|
||||||
|
set HOSTNAME=Unknown PC
|
||||||
|
if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
|
||||||
|
goto userdone
|
||||||
|
:haveuser
|
||||||
|
set HOSTNAME=%USER%'s PC
|
||||||
|
if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
|
||||||
|
goto userdone
|
||||||
|
:haveuname
|
||||||
|
set HOSTNAME=%USERNAME%'s PC
|
||||||
|
if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
|
||||||
|
:userdone
|
||||||
|
set _HOSTNAME=%HOSTNAME%, %OS%
|
||||||
|
if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
|
||||||
|
set HOSTNAME=%_HOSTNAME%
|
||||||
|
:hostdone
|
||||||
|
set _HOSTNAME=
|
||||||
|
set OS=
|
||||||
|
|
||||||
|
Rem install-sh is required by the configure script but clashes with the
|
||||||
|
Rem various Makefile install-foo targets, so we MUST have it before the
|
||||||
|
Rem script runs and rename it afterwards
|
||||||
|
test -f %XSRC%/install-sh
|
||||||
|
if not errorlevel 1 goto NoRen0
|
||||||
|
test -f %XSRC%/install-sh.sh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
|
||||||
|
:NoRen0
|
||||||
|
|
||||||
|
if "%NLS%" == "disabled" goto WithoutNLS
|
||||||
|
|
||||||
|
:WithNLS
|
||||||
|
Rem Check for the needed libraries and binaries.
|
||||||
|
test -x /dev/env/DJDIR/bin/msgfmt.exe
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -x /dev/env/DJDIR/bin/xgettext.exe
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/libcharset.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libcharset.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/iconv.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libiconv.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/libintl.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libintl.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
|
||||||
|
Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
|
||||||
|
redir -e /dev/null rm %XSRC%/po/*.gmo
|
||||||
|
redir -e /dev/null rm %XSRC%/po/bison.pot
|
||||||
|
redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
|
||||||
|
redir -e /dev/null rm %XSRC%/po/stamp-cat-id
|
||||||
|
|
||||||
|
Rem Update the arguments file for the configure script.
|
||||||
|
Rem We prefer without-included-gettext because libintl.a from gettext package
|
||||||
|
Rem is the only one that is garanteed to have been ported to DJGPP.
|
||||||
|
echo --enable-nls --without-included-gettext >> args
|
||||||
|
goto ConfigurePackage
|
||||||
|
|
||||||
|
:MissingNLSTools
|
||||||
|
echo Needed libs/tools for NLS not found. Configuring without NLS.
|
||||||
|
:WithoutNLS
|
||||||
|
Rem Update the arguments file for the configure script.
|
||||||
|
echo --disable-nls >> args
|
||||||
|
|
||||||
|
:ConfigurePackage
|
||||||
|
echo Running the ./configure script...
|
||||||
|
sh ./configure @args
|
||||||
|
if errorlevel 1 goto CfgError
|
||||||
|
rm args
|
||||||
|
echo Done.
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:lalr1_ccFileError
|
||||||
|
echo ./data/lalr1.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:glr_ccFileError
|
||||||
|
echo ./data/glr.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:getargs_cFileError
|
||||||
|
echo ./src/getargs.c file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:location_ccFileError
|
||||||
|
echo ./data/location.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:calcxxFileError
|
||||||
|
echo ./examples/calcxx file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:ScannerFileError
|
||||||
|
echo ./scanner file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SedError
|
||||||
|
echo ./configure script editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SedError2
|
||||||
|
echo ./lib/config.hin editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SedError3
|
||||||
|
echo ./tests/testsuite editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:CfgError
|
||||||
|
echo ./configure script exited abnormally!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SmallEnv
|
||||||
|
echo Your environment size is too small. Enlarge it and run me again.
|
||||||
|
echo Configuration NOT done!
|
||||||
|
|
||||||
|
:End
|
||||||
|
test -f %XSRC%/install-sh.sh
|
||||||
|
if not errorlevel 1 goto NoRen1
|
||||||
|
test -f %XSRC%/install-sh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
|
||||||
|
:NoRen1
|
||||||
|
if "%SHELL%" == "/bin/sh" set SHELL=
|
||||||
|
if "%HOME%" == "%XSRC%/djgpp" set HOME=
|
||||||
|
set CONFIG_SITE=
|
||||||
|
set HOSTNAME=
|
||||||
|
set NLS=
|
||||||
|
set XSRC=
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
# DJGPP specific configuration file.
|
||||||
|
# Sed script for additional DJGPP specific editing
|
||||||
|
# of the configure script generated by autoconf 2.62.
|
||||||
|
|
||||||
|
|
||||||
|
# Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
# Additional editing of Makefiles
|
||||||
|
/^eval sed.*ac_file_inputs.*tmp\/out \\$/ {
|
||||||
|
:loop
|
||||||
|
n
|
||||||
|
/^$/!b loop
|
||||||
|
a\
|
||||||
|
cat > "$tmp/subs-djgpp.sed" << eof_djgpp\
|
||||||
|
# DJGPP specific Makefile changes.\
|
||||||
|
s,\\.deps,_deps,g\
|
||||||
|
s,\\.libs,_libs,g\
|
||||||
|
s,\\.new\\.,_new.,g\
|
||||||
|
s,\\.old\\.,_old.,g\
|
||||||
|
s,\\.tab\\.,_tab.,g\
|
||||||
|
s,c++\\.at,cxx.at,g\
|
||||||
|
s,c++\\.m4,cxx.m4,g\
|
||||||
|
s,c++-skel\\.m4,cxx-skel.m4,g\
|
||||||
|
s,calc++,calcxx,g\
|
||||||
|
s,scan-gram-c,c-scan-gram,g\
|
||||||
|
s,scan-skel-c,c-scan-skel,g\
|
||||||
|
s,inttypes_,_inttypes,g\
|
||||||
|
s,javacomp\\.sh\\.in,javacomp.sh-in,g\
|
||||||
|
s,javaexec\\.sh\\.in,javaexec.sh-in,g\
|
||||||
|
s,yacc\\.1\\.in,yacc.1-in,g\
|
||||||
|
s,bench\\.pl\\.in,bench.pl-in,g\
|
||||||
|
s,Makefile\\.am\\.in,Makefile.am-in,g\
|
||||||
|
s,Makefile\\.in\\.in,Makefile.in-in,g\
|
||||||
|
/^\\.y\\.c:/,/^$/ {\
|
||||||
|
/\\\$(YACCCOMPILE)/ {\
|
||||||
|
a\\\\\\
|
||||||
|
-@test -f y.tab.c && mv -f y.tab.c y_tab.c\\\\\
|
||||||
|
-@test -f y.tab.h && mv -f y.tab.h y_tab.h\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
/^libbison.a:/ i\\\\\\
|
||||||
|
\\\$(top_srcdir)/djgpp/subpipe.c: \\$(top_srcdir)/djgpp/subpipe.h\\\\\
|
||||||
|
subpipe.o: \\$(top_srcdir)/djgpp/subpipe.c \\$(top_srcdir)/djgpp/subpipe.h\\\\\
|
||||||
|
\\\$(COMPILE) -c \\$<\
|
||||||
|
/^yacc:/ i\\\\\\
|
||||||
|
yacc.bat:\\\\\
|
||||||
|
echo "bison\\$(EXEEXT) -y %1 %2 %3 %4 %5 %6 %7 %8 %9" >\\$@\
|
||||||
|
/^bin_SCRIPTS =/s/$/ yacc.bat/\
|
||||||
|
/^MOSTLYCLEANFILES = yacc/s/$/ yacc.bat/\
|
||||||
|
/cross-options.texi:/,/^$/ s|bison|&.exe|g\
|
||||||
|
/^\\.x\\.1:/,/^$/ s|\\$program|&.exe|g\
|
||||||
|
eof_djgpp\
|
||||||
|
sed -f "\$tmp/subs-djgpp.sed" \$tmp/out > \$tmp/out.djgpp\
|
||||||
|
mv -f \$tmp/out.djgpp \$tmp/out
|
||||||
|
}
|
||||||
|
|
||||||
|
# Makefile.in.in is renamed to Makefile.in-in.
|
||||||
|
/ac_config_files=/ {
|
||||||
|
/runtime-po/!s|po/Makefile\.in|&:po/Makefile.in-in|
|
||||||
|
s|runtime-po/Makefile\.in|&:runtime-po/Makefile.in-in|
|
||||||
|
s|javacomp\.sh\.in|javacomp.sh-in|
|
||||||
|
s|javaexec\.sh\.in|javaexec.sh-in|
|
||||||
|
s|doc/yacc\.1|&:doc/yacc.1-in|
|
||||||
|
s|etc/bench.pl|&:etc/bench.pl-in|
|
||||||
|
}
|
||||||
|
|
||||||
|
/CONFIG_FILES=/ {
|
||||||
|
/runtime-po/!s|po/Makefile\.in|&:po/Makefile.in-in|2
|
||||||
|
s|runtime-po/Makefile\.in|&:runtime-po/Makefile.in-in|2
|
||||||
|
s|javacomp\.sh\.in|javacomp.sh-in|
|
||||||
|
s|javaexec\.sh\.in|javaexec.sh-in|
|
||||||
|
s|doc/yacc\.1|&:doc/yacc.1-in|2
|
||||||
|
s|etc/bench\.pl|&:etc/bench.pl-in|2
|
||||||
|
}
|
||||||
|
|
||||||
|
# We always use _deps and _libs instead of .deps and .libs, because
|
||||||
|
# the latter is an invalid name on 8+3 MS-DOS file system. This makes
|
||||||
|
# the generated Makefiles good for every DJGPP installation, not only
|
||||||
|
# the one where the package was configured (which could happen to be
|
||||||
|
# a Windows box, where leading dots in file names are allowed).
|
||||||
|
/^rmdir[ ]*\.tst/ i\
|
||||||
|
am__leading_dot=_
|
||||||
|
|
||||||
|
# Replace (command) > /dev/null with `command > /dev/null`, since
|
||||||
|
# parenthesized commands always return zero status in the ported Bash,
|
||||||
|
# even if the named command doesn't exist
|
||||||
|
/if ([^|;`]*null/{
|
||||||
|
s,(,`,
|
||||||
|
s,),,
|
||||||
|
/null[ ]*2>&1/ s,2>&1,&`,
|
||||||
|
/null.*null/ s,null.*null,&`,
|
||||||
|
/null.*null/ !{
|
||||||
|
/null[ ]*2>&1/ !s,null,&`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# DOS-style absolute file names should be supported as well
|
||||||
|
/\*) top_srcdir=/s,/\*,[\\\\/]* | ?:[\\\\/]*,
|
||||||
|
|
||||||
|
# The following two items are changes needed for configuring
|
||||||
|
# and compiling across partitions.
|
||||||
|
# 1) The given srcdir value is always translated from the
|
||||||
|
# "x:" syntax into "/dev/x" syntax while we run configure.
|
||||||
|
/^[ ]*-srcdir=\*.*$/ a\
|
||||||
|
ac_optarg=`echo "$ac_optarg" | sed "s,^\\([A-Za-z]\\):,/dev/\\1,"`
|
||||||
|
/set X `ls -Lt \$srcdir/ i\
|
||||||
|
if `echo $srcdir | grep "^/dev/" - > /dev/null`; then\
|
||||||
|
srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`\
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Autoconf 2.52e generated configure scripts
|
||||||
|
# write absolute paths into Makefiles and bison.in
|
||||||
|
# making them useless for DJGPP installations for
|
||||||
|
# which the package has not been configured for.
|
||||||
|
/MISSING=/,/^$/ {
|
||||||
|
/^fi$/ a\
|
||||||
|
am_missing_run=`echo "$am_missing_run" | sed 's%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'`
|
||||||
|
}
|
||||||
|
/^install_sh=/a\
|
||||||
|
install_sh=`echo "$install_sh" | sed 's%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'`
|
||||||
|
|
||||||
|
# This will only work if the assumption that the
|
||||||
|
# testsuite is ran from the following path:
|
||||||
|
# ${top_srcdir}/tests/testsuite.dir
|
||||||
|
# holds. The explicit names are of no importance.
|
||||||
|
# ../../. == ${top_srcdir}
|
||||||
|
#/^esac$/,/^ac_abs_srcdir=/ {
|
||||||
|
/^ac_abs_srcdir=/ i\
|
||||||
|
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`\
|
||||||
|
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`\
|
||||||
|
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`
|
||||||
|
#ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`
|
||||||
|
/^ac_abs_srcdir=/ a\
|
||||||
|
for dj_dir in $ac_abs_builddir $ac_abs_top_builddir $ac_abs_top_srcdir $ac_abs_srcdir\
|
||||||
|
do\
|
||||||
|
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%//%/%g"`\
|
||||||
|
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%//%/%g"`\
|
||||||
|
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%//%/%g"`\
|
||||||
|
ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%//%/%g"`\
|
||||||
|
done
|
||||||
|
|
||||||
|
# Add DJGPP version information.
|
||||||
|
/^#define VERSION/ s/\$VERSION/& (DJGPP port (r1))/
|
||||||
|
|
||||||
|
# We need makeinfo to make the html formated docs.
|
||||||
|
/\$am_missing_run[ ]*makeinfo/ s,\$am_missing_run,,
|
||||||
|
|
||||||
|
# The path to the FORTRAN compiler and libraries
|
||||||
|
# shall contain no absolute path reference so it
|
||||||
|
# will be good for all djgpp installations.
|
||||||
|
/^FLIBS="\$ac_cv_flibs"/ i\
|
||||||
|
ac_djgpp_path=`echo "$DJDIR" | sed 's%\\\\\\%/%g' | tr $as_cr_LETTERS $as_cr_letters`\
|
||||||
|
ac_cv_flibs=`echo "$ac_cv_flibs" | sed "s%-L$ac_djgpp_path%-L/dev/env/DJDIR%g"`
|
||||||
|
|
||||||
|
# Autoconf generated configure scripts write absolute
|
||||||
|
# paths of certain header files into Makefiles making
|
||||||
|
# them useless for DJGPP installations for which the
|
||||||
|
# package has not been configured for.
|
||||||
|
/^.*echo "\$as_me:\$LINENO: result: \$gl_cv_absolute_.*$/ {
|
||||||
|
h
|
||||||
|
s,^.*\(gl_cv_absolute_\)\([a-z0-9_]*\)\(_h\).*$,\1\2\3=`echo $\1\2\3 | sed "s%[^:]:.*/include/%/dev/env/DJDIR/include/%"`,
|
||||||
|
G
|
||||||
|
}
|
||||||
|
/^.*echo "\$as_me:\$LINENO: result: \$gl_cv_full_.*$/ {
|
||||||
|
h
|
||||||
|
s,^.*\(gl_cv_full_\)\([a-z0-9_]*\)\(_h\).*$,\1\2\3=`echo $\1\2\3 | sed "s%[^:]:.*/include/%/dev/env/DJDIR/include/%"`,
|
||||||
|
G
|
||||||
|
}
|
||||||
|
|
||||||
|
# The following is not a valid DOS file name
|
||||||
|
s/calc++/calcxx/g
|
||||||
|
|
||||||
|
# The CR test for awk does not work for DJGPP.
|
||||||
|
/^ac_cs_awk_cr=/,/^$/ {
|
||||||
|
/^fi$/ a\
|
||||||
|
ac_cs_awk_cr=$ac_cr
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# This is the config.site file for configuring GNU packages
|
||||||
|
# which are to be built with DJGPP tools.
|
||||||
|
|
||||||
|
# Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program 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
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
# Include the djgpp subdirectory in PATH, so that getconf is found
|
||||||
|
PATH="$srcdir/djgpp:$PATH"
|
||||||
|
|
||||||
|
# These two variables are required, otherwise looking for
|
||||||
|
# programs along the PATH will not work.
|
||||||
|
PATH_SEPARATOR=:
|
||||||
|
PATH_EXPAND=y
|
||||||
|
|
||||||
|
# This is required in for "test -f foo" to find foo.exe
|
||||||
|
export TEST_FINDS_EXE=y
|
||||||
|
|
||||||
|
# The root of the DJGPP tree serves as the default prefix
|
||||||
|
test "x$prefix" = xNONE && prefix='/dev/env/DJDIR'
|
||||||
|
|
||||||
|
# This is required for config.status script to be run, since
|
||||||
|
# ./configure runs it by invoking ${CONFIG_SHELL-/bin/sh}
|
||||||
|
CONFIG_SHELL=${CONFIG_SHELL='sh'}
|
||||||
|
|
||||||
|
# These are set here so the generated Makefile's will be good
|
||||||
|
# for every DJGPP installation, not only the one where the
|
||||||
|
# package was configured.
|
||||||
|
# $INSTALL must be an absolute path name, otherwise config.status
|
||||||
|
# will try to prepend ./ and ../ to it when it goes into subdirs.
|
||||||
|
INSTALL=${INSTALL='/dev/env/DJDIR/bin/ginstall -c'}
|
||||||
|
RANLIB=${RANLIB='ranlib'}
|
||||||
|
GMSGFMT=${GMSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||||
|
MSGFMT=${MSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||||
|
XGETTEXT=${XGETTEXT='/dev/env/DJDIR/bin/xgettext'}
|
||||||
|
AWK=${AWK='gawk'}
|
||||||
|
|
||||||
|
# A sane default for emacs.
|
||||||
|
ac_cv_path_EMACS=${EMACS='/dev/env/DJDIR/gnu/emacs/bin/emacs'}
|
||||||
|
|
||||||
|
# A sane default for m4.
|
||||||
|
ac_cv_path_M4=${M4='/dev/env/DJDIR/bin/m4'}
|
||||||
|
|
||||||
|
# A sane default for grep.
|
||||||
|
ac_cv_path_GREP=${GREP='/dev/env/DJDIR/bin/grep'}
|
||||||
|
|
||||||
|
# A sane default for egrep.
|
||||||
|
ac_cv_path_EGREP=${EGREP='/dev/env/DJDIR/bin/egrep'}
|
||||||
|
|
||||||
|
# A sane default for fgrep.
|
||||||
|
ac_cv_path_FGREP=${FGREP='/dev/env/DJDIR/bin/fgrep'}
|
||||||
|
|
||||||
|
# A sane default for sed.
|
||||||
|
ac_cv_path_SED=${SED='/dev/env/DJDIR/bin/sed'}
|
||||||
|
|
||||||
|
# A sane default for mkdir.
|
||||||
|
ac_cv_path_mkdir=${MKDIR_P='/dev/env/DJDIR/bin/mkdir -p'}
|
||||||
|
|
||||||
|
# These are set here so the generated libtool will be good
|
||||||
|
# for every DJGPP installation, not only the one where the
|
||||||
|
# package was configured.
|
||||||
|
NM=${NM='nm'}
|
||||||
|
LD=${LD='ld'}
|
||||||
|
|
||||||
|
# Force the test for 'ln -s' to report 'cp -pf'.
|
||||||
|
ac_cv_prog_LN_S='cp -pf'
|
||||||
|
|
||||||
|
# There is no fork and vfork functionality.
|
||||||
|
ac_cv_func_fork=no
|
||||||
|
ac_cv_func_vfork=no
|
||||||
|
ac_cv_func_pipe=no
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
# sed script for DJGPP specific editing of config.hin
|
||||||
|
|
||||||
|
# Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# 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
|
||||||
@@ -13,30 +13,16 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1+2*3
|
|
||||||
EOF
|
|
||||||
run 0 7
|
|
||||||
|
|
||||||
cat >input <<EOF
|
$ a\
|
||||||
1 - 2 - 3
|
\
|
||||||
EOF
|
\
|
||||||
run 0 -4
|
/* DJGPP specific defines. */\
|
||||||
|
\
|
||||||
cat >input <<EOF
|
#include <unistd.h>\
|
||||||
8 / 2 / 2
|
#define TAB_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".tab" : "_tab")\
|
||||||
EOF
|
#define OUTPUT_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".output" : ".out")\
|
||||||
run 0 2
|
\
|
||||||
|
#define DEFAULT_TMPDIR "/dev/env/DJDIR/tmp"
|
||||||
cat >input <<EOF
|
|
||||||
(1+2) * 3
|
|
||||||
EOF
|
|
||||||
run 0 9
|
|
||||||
run -noerr 0 9 -p
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1++2
|
|
||||||
EOF
|
|
||||||
run 0 "err: syntax error, unexpected '+', expecting number or '('"
|
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
@echo off
|
||||||
|
Rem
|
||||||
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
Rem
|
||||||
|
Rem This batch file unpacks the Bison distribution while simultaneously
|
||||||
|
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||||
|
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||||
|
Rem
|
||||||
|
Rem Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
Rem
|
||||||
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
Rem the Free Software Foundation, either version 3 of the License, or
|
||||||
|
Rem (at your option) any later version.
|
||||||
|
Rem
|
||||||
|
Rem This program is distributed in the hope that it will be useful,
|
||||||
|
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
Rem GNU General Public License for more details.
|
||||||
|
Rem
|
||||||
|
Rem You should have received a copy of the GNU General Public License
|
||||||
|
Rem along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
Rem
|
||||||
|
Rem
|
||||||
|
Rem Invoke like this:
|
||||||
|
Rem
|
||||||
|
Rem djunpack bison-XYZ.tar.gz
|
||||||
|
Rem or
|
||||||
|
Rem djunpack bison-XYZ.tar.bz2
|
||||||
|
Rem
|
||||||
|
Rem where XYZ is the version number. If the argument includes leading
|
||||||
|
Rem directories, it MUST use backslashes, not forward slashes.
|
||||||
|
Rem
|
||||||
|
|
||||||
|
set ENVIRONMENT_SIZE_TEST_STRING=ENVIRONMENT_SIZE_TEST_STRING
|
||||||
|
if "%ENVIRONMENT_SIZE_TEST_STRING%"=="ENVIRONMENT_SIZE_TEST_STRING" GoTo EnvOk
|
||||||
|
Rem If their environment space is too small, re-exec with a larger one
|
||||||
|
command.com /e:4096 /c %0 %1
|
||||||
|
GoTo End
|
||||||
|
|
||||||
|
:EnvOk
|
||||||
|
set ENVIRONMENT_SIZE_TEST_STRING=
|
||||||
|
if "%1" == "" GoTo NoArgument
|
||||||
|
if not exist %1 GoTo NoArchive
|
||||||
|
Rem Extract top src dir from archive file.
|
||||||
|
djtar -t %1 > top_src.dir
|
||||||
|
Rem The following uses a feature of COPY whereby it does not copy
|
||||||
|
Rem empty files. We need that because the previous line will create
|
||||||
|
Rem an empty fnchange.tmp even if the command failed for some reason.
|
||||||
|
copy top_src.dir junk.tmp > nul
|
||||||
|
if not exist junk.tmp GoTo NoDjTar
|
||||||
|
del junk.tmp
|
||||||
|
sed "1{s/^.*bison-/djtar -x -p -o bison-/;s|$|djgpp/fnchange.lst %%1 > fnchange.tmp|};2,$d" top_src.dir > ext_list.bat
|
||||||
|
Rem See the comment above about the reason for using COPY.
|
||||||
|
copy ext_list.bat junk.tmp > nul
|
||||||
|
if not exist junk.tmp GoTo NoSed
|
||||||
|
del junk.tmp
|
||||||
|
Rem Extract fnchange.lst from archive.
|
||||||
|
call ext_list.bat %1
|
||||||
|
del ext_list.bat
|
||||||
|
sed "1{s|^.*bison-|s/@V@/bison-|;s|$|g|};2,$d" top_src.dir > version.sed
|
||||||
|
sed -f version.sed < fnchange.tmp > fnchange.lst
|
||||||
|
del version.sed
|
||||||
|
del fnchange.tmp
|
||||||
|
del top_src.dir
|
||||||
|
Rem unpack the source distribution
|
||||||
|
djtar -x -n fnchange.lst %1
|
||||||
|
del fnchange.lst
|
||||||
|
GoTo End
|
||||||
|
|
||||||
|
:NoSed
|
||||||
|
del junk.tmp
|
||||||
|
echo FAIL: Sed is not available.
|
||||||
|
GoTo End
|
||||||
|
:NoDjTar
|
||||||
|
del junk.tmp
|
||||||
|
echo FAIL: DJTAR is not available or no fnchange.lst file in %1.
|
||||||
|
GoTo End
|
||||||
|
:NoArchive
|
||||||
|
echo FAIL: the file %1 does not seem to exist.
|
||||||
|
echo Remember that %1 cannot use forward slashes, only backslashes.
|
||||||
|
GoTo End
|
||||||
|
:NoArgument
|
||||||
|
echo FAIL: no archive file has been specified.
|
||||||
|
echo Remember that the file name cannot use forward slashes, only backslashes.
|
||||||
|
:End
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
@V@/build-aux/javacomp.sh.in @V@/build-aux/javacomp.sh-in
|
||||||
|
@V@/build-aux/javaexec.sh.in @V@/build-aux/javaexec.sh-in
|
||||||
|
@V@/data/c++-skel.m4 @V@/data/cxx-skel.m4
|
||||||
|
@V@/data/c++.m4 @V@/data/cxx.m4
|
||||||
|
@V@/doc/yacc.1.in @V@/doc/yacc.1-in
|
||||||
|
@V@/etc/bench.pl.in @V@/etc/bench.pl-in
|
||||||
|
@V@/examples/calc++/ @V@/examples/calcxx/
|
||||||
|
@V@/examples/calc++/Makefile.am @V@/examples/calcxx/Makefile.am
|
||||||
|
@V@/examples/calc++/Makefile.in @V@/examples/calcxx/Makefile.in
|
||||||
|
@V@/examples/calc++/calc++-scanner.cc @V@/examples/calcxx/calcxx-scanner.cc
|
||||||
|
@V@/examples/calc++/calc++-scanner.ll @V@/examples/calcxx/calcxx-scanner.ll
|
||||||
|
@V@/examples/calc++/calc++.cc @V@/examples/calcxx/calcxx.cc
|
||||||
|
@V@/examples/calc++/calc++-driver.hh @V@/examples/calcxx/calcxx-driver.hh
|
||||||
|
@V@/examples/calc++/calc++-driver.cc @V@/examples/calcxx/calcxx-driver.cc
|
||||||
|
@V@/examples/calc++/stack.hh @V@/examples/calcxx/stack.hh
|
||||||
|
@V@/examples/calc++/position.hh @V@/examples/calcxx/position.hh
|
||||||
|
@V@/examples/calc++/location.hh @V@/examples/calcxx/location.hh
|
||||||
|
@V@/examples/calc++/calc++-parser.hh @V@/examples/calcxx/calcxx-parser.hh
|
||||||
|
@V@/examples/calc++/calc++-parser.cc @V@/examples/calcxx/calcxx-parser.cc
|
||||||
|
@V@/examples/calc++/calc++-parser.stamp @V@/examples/calcxx/calcxx-parser.stamp
|
||||||
|
@V@/examples/calc++/calc++-parser.yy @V@/examples/calcxx/calcxx-parser.yy
|
||||||
|
@V@/examples/calc++/test @V@/examples/calcxx/test
|
||||||
|
@V@/po/Makefile.in.in @V@/po/Makefile.in-in
|
||||||
|
@V@/runtime-po/Makefile.in.in @V@/runtime-po/Makefile.in-in
|
||||||
|
@V@/src/scan-gram-c.c @V@/src/c-scan-gram.c
|
||||||
|
@V@/src/scan-skel-c.c @V@/src/c-scan-skel.c
|
||||||
|
@V@/tests/c++.at @V@/tests/cxx.at
|
||||||
+293
@@ -0,0 +1,293 @@
|
|||||||
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
|
Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "subpipe.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "xalloc.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef STDIN_FILENO
|
||||||
|
# define STDIN_FILENO 0
|
||||||
|
#endif
|
||||||
|
#ifndef STDOUT_FILENO
|
||||||
|
# define STDOUT_FILENO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "gettext.h"
|
||||||
|
#define _(Msgid) gettext (Msgid)
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize this module. */
|
||||||
|
|
||||||
|
|
||||||
|
static int old_stdin;
|
||||||
|
static int old_stdout;
|
||||||
|
static char **arguments;
|
||||||
|
static char tmp_file_name[2][L_tmpnam];
|
||||||
|
|
||||||
|
#define remove_tmp_file(fd, name) \
|
||||||
|
do { \
|
||||||
|
close ((fd)); \
|
||||||
|
if (unlink ((name))) \
|
||||||
|
error (EXIT_FAILURE, 0, _("removing of `%s' failed"), (name)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
init_subpipe(void)
|
||||||
|
{
|
||||||
|
char *tmpdir;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
tmpdir = getenv("TMPDIR");
|
||||||
|
if (tmpdir == NULL)
|
||||||
|
tmpdir = getenv("TMP");
|
||||||
|
if (tmpdir == NULL)
|
||||||
|
tmpdir = getenv("TEMP");
|
||||||
|
if (access(tmpdir, D_OK))
|
||||||
|
tmpdir = ".";
|
||||||
|
|
||||||
|
strcpy(tmp_file_name[0], tmpdir);
|
||||||
|
strcat(tmp_file_name[0], "/bnXXXXXX");
|
||||||
|
fd = mkstemp(tmp_file_name[0]);
|
||||||
|
if (fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||||
|
close (fd);
|
||||||
|
|
||||||
|
strcpy(tmp_file_name[1], tmpdir);
|
||||||
|
strcat(tmp_file_name[1], "/bnXXXXXX");
|
||||||
|
fd = mkstemp(tmp_file_name[1]);
|
||||||
|
if (fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||||
|
close (fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a subprocess that is run as a filter. ARGV is the
|
||||||
|
NULL-terminated argument vector for the subprocess. Store read and
|
||||||
|
write file descriptors for communication with the subprocess into
|
||||||
|
FD[0] and FD[1]: input meant for the process can be written into
|
||||||
|
FD[0], and output from the process can be read from FD[1]. Return
|
||||||
|
the subprocess id.
|
||||||
|
|
||||||
|
Because DOS has neither fork nor pipe functionality to run the subprocess
|
||||||
|
as a filter, the filter is reproduced using temporary files. First bison's
|
||||||
|
stdout is redirected to a temporary file. After bison has produced all of
|
||||||
|
is output, this file is closed and connected to m4's stdin. All m4's output
|
||||||
|
is redirected from m4's stdout to a second temporary file and reopened as
|
||||||
|
bison's stdin. */
|
||||||
|
|
||||||
|
pid_t
|
||||||
|
create_subpipe(char const *const *argv, int fd[2])
|
||||||
|
{
|
||||||
|
int argc;
|
||||||
|
int from_in_fd; /* pipe from bison to m4. */
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
|
||||||
|
pid = getpid();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save original stdin and stdout
|
||||||
|
* for later restauration.
|
||||||
|
*/
|
||||||
|
old_stdin = dup(STDIN_FILENO);
|
||||||
|
if (old_stdin < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("saving stdin failed"));
|
||||||
|
|
||||||
|
old_stdout = dup(STDOUT_FILENO);
|
||||||
|
if (old_stdout < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("saving stdout failed"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save argv for later use.
|
||||||
|
*/
|
||||||
|
for (argc = 0; argv[argc]; argc++)
|
||||||
|
;
|
||||||
|
argc++;
|
||||||
|
arguments = xmalloc(argc * sizeof(arguments[0]));
|
||||||
|
for (argc = 0; argv[argc]; argc++)
|
||||||
|
{
|
||||||
|
arguments[argc] = xmalloc((strlen(argv[argc]) + 1) * sizeof(arguments[0][0]));
|
||||||
|
strcpy(arguments[argc], argv[argc]);
|
||||||
|
}
|
||||||
|
arguments[argc] = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All bison's output will be gathered in this temporary file
|
||||||
|
* and will be redirected to m4's stdin.
|
||||||
|
*/
|
||||||
|
from_in_fd = open(tmp_file_name[0], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR);
|
||||||
|
if (from_in_fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
if (dup2(from_in_fd, STDOUT_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(from_in_fd, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting bison's stdout to the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(from_in_fd);
|
||||||
|
|
||||||
|
|
||||||
|
fd[0] = STDOUT_FILENO;
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* A signal handler that just records that a signal has happened. */
|
||||||
|
static int child_interrupted;
|
||||||
|
|
||||||
|
static void
|
||||||
|
signal_catcher(int signo)
|
||||||
|
{
|
||||||
|
child_interrupted++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
end_of_output_subpipe(pid_t pid, int fd[2])
|
||||||
|
{
|
||||||
|
char *program;
|
||||||
|
int from_out_fd = open(tmp_file_name[0], O_RDONLY, S_IRUSR); /* pipe from bison to m4. */
|
||||||
|
int to_in_fd = open(tmp_file_name[1], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR); /* pipe from m4 to bison. */
|
||||||
|
int status;
|
||||||
|
void (*previous_handler)(int);
|
||||||
|
|
||||||
|
|
||||||
|
program = strrchr(arguments[0], '/');
|
||||||
|
if (program)
|
||||||
|
program++;
|
||||||
|
else
|
||||||
|
program = arguments[0];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redirect bison's output to m4's stdin.
|
||||||
|
*/
|
||||||
|
if (from_out_fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
if (dup2(from_out_fd, STDIN_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(from_out_fd, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting m4's stdin from the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(from_out_fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All m4's output will be gathered in this temporary file
|
||||||
|
* and will be redirected to bison's stdin.
|
||||||
|
*/
|
||||||
|
if (to_in_fd < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of a temporary file failed"));
|
||||||
|
}
|
||||||
|
if (dup2(to_in_fd, STDOUT_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting m4's stdout to a temporary file failed"));
|
||||||
|
}
|
||||||
|
close(to_in_fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Run m4.
|
||||||
|
*/
|
||||||
|
child_interrupted = 0;
|
||||||
|
errno = 0;
|
||||||
|
previous_handler = signal(SIGINT, signal_catcher);
|
||||||
|
status = spawnvp(P_WAIT, program, arguments);
|
||||||
|
signal(SIGINT, previous_handler);
|
||||||
|
if (child_interrupted)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _("subsidiary program `%s' interrupted"), program);
|
||||||
|
}
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _(errno == ENOENT
|
||||||
|
? "subsidiary program `%s' not found"
|
||||||
|
: status < 1
|
||||||
|
? "subsidiary program `%s' failed"
|
||||||
|
: "subsidiary program `%s' failed (status=%i, errno=%i)"), program, status, errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redirect m4's output to bison's stdin.
|
||||||
|
*/
|
||||||
|
if (dup2(old_stdout, STDOUT_FILENO) < 0)
|
||||||
|
error(EXIT_FAILURE, 0, "restore of bison's stdout failed");
|
||||||
|
close(old_stdout);
|
||||||
|
to_in_fd = open(tmp_file_name[1], O_RDONLY, S_IRUSR); /* pipe from m4 to bison. */
|
||||||
|
if (to_in_fd < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
}
|
||||||
|
if (dup2(to_in_fd, STDIN_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, -1, "dup2");
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting bison's stdin from the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(to_in_fd);
|
||||||
|
|
||||||
|
|
||||||
|
fd[1] = STDIN_FILENO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free resources, unlink temporary files and restore stdin and stdout. */
|
||||||
|
|
||||||
|
void
|
||||||
|
reap_subpipe(pid_t pid, char const *program)
|
||||||
|
{
|
||||||
|
int argc;
|
||||||
|
|
||||||
|
for (argc = 0; arguments[argc]; argc++)
|
||||||
|
free(arguments[argc]);
|
||||||
|
free(arguments);
|
||||||
|
|
||||||
|
if (unlink(tmp_file_name[0]))
|
||||||
|
error(EXIT_FAILURE, 0, _("removing of `%s' failed"), tmp_file_name[0]);
|
||||||
|
if (unlink(tmp_file_name[1]))
|
||||||
|
error(EXIT_FAILURE, 0, _("removing of `%s' failed"), tmp_file_name[1]);
|
||||||
|
|
||||||
|
if (dup2(old_stdin, STDIN_FILENO) < 0)
|
||||||
|
error(EXIT_FAILURE, 0, "restore of bison's stdin failed");
|
||||||
|
close(old_stdin);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* Subprocesses with pipes.
|
||||||
|
Copyright (C) 2005-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||||
|
|
||||||
|
#if HAVE_SYS_TYPES_H
|
||||||
|
# include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void init_subpipe(void);
|
||||||
|
pid_t create_subpipe(char const * const *, int[2]);
|
||||||
|
void end_of_output_subpipe(pid_t, int[2]);
|
||||||
|
void reap_subpipe(pid_t, char const *);
|
||||||
@@ -1,36 +1,24 @@
|
|||||||
#! /bin/sh
|
# DJGPP specific configuration file.
|
||||||
|
# Sed script for additional DJGPP specific editing
|
||||||
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
|
# of the testsuite script generated by autoconf 2.61.
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
# Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
# This program is free software: you can redistribute it and/or modify
|
||||||
#
|
# it under the terms of the GNU General Public License as published by
|
||||||
# This program is distributed in the hope that it will be useful,
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# (at your option) any later version.
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
#
|
||||||
# GNU General Public License for more details.
|
# This program is distributed in the hope that it will be useful,
|
||||||
#
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# You should have received a copy of the GNU General Public License
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
cat >input <<EOF
|
# You should have received a copy of the GNU General Public License
|
||||||
1 + 2 * 3
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
EOF
|
|
||||||
run 0 7
|
|
||||||
|
# Remove disallowed characters from file names.
|
||||||
cat >input <<EOF
|
|
||||||
+1 + +2 * +3
|
s/~!@#\\\$%^&\*()-=_+{}\[\]|\\\\:;<>, ./~!@#\\$%^\&()-=_+{}[];, ./g
|
||||||
EOF
|
|
||||||
run 0 7
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
-1 + -2 * -3
|
|
||||||
EOF
|
|
||||||
run 0 5
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1 + 2 * * 3
|
|
||||||
EOF
|
|
||||||
run 1 "err: syntax error, unexpected *, expecting + or - or ( or number"
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user