mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-08 18:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57f64ebbf8 | ||
|
|
c8d997cb5f | ||
|
|
61b8a8def5 | ||
|
|
6990c5bde9 | ||
|
|
27e822abfd | ||
|
|
21ba496083 | ||
|
|
9cf0a97aa9 | ||
|
|
3dec8a4caf | ||
|
|
2cb52c5a91 | ||
|
|
04f3bfc596 | ||
|
|
c67daa9a97 | ||
|
|
2ca8e86f83 | ||
|
|
78bb152a63 | ||
|
|
4d6ff4c5e5 | ||
|
|
9bb5087ad1 | ||
|
|
d29e40a047 | ||
|
|
b10366f296 | ||
|
|
139d065594 | ||
|
|
0d73c39bb7 | ||
|
|
7f01adced9 | ||
|
|
3bad20352c | ||
|
|
cb3bf6493d | ||
|
|
57503e2165 | ||
|
|
b3abe014f2 | ||
|
|
80f3220fea | ||
|
|
fc2040a750 | ||
|
|
d55f240991 | ||
|
|
4f961a706d | ||
|
|
ac203e6c3c | ||
|
|
9141f0b79f | ||
|
|
d57eab87e8 | ||
|
|
bb901beb68 | ||
|
|
fa00c56c17 | ||
|
|
5359c479bc | ||
|
|
20107b77c0 | ||
|
|
5e71eef267 | ||
|
|
472531dc72 | ||
|
|
046f238826 | ||
|
|
9bf06f6963 | ||
|
|
357336d254 | ||
|
|
d4a6c3c58a | ||
|
|
8976e0f567 | ||
|
|
6dca1eb950 | ||
|
|
f8d82ff039 | ||
|
|
9e9e49224f | ||
|
|
8b53f4e022 | ||
|
|
8c87a62308 | ||
|
|
478cb5cf12 | ||
|
|
94f70bd861 | ||
|
|
9b4f0970fe | ||
|
|
869028a66d | ||
|
|
6f92a7f664 | ||
|
|
6a61b6b17e | ||
|
|
a4bf7cdf9e | ||
|
|
9471a5ffe9 | ||
|
|
24c5214ae8 | ||
|
|
2f7097d1b1 | ||
|
|
28369ecb5d | ||
|
|
b92f064e9b | ||
|
|
98f19578aa | ||
|
|
7d9839c4a8 | ||
|
|
ad32ec64c8 | ||
|
|
44cdc0f001 | ||
|
|
ca796220ec | ||
|
|
8a910107b3 | ||
|
|
28d1ca8f48 | ||
|
|
1817b475a6 | ||
|
|
22ca07defa | ||
|
|
dbd6975b5c | ||
|
|
cd726fdc4d | ||
|
|
60ebd8e210 | ||
|
|
3765e3e790 | ||
|
|
c313360deb | ||
|
|
25698b58c0 | ||
|
|
17d34c231b | ||
|
|
af000bab11 | ||
|
|
b2347a3c3e | ||
|
|
008d927f71 | ||
|
|
1650c729d9 | ||
|
|
7bdf7246fb | ||
|
|
583c193ffa | ||
|
|
47b9ada6fa | ||
|
|
dcd5bb26e3 | ||
|
|
cce6c998b6 | ||
|
|
3398b0fa90 | ||
|
|
2bd1d9e20f | ||
|
|
1f2546396e | ||
|
|
809268c1a4 | ||
|
|
10acc148bb | ||
|
|
28f1e1546c | ||
|
|
c53b379784 | ||
|
|
fead28d9e3 | ||
|
|
7e0b50c524 | ||
|
|
8228d96d33 | ||
|
|
a5fc4e3b44 | ||
|
|
3be912e4af | ||
|
|
4b4e532748 | ||
|
|
6e7d8ba6a7 | ||
|
|
c680300a29 | ||
|
|
0cbefb71e8 | ||
|
|
402332c4b6 | ||
|
|
aa244fc5fe | ||
|
|
719395c9cd | ||
|
|
fa9871a2fb | ||
|
|
76597d01f3 | ||
|
|
bc5efb558d | ||
|
|
17e21f6158 | ||
|
|
6ef8513e7c | ||
|
|
3945beb1d2 | ||
|
|
c86b7815fc | ||
|
|
048730c691 | ||
|
|
ec64a0bc7e | ||
|
|
d6fe39cd18 | ||
|
|
d76ea5ce06 | ||
|
|
fdef997432 | ||
|
|
0073b5ea5f | ||
|
|
717be0a0f0 | ||
|
|
c6e4b260e0 | ||
|
|
8b87da8d12 | ||
|
|
41b1f828ae | ||
|
|
4e0de4df8c | ||
|
|
97d6da0c5b | ||
|
|
e31f92495c | ||
|
|
54c5d5d1b4 | ||
|
|
693e69f289 | ||
|
|
5c2c9fcb17 | ||
|
|
071f43d5b7 | ||
|
|
8a4ec5d4e4 | ||
|
|
052215a138 | ||
|
|
15c1b913cf | ||
|
|
83c9051a64 | ||
|
|
7a557ee7fe | ||
|
|
08dd5e9feb | ||
|
|
68cc2631a4 | ||
|
|
b47340982b | ||
|
|
ee35055b49 | ||
|
|
e5cbac98b6 | ||
|
|
d563a01709 | ||
|
|
a428a9fa6c | ||
|
|
2a0185b693 | ||
|
|
ab3621678a | ||
|
|
8631f35bf9 | ||
|
|
c483b6593f | ||
|
|
59cb1f421c | ||
|
|
d9d37a1196 | ||
|
|
c3db1394a1 | ||
|
|
2c20ae9b41 | ||
|
|
0c56c195e0 | ||
|
|
3dd2ae4415 | ||
|
|
d50df39f1a | ||
|
|
2c66acfec0 | ||
|
|
3f320159e3 | ||
|
|
f41e0cf73c | ||
|
|
d6ce0521cf | ||
|
|
cf298ebb7d | ||
|
|
734db67004 | ||
|
|
7d47d51962 | ||
|
|
602d562d6f | ||
|
|
825150b085 | ||
|
|
d4b6c86c7f | ||
|
|
5463291a91 | ||
|
|
6373b90fc8 | ||
|
|
beceb2fa93 | ||
|
|
58302c6079 | ||
|
|
d2a7a28438 | ||
|
|
9e6c5328d3 | ||
|
|
fec13ce2db | ||
|
|
be3cf406af | ||
|
|
126c4622de | ||
|
|
dd64eaf9db | ||
|
|
0b585c49ae | ||
|
|
37c4d0b175 | ||
|
|
56bcccbc51 | ||
|
|
17cc7da519 | ||
|
|
2713e7c4ff | ||
|
|
32e5a91a91 | ||
|
|
5973d763c0 | ||
|
|
4246cd81df | ||
|
|
e69b47cd18 | ||
|
|
8f5aaa0e04 | ||
|
|
b75b055288 | ||
|
|
41e84cddc7 | ||
|
|
5709f94a91 | ||
|
|
bc96b757ca | ||
|
|
1133220416 | ||
|
|
39eb80bdbc | ||
|
|
361004aabe | ||
|
|
032a52be6e | ||
|
|
843ef49bc3 | ||
|
|
5df33278b4 | ||
|
|
d96fff6115 | ||
|
|
be92ad1eb4 | ||
|
|
ff2f02815b | ||
|
|
67dcef357c | ||
|
|
133edcd248 | ||
|
|
4d9ff272cf | ||
|
|
2ca6b71967 | ||
|
|
871c02b327 | ||
|
|
a57e74a5bf | ||
|
|
4971409e39 | ||
|
|
b772baef24 | ||
|
|
406e8c7c02 | ||
|
|
97c4169f23 | ||
|
|
8add45dbd9 | ||
|
|
b3e9c20227 | ||
|
|
b2c381cd25 | ||
|
|
67bff62e31 | ||
|
|
5f45cb05f1 | ||
|
|
b61b0eb9ac | ||
|
|
69277e109a | ||
|
|
f716484627 | ||
|
|
945b917da2 | ||
|
|
1ef407d923 | ||
|
|
576b863e91 | ||
|
|
2274c34e91 | ||
|
|
fccab9bc40 | ||
|
|
488607534a | ||
|
|
4db572dd21 | ||
|
|
8faf075fd7 | ||
|
|
453639dfac | ||
|
|
4901ee115b | ||
|
|
6c7b2dfe51 | ||
|
|
a3e201de02 | ||
|
|
5e95bb6251 | ||
|
|
569125a6bf | ||
|
|
8ac28ba1f0 | ||
|
|
3ca713abd0 | ||
|
|
8c18e3f18c | ||
|
|
1e5e274972 | ||
|
|
b1679f8346 | ||
|
|
9861bcc540 | ||
|
|
d94d83e10b | ||
|
|
2f6e377953 | ||
|
|
32dff87c1d | ||
|
|
19da501e06 | ||
|
|
5e4133175d | ||
|
|
0b093ac4d9 | ||
|
|
69b22b49d4 | ||
|
|
ec11f08fb3 | ||
|
|
67444a6f0d | ||
|
|
4eed3a0f0c | ||
|
|
84a6621c78 | ||
|
|
06a273625b | ||
|
|
d120a07e6b | ||
|
|
741a58a504 | ||
|
|
d80815ac23 | ||
|
|
0b417c3479 | ||
|
|
f6fd9be688 | ||
|
|
77dbdd0d59 | ||
|
|
f8db8fe4d7 | ||
|
|
375eb71489 | ||
|
|
d3a86f7b20 | ||
|
|
29c75ef27f | ||
|
|
628012d830 | ||
|
|
f788ba2ab6 | ||
|
|
53526f31df | ||
|
|
e63811dd86 | ||
|
|
47262c36bb | ||
|
|
1e452b1553 | ||
|
|
ed796869bb | ||
|
|
12c412f6bb | ||
|
|
2663035ea5 | ||
|
|
de7c66ab41 | ||
|
|
feeacc2d57 | ||
|
|
cc10f9ab24 | ||
|
|
a9499e6ea2 | ||
|
|
09a4bfdab4 | ||
|
|
7d701f4378 | ||
|
|
378963b139 | ||
|
|
2dd882bce5 | ||
|
|
989503b1ba | ||
|
|
61c2c40092 | ||
|
|
3953c61362 | ||
|
|
39e584c018 | ||
|
|
611eaffd28 | ||
|
|
3f4ad2cd24 | ||
|
|
989a7aa865 | ||
|
|
95cbd56882 | ||
|
|
92124d27c1 | ||
|
|
6d81b91ae0 | ||
|
|
9145bd0b61 | ||
|
|
d7cf3f5b18 | ||
|
|
f49598a1e1 | ||
|
|
72d4ae5306 | ||
|
|
996abe62d7 | ||
|
|
0420362ee8 | ||
|
|
6f47eea7ab | ||
|
|
99bfdc09cb | ||
|
|
52f21717f7 | ||
|
|
cbdc22af10 | ||
|
|
220c593a79 | ||
|
|
e29ac453d0 | ||
|
|
44a56b20ac | ||
|
|
f99956b550 | ||
|
|
1f02348d6c | ||
|
|
421ff03018 | ||
|
|
5d3468e0d1 | ||
|
|
40a8dddde1 | ||
|
|
9bdefd7984 | ||
|
|
d233a2e314 | ||
|
|
d90023af5f | ||
|
|
964c6508b1 | ||
|
|
4e3c6f59cc | ||
|
|
801582b410 | ||
|
|
6d35340556 | ||
|
|
1161649446 | ||
|
|
13577a809e | ||
|
|
afc219a765 | ||
|
|
21aa4b2713 | ||
|
|
63f4dca78f | ||
|
|
0984f70e08 | ||
|
|
f26bd45da3 | ||
|
|
a3adc1701b | ||
|
|
7ab275214b | ||
|
|
0428c429a1 | ||
|
|
14fb2cc820 | ||
|
|
faf033957c | ||
|
|
0555e25a41 | ||
|
|
cde8c0a0e6 | ||
|
|
5b525e86a5 | ||
|
|
df77a98edf | ||
|
|
c23fa0fc97 | ||
|
|
08c0571613 | ||
|
|
f2b210a901 | ||
|
|
66ac4acc6c | ||
|
|
cd0f25df5f | ||
|
|
0f46038589 | ||
|
|
1105cf841b | ||
|
|
a298a6d82b | ||
|
|
5f33acefd1 | ||
|
|
849ba01b8b | ||
|
|
29c9cb3188 | ||
|
|
ec4d49e129 | ||
|
|
d84b245c63 | ||
|
|
73797b2552 | ||
|
|
dfef525920 | ||
|
|
7f017ae1c9 | ||
|
|
65126716d7 | ||
|
|
1dcd6068dd | ||
|
|
02f16dc799 | ||
|
|
aa21c457f2 | ||
|
|
9f26e6d6b3 | ||
|
|
8d3e782e05 |
@@ -1,9 +1,6 @@
|
||||
/ABOUT-NLS~
|
||||
*.eps
|
||||
*.log
|
||||
*.o
|
||||
*.pdf
|
||||
*.png
|
||||
*.stamp
|
||||
*.trs
|
||||
*~
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
3.4
|
||||
3.5
|
||||
|
||||
+209
-170
@@ -1,14 +1,8 @@
|
||||
# Travis defines and exports CC and CXX *after* we have defined our
|
||||
# environment variables via 'env'. So, do not use 'env' to define them.
|
||||
# Instead, put their definitions in MATRIX_EVAL, which we eval after the
|
||||
# definitions from Travis.
|
||||
language: cpp
|
||||
version: ~> 1.0
|
||||
|
||||
env:
|
||||
global:
|
||||
# ICC serial number.
|
||||
# See https://github.com/nemequ/icc-travis.
|
||||
secure: B3manbbi0anCAGDJTdAa9TlodzRHeiYD87FKmFzS877dPm8Cm0BDvtUhKBUpBvP8+nbHOWFGrgDmLugSZjTGU+mAxtuQpamUFHvinu0BIk3qtjlqouwvbtIqUu8iiZ3Uqu+xKeAANKRy0YVZGLlEb9F3N119tJ/Fxp1p9bXL1qph+CZ25OFbUgZ2s4F+/AyHMUxJlNXKFe3Qean65hC6edhU3zoaKzr/g/wtbhRmcyWbkOa1dJqzr2yKotcPvrnApGhDzgMKFtohg/t7xfMADDVv6sGS5XNpt25Z+MUCmLg4Z9eD7u109jvRV1eu/jgVafqsthWEhXbuMiFgFhKBKGCNZ0dACIfKZSkFZI6FdM7ovJ6aNhSlxZ2169Ybd22rN1UTHeCQWySPcVVOg5taLVpqe+E8Xhnv4hBO5NrzElWwCMLxIdPUSwVStYvtDr8ZytHWzfot50vSnFKIFpTOr9hP4+AJMVmmqJfaJo2MLBft/q2xkztrMv3lQSj3m4+ma9kPDwXIu9uCutjlnhc00jNx9qegi5VfpAjxcG1R+pX4T20az6ByHk/7LPQsANkT31RJq/jAeD9LEuMOy8miha83q4QuvbFaqPK3PY0el/O1LZaXqLsV2aQ0uqH8YX0l4r5NzHdhb+3lYgvpMBO5ytr/EWJiEyNYV518050IUDE=
|
||||
# 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
|
||||
@@ -17,24 +11,23 @@ env:
|
||||
# Less dependencies, and little git content (we would like to have none, but it's not
|
||||
# an option on Travis).
|
||||
stages:
|
||||
- compile
|
||||
- test
|
||||
- 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:
|
||||
# Manually handle submodules so that we don't have to uselessly waste 150s
|
||||
# to download gnulib in the 'test' jobs.
|
||||
submodules: false
|
||||
|
||||
# For the same reasons, we would like to not clone the repo either, but it
|
||||
# does not seem to be possible.
|
||||
depth: 1
|
||||
clone: false
|
||||
|
||||
# matrix.include and jobs.include are aliases
|
||||
# (https://docs.travis-ci.com/user/conditional-builds-stages-jobs/).
|
||||
jobs:
|
||||
include:
|
||||
- stage: "compile"
|
||||
dist: xenial
|
||||
- stage: dist
|
||||
name: "Make dist"
|
||||
git:
|
||||
clone: true
|
||||
dist: bionic
|
||||
script:
|
||||
- sudo apt-get install -qq autoconf automake autopoint flex gettext graphviz help2man m4 texinfo
|
||||
- autoconf --version
|
||||
@@ -51,16 +44,24 @@ jobs:
|
||||
- git submodule update --init --recursive
|
||||
|
||||
- ./bootstrap
|
||||
- ./configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
|
||||
- ./configure --enable-gcc-warnings || { cat config.log && false; }
|
||||
- make -j2
|
||||
- make -j2 dist
|
||||
# Can help understanding why we get "dirty" tarballs.
|
||||
- git status
|
||||
- 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). Besides, one day we would like not to depend on the repository at all in the
|
||||
# 'test' jobs. So also expose this tarball on a name that only depends on the Travis build
|
||||
# number.
|
||||
- sftp [email protected] <<< "put $dist"$'\n'"ln -s $dist bison-$TRAVIS_BUILD_NUMBER.tar.xz"
|
||||
# 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. ##
|
||||
@@ -69,173 +70,217 @@ jobs:
|
||||
# Start with three completely different environments, to get
|
||||
# errors asap.
|
||||
|
||||
- name: "GCC 7 -O3"
|
||||
stage: test
|
||||
- name: "GCC 9 -O3"
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-7
|
||||
# See https://github.com/travis-ci/apt-source-safelist/issues/410.
|
||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||
packages: g++-9
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'"
|
||||
- CC=gcc-9
|
||||
- CXX=g++-9
|
||||
- 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 7 libc++ and ASAN part 1"
|
||||
stage: test
|
||||
- name: "Clang 9 libc++ and ASAN part 1"
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
dist: bionic
|
||||
addons: &clang9
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-7
|
||||
- ubuntu-toolchain-r-test
|
||||
# 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-7
|
||||
- libc++-7-dev
|
||||
- libc++abi-7-dev
|
||||
- clang-9
|
||||
- libc++-9-dev
|
||||
- libc++abi-9-dev
|
||||
env:
|
||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||
- MATRIX_EVAL="PART=1 CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
|
||||
- CC='clang-9 -fsanitize=address'
|
||||
- CXX='clang++-9 -fsanitize=address -stdlib=libc++'
|
||||
- PART=1
|
||||
|
||||
- name: "Clang 7 libc++ and ASAN part 2"
|
||||
stage: test
|
||||
- name: "Clang 9 libc++ and ASAN part 2"
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-7
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-7
|
||||
- libc++-7-dev
|
||||
- libc++abi-7-dev
|
||||
dist: bionic
|
||||
addons: *clang9
|
||||
env:
|
||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
||||
- MATRIX_EVAL="PART=2 CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
|
||||
- CC='clang-9 -fsanitize=address'
|
||||
- CXX='clang++-9 -fsanitize=address -stdlib=libc++'
|
||||
- PART=2
|
||||
|
||||
- name: "ICC"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
compiler: icc
|
||||
env:
|
||||
# ICC's warnings are often very wrong (e.g., it thinks foo ?
|
||||
# "bar" : "baz" is char* instead of const char*), so don't try
|
||||
# to work around the, and obviously, don't die on them.
|
||||
- MATRIX_EVAL="CC=icc && CXX=icpc"
|
||||
- MAKE_ARGS='WERROR_CFLAGS= WERROR_CXXFLAGS='
|
||||
|
||||
- CC=icc
|
||||
- CXX=icpc
|
||||
install:
|
||||
- source /opt/intel/inteloneapi/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
|
||||
|
||||
## ----- ##
|
||||
## GCC. ##
|
||||
## ----- ##
|
||||
|
||||
#- name: "GCC 8 with sanitizers"
|
||||
# os: linux
|
||||
# dist: xenial
|
||||
# addons:
|
||||
# apt:
|
||||
# sources:
|
||||
# - ubuntu-toolchain-r-test
|
||||
# packages:
|
||||
# - g++-8
|
||||
# env:
|
||||
# # Can't use UBSAN: I get:
|
||||
# # configure:4951: gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer conftest.c
|
||||
# # /usr/bin/ld: unrecognized option '--push-state' (on trusty)
|
||||
# # /usr/bin/ld: unrecognized option '--push-state--no-as-needed' (on xenial)
|
||||
# #
|
||||
# # https://stackoverflow.com/questions/50024731/ suggests using the gold linker.
|
||||
# - MATRIX_EVAL="CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer' CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'"
|
||||
- name: "GCC 8 with sanitizers part 1"
|
||||
os: linux
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
packages: g++-8
|
||||
env:
|
||||
- CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
||||
- CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'
|
||||
- CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
|
||||
- PART=1
|
||||
|
||||
- name: "GCC 8"
|
||||
stage: check
|
||||
os: linux
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
packages: g++-8
|
||||
env:
|
||||
- CC=gcc-8
|
||||
- CXX=g++-8
|
||||
|
||||
- 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: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-6
|
||||
sources: ubuntu-toolchain-r-test
|
||||
packages: g++-6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
||||
- CC=gcc-6
|
||||
- CXX=g++-6
|
||||
|
||||
- name: "GCC 5"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-5
|
||||
sources: ubuntu-toolchain-r-test
|
||||
packages: g++-5
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
||||
- CC=gcc-5
|
||||
- CXX=g++-5
|
||||
|
||||
- name: "GCC 4.9"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.9
|
||||
sources: ubuntu-toolchain-r-test
|
||||
packages: g++-4.9
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
|
||||
- CC=gcc-4.9
|
||||
- CXX=g++-4.9
|
||||
|
||||
- name: "GCC 4.8"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
sources: ubuntu-toolchain-r-test
|
||||
packages: g++-4.8
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
|
||||
- CC=gcc-4.8
|
||||
- CXX=g++-4.8
|
||||
|
||||
- name: "GCC 4.7"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.7
|
||||
sources: ubuntu-toolchain-r-test
|
||||
packages: g++-4.7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.7 && CXX=g++-4.7"
|
||||
- CC=gcc-4.7
|
||||
- CXX=g++-4.7
|
||||
|
||||
- name: "GCC 4.6"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.6
|
||||
sources: ubuntu-toolchain-r-test
|
||||
packages: g++-4.6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-4.6 && CXX=g++-4.6"
|
||||
- CC=gcc-4.6
|
||||
- CXX=g++-4.6
|
||||
|
||||
## ------- ##
|
||||
## Clang. ##
|
||||
## ------- ##
|
||||
|
||||
- name: "Clang 6 -O3 and libc++"
|
||||
stage: test
|
||||
- name: "Clang 8 -O3"
|
||||
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++'
|
||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
||||
|
||||
- name: "Clang 7"
|
||||
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:
|
||||
@@ -247,51 +292,49 @@ jobs:
|
||||
- clang-6.0
|
||||
- libc++-dev
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-6.0 && CXX='clang++-6.0 -stdlib=libc++'"
|
||||
- CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
|
||||
- CC=clang-6.0
|
||||
- CXX='clang++-6.0 -stdlib=libc++'
|
||||
|
||||
- name: "Clang 5"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-5.0
|
||||
sources: llvm-toolchain-xenial-5.0
|
||||
packages:
|
||||
- clang-5.0
|
||||
- libc++-dev
|
||||
env:
|
||||
- MATRIX_EVAL="CC='clang-5.0' CXX='clang++-5.0'"
|
||||
- CC='clang-5.0'
|
||||
- CXX='clang++-5.0'
|
||||
|
||||
- name: "Clang 4"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-4.0
|
||||
packages:
|
||||
- clang-4.0
|
||||
sources: llvm-toolchain-xenial-4.0
|
||||
packages: clang-4.0
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
|
||||
- CC=clang-4.0
|
||||
- CXX=clang++-4.0
|
||||
|
||||
- name: "Clang 3.9"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-xenial-3.9
|
||||
packages:
|
||||
- clang-3.9
|
||||
sources: llvm-toolchain-xenial-3.9
|
||||
packages: clang-3.9
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
|
||||
- CC=clang-3.9
|
||||
- CXX=clang++-3.9
|
||||
|
||||
- name: "Clang 3.8"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
@@ -299,13 +342,13 @@ jobs:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
packages:
|
||||
- clang-3.8
|
||||
packages: clang-3.8
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
|
||||
- CC=clang-3.8
|
||||
- CXX=clang++-3.8
|
||||
|
||||
- name: "CLang 3.7"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
@@ -313,13 +356,13 @@ jobs:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
packages:
|
||||
- clang-3.7
|
||||
packages: clang-3.7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.7 && CXX=clang++-3.7"
|
||||
- CC=clang-3.7
|
||||
- CXX=clang++-3.7
|
||||
|
||||
- name: "Clang 3.6"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
@@ -327,13 +370,13 @@ jobs:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
packages:
|
||||
- clang-3.6
|
||||
packages: clang-3.6
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6"
|
||||
- CC=clang-3.6
|
||||
- CXX=clang++-3.6
|
||||
|
||||
- name: "Clang 3.5"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
@@ -341,37 +384,37 @@ jobs:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.5
|
||||
packages:
|
||||
- clang-3.5
|
||||
packages: clang-3.5
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.5 && CXX=clang++-3.5"
|
||||
- CC=clang-3.5
|
||||
- CXX=clang++-3.5
|
||||
|
||||
- name: "Clang 3.4"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
# Not available on Xenial.
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.4
|
||||
packages: clang-3.4
|
||||
env:
|
||||
# No versioned name installed, but beware that Travis installs
|
||||
# a more modern clang earlier in the default PATH.
|
||||
- MATRIX_EVAL='CC=/usr/bin/clang && CXX=/usr/bin/clang++'
|
||||
- CC=/usr/bin/clang
|
||||
- CXX=/usr/bin/clang++
|
||||
|
||||
- name: "Clang 3.3"
|
||||
stage: test
|
||||
stage: check
|
||||
os: linux
|
||||
# Not available on Xenial.
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.3
|
||||
packages: clang-3.3
|
||||
env:
|
||||
# See comment for 3.4.
|
||||
- MATRIX_EVAL='CC=/usr/bin/clang && CXX=/usr/bin/clang++'
|
||||
- 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).
|
||||
@@ -387,15 +430,11 @@ before_script:
|
||||
- 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 'test' jobs, but not the 'compile' one.
|
||||
# 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:
|
||||
- eval "$MATRIX_EVAL"
|
||||
# Beware not too leak $SSH_PRIVATE_KEY.
|
||||
# - env
|
||||
- sudo apt-get install -qq doxygen flex m4
|
||||
# Install and activate ICC.
|
||||
- if [[ $CC == "icc" ]]; then build-aux/install-icc.sh; fi
|
||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
||||
# Install and activate dmd.
|
||||
- mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
|
||||
- source $(source ~/dlang/install.sh dmd -a)
|
||||
@@ -413,6 +452,9 @@ script:
|
||||
# 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)
|
||||
@@ -422,8 +464,5 @@ script:
|
||||
- ../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-1} = 1; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { 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
|
||||
|
||||
after_script:
|
||||
- if [[ $CC == "icc" ]]; then uninstall_intel_software; fi
|
||||
|
||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1998-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
+1
-1
@@ -26733,7 +26733,7 @@
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1987-1988, 1991-2015, 2018-2019 Free Software
|
||||
Copyright (C) 1987-1988, 1991-2015, 2018-2020 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
# Copyright (C) 2001-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2015, 2018-2020 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
|
||||
|
||||
@@ -1,5 +1,237 @@
|
||||
GNU Bison NEWS
|
||||
|
||||
* Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
Portability fixes.
|
||||
|
||||
Fix compiler warnings.
|
||||
|
||||
* Noteworthy changes in release 3.5 (2019-12-11) [stable]
|
||||
|
||||
** Backward incompatible changes
|
||||
|
||||
Lone carriage-return characters (aka \r or ^M) in the grammar files are no
|
||||
longer treated as end-of-lines. This changes the diagnostics, and in
|
||||
particular their locations.
|
||||
|
||||
In C++, line numbers and columns are now represented as 'int' not
|
||||
'unsigned', so that integer overflow on positions is easily checkable via
|
||||
'gcc -fsanitize=undefined' and the like. This affects the API for
|
||||
positions. The default position and location classes now expose
|
||||
'counter_type' (int), used to define line and column numbers.
|
||||
|
||||
** Deprecated features
|
||||
|
||||
The YYPRINT macro, which works only with yacc.c and only for tokens, was
|
||||
obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
|
||||
It is deprecated and its support will be removed eventually.
|
||||
|
||||
** New features
|
||||
|
||||
*** Lookahead correction in C++
|
||||
|
||||
Contributed by Adrian Vogelsgesang.
|
||||
|
||||
The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
|
||||
%define variable parse.lac.
|
||||
|
||||
*** Variable api.token.raw: Optimized token numbers (all skeletons)
|
||||
|
||||
In the generated parsers, tokens have two numbers: the "external" token
|
||||
number as returned by yylex (which starts at 257), and the "internal"
|
||||
symbol number (which starts at 3). Each time yylex is called, a table
|
||||
lookup maps the external token number to the internal symbol number.
|
||||
|
||||
When the %define variable api.token.raw is set, tokens are assigned their
|
||||
internal number, which saves one table lookup per token, and also saves
|
||||
the generation of the mapping table.
|
||||
|
||||
The gain is typically moderate, but in extreme cases (very simple user
|
||||
actions), a 10% improvement can be observed.
|
||||
|
||||
*** Generated parsers use better types for states
|
||||
|
||||
Stacks now use the best integral type for state numbers, instead of always
|
||||
using 15 bits. As a result "small" parsers now have a smaller memory
|
||||
footprint (they use 8 bits), and there is support for large automata (16
|
||||
bits), and extra large (using int, i.e., typically 31 bits).
|
||||
|
||||
*** Generated parsers prefer signed integer types
|
||||
|
||||
Bison skeletons now prefer signed to unsigned integer types when either
|
||||
will do, as the signed types are less error-prone and allow for better
|
||||
checking with 'gcc -fsanitize=undefined'. Also, the types chosen are now
|
||||
portable to unusual machines where char, short and int are all the same
|
||||
width. On non-GNU platforms this may entail including <limits.h> and (if
|
||||
available) <stdint.h> to define integer types and constants.
|
||||
|
||||
*** A skeleton for the D programming language
|
||||
|
||||
For the last few releases, Bison has shipped a stealth experimental
|
||||
skeleton: lalr1.d. It was first contributed by Oliver Mangold, based on
|
||||
Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
|
||||
H. S. Teoh.
|
||||
|
||||
However, because nobody has committed to improving, testing, and
|
||||
documenting this skeleton, it is not clear that it will be supported in
|
||||
the future.
|
||||
|
||||
The lalr1.d skeleton *is functional*, and works well, as demonstrated in
|
||||
examples/d/calc.d. Please try it, enjoy it, and... commit to support it.
|
||||
|
||||
*** Debug traces in Java
|
||||
|
||||
The Java backend no longer emits code and data for parser tracing if the
|
||||
%define variable parse.trace is not defined.
|
||||
|
||||
** Diagnostics
|
||||
|
||||
*** New diagnostic: -Wdangling-alias
|
||||
|
||||
String literals, which allow for better error messages, are (too)
|
||||
liberally accepted by Bison, which might result in silent errors. For
|
||||
instance
|
||||
|
||||
%type <exVal> cond "condition"
|
||||
|
||||
does not define "condition" as a string alias to 'cond' (nonterminal
|
||||
symbols do not have string aliases). It is rather equivalent to
|
||||
|
||||
%nterm <exVal> cond
|
||||
%token <exVal> "condition"
|
||||
|
||||
i.e., it gives the type 'exVal' to the "condition" token, which was
|
||||
clearly not the intention.
|
||||
|
||||
Also, because string aliases need not be defined, typos such as "baz"
|
||||
instead of "bar" will be not reported.
|
||||
|
||||
The option -Wdangling-alias catches these situations. On
|
||||
|
||||
%token BAR "bar"
|
||||
%type <ival> foo "foo"
|
||||
%%
|
||||
foo: "baz" {}
|
||||
|
||||
bison -Wdangling-alias reports
|
||||
|
||||
warning: string literal not attached to a symbol
|
||||
| %type <ival> foo "foo"
|
||||
| ^~~~~
|
||||
warning: string literal not attached to a symbol
|
||||
| foo: "baz" {}
|
||||
| ^~~~~
|
||||
|
||||
The -Wall option does not (yet?) include -Wdangling-alias.
|
||||
|
||||
*** Better POSIX Yacc compatibility diagnostics
|
||||
|
||||
POSIX Yacc restricts %type to nonterminals. This is now diagnosed by
|
||||
-Wyacc.
|
||||
|
||||
%token TOKEN1
|
||||
%type <ival> TOKEN1 TOKEN2 't'
|
||||
%token TOKEN2
|
||||
%%
|
||||
expr:
|
||||
|
||||
gives with -Wyacc
|
||||
|
||||
input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
|
||||
2 | %type <ival> TOKEN1 TOKEN2 't'
|
||||
| ^~~~~~
|
||||
input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
|
||||
2 | %type <ival> TOKEN1 TOKEN2 't'
|
||||
| ^~~
|
||||
input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
|
||||
2 | %type <ival> TOKEN1 TOKEN2 't'
|
||||
| ^~~~~~
|
||||
|
||||
*** Diagnostics with insertion
|
||||
|
||||
The diagnostics now display the suggestion below the underlined source.
|
||||
Replacement for undeclared symbols are now also suggested.
|
||||
|
||||
$ cat /tmp/foo.y
|
||||
%%
|
||||
list: lis '.' |
|
||||
|
||||
$ bison -Wall foo.y
|
||||
foo.y:2.7-9: error: symbol 'lis' is used, but is not defined as a token and has no rules; did you mean 'list'?
|
||||
2 | list: lis '.' |
|
||||
| ^~~
|
||||
| list
|
||||
foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
|
||||
2 | list: lis '.' |
|
||||
| ^
|
||||
| %empty
|
||||
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||
|
||||
*** Diagnostics about long lines
|
||||
|
||||
Quoted sources may now be truncated to fit the screen. For instance, on a
|
||||
30-column wide terminal:
|
||||
|
||||
$ cat foo.y
|
||||
%token FOO FOO FOO
|
||||
%%
|
||||
exp: FOO
|
||||
$ bison foo.y
|
||||
foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
|
||||
1 | … FOO …
|
||||
| ^~~
|
||||
foo.y:1.8-10: previous declaration
|
||||
1 | %token FOO …
|
||||
| ^~~
|
||||
foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
|
||||
1 | … FOO
|
||||
| ^~~
|
||||
foo.y:1.8-10: previous declaration
|
||||
1 | %token FOO …
|
||||
| ^~~
|
||||
|
||||
** Changes
|
||||
|
||||
*** Debugging glr.c and glr.cc
|
||||
|
||||
The glr.c skeleton always had asserts to check its own behavior (not the
|
||||
user's). These assertions are now under the control of the parse.assert
|
||||
%define variable (disabled by default).
|
||||
|
||||
*** Clean up
|
||||
|
||||
Several new compiler warnings in the generated output have been avoided.
|
||||
Some unused features are no longer emitted. Cleaner generated code in
|
||||
general.
|
||||
|
||||
** Bug Fixes
|
||||
|
||||
Portability issues in the test suite.
|
||||
|
||||
In theory, parsers using %nonassoc could crash when reporting verbose
|
||||
error messages. This unlikely bug has been fixed.
|
||||
|
||||
In Java, %define api.prefix was ignored. It now behaves as expected.
|
||||
|
||||
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
In some cases, when warnings are disabled, bison could emit tons of white
|
||||
spaces as diagnostics.
|
||||
|
||||
When running out of memory, bison could crash (found by fuzzing).
|
||||
|
||||
When defining twice the EOF token, bison would crash.
|
||||
|
||||
New warnings from recent compilers have been addressed in the generated
|
||||
parsers (yacc.c, glr.c, glr.cc).
|
||||
|
||||
When lone carriage-return characters appeared in the input file,
|
||||
diagnostics could hang forever.
|
||||
|
||||
* Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
|
||||
|
||||
** Bug fixes
|
||||
@@ -883,10 +1115,10 @@ GNU Bison NEWS
|
||||
|
||||
bison used to report:
|
||||
|
||||
/tmp/foo.yy:2.10-11: error: %printer redeclaration for FOO
|
||||
foo.yy:2.10-11: error: %printer redeclaration for FOO
|
||||
%printer {} "foo"
|
||||
^^
|
||||
/tmp/foo.yy:3.10-11: previous declaration
|
||||
foo.yy:3.10-11: previous declaration
|
||||
%printer {} FOO
|
||||
^^
|
||||
|
||||
@@ -3587,7 +3819,7 @@ Output file does not redefine const for C++.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1995-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Parser Generator.
|
||||
|
||||
@@ -3633,7 +3865,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
|
||||
LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
|
||||
LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
|
||||
LocalWords: noexcept constexpr ispell american deprecations
|
||||
LocalWords: noexcept constexpr ispell american deprecations backend Teoh
|
||||
LocalWords: YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
|
||||
LocalWords: fsanitize Vogelsgesang lis redeclared stdint automata
|
||||
|
||||
Local Variables:
|
||||
ispell-dictionary: "american"
|
||||
|
||||
@@ -36,7 +36,7 @@ to the bison package.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2005, 2009-2015, 2018-2019 Free Software Foundation,
|
||||
Copyright (C) 2002, 2005, 2009-2015, 2018-2020 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -1,26 +1,47 @@
|
||||
This package contains the GNU Bison parser generator.
|
||||
|
||||
* Installation
|
||||
** Build from git
|
||||
# Installation
|
||||
## Build from git
|
||||
Here are basic installation instructions for a repository checkout:
|
||||
|
||||
$ git submodules update --init
|
||||
$ git submodule update --init
|
||||
$ ./bootstrap
|
||||
|
||||
then proceed with the usual 'configure && make' steps.
|
||||
then proceed with the usual `configure && make` steps.
|
||||
|
||||
README-hacking contains more information about building and modifying the
|
||||
software.
|
||||
The file README-hacking.md is about building, modifying and checking Bison.
|
||||
|
||||
** Build for tarball
|
||||
## Build from tarball
|
||||
See the file INSTALL for generic compilation and installation 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.
|
||||
|
||||
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
||||
## Colored diagnostics
|
||||
As an experimental feature, diagnostics are now colored, controlled by the
|
||||
`--color` and `--style` options.
|
||||
|
||||
** Relocatability
|
||||
If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
|
||||
To use them, install the libtextstyle library before configuring Bison. It
|
||||
is available from https://alpha.gnu.org/gnu/gettext/, for instance
|
||||
https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz.
|
||||
|
||||
The option --color supports the following arguments:
|
||||
- always, yes: Enable colors.
|
||||
- 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
|
||||
|
||||
/* 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`.
|
||||
|
||||
## 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.
|
||||
@@ -29,7 +50,7 @@ invoke them through the symlink.
|
||||
|
||||
See "Enabling Relocatability" in the documentation.
|
||||
|
||||
** Internationalization
|
||||
## 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:
|
||||
@@ -39,33 +60,27 @@ generated parsers could have been localized. See
|
||||
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for more
|
||||
details.
|
||||
|
||||
* Questions
|
||||
# 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".
|
||||
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
|
||||
# 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
|
||||
version number from `bison --version`, and a complete, self-contained test
|
||||
case in each bug report.
|
||||
|
||||
* Copyright statements
|
||||
# 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.
|
||||
|
||||
-----
|
||||
<!--
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2019 Free
|
||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2020 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
||||
@@ -83,5 +98,13 @@ 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/>.
|
||||
|
||||
# LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american
|
||||
# LocalWords: MERCHANTABILITY
|
||||
Local Variables:
|
||||
mode: markdown
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american
|
||||
LocalWords: MERCHANTABILITY
|
||||
|
||||
-->
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ the problems you encounter.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018-2019 Free Software Foundation,
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018-2020 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
+196
-163
@@ -2,20 +2,19 @@ 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/
|
||||
http://savannah.gnu.org/projects/bison/.
|
||||
|
||||
|
||||
* Administrivia
|
||||
# Administrivia
|
||||
|
||||
** If you incorporate a change from somebody on the net:
|
||||
## 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.
|
||||
## If a change fixes a test, mention the test in the commit message.
|
||||
|
||||
** Bug reports
|
||||
## 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.
|
||||
|
||||
@@ -24,18 +23,18 @@ demonstrates the bug. Then fix the bug, re-run the test suite, and check
|
||||
everything in.
|
||||
|
||||
|
||||
* Hacking
|
||||
# Hacking
|
||||
|
||||
** Visible changes
|
||||
## Visible changes
|
||||
Which include serious bug fixes, must be mentioned in NEWS.
|
||||
|
||||
** Translations
|
||||
## 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.
|
||||
|
||||
** Horizontal tabs
|
||||
## Horizontal tabs
|
||||
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.
|
||||
@@ -43,12 +42,12 @@ Also, test cases might need to contain tabs to check that Bison properly
|
||||
processes tabs in its input.
|
||||
|
||||
|
||||
* Working from the repository
|
||||
# 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.
|
||||
These notes intend to help people working on the checked-out sources. These
|
||||
requirements do not apply when building from a distribution tarball.
|
||||
|
||||
** Requirements
|
||||
## 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
|
||||
@@ -75,8 +74,8 @@ 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 graphviz help2man texinfo valgrind
|
||||
sudo apt-get install \
|
||||
autoconf automake autopoint flex 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
|
||||
@@ -89,53 +88,51 @@ 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
|
||||
## 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
|
||||
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 update --init
|
||||
|
||||
The next step is to get other files needed to build, which are extracted
|
||||
from other source packages:
|
||||
|
||||
$ ./bootstrap
|
||||
$ ./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
|
||||
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
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make check
|
||||
|
||||
At this point, there should be no difference between your local copy, and
|
||||
the master copy:
|
||||
|
||||
$ git diff
|
||||
$ git diff
|
||||
|
||||
should output no difference.
|
||||
|
||||
Enjoy!
|
||||
|
||||
** Updating
|
||||
## Updating
|
||||
|
||||
If you have git at version 1.8.2 or later, the command
|
||||
|
||||
$ git submodule update --recursive --remote
|
||||
$ git submodule update --recursive --remote
|
||||
|
||||
will be useful for updating to the latest version of all submodules.
|
||||
|
||||
@@ -143,102 +140,132 @@ 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
|
||||
### 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
|
||||
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".
|
||||
actually requested by the subscriber, run `git submodule update`.
|
||||
|
||||
$ git pull
|
||||
$ git submodule update
|
||||
$ git pull
|
||||
$ git submodule update
|
||||
|
||||
*** Updating a submodule
|
||||
### 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
|
||||
$ 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
|
||||
$ cd ..
|
||||
$ ./bootstrap
|
||||
$ make distcheck
|
||||
|
||||
Register your changes.
|
||||
|
||||
$ git checkin ...
|
||||
$ 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:
|
||||
|
||||
http://erislabs.net/ianb/projects/gnulib/
|
||||
release, see the ChangeLog in the latest gnulib snapshot at
|
||||
http://erislabs.net/ianb/projects/gnulib/.
|
||||
|
||||
The Autoconf files we use are currently:
|
||||
|
||||
m4/m4.m4
|
||||
lib/m4sugar/m4sugar.m4
|
||||
lib/m4sugar/foreach.m4
|
||||
- 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.
|
||||
|
||||
* Test suite
|
||||
# Test Suite
|
||||
|
||||
** make check
|
||||
Use liberally.
|
||||
## make check
|
||||
Consume without moderation. It is composed of two kinds of tests: the
|
||||
examples, and the main test suite.
|
||||
|
||||
** 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: tests/update-test. Read it for more information.
|
||||
### The Examples
|
||||
In examples/, there is a number of ready-to-use examples (see
|
||||
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`).
|
||||
|
||||
** TESTSUITEFLAGS
|
||||
### 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.
|
||||
|
||||
To run just the testsuite (not the tests related to the examples), run `make
|
||||
check-local`.
|
||||
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-local`.
|
||||
|
||||
The default is for make check-local 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:
|
||||
|
||||
Using -j, in a make-like fashion, for example:
|
||||
$ make check-local TESTSUITEFLAGS='-j8'
|
||||
|
||||
$ make check-local TESTSUITEFLAGS='-j8'
|
||||
|
||||
Actually, when using GNU Make, TESTSUITEFLAGS defaults to the -jN passed to
|
||||
it, so you may simply run
|
||||
|
||||
$ make check-local -j8
|
||||
|
||||
Running only the tests of a certain category, as specified in the AT files
|
||||
with AT_KEYWORDS([[category]]). Categories include:
|
||||
- c++, for c++ parsers
|
||||
- deprec, for tests concerning deprecated constructs.
|
||||
- glr, for glr parsers
|
||||
- java, for java parsers
|
||||
- report, for automaton dumps
|
||||
- c++, for c++ parsers
|
||||
- deprec, for tests concerning deprecated constructs.
|
||||
- glr, for glr parsers
|
||||
- java, for java parsers
|
||||
- report, for automaton dumps
|
||||
|
||||
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-local TESTSUITEFLAGS='-k c++'
|
||||
|
||||
$ make check-local TESTSUITEFLAGS='-k c++'
|
||||
|
||||
Both can be combined.
|
||||
|
||||
** Typical errors
|
||||
If the test suite shows failures such as the following one
|
||||
$ make check-local TESTSUITEFLAGS='-j8 -k c++'
|
||||
|
||||
.../bison/lib/getopt.h:196:8: error: redefinition of 'struct option'
|
||||
/usr/include/getopt.h:54:8: error: previous definition of 'struct option'
|
||||
To rerun the tests that failed:
|
||||
|
||||
it probably means that some file was compiled without
|
||||
AT_DATA_SOURCE_PROLOGUE. This error is due to the fact that our -I options
|
||||
pick up gnulib's replacement headers, such as getopt.h, and this will go
|
||||
wrong if config.h was not included first.
|
||||
$ make recheck -j5
|
||||
|
||||
See tests/local.at for details.
|
||||
#### 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`.
|
||||
|
||||
** make maintainer-check-valgrind
|
||||
Once you ran the test suite, and therefore have many `testsuite.log` files,
|
||||
run, 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...
|
||||
|
||||
|
||||
## 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
|
||||
@@ -249,13 +276,13 @@ 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 );
|
||||
--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
|
||||
## Release checks
|
||||
Try to run the test suite with more severe conditions before a
|
||||
release:
|
||||
|
||||
@@ -267,25 +294,25 @@ release:
|
||||
its warnings; there's no need to obey blindly to it
|
||||
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
|
||||
|
||||
- Check with "make syntax-check" if there are issues diagnosed by gnulib.
|
||||
- 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.
|
||||
- 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
|
||||
- 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
|
||||
- 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
|
||||
- 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.
|
||||
@@ -293,7 +320,7 @@ release:
|
||||
- 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
|
||||
## gnulib
|
||||
To run tests on gnulib components (e.g., on bitset):
|
||||
|
||||
cd gnulib
|
||||
@@ -309,61 +336,61 @@ re-run the tests, run:
|
||||
|
||||
./gnulib-tool --symlink --create-test --dir=/tmp/gnutest bitset-tests
|
||||
cd /tmp/gnutest
|
||||
./configure CC='gcc-mp-8 -fsanitize=undefined'
|
||||
./configure -C CC='gcc-mp-8 -fsanitize=undefined' CFLAGS='-ggdb'
|
||||
make check
|
||||
|
||||
* Release Procedure
|
||||
# Release Procedure
|
||||
This section needs to be updated to take into account features from gnulib.
|
||||
In particular, be sure to read README-release.
|
||||
|
||||
** Update the submodules. See above.
|
||||
## Update the submodules. See above.
|
||||
|
||||
** Update maintainer tools, such as Autoconf. See above.
|
||||
## Update maintainer tools, such as Autoconf. See above.
|
||||
|
||||
** Try to get the *.pot files to the Translation Project at least one
|
||||
## 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 '\<_(' *.
|
||||
helps: `grep -l '\<_(' *`.
|
||||
|
||||
** Tests
|
||||
## Tests
|
||||
See above.
|
||||
|
||||
** Update the foreign files
|
||||
Running "./bootstrap" in the top level should update them all for you. This
|
||||
## 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
|
||||
## 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.
|
||||
## 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
|
||||
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.
|
||||
`PACKAGE_COPYRIGHT_YEAR` in configure.ac.
|
||||
|
||||
** Update NEWS, commit and tag.
|
||||
## Update NEWS, commit and tag.
|
||||
See do-release-commit-and-tag in README-release. For a while, we used beta
|
||||
names such as "2.6_rc1". Now that we use gnulib in the release procedure,
|
||||
we must use "2.5.90", which has the additional benefit of being properly
|
||||
sorted in "git tag -l".
|
||||
names such as `2.6_rc1`. Now that we use gnulib in the release procedure,
|
||||
we must use `2.5.90`, which has the additional benefit of being properly
|
||||
sorted in `git tag -l`.
|
||||
|
||||
** make alpha, beta, or stable
|
||||
## make alpha, beta, or stable
|
||||
See README-release.
|
||||
|
||||
** Upload
|
||||
## Upload
|
||||
There are two ways to upload the tarballs to the GNU servers: using gnupload
|
||||
(from gnulib), or by hand. Obviously prefer the former. But in either
|
||||
case, be sure to read the following paragraph.
|
||||
|
||||
*** Setup
|
||||
You need "gnupg".
|
||||
### Setup
|
||||
You need `gnupg`.
|
||||
|
||||
Make sure your public key has been uploaded at least to keys.gnupg.net. You
|
||||
can upload it with:
|
||||
@@ -372,106 +399,105 @@ can upload it with:
|
||||
|
||||
where F125BDF3 should be replaced with your key ID.
|
||||
|
||||
*** Using gnupload
|
||||
You need "ncftp".
|
||||
### Using gnupload
|
||||
You need `ncftp`.
|
||||
|
||||
At the end "make stable" (or alpha/beta) will display the procedure to run.
|
||||
At the end `make stable` (or alpha/beta) will display the procedure to run.
|
||||
Just copy and paste it in your shell.
|
||||
|
||||
*** By hand
|
||||
### By hand
|
||||
|
||||
The generic GNU upload procedure is at:
|
||||
|
||||
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads
|
||||
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.
|
||||
|
||||
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:
|
||||
### 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
|
||||
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.xz.
|
||||
### 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.xz.
|
||||
|
||||
** Update Bison manual on www.gnu.org.
|
||||
## Update Bison manual on www.gnu.org.
|
||||
|
||||
The instructions below are obsolete, and left in case one would like to run
|
||||
the commands by hand. Today, one just needs to run
|
||||
|
||||
$ make web-manual-update
|
||||
$ make web-manual-update
|
||||
|
||||
See README-release.
|
||||
|
||||
*** You need a non-anonymous checkout of the web pages directory.
|
||||
### You need a non-anonymous checkout of the web pages directory.
|
||||
|
||||
$ cvs -d YOUR_USERID@cvs.savannah.gnu.org:/web/bison checkout bison
|
||||
$ cvs -d YOUR_USERID@cvs.savannah.gnu.org:/web/bison checkout bison
|
||||
|
||||
*** Get familiar with the instructions for web page maintainers.
|
||||
### 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.
|
||||
### 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
|
||||
$ 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.
|
||||
### Commit the modified and the new files.
|
||||
|
||||
*** Remove old 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
|
||||
$ 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.
|
||||
|
||||
** Announce
|
||||
## Announce
|
||||
The "make release" command just created a template,
|
||||
$HOME/announce-bison-X.Y. Otherwise, to generate it, run:
|
||||
`$HOME/announce-bison-X.Y`. Otherwise, to generate it, run:
|
||||
|
||||
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
||||
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
||||
|
||||
where alpha can be replaced by beta or stable and F125BDF3 should be
|
||||
where alpha can be replaced by `beta` or `table` and F125BDF3 should be
|
||||
replaced with your key ID.
|
||||
|
||||
Complete/fix the announcement file. The generated list of recipients
|
||||
(info-gnu@gnu.org, bug-bison@gnu.org, help-bison@gnu.org,
|
||||
bison-patches@gnu.org, and coordinator@translationproject.org) is
|
||||
appropriate for a stable release or a "serious beta". For any other
|
||||
release, drop at least info-gnu@gnu.org. For an example of how to fill out
|
||||
the rest of the template, search the mailing list archives for the most
|
||||
recent release announcement.
|
||||
(info-gnu@gnu.org, bison-announce@gnu.org, bug-bison@gnu.org,
|
||||
help-bison@gnu.org, bison-patches@gnu.org, and
|
||||
coordinator@translationproject.org) is appropriate for a stable release or a
|
||||
"serious beta". For any other release, drop at least info-gnu@gnu.org. For
|
||||
an example of how to fill out the rest of the template, search the mailing
|
||||
list archives for the most recent release announcement.
|
||||
|
||||
For a stable release, send the same announcement on the comp.compilers
|
||||
newsgroup by sending email to compilers@iecc.com. 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.
|
||||
|
||||
** Prepare NEWS
|
||||
## Prepare NEWS
|
||||
So that developers don't accidentally add new items to the old NEWS entry,
|
||||
create a new empty entry in line 3 (without the two leading spaces):
|
||||
|
||||
@@ -479,9 +505,9 @@ create a new empty entry in line 3 (without the two leading spaces):
|
||||
|
||||
Push these changes.
|
||||
|
||||
-----
|
||||
<!--
|
||||
|
||||
Copyright (C) 2002-2005, 2007-2015, 2018-2019 Free Software Foundation,
|
||||
Copyright (C) 2002-2005, 2007-2015, 2018-2020 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
@@ -499,13 +525,20 @@ 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/>.
|
||||
|
||||
LocalWords: Automake Autoconf Gettext Gzip Rsync Valgrind gnulib submodules
|
||||
LocalWords: submodule init cd distcheck checkin ChangeLog valgrind sigreturn
|
||||
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
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
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
|
||||
LocalWords: TESTSUITEFLAGS deprec struct gnulib's getopt config ggdb
|
||||
LocalWords: bitset fsanitize symlink CFLAGS MERCHANTABILITY ispell
|
||||
LocalWords: american
|
||||
|
||||
-->
|
||||
@@ -10,6 +10,7 @@ Albert Chin-A-Young [email protected]
|
||||
Alexander Belopolsky [email protected]
|
||||
Alexandre Duret-Lutz [email protected]
|
||||
Andre da Costa Barros [email protected]
|
||||
Andreas Damm [email protected]
|
||||
Andreas Schwab [email protected]
|
||||
Andrew Suffield [email protected]
|
||||
Angelo Borsotti [email protected]
|
||||
@@ -59,6 +60,7 @@ Enrico Scholz [email protected]
|
||||
Eric Blake [email protected]
|
||||
Eric S. Raymond [email protected]
|
||||
Étienne Renault [email protected]
|
||||
Evan Nemerson [email protected]
|
||||
Evgeny Stambulchik [email protected]
|
||||
Fabrice Bauzac [email protected]
|
||||
Ferdinand Thiessen [email protected]
|
||||
@@ -78,6 +80,7 @@ Hans Åberg [email protected]
|
||||
Horst Von Brand [email protected]
|
||||
Jan Nieuwenhuizen [email protected]
|
||||
Jannick [email protected]
|
||||
Jeff Hammond [email protected]
|
||||
Jerry Quinn [email protected]
|
||||
Jesse Thilo [email protected]
|
||||
Jim Kent [email protected]
|
||||
@@ -94,11 +97,14 @@ Kees Zeelenberg [email protected]
|
||||
Keith Browne [email protected]
|
||||
Ken Moffat [email protected]
|
||||
Kiyoshi Kanazawa [email protected]
|
||||
Lars Maier [email protected]
|
||||
László Várady [email protected]
|
||||
Laurent Mascherpa [email protected]
|
||||
Lie Yan [email protected]
|
||||
Magnus Fromreide [email protected]
|
||||
Marc Autret [email protected]
|
||||
Marc Mendiola [email protected]
|
||||
Marc Schönefeld [email protected]
|
||||
Mark Boyall [email protected]
|
||||
Martin Jacobs [email protected]
|
||||
Martin Mokrejs [email protected]
|
||||
@@ -171,17 +177,20 @@ 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 Landscheidt [email protected]
|
||||
Tim Van Holder [email protected]
|
||||
Tobias Frost [email protected]
|
||||
Todd Freed [email protected]
|
||||
Tom Kramer [email protected]
|
||||
Tom Lane [email protected]
|
||||
Tom Tromey [email protected]
|
||||
Tomasz Kłoczko [email protected]
|
||||
Tommy Nordgren [email protected]
|
||||
Troy A. Johnson [email protected]
|
||||
Tys Lefering [email protected]
|
||||
Uxio Prego uxio[email protected]
|
||||
Uxio Prego uxio@uma.es
|
||||
Valentin Tolmer [email protected]
|
||||
wcventure [email protected]
|
||||
Victor Khomenko [email protected]
|
||||
@@ -196,8 +205,11 @@ Wolfgang Thaller [email protected]
|
||||
Wolfram Wagner [email protected]
|
||||
Wwp [email protected]
|
||||
xolodho [email protected]
|
||||
Yuichiro Kaneko [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
|
||||
thank them! Please, help us keeping this list up to date.
|
||||
@@ -209,7 +221,7 @@ End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2000-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Parser Generator.
|
||||
|
||||
|
||||
@@ -1,26 +1,4 @@
|
||||
* Bison 3.4
|
||||
** bad diagnostics
|
||||
%token <val> NUM
|
||||
%type <val> expr term fact
|
||||
|
||||
%%
|
||||
|
||||
res: expr { printf ("%d\n", $1); };
|
||||
expr: expr '+' term { $$ = $1 + $3; } | term;
|
||||
term: NUM | { $$ = 0; };
|
||||
|
||||
The second warning about fact is... useless.
|
||||
|
||||
$ bison /tmp/bar.y
|
||||
/tmp/bar.y:2.24-27: warning: symbol fact is used, but is not defined as a token and has no rules [-Wother]
|
||||
%type <val> expr term fact
|
||||
^~~~
|
||||
/tmp/bar.y: warning: 1 nonterminal useless in grammar [-Wother]
|
||||
/tmp/bar.y:2.24-27: warning: nonterminal useless in grammar: fact [-Wother]
|
||||
%type <val> expr term fact
|
||||
^~~~
|
||||
|
||||
* Bison 3.5
|
||||
* Bison 3.6
|
||||
** doc
|
||||
I feel its 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
|
||||
@@ -29,9 +7,6 @@ breaks.
|
||||
Also, we seem to teach YYPRINT very early on, although it should be
|
||||
considered deprecated: %printer is superior.
|
||||
|
||||
** glr.cc
|
||||
move glr.c into the yy namespace
|
||||
|
||||
** improve syntax errors (UTF-8, internationalization)
|
||||
Bison depends on the current locale. For instance:
|
||||
|
||||
@@ -73,10 +48,75 @@ syntax error, unexpected $end, expecting ↦ or 🎅🐃 or '\n'
|
||||
|
||||
|
||||
While at it, we should stop using "$end" by default, in favor of "end of
|
||||
file", or "end of input", whatever.
|
||||
file", or "end of input", whatever. See how lalr1.java does that.
|
||||
|
||||
* Bison 3.6
|
||||
** Unit rules
|
||||
** consistency
|
||||
token vs terminal, variable vs non terminal.
|
||||
|
||||
** Stop indentation in diagnostics
|
||||
Before Bison 2.7, we printed "flatly" the dependencies in long diagnostics:
|
||||
|
||||
input.y:2.7-12: %type redeclaration for exp
|
||||
input.y:1.7-12: previous declaration
|
||||
|
||||
In Bison 2.7, we indented them
|
||||
|
||||
input.y:2.7-12: error: %type redeclaration for exp
|
||||
input.y:1.7-12: previous declaration
|
||||
|
||||
Later we quoted the source in the diagnostics, and today we have:
|
||||
|
||||
/tmp/foo.y:1.12-14: warning: symbol FOO redeclared [-Wother]
|
||||
1 | %token FOO FOO
|
||||
| ^~~
|
||||
/tmp/foo.y:1.8-10: previous declaration
|
||||
1 | %token FOO FOO
|
||||
| ^~~
|
||||
|
||||
The indentation is no longer helping. We should probably get rid of it, or
|
||||
maybe keep it only when -fno-caret. GCC displays this as a "note":
|
||||
|
||||
$ g++-mp-9 -Wall /tmp/foo.c -c
|
||||
/tmp/foo.c:1:10: error: redefinition of 'int foo'
|
||||
1 | int foo, foo;
|
||||
| ^~~
|
||||
/tmp/foo.c:1:5: note: 'int foo' previously declared here
|
||||
1 | int foo, foo;
|
||||
| ^~~
|
||||
|
||||
Likewise for Clang, contrary to what I believed (because "note:" is written
|
||||
in black, so it doesn't show in my terminal :-)
|
||||
|
||||
$ clang++-mp-8.0 -Wall /tmp/foo.c -c
|
||||
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
|
||||
/tmp/foo.c:1:10: error: redefinition of 'foo'
|
||||
int foo, foo;
|
||||
^
|
||||
/tmp/foo.c:1:5: note: previous definition is here
|
||||
int foo, foo;
|
||||
^
|
||||
1 error generated.
|
||||
|
||||
See also the item "Complaint submessage indentation" below.
|
||||
|
||||
** api.token.raw
|
||||
Maybe we should exhibit the YYUNDEFTOK token. It could also be assigned a
|
||||
semantic value so that yyerror could be used to report invalid lexemes.
|
||||
See also the item "$undefined" below.
|
||||
|
||||
** C++
|
||||
Move to int everywhere instead of unsigned? stack_size, etc. The parser
|
||||
itself uses int (for yylen for instance), yet stack is based on size_t.
|
||||
|
||||
Maybe locations should also move to ints.
|
||||
|
||||
Paul Eggert already covered most of this. But before publishing these
|
||||
changes, we need to ask our C++ users if they agree with that change, or if
|
||||
we need some migration path. Could be a %define variable, or simply
|
||||
%require "3.5".
|
||||
|
||||
* Bison 3.7
|
||||
** 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
|
||||
@@ -95,10 +135,12 @@ Practice' is impossible to find, but according to 'Parsing Techniques: a
|
||||
Practical Guide', it includes information about this issue. Does anybody
|
||||
have it?
|
||||
|
||||
** Injection rules
|
||||
See above.
|
||||
** 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.
|
||||
|
||||
** clean up
|
||||
*** lalr.c
|
||||
Introduce a goto struct, and use it in place of from_state/to_state.
|
||||
Rename states1 as path, length as pathlen.
|
||||
@@ -119,7 +161,20 @@ introduce lr(0) and lalr, just the way we have ielr categories. The
|
||||
"set" can still be used for summariring 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.
|
||||
|
||||
* 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 backends.
|
||||
@@ -139,20 +194,42 @@ $ ./tests/testsuite -l | grep errors | sed q
|
||||
38: input.at:1730 errors
|
||||
|
||||
* Short term
|
||||
** consistency
|
||||
token vs terminal
|
||||
** Get rid of YYPRINT and b4_toknum
|
||||
Besides yytoknum is wrong when api.token.raw is defined.
|
||||
|
||||
** C++
|
||||
Move to int everywhere instead of unsigned? stack_size, etc. The parser
|
||||
itself uses int (for yylen for instance), yet stack is based on size_t.
|
||||
** Better design for diagnostics
|
||||
The current implementation of diagnostics is adhoc, it grew organically. It
|
||||
works as a series of calls to several functions, with dependency of the
|
||||
latter calls on the former. For instance:
|
||||
|
||||
Maybe locations should also move to ints.
|
||||
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);
|
||||
|
||||
** C
|
||||
Introduce state_type rather than spreading yytype_int16 everywhere?
|
||||
We should rewrite this in a more FP way:
|
||||
|
||||
** glr.c
|
||||
yyspaceLeft should probably be a pointer diff.
|
||||
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
|
||||
@@ -173,9 +250,6 @@ Little effort seems to have been given to factoring these files and their
|
||||
rint{,-xml} counterpart. We would very much like to re-use the pretty format
|
||||
of states from .output for the graphs, etc.
|
||||
|
||||
Also, the underscore in print_graph.[ch] isn't very fitting considering the
|
||||
dashes in the other filenames.
|
||||
|
||||
Since graphviz dies on medium-to-big grammars, maybe consider an other tool?
|
||||
|
||||
** push-parser
|
||||
@@ -233,11 +307,13 @@ since it is no longer bound to a particular parser, it's just a
|
||||
(standalone symbol).
|
||||
|
||||
* Various
|
||||
** Rewrite glr.cc in C++
|
||||
** 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.
|
||||
|
||||
** YYERRCODE
|
||||
Defined to 256, but not used, not documented. Probably the token
|
||||
number for the error token, which POSIX wants to be 256, but which
|
||||
@@ -307,10 +383,21 @@ 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.
|
||||
|
||||
** yysyntax_error
|
||||
The code bw glr.c and yacc.c is really alike, we can certainly factor
|
||||
some parts.
|
||||
|
||||
This should be worked on when we also address the expected improvements for
|
||||
error generation (e.g., i18n).
|
||||
|
||||
|
||||
* Report
|
||||
|
||||
@@ -350,7 +437,26 @@ LORIA, INRIA Nancy - Grand Est, Nancy, France
|
||||
|
||||
* Extensions
|
||||
** Multiple start symbols
|
||||
Would be very useful when parsing closely related languages.
|
||||
Would be very useful when parsing closely related languages. The idea is to
|
||||
declare several start symbols, for instance
|
||||
|
||||
%start stmt expr
|
||||
%%
|
||||
stmt: ...
|
||||
expr: ...
|
||||
|
||||
and to generate parse(), parse_stmt() and parse_expr(). Technically, the
|
||||
above grammar would be transformed into
|
||||
|
||||
%start yy_start
|
||||
%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.
|
||||
|
||||
** Better error messages
|
||||
The users are not provided with enough tools to forge their error messages.
|
||||
@@ -368,6 +474,12 @@ should make this reasonably easy to implement.
|
||||
Bruce Mardle <[email protected]>
|
||||
https://lists.gnu.org/archive/html/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 Java and C++. And GLR I guess.
|
||||
|
||||
@@ -394,6 +506,10 @@ 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
|
||||
to avoid falling into another CPP mistake.
|
||||
|
||||
(Later): I'm sure there's actually good case for this. People who need that
|
||||
feature can use m4/cpp on top of Bison. I don't think it is worth the
|
||||
trouble in Bison itself.
|
||||
|
||||
** XML Output
|
||||
There are couple of available extensions of Bison targeting some XML
|
||||
output. Some day we should consider including them. One issue is
|
||||
@@ -413,6 +529,9 @@ XML output for GNU Bison
|
||||
https://lists.gnu.org/archive/html/bug-bison/2016-06/msg00000.html
|
||||
http://www.cs.cornell.edu/andru/papers/cupex/
|
||||
|
||||
Andrew Myers and Vincent Imbimbo are working on this item, see
|
||||
https://github.com/akimd/bison/issues/12
|
||||
|
||||
* Coding system independence
|
||||
Paul notes:
|
||||
|
||||
@@ -430,7 +549,7 @@ Paul notes:
|
||||
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
||||
the source code. This should get fixed.
|
||||
|
||||
* Broken options ?
|
||||
* Broken options?
|
||||
** %token-table
|
||||
** Skeleton strategy
|
||||
Must we keep %token-table?
|
||||
@@ -442,6 +561,7 @@ It is unfortunate that there is a total order for precedence. It
|
||||
makes it impossible to have modular precedence information. We should
|
||||
move to partial orders (sounds like series/parallel orders to me).
|
||||
|
||||
This is a prerequisite for modules.
|
||||
|
||||
* $undefined
|
||||
From Hans:
|
||||
@@ -483,23 +603,6 @@ to bison. If you're interested, I'll work on a patch.
|
||||
* Better graphics
|
||||
Equip the parser with a means to create the (visual) parse tree.
|
||||
|
||||
* Complaint submessage indentation.
|
||||
We already have an implementation that works fairly well for named
|
||||
reference messages, but it would be nice to use it consistently for all
|
||||
submessages from Bison. For example, the "previous definition"
|
||||
submessage or the list of correct values for a %define variable might
|
||||
look better with indentation.
|
||||
|
||||
However, the current implementation makes the assumption that the
|
||||
location printed on the first line is not usually much shorter than the
|
||||
locations printed on the submessage lines that follow. That assumption
|
||||
may not hold true as often for some kinds of submessages especially if
|
||||
we ever support multiple grammar files.
|
||||
|
||||
Here's a proposal for how a new implementation might look:
|
||||
|
||||
http://lists.gnu.org/archive/html/bison-patches/2009-09/msg00086.html
|
||||
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
@@ -509,7 +612,7 @@ End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2019 Free Software
|
||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2020 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -4,7 +4,7 @@ scriptversion=2019-01-04.17; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2020 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
|
||||
@@ -166,7 +166,7 @@ bootstrap_epilogue() { :; }
|
||||
# specified directory. Fill in the first %s with the destination
|
||||
# directory and the second with the domain name.
|
||||
po_download_command_format=\
|
||||
"wget --mirror --level=1 -nd -q -A.po -P '%s' \
|
||||
"wget --mirror --level=1 -nd -nv -A.po -P '%s' \
|
||||
https://translationproject.org/latest/%s/"
|
||||
|
||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
||||
|
||||
+17
-4
@@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2006-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2015, 2018-2020 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
|
||||
@@ -22,15 +22,16 @@ gnulib_modules='
|
||||
calloc-posix close closeout config-h c-strcase
|
||||
configmake
|
||||
dirname
|
||||
error extensions fdl fopen-safer
|
||||
error extensions
|
||||
fdl fopen-safer fstrcmp
|
||||
getopt-gnu
|
||||
gettext-h git-version-gen gitlog-to-changelog
|
||||
gpl-3.0 hash inttypes isnan javacomp-script
|
||||
gpl-3.0 intprops inttypes isnan javacomp-script
|
||||
javaexec-script
|
||||
ldexpl
|
||||
libtextstyle-optional
|
||||
malloc-gnu
|
||||
mbswidth
|
||||
mbfile mbswidth
|
||||
non-recursive-gnulib-prefix-hack
|
||||
obstack
|
||||
obstack-printf
|
||||
@@ -45,9 +46,12 @@ gnulib_modules='
|
||||
unistd unistd-safer unlink unlocked-io
|
||||
update-copyright unsetenv verify
|
||||
warnings
|
||||
winsz-ioctl
|
||||
winsz-termios
|
||||
xalloc
|
||||
xalloc-die
|
||||
xconcat-filename
|
||||
xhash
|
||||
xlist
|
||||
xmemdup0
|
||||
xstrndup
|
||||
@@ -56,6 +60,8 @@ gnulib_modules='
|
||||
vsnprintf-posix vsprintf-posix
|
||||
'
|
||||
|
||||
checkout_only_file=README-hacking.md
|
||||
|
||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||
--from-code=UTF-8\\\
|
||||
@@ -86,6 +92,13 @@ bootstrap_epilogue()
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2012-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015, 2018-2020 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2012-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015, 2018-2020 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
|
||||
|
||||
+31
-10
@@ -1,5 +1,24 @@
|
||||
#! /usr/bin/env perl
|
||||
|
||||
# Generate a release announcement message.
|
||||
|
||||
# Copyright (C) 2007-2020 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 Akimn Demaille.
|
||||
|
||||
use warnings;
|
||||
use 5.005;
|
||||
use strict;
|
||||
@@ -12,7 +31,7 @@ while (<STDIN>)
|
||||
{
|
||||
if (/^\s* # Initial spaces.
|
||||
(?:(-\w),\s+)? # $1: $short: Possible short option.
|
||||
(--[-\w]+) # $2: $long: Long option.
|
||||
(--[-\w]+) # $2: $long: Mandatory long option.
|
||||
(\[?) # $3: $opt: '[' iff the argument is optional.
|
||||
(?:=(\S+))? # $4: $arg: Possible argument name.
|
||||
\s # Spaces.
|
||||
@@ -32,7 +51,6 @@ while (<STDIN>)
|
||||
# if $opt, $arg contains the closing ].
|
||||
substr ($arg, -1) = ''
|
||||
if $opt eq '[';
|
||||
$arg =~ s/^=//;
|
||||
$arg = lc ($arg);
|
||||
my $dir_arg = $arg;
|
||||
# If the argument is complete (e.g., for --define[=NAME[=VALUE]]),
|
||||
@@ -72,12 +90,15 @@ while (<STDIN>)
|
||||
my $sep = '';
|
||||
foreach my $long (sort keys %option)
|
||||
{
|
||||
# Avoid trailing spaces.
|
||||
print $sep;
|
||||
$sep = "\n";
|
||||
print '@item @option{', $long, "}\n\@tab";
|
||||
print ' @option{', $option{$long}, '}' if $option{$long};
|
||||
print "\n\@tab";
|
||||
print ' @code{', $directive{$long}, '}' if $directive{$long};
|
||||
print "\n";
|
||||
# Couldn't find a means to escape @ in the format (for @item, @tab), so
|
||||
# pass it as a literal to print.
|
||||
format STDOUT =
|
||||
@item @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @tab @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @tab @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
{
|
||||
'@', '@option{' . $long . '}',
|
||||
'@', $option{$long} ? ('@option{' . $option{$long} . '}') : '',
|
||||
'@', $directive{$long} ? ('@code{' . $directive{$long} . '}') : ''
|
||||
}
|
||||
.
|
||||
write;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2000-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2000-2015, 2018-2020 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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
||||
# include the current year.
|
||||
|
||||
# Copyright (C) 2009-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2015, 2018-2020 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
||||
|
||||
# Copyright (C) 2010-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2010-2015, 2018-2020 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
|
||||
|
||||
+35
-13
@@ -1,8 +1,29 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
# usage:
|
||||
# update-test _build/8d/tests/testsuite.dir/*.testsuite.log
|
||||
# Update expectations in an Autotest test suite.
|
||||
|
||||
# Copyright (C) 2019-2020 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
|
||||
@@ -11,8 +32,8 @@ import re
|
||||
def getargs():
|
||||
p = argparse.ArgumentParser(description='Update test cases.')
|
||||
opt = p.add_argument
|
||||
opt('tests', metavar='test', nargs='+', type=str, default=None,
|
||||
help='test files to update')
|
||||
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()
|
||||
@@ -21,14 +42,14 @@ args = getargs()
|
||||
subst = dict()
|
||||
|
||||
|
||||
def log(*args_):
|
||||
def trace(*args_):
|
||||
if args.verbose:
|
||||
print(*args_)
|
||||
|
||||
|
||||
def contents(file):
|
||||
'''The contents of a file.'''
|
||||
log(file)
|
||||
trace(file)
|
||||
f = open(file)
|
||||
return f.read()
|
||||
|
||||
@@ -60,9 +81,9 @@ def diff_to_re(match):
|
||||
def update(at_file, logfile):
|
||||
test = contents(at_file)
|
||||
if os.path.isfile(logfile):
|
||||
log("LOG: ", logfile)
|
||||
trace("LOG: ", logfile)
|
||||
l = contents(logfile)
|
||||
log("LOG: ", l)
|
||||
trace("LOG: ", l)
|
||||
global subst
|
||||
subst = {}
|
||||
re.sub(r'(?:^@@.*\n)((?:^[-+ ].*\n)+)',
|
||||
@@ -71,7 +92,7 @@ def update(at_file, logfile):
|
||||
if subst:
|
||||
# Turn "subst{frm} -> to" into a large RE.
|
||||
frm = '|'.join([re.escape(x) for x in subst])
|
||||
log("FROM:", frm)
|
||||
trace("FROM:", frm)
|
||||
test = re.sub("(" + frm + ")",
|
||||
lambda m: subst[m.group(1)],
|
||||
test, flags=re.MULTILINE)
|
||||
@@ -81,13 +102,14 @@ def update(at_file, logfile):
|
||||
def process(logfile):
|
||||
log = contents(logfile)
|
||||
# Look for the file to update.
|
||||
m = re.search(r'^\d+\. (\w+\.at):\d+: ', log, re.MULTILINE)
|
||||
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 t in args.tests:
|
||||
log("FILE:", t)
|
||||
process(t)
|
||||
for logfile in args.logs:
|
||||
trace("FILE:", logfile)
|
||||
process(logfile)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
## Customize maint.mk -*- makefile -*-
|
||||
## Copyright (C) 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2008-2015, 2018-2020 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
|
||||
@@ -26,6 +26,9 @@ regen: _version
|
||||
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,
|
||||
# override the _is-dist-target from GNUmakefile so that maintainer-check*
|
||||
@@ -153,7 +156,7 @@ exclude = \
|
||||
$(call exclude, \
|
||||
bindtextdomain=^lib/main.c$$ \
|
||||
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
||||
po_check=^po/POTFILES.in$$ \
|
||||
po_check=(^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$$ \
|
||||
|
||||
+69
-16
@@ -1,6 +1,6 @@
|
||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2001-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2015, 2018-2020 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
|
||||
@@ -26,8 +26,10 @@ m4_pattern_allow([^BISON_USE_NLS$])
|
||||
|
||||
AC_INIT([GNU Bison],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[[email protected]])
|
||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2019])
|
||||
[[email protected]],
|
||||
[],
|
||||
[https://www.gnu.org/software/bison/])
|
||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2020])
|
||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||
[The copyright year for this package])
|
||||
|
||||
@@ -36,6 +38,9 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# We use Automake 1.14's %D% and %C%.
|
||||
#
|
||||
# When we move to Automake 1.16, simplify examples/c/reccalc/local.mk.
|
||||
# Our CI runs on Xenial, which has only Automake 1.15.
|
||||
#
|
||||
# We want gnits strictness only when rolling a stable release. For
|
||||
# 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
|
||||
@@ -94,13 +99,47 @@ AC_ARG_ENABLE([gcc-warnings],
|
||||
[enable_gcc_warnings=no])
|
||||
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
||||
if test "$enable_gcc_warnings" = yes; then
|
||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
||||
# -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 -Wnull-dereference
|
||||
-Wno-sign-compare -Wno-tautological-constant-out-of-range-compare
|
||||
-Wpointer-arith -Wshadow
|
||||
-Wwrite-strings'
|
||||
-Wwrite-strings
|
||||
-wr188 -wr2259 -wr3179'
|
||||
warn_c='-Wbad-function-cast -Wstrict-prototypes'
|
||||
warn_cxx='-Wextra-semi -Wnoexcept -Wundefined-func-template -Wweak-vtables'
|
||||
warn_cxx='-Wextra-semi -Wnoexcept -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
|
||||
@@ -112,6 +151,7 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
# 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'
|
||||
|
||||
@@ -142,8 +182,6 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
|
||||
# Warnings for the test suite, and maybe for bison if GCC is modern
|
||||
# enough.
|
||||
gl_WARN_ADD([-Wmissing-declarations], [WARN_CFLAGS_TEST])
|
||||
gl_WARN_ADD([-Wmissing-prototypes], [WARN_CFLAGS_TEST])
|
||||
test $lv_cv_gcc_pragma_push_works = yes &&
|
||||
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
||||
|
||||
@@ -170,6 +208,14 @@ if test "$enable_gcc_warnings" = yes; then
|
||||
[[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;
|
||||
@@ -192,7 +238,7 @@ BISON_CXX_COMPILER_POSIXLY_CORRECT
|
||||
|
||||
# D.
|
||||
AC_CHECK_PROGS([DC], [dmd])
|
||||
AC_CHECK_PROGS([DCFLAGS], [])
|
||||
AC_CHECK_PROGS([DCFLAGS], [-g])
|
||||
AM_CONDITIONAL([ENABLE_D], [test x"$DC" != x])
|
||||
|
||||
# Java.
|
||||
@@ -211,10 +257,10 @@ AC_CONFIG_FILES([src/yacc], [chmod +x src/yacc])
|
||||
# Checks for programs.
|
||||
AM_MISSING_PROG([DOT], [dot])
|
||||
AC_PROG_LEX
|
||||
$LEX_IS_FLEX || test "X$LEX" = X: || {
|
||||
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])
|
||||
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
||||
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
|
||||
@@ -225,9 +271,6 @@ 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
|
||||
supports -g, otherwise to "".])
|
||||
AC_PATH_PROG([PERL], [perl])
|
||||
if test -z "$PERL"; then
|
||||
AC_MSG_ERROR([perl not found])
|
||||
fi
|
||||
AM_MISSING_PROG([HELP2MAN], [help2man])
|
||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||
AC_SUBST([XSLTPROC])
|
||||
@@ -244,7 +287,6 @@ gl_INIT
|
||||
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS_ONCE([setlocale])
|
||||
AM_WITH_DMALLOC
|
||||
|
||||
# Gettext.
|
||||
# We use gnulib, which is only guaranteed to work properly with the
|
||||
@@ -274,7 +316,7 @@ uname=`uname`
|
||||
case $VALGRIND:$uname in
|
||||
'':*) ;;
|
||||
*:Darwin)
|
||||
# See README-hacking.
|
||||
# See README-hacking.md.
|
||||
VALGRIND=;;
|
||||
*:*)
|
||||
suppfile=build-aux/$uname.valgrind
|
||||
@@ -297,4 +339,15 @@ AC_SUBST([GCC])
|
||||
AC_CONFIG_FILES([Makefile
|
||||
po/Makefile.in
|
||||
doc/yacc.1])
|
||||
|
||||
# Fix LIBOBJS to give the Makefile the right file names. Otherwise
|
||||
# compilation works, but with unexpected file names, so clean rules don't
|
||||
# remove the actual files and distcheck fails.
|
||||
AC_CONFIG_COMMANDS_PRE([
|
||||
case $am__api_version in
|
||||
1.14*|1.15*) gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, lib/, lib/lib_libbison_a-,g'`;;
|
||||
*) gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, lib/, lib/libbison_a-,g'`;;
|
||||
esac
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2002, 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2008-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Default styling rules for Bison when doing terminal output.
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2019-2020 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
|
||||
@@ -17,8 +17,15 @@
|
||||
/* 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; }
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2002, 2005-2015, 2018-2019 Free Software Foundation,
|
||||
## Copyright (C) 2002, 2005-2015, 2018-2020 Free Software Foundation,
|
||||
## Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Language-independent M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2015, 2018-2019 Free Software Foundation,
|
||||
# Copyright (C) 2002, 2004-2015, 2018-2020 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -192,7 +192,7 @@ m4_define([b4_error],
|
||||
# @warn(1@)
|
||||
# @warn(1@,2@)
|
||||
m4_define([b4_warn],
|
||||
[b4_error([[warn]], [], [], $@)])
|
||||
[b4_warn_at([], [], $@)])
|
||||
|
||||
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||
# ---------------------------------------------------
|
||||
@@ -210,7 +210,7 @@ m4_define([b4_warn_at],
|
||||
#
|
||||
# See b4_warn example.
|
||||
m4_define([b4_complain],
|
||||
[b4_error([[complain]], [], [], $@)])
|
||||
[b4_complain_at([], [], $@)])
|
||||
|
||||
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||
# -------------------------------------------------------
|
||||
@@ -226,8 +226,7 @@ m4_define([b4_complain_at],
|
||||
#
|
||||
# See b4_warn example.
|
||||
m4_define([b4_fatal],
|
||||
[b4_error([[fatal]], [], [], $@)dnl
|
||||
m4_exit(1)])
|
||||
[b4_fatal_at([], [], $@)])
|
||||
|
||||
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||
# ----------------------------------------------------
|
||||
@@ -449,7 +448,7 @@ m4_define([b4_symbol_action],
|
||||
[(*yylocationp)])dnl
|
||||
_b4_symbol_case([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
|
||||
b4_symbol([$1], [$2])
|
||||
b4_symbol([$1], [$2])
|
||||
b4_syncline([@oline@], [@ofile@])dnl
|
||||
break;
|
||||
|
||||
@@ -535,7 +534,7 @@ m4_define([b4_token_format],
|
||||
[b4_token_visible_if([$2],
|
||||
[m4_quote(m4_format([$1],
|
||||
[b4_symbol([$2], [id])],
|
||||
[b4_symbol([$2], [user_number])]))])])
|
||||
[b4_symbol([$2], b4_api_token_raw_if([[number]], [[user_number]]))]))])])
|
||||
|
||||
|
||||
## ------- ##
|
||||
@@ -976,8 +975,8 @@ 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_comment(m4_if([$#], [0], [[[Unqualified %code blocks.]]],
|
||||
[[["%code ]$1[" blocks.]]]))
|
||||
b4_user_code([m4_indir(b4_macro_name)])])dnl
|
||||
m4_popdef([b4_macro_name])])
|
||||
|
||||
@@ -1002,6 +1001,7 @@ m4_define([b4_percent_code_ifdef],
|
||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
||||
# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
|
||||
# ----------------------------------------------------------
|
||||
b4_percent_define_if_define([api.token.raw])
|
||||
b4_percent_define_if_define([token_ctor], [api.token.constructor])
|
||||
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
||||
b4_percent_define_if_define([parse.assert])
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# C++ skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2019 Free Software
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2020 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+10
-28
@@ -2,7 +2,7 @@
|
||||
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2020 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
|
||||
@@ -367,9 +367,6 @@ m4_define([b4_symbol_type_define],
|
||||
/// \a empty when empty.
|
||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
||||
|
||||
/// The token.
|
||||
token_type token () const YY_NOEXCEPT;
|
||||
|
||||
/// The symbol type.
|
||||
/// \a empty_symbol when empty.
|
||||
/// An int, not token_number_type, to be able to store empty_symbol.
|
||||
@@ -498,22 +495,7 @@ m4_define([b4_public_types_define],
|
||||
{
|
||||
return type;
|
||||
}
|
||||
]b4_token_ctor_if([[
|
||||
]b4_inline([$1])b4_parser_class[::token_type
|
||||
]b4_parser_class[::by_type::token () const YY_NOEXCEPT
|
||||
{
|
||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
||||
// (internal) symbol number NUM (which must be that of a token). */
|
||||
static
|
||||
const ]b4_int_type_for([b4_toknum])[
|
||||
yytoken_number_[] =
|
||||
{
|
||||
]b4_toknum[
|
||||
};
|
||||
return token_type (yytoken_number_[type]);
|
||||
}
|
||||
]])[]dnl
|
||||
])
|
||||
]])
|
||||
|
||||
|
||||
# b4_token_constructor_define
|
||||
@@ -529,10 +511,11 @@ m4_define([b4_token_constructor_define], [])
|
||||
# sometimes in the cc file.
|
||||
m4_define([b4_yytranslate_define],
|
||||
[ b4_inline([$1])b4_parser_class[::token_number_type
|
||||
]b4_parser_class[::yytranslate_ (]b4_token_ctor_if([token_type],
|
||||
[int])[ t)
|
||||
]b4_parser_class[::yytranslate_ (int t)
|
||||
{
|
||||
// YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
||||
]b4_api_token_raw_if(
|
||||
[[ return static_cast<token_number_type> (t);]],
|
||||
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
||||
// TOKEN-NUM as returned by yylex.
|
||||
static
|
||||
const token_number_type
|
||||
@@ -540,15 +523,14 @@ m4_define([b4_yytranslate_define],
|
||||
{
|
||||
]b4_translate[
|
||||
};
|
||||
const unsigned user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
||||
const int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
|
||||
if (static_cast<int> (t) <= yyeof_)
|
||||
if (t <= 0)
|
||||
return yyeof_;
|
||||
else if (static_cast<unsigned> (t) <= user_token_number_max_)
|
||||
else if (t <= user_token_number_max_)
|
||||
return translate_table[t];
|
||||
else
|
||||
return undef_token_;
|
||||
return yy_undef_token_;]])[
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Common code for C-like languages (C, C++, Java, etc.)
|
||||
|
||||
# Copyright (C) 2012-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015, 2018-2020 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# C skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2019 Free Software
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2020 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+127
-28
@@ -2,7 +2,7 @@
|
||||
|
||||
# C M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2015, 2018-2019 Free Software Foundation,
|
||||
# Copyright (C) 2002, 2004-2015, 2018-2020 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -167,38 +167,110 @@ b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
||||
|
||||
# b4_int_type(MIN, MAX)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# MIN to MAX (included).
|
||||
# Return a narrow int type able to handle integers ranging from MIN
|
||||
# to MAX (included) in portable C code. Assume MIN and MAX fall in
|
||||
# 'int' range.
|
||||
m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
||||
[m4_if(b4_ints_in($@, [-127], [127]), [1], [signed char],
|
||||
b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||
|
||||
b4_ints_in($@, [-32767], [32767]), [1], [short],
|
||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned],
|
||||
|
||||
[int])])
|
||||
|
||||
# b4_c99_int_type(MIN, MAX)
|
||||
# -------------------------
|
||||
# Like b4_int_type, but for C99.
|
||||
# b4_c99_int_type_define replaces b4_int_type with this.
|
||||
m4_define([b4_c99_int_type],
|
||||
[m4_if(b4_ints_in($@, [-127], [127]), [1], [yytype_int8],
|
||||
b4_ints_in($@, [0], [255]), [1], [yytype_uint8],
|
||||
|
||||
b4_ints_in($@, [-32767], [32767]), [1], [yytype_int16],
|
||||
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
||||
|
||||
[int])])
|
||||
|
||||
# b4_c99_int_type_define
|
||||
# ----------------------
|
||||
# Define private types suitable for holding small integers in C99 or later.
|
||||
m4_define([b4_c99_int_type_define],
|
||||
[m4_copy_force([b4_c99_int_type], [b4_int_type])dnl
|
||||
[/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
|
||||
<limits.h> and (if available) <stdint.h> are included
|
||||
so that the code can choose integer types of a good width. */
|
||||
|
||||
#ifndef __PTRDIFF_MAX__
|
||||
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
||||
# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YY_STDINT_H
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Narrow types that promote to a signed type and that can represent a
|
||||
signed or unsigned integer of at least N bits. In tables they can
|
||||
save space and decrease cache pressure. Promoting to a signed type
|
||||
helps avoid bugs in integer arithmetic. */
|
||||
|
||||
#ifdef __INT_LEAST8_MAX__
|
||||
typedef __INT_LEAST8_TYPE__ yytype_int8;
|
||||
#elif defined YY_STDINT_H
|
||||
typedef int_least8_t yytype_int8;
|
||||
#else
|
||||
typedef signed char yytype_int8;
|
||||
#endif
|
||||
|
||||
#ifdef __INT_LEAST16_MAX__
|
||||
typedef __INT_LEAST16_TYPE__ yytype_int16;
|
||||
#elif defined YY_STDINT_H
|
||||
typedef int_least16_t yytype_int16;
|
||||
#else
|
||||
typedef short yytype_int16;
|
||||
#endif
|
||||
|
||||
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
|
||||
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
|
||||
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
|
||||
&& UINT_LEAST8_MAX <= INT_MAX)
|
||||
typedef uint_least8_t yytype_uint8;
|
||||
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
|
||||
typedef unsigned char yytype_uint8;
|
||||
#else
|
||||
typedef short yytype_uint8;
|
||||
#endif
|
||||
|
||||
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
|
||||
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
|
||||
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
|
||||
&& UINT_LEAST16_MAX <= INT_MAX)
|
||||
typedef uint_least16_t yytype_uint16;
|
||||
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
|
||||
typedef unsigned short yytype_uint16;
|
||||
#else
|
||||
typedef int yytype_uint16;
|
||||
#endif]])
|
||||
|
||||
|
||||
# b4_int_type_for(NAME)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# Return a narrow 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_table_value_equals(TABLE, VALUE, LITERAL)
|
||||
# --------------------------------------------
|
||||
# b4_table_value_equals(TABLE, VALUE, LITERAL, SYMBOL)
|
||||
# ----------------------------------------------------
|
||||
# Without inducing a comparison warning from the compiler, check if the
|
||||
# literal value LITERAL equals VALUE from table TABLE, which must have
|
||||
# TABLE_min and TABLE_max defined.
|
||||
# TABLE_min and TABLE_max defined. SYMBOL denotes
|
||||
m4_define([b4_table_value_equals],
|
||||
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
||||
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
||||
[[0]],
|
||||
[(!!(($2) == ($3)))])])
|
||||
[(($2) == $4)])])
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
@@ -210,22 +282,20 @@ m4_define([b4_table_value_equals],
|
||||
# Provide portable compiler "attributes". If "noreturn" is passed, define
|
||||
# _Noreturn.
|
||||
m4_define([b4_attribute_define],
|
||||
[[#ifndef YY_ATTRIBUTE
|
||||
# if (defined __GNUC__ \
|
||||
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|
||||
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
|
||||
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
|
||||
[[#ifndef YY_ATTRIBUTE_PURE
|
||||
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
|
||||
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
# else
|
||||
# define YY_ATTRIBUTE(Spec) /* empty */
|
||||
# define YY_ATTRIBUTE_PURE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef YY_ATTRIBUTE_PURE
|
||||
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
|
||||
#endif
|
||||
|
||||
#ifndef YY_ATTRIBUTE_UNUSED
|
||||
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
|
||||
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
|
||||
# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
# else
|
||||
# define YY_ATTRIBUTE_UNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11. */
|
||||
@@ -257,11 +327,11 @@ m4_define([b4_attribute_define],
|
||||
|
||||
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||
_Pragma ("GCC diagnostic pop")
|
||||
#else
|
||||
# define YY_INITIAL_VALUE(Value) Value
|
||||
@@ -273,9 +343,36 @@ m4_define([b4_attribute_define],
|
||||
#ifndef YY_INITIAL_VALUE
|
||||
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
||||
#endif
|
||||
|
||||
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
|
||||
# define YY_IGNORE_USELESS_CAST_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
|
||||
# define YY_IGNORE_USELESS_CAST_END \
|
||||
_Pragma ("GCC diagnostic pop")
|
||||
#endif
|
||||
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
|
||||
# define YY_IGNORE_USELESS_CAST_BEGIN
|
||||
# define YY_IGNORE_USELESS_CAST_END
|
||||
#endif
|
||||
]])
|
||||
|
||||
|
||||
# b4_cast_define
|
||||
# --------------
|
||||
m4_define([b4_cast_define],
|
||||
[# ifndef YY_CAST
|
||||
# ifdef __cplusplus
|
||||
# define YY_CAST(Type, Val) static_cast<Type> (Val)
|
||||
# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
|
||||
# else
|
||||
# define YY_CAST(Type, Val) ((Type) (Val))
|
||||
# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
|
||||
# endif
|
||||
# endif[]dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_null_define
|
||||
# --------------
|
||||
# Portability issues: define a YY_NULLPTR appropriate for the current
|
||||
@@ -545,7 +642,9 @@ m4_if(b4_skeleton, ["yacc.c"],
|
||||
# endif
|
||||
]])dnl
|
||||
b4_percent_code_get([[pre-printer]])dnl
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||
b4_symbol_actions([printer])
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||
b4_percent_code_get([[post-printer]])dnl
|
||||
[}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# D skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2018-2020 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
|
||||
|
||||
+6
-7
@@ -2,7 +2,7 @@
|
||||
|
||||
# D language support for Bison
|
||||
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2018-2020 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
|
||||
@@ -38,6 +38,11 @@ m4_define([b4_comment],
|
||||
[_b4_comment([$1], [$2/* ], [$2 ], [ */])])
|
||||
|
||||
|
||||
# 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.
|
||||
@@ -95,12 +100,6 @@ m4_define([b4_location_type_if],
|
||||
[b4_percent_define_ifdef([[location_type]], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_locations_if(TRUE, FALSE)
|
||||
# ----------------------------
|
||||
m4_define([b4_locations_if],
|
||||
[m4_if(b4_locations_flag, 1, [$1], [$2])])
|
||||
|
||||
|
||||
# b4_identification
|
||||
# -----------------
|
||||
m4_define([b4_identification],
|
||||
|
||||
+296
-257
File diff suppressed because it is too large
Load Diff
+17
-2
@@ -1,6 +1,6 @@
|
||||
# C++ GLR skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018-2020 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
|
||||
@@ -257,6 +257,21 @@ b4_percent_code_get([[requires]])[
|
||||
]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
|
||||
|
||||
// Whether we are compiled with exception support.
|
||||
#ifndef YY_EXCEPTIONS
|
||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
||||
@@ -353,7 +368,7 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||
b4_defines_if(
|
||||
[b4_output_begin([b4_spec_header_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
[2002-2015, 2018-2019])[
|
||||
[2002-2015, 2018-2020])[
|
||||
// C++ GLR parser skeleton written by Akim Demaille.
|
||||
|
||||
]b4_disclaimer[
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Java skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2007, 2009-2015, 2018-2019 Free Software Foundation,
|
||||
# Copyright (C) 2007, 2009-2015, 2018-2020 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+14
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
# Java language support for Bison
|
||||
|
||||
# Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018-2020 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
|
||||
@@ -184,8 +184,19 @@ b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
||||
m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
|
||||
b4_percent_define_default([[api.value.type]], [[Object]])
|
||||
|
||||
# %name-prefix
|
||||
m4_define_default([b4_prefix], [[YY]])
|
||||
# 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]])])
|
||||
|
||||
+268
-52
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018-2020 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
|
||||
@@ -20,14 +20,22 @@ m4_include(b4_skeletonsdir/[c++.m4])
|
||||
# api.value.type=variant is valid.
|
||||
m4_define([b4_value_type_setup_variant])
|
||||
|
||||
# Check the value of %define parse.lac, where LAC stands for lookahead
|
||||
# correction.
|
||||
b4_percent_define_default([[parse.lac]], [[none]])
|
||||
b4_define_flag_if([lac])
|
||||
m4_define([b4_lac_flag],
|
||||
[m4_if(b4_percent_define_get([[parse.lac]]),
|
||||
[none], [[0]], [[1]])])
|
||||
|
||||
|
||||
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
||||
# --------------------------------------------------------------
|
||||
# Declare "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
||||
m4_define([b4_integral_parser_table_declare],
|
||||
[m4_ifval([$3], [b4_comment([$3], [ ])
|
||||
[m4_ifval([$3], [b4_comment([$3], [ ])
|
||||
])dnl
|
||||
static const b4_int_type_for([$2]) yy$1_[[]];dnl
|
||||
static const b4_int_type_for([$2]) yy$1_[[]];dnl
|
||||
])
|
||||
|
||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||
@@ -135,7 +143,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
||||
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015, 2018-2019])
|
||||
[2002-2015, 2018-2020])
|
||||
|
||||
m4_define([b4_parser_class],
|
||||
[b4_percent_define_get([[api.parser.class]])])
|
||||
@@ -166,6 +174,7 @@ m4_define([b4_shared_declarations],
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
|
||||
]b4_attribute_define[
|
||||
]b4_cast_define[
|
||||
]b4_null_define[
|
||||
|
||||
]b4_YYDEBUG_define[
|
||||
@@ -220,10 +229,21 @@ m4_define([b4_shared_declarations],
|
||||
private:
|
||||
/// This class is not copyable.
|
||||
]b4_parser_class[ (const ]b4_parser_class[&);
|
||||
]b4_parser_class[& operator= (const ]b4_parser_class[&);
|
||||
]b4_parser_class[& operator= (const ]b4_parser_class[&);]b4_lac_if([[
|
||||
|
||||
/// State numbers.
|
||||
typedef int state_type;
|
||||
/// Check the lookahead yytoken.
|
||||
/// \returns true iff the token will be eventually shifted.
|
||||
bool yy_lac_check_ (int yytoken) const;
|
||||
/// Establish the initial context if no initial context currently exists.
|
||||
/// \returns true iff the token will be eventually shifted.
|
||||
bool yy_lac_establish_ (int yytoken);
|
||||
/// Discard any previous initial lookahead context because of event.
|
||||
/// \param event the event which caused the lookahead to be discarded.
|
||||
/// Only used for debbuging output.
|
||||
void yy_lac_discard_ (const char* event);]])[
|
||||
|
||||
/// Stored state numbers (used for stacks).
|
||||
typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ state_type;
|
||||
|
||||
/// Generate an error message.
|
||||
/// \param yystate the state where the error occurred.
|
||||
@@ -234,7 +254,7 @@ m4_define([b4_shared_declarations],
|
||||
/// Compute post-reduction state.
|
||||
/// \param yystate the current state
|
||||
/// \param yysym the nonterminal to push on the stack
|
||||
state_type yy_lr_goto_state_ (state_type yystate, int yysym);
|
||||
static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
|
||||
|
||||
/// Whether the given \c yypact_ value indicates a defaulted state.
|
||||
/// \param yyvalue the value to check
|
||||
@@ -248,7 +268,9 @@ m4_define([b4_shared_declarations],
|
||||
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
|
||||
|
||||
/// Convert a scanner token number \a t to a symbol number.
|
||||
static token_number_type yytranslate_ (]b4_token_ctor_if([token_type], [int])[ t);
|
||||
/// In theory \a t should be a token_type, but character literals
|
||||
/// are valid, yet not members of the token_type enum.
|
||||
static token_number_type yytranslate_ (int t);
|
||||
|
||||
// Tables.
|
||||
]b4_parser_tables_declare[]b4_error_verbose_if([
|
||||
@@ -313,7 +335,8 @@ m4_define([b4_shared_declarations],
|
||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
||||
|
||||
/// The state number used to denote an empty symbol.
|
||||
enum { empty_state = -1 };
|
||||
/// We use the initial state, as it does not have a value.
|
||||
enum { empty_state = 0 };
|
||||
|
||||
/// The state.
|
||||
/// \a empty when empty.
|
||||
@@ -335,6 +358,10 @@ m4_define([b4_shared_declarations],
|
||||
/// Assignment, needed by push_back by some old implementations.
|
||||
/// Moves the contents of that.
|
||||
stack_symbol_type& operator= (stack_symbol_type& that);
|
||||
|
||||
/// Assignment, needed by push_back by other implementations.
|
||||
/// Needed by some other old implementations.
|
||||
stack_symbol_type& operator= (const stack_symbol_type& that);
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -344,7 +371,16 @@ m4_define([b4_shared_declarations],
|
||||
typedef stack<stack_symbol_type> stack_type;
|
||||
|
||||
/// The stack.
|
||||
stack_type yystack_;
|
||||
stack_type yystack_;]b4_lac_if([[
|
||||
/// The stack for LAC.
|
||||
/// Logically, the yy_lac_stack's lifetime is confined to the function
|
||||
/// yy_lac_check_. We just store it as a member of this class to hold
|
||||
/// on to the memory and to avoid frequent reallocations.
|
||||
/// Since yy_lac_check_ is const, this member must be mutable.
|
||||
mutable std::vector<state_type> yylac_stack_;
|
||||
/// Whether an initial LAC context was established.
|
||||
bool yy_lac_established_;
|
||||
]])[
|
||||
|
||||
/// Push a new state on the stack.
|
||||
/// \param m a debug message to display
|
||||
@@ -364,6 +400,10 @@ m4_define([b4_shared_declarations],
|
||||
/// Pop \a n symbols from the stack.
|
||||
void yypop_ (int n = 1);
|
||||
|
||||
/// Some specific tokens.
|
||||
static const token_number_type yy_error_token_ = 1;
|
||||
static const token_number_type yy_undef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
/// Constants.
|
||||
enum
|
||||
{
|
||||
@@ -371,8 +411,6 @@ m4_define([b4_shared_declarations],
|
||||
yylast_ = ]b4_last[, ///< Last index in yytable_.
|
||||
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
|
||||
yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
|
||||
yyterror_ = 1,
|
||||
yyerrcode_ = 256,
|
||||
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
|
||||
};
|
||||
|
||||
@@ -459,9 +497,6 @@ m4_if(b4_prefix, [yy], [],
|
||||
[#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
|
||||
]b4_yylloc_default_define])[
|
||||
|
||||
// Suppress unused-variable warnings by "using" E.
|
||||
#define YYUSE(E) ((void) (E))
|
||||
|
||||
// Enable debugging if requested.
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
|
||||
@@ -551,12 +586,14 @@ m4_if(b4_prefix, [yy], [],
|
||||
]])[
|
||||
|
||||
/// Build a parser object.
|
||||
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||
:])[
|
||||
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
||||
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||
#endif]b4_parse_param_cons[
|
||||
: yydebug_ (false),
|
||||
yycdebug_ (&std::cerr)]b4_lac_if([,], [m4_ifset([b4_parse_param], [,])])[
|
||||
#else
|
||||
]b4_lac_if([ :], [m4_ifset([b4_parse_param], [ :])])[
|
||||
#endif]b4_lac_if([[
|
||||
yy_lac_established_ (false)]m4_ifset([b4_parse_param], [,])])[]b4_parse_param_cons[
|
||||
{}
|
||||
|
||||
]b4_parser_class::~b4_parser_class[ ()
|
||||
@@ -603,7 +640,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
if (state == empty_state)
|
||||
return empty_symbol;
|
||||
else
|
||||
return yystos_[state];
|
||||
return yystos_[+state];
|
||||
}
|
||||
|
||||
]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
|
||||
@@ -630,6 +667,17 @@ m4_if(b4_prefix, [yy], [],
|
||||
}
|
||||
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
]b4_parser_class[::stack_symbol_type&
|
||||
]b4_parser_class[::stack_symbol_type::operator= (const stack_symbol_type& that)
|
||||
{
|
||||
state = that.state;
|
||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
||||
[value], [copy], [that.value])],
|
||||
[[value = that.value;]])[]b4_locations_if([
|
||||
location = that.location;])[
|
||||
return *this;
|
||||
}
|
||||
|
||||
]b4_parser_class[::stack_symbol_type&
|
||||
]b4_parser_class[::stack_symbol_type::operator= (stack_symbol_type& that)
|
||||
{
|
||||
@@ -761,7 +809,6 @@ m4_if(b4_prefix, [yy], [],
|
||||
int
|
||||
]b4_parser_class[::parse ()
|
||||
{
|
||||
// State.
|
||||
int yyn;
|
||||
/// Length of the RHS of the rule being reduced.
|
||||
int yylen = 0;
|
||||
@@ -777,7 +824,11 @@ m4_if(b4_prefix, [yy], [],
|
||||
stack_symbol_type yyerror_range[3];]])[
|
||||
|
||||
/// The return value of parse ().
|
||||
int yyresult;
|
||||
int yyresult;]b4_lac_if([[
|
||||
|
||||
/// Discard the LAC context in case there still is one left from a
|
||||
/// previous invocation.
|
||||
yy_lac_discard_ ("init");]])[
|
||||
|
||||
#if YY_EXCEPTIONS
|
||||
try
|
||||
@@ -801,7 +852,7 @@ b4_dollar_popdef])[]dnl
|
||||
| yynewstate -- push a new symbol on the stack. |
|
||||
`-----------------------------------------------*/
|
||||
yynewstate:
|
||||
YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
|
||||
YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
|
||||
|
||||
// Accept?
|
||||
if (yystack_[0].state == yyfinal_)
|
||||
@@ -815,7 +866,7 @@ b4_dollar_popdef])[]dnl
|
||||
`-----------*/
|
||||
yybackup:
|
||||
// Try to take a decision without lookahead.
|
||||
yyn = yypact_[yystack_[0].state];
|
||||
yyn = yypact_[+yystack_[0].state];
|
||||
if (yy_pact_value_is_default_ (yyn))
|
||||
goto yydefault;
|
||||
|
||||
@@ -846,14 +897,21 @@ b4_dollar_popdef])[]dnl
|
||||
to detect an error, take that action. */
|
||||
yyn += yyla.type_get ();
|
||||
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ())
|
||||
goto yydefault;
|
||||
{]b4_lac_if([[
|
||||
if (!yy_lac_establish_ (yyla.type_get ()))
|
||||
goto yyerrlab;]])[
|
||||
goto yydefault;
|
||||
}
|
||||
|
||||
// Reduce or error.
|
||||
yyn = yytable_[yyn];
|
||||
if (yyn <= 0)
|
||||
{
|
||||
if (yy_table_value_is_error_ (yyn))
|
||||
goto yyerrlab;
|
||||
goto yyerrlab;]b4_lac_if([[
|
||||
if (!yy_lac_establish_ (yyla.type_get ()))
|
||||
goto yyerrlab;
|
||||
]])[
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
@@ -863,7 +921,8 @@ b4_dollar_popdef])[]dnl
|
||||
--yyerrstatus_;
|
||||
|
||||
// Shift the lookahead token.
|
||||
yypush_ ("Shifting", yyn, YY_MOVE (yyla));
|
||||
yypush_ ("Shifting", state_type (yyn), YY_MOVE (yyla));]b4_lac_if([[
|
||||
yy_lac_discard_ ("shift");]])[
|
||||
goto yynewstate;
|
||||
|
||||
|
||||
@@ -871,7 +930,7 @@ b4_dollar_popdef])[]dnl
|
||||
| yydefault -- do the default action for the current state. |
|
||||
`-----------------------------------------------------------*/
|
||||
yydefault:
|
||||
yyn = yydefact_[yystack_[0].state];
|
||||
yyn = yydefact_[+yystack_[0].state];
|
||||
if (yyn == 0)
|
||||
goto yyerrlab;
|
||||
goto yyreduce;
|
||||
@@ -998,11 +1057,11 @@ b4_dollar_popdef])[]dnl
|
||||
stack_symbol_type error_token;
|
||||
for (;;)
|
||||
{
|
||||
yyn = yypact_[yystack_[0].state];
|
||||
yyn = yypact_[+yystack_[0].state];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
{
|
||||
yyn += yyterror_;
|
||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||
yyn += yy_error_token_;
|
||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
|
||||
{
|
||||
yyn = yytable_[yyn];
|
||||
if (0 < yyn)
|
||||
@@ -1023,8 +1082,9 @@ b4_dollar_popdef])[]dnl
|
||||
yyerror_range[2].location = yyla.location;
|
||||
YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);]])[
|
||||
|
||||
// Shift the error token.
|
||||
error_token.state = yyn;
|
||||
// Shift the error token.]b4_lac_if([[
|
||||
yy_lac_discard_ ("error recovery");]])[
|
||||
error_token.state = state_type (yyn);
|
||||
yypush_ ("Shifting", YY_MOVE (error_token));
|
||||
}
|
||||
goto yynewstate;
|
||||
@@ -1088,8 +1148,147 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
error (]b4_join(b4_locations_if([yyexc.location]),
|
||||
[[yyexc.what ()]])[);
|
||||
}]b4_lac_if([[
|
||||
|
||||
bool
|
||||
]b4_parser_class[::yy_lac_check_ (int yytoken) const
|
||||
{
|
||||
// Logically, the yylac_stack's lifetime is confined to this function.
|
||||
// Clear it, to get rid of potential left-overs from previous call.
|
||||
yylac_stack_.clear ();
|
||||
// Reduce until we encounter a shift and thereby accept the token.
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
YYCDEBUG << "LAC: checking lookahead " << yytname_[yytoken] << ':';
|
||||
#endif
|
||||
std::ptrdiff_t lac_top = 0;
|
||||
while (true)
|
||||
{
|
||||
state_type top_state = (yylac_stack_.empty ()
|
||||
? yystack_[lac_top].state
|
||||
: yylac_stack_.back ());
|
||||
int yyrule = yypact_[+top_state];
|
||||
if (yy_pact_value_is_default_ (yyrule)
|
||||
|| (yyrule += yytoken) < 0 || yylast_ < yyrule
|
||||
|| yycheck_[yyrule] != yytoken)
|
||||
{
|
||||
// Use the default action.
|
||||
yyrule = yydefact_[+top_state];
|
||||
if (yyrule == 0)
|
||||
{
|
||||
YYCDEBUG << " Err\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the action from yytable.
|
||||
yyrule = yytable_[yyrule];
|
||||
if (yy_table_value_is_error_ (yyrule))
|
||||
{
|
||||
YYCDEBUG << " Err\n";
|
||||
return false;
|
||||
}
|
||||
if (0 < yyrule)
|
||||
{
|
||||
YYCDEBUG << " S" << yyrule << '\n';
|
||||
return true;
|
||||
}
|
||||
yyrule = -yyrule;
|
||||
}
|
||||
// By now we know we have to simulate a reduce.
|
||||
YYCDEBUG << " R" << yyrule - 1;
|
||||
// Pop the corresponding number of values from the stack.
|
||||
{
|
||||
std::ptrdiff_t yylen = yyr2_[yyrule];
|
||||
// First pop from the LAC stack as many tokens as possible.
|
||||
std::ptrdiff_t lac_size = std::ptrdiff_t (yylac_stack_.size ());
|
||||
if (yylen < lac_size)
|
||||
{
|
||||
yylac_stack_.resize (std::size_t (lac_size - yylen));
|
||||
yylen = 0;
|
||||
}
|
||||
else if (lac_size)
|
||||
{
|
||||
yylac_stack_.clear ();
|
||||
yylen -= lac_size;
|
||||
}
|
||||
// Only afterwards look at the main stack.
|
||||
// We simulate popping elements by incrementing lac_top.
|
||||
lac_top += yylen;
|
||||
}
|
||||
// Keep top_state in sync with the updated stack.
|
||||
top_state = (yylac_stack_.empty ()
|
||||
? yystack_[lac_top].state
|
||||
: yylac_stack_.back ());
|
||||
// Push the resulting state of the reduction.
|
||||
state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]);
|
||||
YYCDEBUG << " G" << state;
|
||||
yylac_stack_.push_back (state);
|
||||
}
|
||||
}
|
||||
|
||||
// Establish the initial context if no initial context currently exists.
|
||||
bool
|
||||
]b4_parser_class[::yy_lac_establish_ (int yytoken)
|
||||
{
|
||||
/* Establish the initial context for the current lookahead if no initial
|
||||
context is currently established.
|
||||
|
||||
We define a context as a snapshot of the parser stacks. We define
|
||||
the initial context for a lookahead as the context in which the
|
||||
parser initially examines that lookahead in order to select a
|
||||
syntactic action. Thus, if the lookahead eventually proves
|
||||
syntactically unacceptable (possibly in a later context reached via a
|
||||
series of reductions), the initial context can be used to determine
|
||||
the exact set of tokens that would be syntactically acceptable in the
|
||||
lookahead's place. Moreover, it is the context after which any
|
||||
further semantic actions would be erroneous because they would be
|
||||
determined by a syntactically unacceptable token.
|
||||
|
||||
yy_lac_establish_ should be invoked when a reduction is about to be
|
||||
performed in an inconsistent state (which, for the purposes of LAC,
|
||||
includes consistent states that don't know they're consistent because
|
||||
their default reductions have been disabled).
|
||||
|
||||
For parse.lac=full, the implementation of yy_lac_establish_ is as
|
||||
follows. If no initial context is currently established for the
|
||||
current lookahead, then check if that lookahead can eventually be
|
||||
shifted if syntactic actions continue from the current context. */
|
||||
if (!yy_lac_established_)
|
||||
{
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
YYCDEBUG << "LAC: initial context established for "
|
||||
<< yytname_[yytoken] << '\n';
|
||||
#endif
|
||||
yy_lac_established_ = true;
|
||||
return yy_lac_check_ (yytoken);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Discard any previous initial lookahead context.
|
||||
void
|
||||
]b4_parser_class[::yy_lac_discard_ (const char* evt)
|
||||
{
|
||||
/* Discard any previous initial lookahead context because of Event,
|
||||
which may be a lookahead change or an invalidation of the currently
|
||||
established initial context for the current lookahead.
|
||||
|
||||
The most common example of a lookahead change is a shift. An example
|
||||
of both cases is syntax error recovery. That is, a syntax error
|
||||
occurs when the lookahead is syntactically erroneous for the
|
||||
currently established initial context, so error recovery manipulates
|
||||
the parser stacks to try to find a new initial context in which the
|
||||
current lookahead is syntactically acceptable. If it fails to find
|
||||
such a context, it discards the lookahead. */
|
||||
if (yy_lac_established_)
|
||||
{
|
||||
YYCDEBUG << "LAC: initial context discarded due to "
|
||||
<< evt << '\n';
|
||||
yy_lac_established_ = false;
|
||||
}
|
||||
}]])[
|
||||
|
||||
// Generate an error message.
|
||||
std::string
|
||||
]b4_parser_class[::yysyntax_error_ (]dnl
|
||||
@@ -1098,7 +1297,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
{]b4_error_verbose_if([[
|
||||
// Number of reported tokens (one for the "unexpected", one per
|
||||
// "expected").
|
||||
size_t yycount = 0;
|
||||
std::ptrdiff_t yycount = 0;
|
||||
// Its maximum.
|
||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||
// Arguments of yyformat.
|
||||
@@ -1118,24 +1317,41 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
a consistent state with a default action. There might have
|
||||
been a previous inconsistent state, consistent state with a
|
||||
non-default action, or user semantic action that manipulated
|
||||
yyla. (However, yyla is currently not documented for users.)
|
||||
yyla. (However, yyla is currently not documented for users.)]b4_lac_if([[
|
||||
In the first two cases, it might appear that the current syntax
|
||||
error should have been detected in the previous state when
|
||||
yy_lac_check was invoked. However, at that time, there might
|
||||
have been a different syntax error that discarded a different
|
||||
initial context during error recovery, leaving behind the
|
||||
current lookahead.]], [[
|
||||
- Of course, the expected token list depends on states to have
|
||||
correct lookahead information, and it depends on the parser not
|
||||
to perform extra reductions after fetching a lookahead from the
|
||||
scanner and before detecting a syntax error. Thus, state
|
||||
merging (from LALR or IELR) and default reductions corrupt the
|
||||
expected token list. However, the list is correct for
|
||||
canonical LR with one exception: it will still contain any
|
||||
token that will not be accepted due to an error action in a
|
||||
later state.
|
||||
scanner and before detecting a syntax error. Thus, state merging
|
||||
(from LALR or IELR) and default reductions corrupt the expected
|
||||
token list. However, the list is correct for canonical LR with
|
||||
one exception: it will still contain any token that will not be
|
||||
accepted due to an error action in a later state.]])[
|
||||
*/
|
||||
if (!yyla.empty ())
|
||||
{
|
||||
int yytoken = yyla.type_get ();
|
||||
yyarg[yycount++] = yytname_[yytoken];
|
||||
int yyn = yypact_[yystate];
|
||||
symbol_number_type yytoken = yyla.type_get ();
|
||||
yyarg[yycount++] = yytname_[yytoken];]b4_lac_if([[
|
||||
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
// Execute LAC once. We don't care if it is succesful, we
|
||||
// only do it for the sake of debugging output.
|
||||
if (!yy_lac_established_)
|
||||
yy_lac_check_ (yytoken);
|
||||
#endif]])[
|
||||
|
||||
int yyn = yypact_[+yystate];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
{
|
||||
{]b4_lac_if([[
|
||||
for (int yyx = 0; yyx < yyntokens_; ++yyx)
|
||||
if (yyx != yy_error_token_ && yyx != yy_undef_token_
|
||||
&& yy_lac_check_ (yyx))
|
||||
{]], [[
|
||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||
YYCHECK. In other words, skip the first -YYN actions for
|
||||
this state because they are default actions. */
|
||||
@@ -1144,9 +1360,9 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
int yychecklim = yylast_ - yyn + 1;
|
||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||
if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
|
||||
if (yycheck_[yyx + yyn] == yyx && yyx != yy_error_token_
|
||||
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
||||
{
|
||||
{]])[
|
||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||
{
|
||||
yycount = 1;
|
||||
@@ -1177,7 +1393,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
|
||||
std::string yyres;
|
||||
// Argument number.
|
||||
size_t yyi = 0;
|
||||
std::ptrdiff_t yyi = 0;
|
||||
for (char const* yyp = yyformat; *yyp; ++yyp)
|
||||
if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
|
||||
{
|
||||
@@ -1218,7 +1434,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
i = yystack_.begin (),
|
||||
i_end = yystack_.end ();
|
||||
i != i_end; ++i)
|
||||
*yycdebug_ << ' ' << i->state;
|
||||
*yycdebug_ << ' ' << int (i->state);
|
||||
*yycdebug_ << '\n';
|
||||
}
|
||||
|
||||
@@ -1226,7 +1442,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
void
|
||||
]b4_parser_class[::yy_reduce_print_ (int yyrule)
|
||||
{
|
||||
unsigned yylno = yyrline_[yyrule];
|
||||
int yylno = yyrline_[yyrule];
|
||||
int yynrhs = yyr2_[yyrule];
|
||||
// Print the symbols being reduced, and their result.
|
||||
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
||||
|
||||
+221
-222
@@ -1,6 +1,6 @@
|
||||
# Java skeleton for Bison -*- autoconf -*-
|
||||
# D skeleton for Bison -*- autoconf -*-
|
||||
|
||||
# Copyright (C) 2007-2011, 2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2012, 2019-2020 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
|
||||
@@ -18,12 +18,11 @@
|
||||
m4_include(b4_skeletonsdir/[d.m4])
|
||||
|
||||
|
||||
m4_divert_push(0)dnl
|
||||
@output(b4_parser_file_name@)@
|
||||
b4_output_begin([b4_parser_file_name])
|
||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
|
||||
[2007-2012, 2019])
|
||||
[2007-2012, 2019-2020])[
|
||||
|
||||
b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
|
||||
]b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
|
||||
])[
|
||||
version(D_Version2) {
|
||||
} else {
|
||||
@@ -81,68 +80,14 @@ public interface Lexer
|
||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[string s);
|
||||
}
|
||||
|
||||
private final struct YYStackElement{
|
||||
int state;
|
||||
]b4_yystype[ value;]b4_locations_if(
|
||||
b4_location_type[[] location;])[
|
||||
}
|
||||
|
||||
private final struct YYStack {
|
||||
private YYStackElement[] stack = [];
|
||||
|
||||
public final @@property ulong height()
|
||||
{
|
||||
return stack.length;
|
||||
}
|
||||
|
||||
public final void push (int state, ]b4_yystype[ value]dnl
|
||||
b4_locations_if([, ref ]b4_location_type[ loc])[)
|
||||
{
|
||||
stack ~= YYStackElement(state, value]b4_locations_if([, loc])[);
|
||||
}
|
||||
|
||||
public final void pop ()
|
||||
{
|
||||
pop (1);
|
||||
}
|
||||
|
||||
public final void pop (int num)
|
||||
{
|
||||
stack.length -= num;
|
||||
}
|
||||
|
||||
public final int stateAt (int i)
|
||||
{
|
||||
return stack[$-i-1].state;
|
||||
}
|
||||
|
||||
]b4_locations_if([[public final ref ]b4_location_type[ locationAt (int i)
|
||||
{
|
||||
return stack[$-i-1].location;
|
||||
}
|
||||
|
||||
]])[public final ref ]b4_yystype[ valueAt (int i)
|
||||
{
|
||||
return stack[$-i-1].value;
|
||||
}
|
||||
|
||||
// Print the state stack on the debug stream.
|
||||
public final void print (File stream)
|
||||
{
|
||||
stream.write ("Stack now");
|
||||
for (int i = 0; i < stack.length; i++)
|
||||
stream.write (" %d", stack[i].state);
|
||||
stream.writeln ();
|
||||
}
|
||||
}
|
||||
]b4_locations_if(b4_position_type_if([[[
|
||||
]b4_locations_if([b4_position_type_if([[
|
||||
static assert(__traits(compiles,
|
||||
(new ]b4_position_type[[1])[0]=(new ]b4_position_type[[1])[0]),
|
||||
"struct/class ]b4_position_type[ must be default-constructible "
|
||||
"and assignable");
|
||||
static assert(__traits(compiles, (new string[1])[0]=(new ]b4_position_type[).toString()),
|
||||
"error: struct/class ]b4_position_type[ must have toString method");
|
||||
]]], [[
|
||||
]], [[
|
||||
/**
|
||||
* A struct denoting a point in the input.*/
|
||||
public struct ]b4_position_type[ {
|
||||
@@ -152,15 +97,18 @@ public struct ]b4_position_type[ {
|
||||
/** The line number within an input file. */
|
||||
public int line = 1;
|
||||
/** The name of the input file. */
|
||||
public string filename = "(unspecified file)";
|
||||
public string filename = null;
|
||||
|
||||
/**
|
||||
* Return a string representation of the position. */
|
||||
* A string representation of the position. */
|
||||
public string toString() const {
|
||||
return format("%s:%d.%d", filename, line, column);
|
||||
if (filename)
|
||||
return format("%s:%d.%d", filename, line, column);
|
||||
else
|
||||
return format("%d.%d", line, column);
|
||||
}
|
||||
}
|
||||
]])b4_location_type_if([[[
|
||||
]])b4_location_type_if([[
|
||||
static assert(__traits(compiles, (new ]b4_location_type[((new ]b4_position_type[[1])[0]))) &&
|
||||
__traits(compiles, (new ]b4_location_type[((new ]b4_position_type[[1])[0], (new ]b4_position_type[[1])[0]))),
|
||||
"error: struct/class ]b4_location_type[ must have "
|
||||
@@ -174,7 +122,7 @@ static assert(__traits(compiles, (new ]b4_location_type[[1])[0].begin=(new ]b4_l
|
||||
static assert(__traits(compiles, (new string[1])[0]=(new ]b4_location_type[[1])[0].toString()),
|
||||
"error: struct/class ]b4_location_type[ must have toString method.");
|
||||
|
||||
private immutable bool yy_location_is_class = !__traits(compiles, *(new ]b4_location_type[((new ]b4_position_type[[1])[0])));]]], [[
|
||||
private immutable bool yy_location_is_class = !__traits(compiles, *(new ]b4_location_type[((new ]b4_position_type[[1])[0])));]], [[
|
||||
/**
|
||||
* A class defining a pair of positions. Positions, defined by the
|
||||
* <code>]b4_position_type[</code> class, denote a point in the input.
|
||||
@@ -196,6 +144,9 @@ public class ]b4_location_type[
|
||||
this.begin = this.end = loc;
|
||||
}
|
||||
|
||||
public this () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
||||
* @@param begin The first position included in the range.
|
||||
@@ -207,20 +158,25 @@ public class ]b4_location_type[
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a representation of the location. For this to be correct,
|
||||
* A representation of the location. For this to be correct,
|
||||
* <code>]b4_position_type[</code> should override the <code>toString</code>
|
||||
* method. */
|
||||
public const string toString () const {
|
||||
if (begin==end)
|
||||
return begin.toString ();
|
||||
else
|
||||
return begin.toString () ~ "-" ~ end.toString ();
|
||||
public override string toString () const {
|
||||
auto end_col = 0 < end.column ? end.column - 1 : 0;
|
||||
auto res = begin.toString ();
|
||||
if (end.filename && begin.filename != end.filename)
|
||||
res ~= "-" ~ format("%s:%d.%d", end.filename, end.line, end_col);
|
||||
else if (begin.line < end.line)
|
||||
res ~= "-" ~ format("%d.%d", end.line, end_col);
|
||||
else if (begin.column < end_col)
|
||||
res ~= "-" ~ format("%d", end_col);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
private immutable bool yy_location_is_class = true;
|
||||
|
||||
]]))m4_ifdef([b4_user_union_members], [private union YYSemanticType
|
||||
]])])m4_ifdef([b4_user_union_members], [private union YYSemanticType
|
||||
{
|
||||
b4_user_union_members
|
||||
};],
|
||||
@@ -231,9 +187,6 @@ b4_user_union_members
|
||||
{
|
||||
]b4_identification[
|
||||
|
||||
/** True if verbose error messages are enabled. */
|
||||
public bool errorVerbose = ]b4_flag_value([error_verbose])[;
|
||||
|
||||
]b4_locations_if([[
|
||||
private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n)
|
||||
{
|
||||
@@ -261,29 +214,27 @@ b4_user_union_members
|
||||
|
||||
]b4_lexer_if([[
|
||||
/**
|
||||
* Instantiates the Bison-generated parser.
|
||||
* Instantiate the Bison-generated parser.
|
||||
*/
|
||||
public this] (b4_parse_param_decl([b4_lex_param_decl])[) {
|
||||
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
||||
this.yyDebugStream = stderr;
|
||||
]b4_parse_param_cons[
|
||||
this (new YYLexer(]b4_lex_param_call[));
|
||||
}
|
||||
]])[
|
||||
|
||||
/**
|
||||
* Instantiates the Bison-generated parser.
|
||||
* Instantiate the Bison-generated parser.
|
||||
* @@param yylexer The scanner that will supply tokens to the parser.
|
||||
*/
|
||||
]b4_lexer_if([[protected]], [[public]]) [this (]b4_parse_param_decl([[Lexer yylexer]])[) {
|
||||
this.yylexer = yylexer;
|
||||
this.yyDebugStream = stderr;
|
||||
this.yylexer = yylexer;]b4_parse_trace_if([[
|
||||
this.yyDebugStream = stderr;]])[
|
||||
]b4_parse_param_cons[
|
||||
}
|
||||
|
||||
]b4_parse_trace_if([[
|
||||
private File yyDebugStream;
|
||||
|
||||
/**
|
||||
* Return the <tt>File</tt> on which the debugging output is
|
||||
* The <tt>File</tt> on which the debugging output is
|
||||
* printed.
|
||||
*/
|
||||
public File getDebugStream () { return yyDebugStream; }
|
||||
@@ -309,16 +260,17 @@ b4_user_union_members
|
||||
*/
|
||||
public final void setDebugLevel(int level) { yydebug = level; }
|
||||
|
||||
protected final void yycdebug (string s) {
|
||||
if (0 < yydebug)
|
||||
yyDebugStream.writeln (s);
|
||||
}
|
||||
]])[
|
||||
private final int yylex () {
|
||||
return yylexer.yylex ();
|
||||
}
|
||||
|
||||
protected final void yyerror (]b4_locations_if(ref [b4_location_type[ loc, ]])[string s) {
|
||||
yylexer.yyerror (]b4_locations_if([loc, ])[s);
|
||||
}]
|
||||
|
||||
[protected final void yycdebug (string s) {
|
||||
if (yydebug > 0)
|
||||
yyDebugStream.writeln (s);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,11 +297,11 @@ b4_user_union_members
|
||||
private static immutable int YYERRLAB1 = 7;
|
||||
private static immutable int YYRETURN = 8;
|
||||
]b4_locations_if([
|
||||
private static immutable YYSemanticType yy_semantic_null = cast(YYSemanticType)null;])[
|
||||
private static immutable YYSemanticType yy_semantic_null;])[
|
||||
private int yyerrstatus_ = 0;
|
||||
|
||||
/**
|
||||
* Return whether error recovery is being done. In this state, the parser
|
||||
* 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 bool recovering ()
|
||||
@@ -373,7 +325,8 @@ b4_user_union_members
|
||||
else
|
||||
yyval = yystack.valueAt (0);
|
||||
|
||||
yy_reduce_print (yyn, yystack);
|
||||
]b4_parse_trace_if([[
|
||||
yy_reduce_print (yyn, yystack);]])[
|
||||
|
||||
switch (yyn)
|
||||
{
|
||||
@@ -381,7 +334,8 @@ b4_user_union_members
|
||||
default: break;
|
||||
}
|
||||
|
||||
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
||||
]b4_parse_trace_if([[
|
||||
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);]])[
|
||||
|
||||
yystack.pop (yylen);
|
||||
yylen = 0;
|
||||
@@ -429,12 +383,12 @@ b4_user_union_members
|
||||
return yyr;
|
||||
}
|
||||
}
|
||||
else if (yystr=="$end")
|
||||
else if (yystr == "$end")
|
||||
return "end of input";
|
||||
|
||||
return yystr;
|
||||
}
|
||||
|
||||
]b4_parse_trace_if([[
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
@@ -443,11 +397,12 @@ b4_user_union_members
|
||||
ref ]b4_yystype[ yyvaluep]dnl
|
||||
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||
{
|
||||
if (yydebug > 0) {
|
||||
if (0 < yydebug)
|
||||
{
|
||||
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
|
||||
~ yytname_[yytype] ~ " ("]b4_locations_if([
|
||||
~ yylocationp.toString() ~ ": "])[;
|
||||
static if (__traits(compiles, message~=yyvaluep.toString ()))
|
||||
static if (__traits(compiles, message ~= yyvaluep.toString ()))
|
||||
message ~= yyvaluep.toString ();
|
||||
else
|
||||
message ~= format ("%s", &yyvaluep);
|
||||
@@ -455,7 +410,7 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||
yycdebug (message);
|
||||
}
|
||||
}
|
||||
|
||||
]])[
|
||||
/**
|
||||
* Parse input from the scanner that was specified at object construction
|
||||
* time. Return whether the end of the input was reached successfully.
|
||||
@@ -490,9 +445,9 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||
/// Semantic value of the lookahead.
|
||||
]b4_yystype[ yylval;
|
||||
|
||||
int yyresult;
|
||||
int yyresult;]b4_parse_trace_if([[
|
||||
|
||||
yycdebug ("Starting parse\n");
|
||||
yycdebug ("Starting parse\n");]])[
|
||||
yyerrstatus_ = 0;
|
||||
|
||||
]m4_ifdef([b4_initial_action], [
|
||||
@@ -512,10 +467,10 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
{
|
||||
/* New state. Unlike in the C/C++ skeletons, the state is already
|
||||
pushed when we come here. */
|
||||
case YYNEWSTATE:
|
||||
case YYNEWSTATE:]b4_parse_trace_if([[
|
||||
yycdebug (format("Entering state %d\n", yystate));
|
||||
if (yydebug > 0)
|
||||
yystack.print (yyDebugStream);
|
||||
if (0 < yydebug)
|
||||
yystack.print (yyDebugStream);]])[
|
||||
|
||||
/* Accept? */
|
||||
if (yystate == yyfinal_)
|
||||
@@ -531,8 +486,8 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
|
||||
/* Read a lookahead token. */
|
||||
if (yychar == yyempty_)
|
||||
{
|
||||
yycdebug ("Reading a token: ");
|
||||
{]b4_parse_trace_if([[
|
||||
yycdebug ("Reading a token: ");]])[
|
||||
yychar = yylex ();]b4_locations_if([[
|
||||
static if (yy_location_is_class) {
|
||||
yylloc = new ]b4_location_type[(yylexer.startPos, yylexer.endPos);
|
||||
@@ -543,17 +498,9 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
}
|
||||
|
||||
/* Convert token to internal form. */
|
||||
if (yychar <= YYTokenType.EOF)
|
||||
{
|
||||
yychar = yytoken = YYTokenType.EOF;
|
||||
yycdebug ("Now at end of input.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
yytoken = yytranslate_ (yychar);
|
||||
yy_symbol_print ("Next token is",
|
||||
yytoken, yylval]b4_locations_if([, yylloc])[);
|
||||
}
|
||||
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
||||
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. */
|
||||
@@ -574,9 +521,9 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Shift the lookahead token. */
|
||||
/* Shift the lookahead token. */]b4_parse_trace_if([[
|
||||
yy_symbol_print ("Shifting", yytoken,
|
||||
yylval]b4_locations_if([, yylloc])[);
|
||||
yylval]b4_locations_if([, yylloc])[);]])[
|
||||
|
||||
/* Discard the token being shifted. */
|
||||
yychar = yyempty_;
|
||||
@@ -670,8 +617,8 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
yyn = yypact_[yystate];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
{
|
||||
yyn += yyterror_;
|
||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||
yyn += yy_error_token_;
|
||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
|
||||
{
|
||||
yyn = yytable_[yyn];
|
||||
if (0 < yyn)
|
||||
@@ -685,9 +632,9 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
|
||||
]b4_locations_if([ yyerrloc = yystack.locationAt (0);])[
|
||||
yystack.pop ();
|
||||
yystate = yystack.stateAt (0);
|
||||
if (yydebug > 0)
|
||||
yystack.print (yyDebugStream);
|
||||
yystate = yystack.stateAt (0);]b4_parse_trace_if([[
|
||||
if (0 < yydebug)
|
||||
yystack.print (yyDebugStream);]])[
|
||||
}
|
||||
|
||||
]b4_locations_if([
|
||||
@@ -697,9 +644,9 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
yyloc = yylloc_from_stack (yystack, 2);
|
||||
yystack.pop (2);])[
|
||||
|
||||
/* Shift the error token. */
|
||||
/* Shift the error token. */]b4_parse_trace_if([[
|
||||
yy_symbol_print ("Shifting", yystos_[yyn],
|
||||
yylval]b4_locations_if([, yyloc])[);
|
||||
yylval]b4_locations_if([, yyloc])[);]])[
|
||||
|
||||
yystate = yyn;
|
||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||
@@ -718,78 +665,74 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
|
||||
// Generate an error message.
|
||||
private final string yysyntax_error (int yystate, int tok)
|
||||
{
|
||||
if (errorVerbose)
|
||||
{]b4_error_verbose_if([[
|
||||
/* There are many possibilities here to consider:
|
||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
||||
See
|
||||
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
||||
for details. YYERROR is fine as it does not invoke this
|
||||
function.
|
||||
- If this state is a consistent state with a default action,
|
||||
then the only way this function was invoked is if the
|
||||
default action is an error action. In that case, don't
|
||||
check for expected tokens because there are none.
|
||||
- The only way there can be no lookahead present (in tok) is
|
||||
if this state is a consistent state with a default action.
|
||||
Thus, detecting the absence of a lookahead is sufficient to
|
||||
determine that there is no unexpected or expected token to
|
||||
report. In that case, just report a simple "syntax error".
|
||||
- Don't assume there isn't a lookahead just because this
|
||||
state is a consistent state with a default action. There
|
||||
might have been a previous inconsistent state, consistent
|
||||
state with a non-default action, or user semantic action
|
||||
that manipulated yychar. (However, yychar is currently out
|
||||
of scope during semantic actions.)
|
||||
- Of course, the expected token list depends on states to
|
||||
have correct lookahead information, and it depends on the
|
||||
parser not to perform extra reductions after fetching a
|
||||
lookahead from the scanner and before detecting a syntax
|
||||
error. Thus, state merging (from LALR or IELR) and default
|
||||
reductions corrupt the expected token list. However, the
|
||||
list is correct for canonical LR with one exception: it
|
||||
will still contain any token that will not be accepted due
|
||||
to an error action in a later state.
|
||||
*/
|
||||
if (tok != yyempty_)
|
||||
{
|
||||
/* There are many possibilities here to consider:
|
||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
||||
See
|
||||
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
||||
for details. YYERROR is fine as it does not invoke this
|
||||
function.
|
||||
- If this state is a consistent state with a default action,
|
||||
then the only way this function was invoked is if the
|
||||
default action is an error action. In that case, don't
|
||||
check for expected tokens because there are none.
|
||||
- The only way there can be no lookahead present (in tok) is
|
||||
if this state is a consistent state with a default action.
|
||||
Thus, detecting the absence of a lookahead is sufficient to
|
||||
determine that there is no unexpected or expected token to
|
||||
report. In that case, just report a simple "syntax error".
|
||||
- Don't assume there isn't a lookahead just because this
|
||||
state is a consistent state with a default action. There
|
||||
might have been a previous inconsistent state, consistent
|
||||
state with a non-default action, or user semantic action
|
||||
that manipulated yychar. (However, yychar is currently out
|
||||
of scope during semantic actions.)
|
||||
- Of course, the expected token list depends on states to
|
||||
have correct lookahead information, and it depends on the
|
||||
parser not to perform extra reductions after fetching a
|
||||
lookahead from the scanner and before detecting a syntax
|
||||
error. Thus, state merging (from LALR or IELR) and default
|
||||
reductions corrupt the expected token list. However, the
|
||||
list is correct for canonical LR with one exception: it
|
||||
will still contain any token that will not be accepted due
|
||||
to an error action in a later state.
|
||||
*/
|
||||
if (tok != yyempty_)
|
||||
// FIXME: This method of building the message is not compatible
|
||||
// with internationalization.
|
||||
string res = "syntax error, unexpected ";
|
||||
res ~= yytnamerr_ (yytname_[tok]);
|
||||
int yyn = yypact_[yystate];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
{
|
||||
// FIXME: This method of building the message is not compatible
|
||||
// with internationalization.
|
||||
string res = "syntax error, unexpected ";
|
||||
res ~= yytnamerr_ (yytname_[tok]);
|
||||
int yyn = yypact_[yystate];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
{
|
||||
/* Start YYX at -YYN if negative to avoid negative
|
||||
indexes in YYCHECK. In other words, skip the first
|
||||
-YYN actions for this state because they are default
|
||||
actions. */
|
||||
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_
|
||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||
++count;
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (int x = yyxbegin; x < yyxend; ++x)
|
||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||
{
|
||||
res ~= count++ == 0 ? ", expecting " : " or ";
|
||||
res ~= yytnamerr_ (yytname_[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
/* Start YYX at -YYN if negative to avoid negative
|
||||
indexes in YYCHECK. In other words, skip the first
|
||||
-YYN actions for this state because they are default
|
||||
actions. */
|
||||
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 != yy_error_token_
|
||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||
++count;
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (int x = yyxbegin; x < yyxend; ++x)
|
||||
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||
{
|
||||
res ~= count++ == 0 ? ", expecting " : " or ";
|
||||
res ~= yytnamerr_ (yytname_[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}]])[
|
||||
return "syntax error";
|
||||
}
|
||||
|
||||
@@ -822,14 +765,6 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
|
||||
]b4_parser_tables_define[
|
||||
|
||||
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
||||
to YYLEX-NUM. */
|
||||
private static immutable ]b4_int_type_for([b4_toknum])[[]
|
||||
yytoken_number_ =
|
||||
@{
|
||||
]b4_toknum[
|
||||
@};
|
||||
|
||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||
private static immutable string[] yytname_ =
|
||||
@@ -837,6 +772,7 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
]b4_tname[
|
||||
@};
|
||||
|
||||
]b4_parse_trace_if([[
|
||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||
private static immutable ]b4_int_type_for([b4_rline])[[] yyrline_ =
|
||||
@{
|
||||
@@ -862,35 +798,98 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
]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 immutable ]b4_int_type_for([b4_translate])[[] yytranslate_table_ =
|
||||
@{
|
||||
]b4_translate[
|
||||
@};
|
||||
|
||||
private static ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
||||
private static token_number_type yytranslate_ (int t)
|
||||
{
|
||||
if (t >= 0 && t <= yyuser_token_number_max_)
|
||||
return yytranslate_table_[t];
|
||||
]b4_api_token_raw_if(
|
||||
[[ import std.conv : to;
|
||||
return to!byte (t);]],
|
||||
[[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
immutable token_number_type[] translate_table =
|
||||
@{
|
||||
]b4_translate[
|
||||
@};
|
||||
|
||||
immutable int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
immutable token_number_type undef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
if (t <= 0)
|
||||
return YYTokenType.EOF;
|
||||
else if (t <= user_token_number_max_)
|
||||
return translate_table[t];
|
||||
else
|
||||
return yyundef_token_;
|
||||
return undef_token_;]])[
|
||||
}
|
||||
|
||||
alias ]b4_int_type_for([b4_translate])[ token_number_type;
|
||||
|
||||
private static immutable token_number_type yy_error_token_ = 1;
|
||||
|
||||
private static immutable int yylast_ = ]b4_last[;
|
||||
private static immutable int yynnts_ = ]b4_nterms_number[;
|
||||
private static immutable int yyempty_ = -2;
|
||||
private static immutable int yyfinal_ = ]b4_final_state_number[;
|
||||
private static immutable int yyterror_ = 1;
|
||||
private static immutable int yyerrcode_ = 256;
|
||||
private static immutable int yyntokens_ = ]b4_tokens_number[;
|
||||
|
||||
private static immutable int yyuser_token_number_max_ = ]b4_user_token_number_max[;
|
||||
private static immutable int yyundef_token_ = ]b4_undef_token_number[;
|
||||
private final struct YYStackElement {
|
||||
int state;
|
||||
]b4_yystype[ value;]b4_locations_if(
|
||||
b4_location_type[[] location;])[
|
||||
}
|
||||
|
||||
]/* User implementation code. */
|
||||
b4_percent_code_get[]dnl
|
||||
private final struct YYStack {
|
||||
private YYStackElement[] stack = [];
|
||||
|
||||
public final @@property ulong height()
|
||||
{
|
||||
return stack.length;
|
||||
}
|
||||
|
||||
public final void push (int state, ]b4_yystype[ value]dnl
|
||||
b4_locations_if([, ref ]b4_location_type[ loc])[)
|
||||
{
|
||||
stack ~= YYStackElement(state, value]b4_locations_if([, loc])[);
|
||||
}
|
||||
|
||||
public final void pop ()
|
||||
{
|
||||
pop (1);
|
||||
}
|
||||
|
||||
public final void pop (int num)
|
||||
{
|
||||
stack.length -= num;
|
||||
}
|
||||
|
||||
public final int stateAt (int i)
|
||||
{
|
||||
return stack[$-i-1].state;
|
||||
}
|
||||
|
||||
]b4_locations_if([[
|
||||
public final ref ]b4_location_type[ locationAt (int i)
|
||||
{
|
||||
return stack[$-i-1].location;
|
||||
}]])[
|
||||
|
||||
public final ref ]b4_yystype[ valueAt (int i)
|
||||
{
|
||||
return stack[$-i-1].value;
|
||||
}
|
||||
]b4_parse_trace_if([[
|
||||
// Print the state stack on the debug stream.
|
||||
public final void print (File stream)
|
||||
{
|
||||
stream.write ("Stack now");
|
||||
for (int i = 0; i < stack.length; i++)
|
||||
stream.write (" ", stack[i].state);
|
||||
stream.writeln ();
|
||||
}]])[
|
||||
}
|
||||
|
||||
/* User implementation code. */
|
||||
]b4_percent_code_get[
|
||||
}
|
||||
b4_epilogue[]dnl
|
||||
m4_divert_pop(0)dnl
|
||||
]b4_epilogue[]dnl
|
||||
b4_output_end
|
||||
|
||||
+133
-147
@@ -1,6 +1,6 @@
|
||||
# Java skeleton for Bison -*- autoconf -*-
|
||||
# Java skeleton for Bison -*- autoconf -*-
|
||||
|
||||
# Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018-2020 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
|
||||
@@ -19,10 +19,6 @@ m4_include(b4_skeletonsdir/[java.m4])
|
||||
|
||||
b4_defines_if([b4_complain([%defines does not make sense in Java])])
|
||||
|
||||
# We do not depend on %debug in Java, but pacify warnings about
|
||||
# non-used flags.
|
||||
b4_parse_trace_if([0], [0])
|
||||
|
||||
m4_define([b4_symbol_no_destructor_assert],
|
||||
[b4_symbol_if([$1], [has_destructor],
|
||||
[b4_complain_at(m4_unquote(b4_symbol([$1], [destructor_loc])),
|
||||
@@ -70,19 +66,19 @@ m4_define([b4_define_state],[[
|
||||
|
||||
/* Error handling. */
|
||||
int yynerrs_ = 0;
|
||||
]b4_locations_if([/* The location where the error started. */
|
||||
b4_location_type yyerrloc = null;
|
||||
]b4_locations_if([[/* The location where the error started. */
|
||||
]b4_location_type[ yyerrloc = null;
|
||||
|
||||
/* Location. */
|
||||
b4_location_type yylloc = new b4_location_type (null, null);])[
|
||||
]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);]])[
|
||||
|
||||
/* Semantic value of the lookahead. */
|
||||
]b4_yystype[ yylval = null;
|
||||
]])
|
||||
]])[
|
||||
|
||||
b4_output_begin([b4_parser_file_name])[
|
||||
]b4_output_begin([b4_parser_file_name])[
|
||||
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||
[2007-2015, 2018])[
|
||||
[2007-2015, 2018-2020])[
|
||||
]b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);[
|
||||
]])[
|
||||
]b4_user_pre_prologue[
|
||||
@@ -103,7 +99,7 @@ b4_output_begin([b4_parser_file_name])[
|
||||
private boolean yyErrorVerbose = true;
|
||||
|
||||
/**
|
||||
* Return whether verbose error messages are enabled.
|
||||
* Whether verbose error messages are enabled.
|
||||
*/
|
||||
public final boolean getErrorVerbose() { return yyErrorVerbose; }
|
||||
|
||||
@@ -165,12 +161,12 @@ b4_locations_if([[
|
||||
}
|
||||
}
|
||||
|
||||
]])
|
||||
]])[
|
||||
|
||||
b4_locations_if([[
|
||||
]b4_locations_if([[
|
||||
private ]b4_location_type[ yylloc (YYStack rhs, int n)
|
||||
{
|
||||
if (n > 0)
|
||||
if (0 < n)
|
||||
return new ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
|
||||
else
|
||||
return new ]b4_location_type[ (rhs.locationAt (0).end);
|
||||
@@ -220,10 +216,11 @@ b4_locations_if([[
|
||||
* error message is related]])[
|
||||
* @@param msg The string for the error message.
|
||||
*/
|
||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);]
|
||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);
|
||||
}
|
||||
|
||||
b4_lexer_if([[private class YYLexer implements Lexer {
|
||||
]b4_lexer_if([[
|
||||
private class YYLexer implements Lexer {
|
||||
]b4_percent_code_get([[lexer]])[
|
||||
}
|
||||
|
||||
@@ -231,10 +228,10 @@ b4_locations_if([[
|
||||
* The object doing lexical analysis for us.
|
||||
*/
|
||||
private Lexer yylexer;
|
||||
]
|
||||
b4_parse_param_vars
|
||||
|
||||
b4_lexer_if([[
|
||||
]b4_parse_param_vars[
|
||||
|
||||
]b4_lexer_if([[
|
||||
/**
|
||||
* Instantiates the Bison-generated parser.
|
||||
*/
|
||||
@@ -244,24 +241,24 @@ b4_lexer_if([[
|
||||
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[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[
|
||||
]b4_lexer_if([[protected]], [[public]]) b4_parser_class[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[
|
||||
{
|
||||
]b4_percent_code_get([[init]])[
|
||||
this.yylexer = yylexer;
|
||||
]b4_parse_param_cons[
|
||||
}
|
||||
|
||||
]b4_parse_trace_if([[
|
||||
private java.io.PrintStream yyDebugStream = System.err;
|
||||
|
||||
/**
|
||||
* Return the <tt>PrintStream</tt> on which the debugging output is
|
||||
* printed.
|
||||
* The <tt>PrintStream</tt> on which the debugging output is printed.
|
||||
*/
|
||||
public final java.io.PrintStream getDebugStream () { return yyDebugStream; }
|
||||
|
||||
@@ -285,6 +282,7 @@ b4_lexer_if([[
|
||||
* @@param level The verbosity level for debugging output.
|
||||
*/
|
||||
public final void setDebugLevel(int level) { yydebug = level; }
|
||||
]])[
|
||||
|
||||
/**
|
||||
* Print an error message via the lexer.
|
||||
@@ -314,12 +312,12 @@ b4_lexer_if([[
|
||||
public final void yyerror (]b4_position_type[ pos, String msg)
|
||||
{
|
||||
yylexer.yyerror (new ]b4_location_type[ (pos), msg);
|
||||
}]])
|
||||
|
||||
[protected final void yycdebug (String s) {
|
||||
if (yydebug > 0)
|
||||
}]])[
|
||||
]b4_parse_trace_if([[
|
||||
protected final void yycdebug (String s) {
|
||||
if (0 < yydebug)
|
||||
yyDebugStream.println (s);
|
||||
}
|
||||
}]])[
|
||||
|
||||
private final class YYStack {
|
||||
private int[] stateStack = new int[16];
|
||||
@@ -360,7 +358,7 @@ b4_lexer_if([[
|
||||
|
||||
public final void pop (int num) {
|
||||
// Avoid memory leaks... garbage collection is a white lie!
|
||||
if (num > 0) {
|
||||
if (0 < num) {
|
||||
java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null);
|
||||
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[
|
||||
}
|
||||
@@ -430,10 +428,9 @@ b4_lexer_if([[
|
||||
|
||||
private int yyerrstatus_ = 0;
|
||||
|
||||
]b4_push_if([dnl
|
||||
b4_define_state])[
|
||||
]b4_push_if([b4_define_state])[
|
||||
/**
|
||||
* Return whether error recovery is being done. In this state, the parser
|
||||
* Whether error recovery is being done. In this state, the parser
|
||||
* reads token until it reaches a known state, and then restarts normal
|
||||
* operation.
|
||||
*/
|
||||
@@ -446,7 +443,7 @@ b4_define_state])[
|
||||
* @@param yystate the current state
|
||||
* @@param yysym the nonterminal to push on the stack
|
||||
*/
|
||||
private int yy_lr_goto_state_ (int yystate, int yysym)
|
||||
private int yyLRGotoState (int yystate, int yysym)
|
||||
{
|
||||
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
||||
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
||||
@@ -457,35 +454,30 @@ b4_define_state])[
|
||||
|
||||
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);
|
||||
]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt (yylen - 1) : yystack.valueAt (0);
|
||||
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[]b4_parse_trace_if([[
|
||||
|
||||
yy_reduce_print (yyn, yystack);
|
||||
yyReducePrint (yyn, yystack);]])[
|
||||
|
||||
switch (yyn)
|
||||
{
|
||||
]b4_user_actions[
|
||||
default: break;
|
||||
}
|
||||
}]b4_parse_trace_if([[
|
||||
|
||||
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
||||
yySymbolPrint ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);]])[
|
||||
|
||||
yystack.pop (yylen);
|
||||
yylen = 0;
|
||||
|
||||
/* Shift the result of the reduction. */
|
||||
int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]);
|
||||
int yystate = yyLRGotoState (yystack.stateAt (0), yyr1_[yyn]);
|
||||
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
||||
return YYNEWSTATE;
|
||||
}
|
||||
@@ -526,21 +518,20 @@ b4_define_state])[
|
||||
return yystr;
|
||||
}
|
||||
]])[
|
||||
|
||||
]b4_parse_trace_if([[
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
|
||||
private void yy_symbol_print (String s, int yytype,
|
||||
]b4_yystype[ yyvaluep]dnl
|
||||
b4_locations_if([, Object yylocationp])[)
|
||||
private void yySymbolPrint (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 ()) + ")");
|
||||
}
|
||||
}]])[
|
||||
|
||||
]b4_push_if([],[[
|
||||
/**
|
||||
@@ -550,7 +541,7 @@ b4_define_state])[
|
||||
* @@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])])[]])[
|
||||
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[
|
||||
]b4_push_if([
|
||||
/**
|
||||
* Push Parse input from external lexer
|
||||
@@ -567,8 +558,8 @@ b4_define_state])[
|
||||
]b4_locations_if([/* @@$. */
|
||||
b4_location_type yyloc;])[
|
||||
]b4_push_if([],[[
|
||||
]b4_define_state[
|
||||
yycdebug ("Starting parse\n");
|
||||
]b4_define_state[]b4_parse_trace_if([[
|
||||
yycdebug ("Starting parse\n");]])[
|
||||
yyerrstatus_ = 0;
|
||||
|
||||
/* Initialize the stack. */
|
||||
@@ -587,8 +578,8 @@ b4_dollar_popdef[]dnl
|
||||
b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
|
||||
b4_user_initial_action
|
||||
b4_dollar_popdef[]dnl
|
||||
])[
|
||||
yycdebug ("Starting parse\n");
|
||||
])[]b4_parse_trace_if([[
|
||||
yycdebug ("Starting parse\n");]])[
|
||||
yyerrstatus_ = 0;
|
||||
} else
|
||||
label = YYGETTOKEN;
|
||||
@@ -600,10 +591,10 @@ b4_dollar_popdef[]dnl
|
||||
{
|
||||
/* New state. Unlike in the C/C++ skeletons, the state is already
|
||||
pushed when we come here. */
|
||||
case YYNEWSTATE:
|
||||
case YYNEWSTATE:]b4_parse_trace_if([[
|
||||
yycdebug ("Entering state " + yystate + "\n");
|
||||
if (yydebug > 0)
|
||||
yystack.print (yyDebugStream);
|
||||
if (0 < yydebug)
|
||||
yystack.print (yyDebugStream);]])[
|
||||
|
||||
/* Accept? */
|
||||
if (yystate == yyfinal_)
|
||||
@@ -612,7 +603,7 @@ b4_dollar_popdef[]dnl
|
||||
|
||||
/* Take a decision. First try without lookahead. */
|
||||
yyn = yypact_[yystate];
|
||||
if (yy_pact_value_is_default_ (yyn))
|
||||
if (yyPactValueIsDefault (yyn))
|
||||
{
|
||||
label = YYDEFAULT;
|
||||
break;
|
||||
@@ -625,14 +616,13 @@ b4_dollar_popdef[]dnl
|
||||
{
|
||||
]b4_push_if([[
|
||||
if (!push_token_consumed)
|
||||
return YYPUSH_MORE;
|
||||
yycdebug ("Reading a token: ");
|
||||
return YYPUSH_MORE;]b4_parse_trace_if([[
|
||||
yycdebug ("Reading a token: ");]])[
|
||||
yychar = yylextoken;
|
||||
yylval = yylexval;]b4_locations_if([
|
||||
yylloc = yylexloc;])[
|
||||
push_token_consumed = false;]])[
|
||||
]b4_push_if([],[[
|
||||
yycdebug ("Reading a token: ");
|
||||
push_token_consumed = false;]], [b4_parse_trace_if([[
|
||||
yycdebug ("Reading a token: ");]])[
|
||||
yychar = yylexer.yylex ();
|
||||
yylval = yylexer.getLVal ();]b4_locations_if([
|
||||
yylloc = new b4_location_type (yylexer.getStartPos (),
|
||||
@@ -641,17 +631,9 @@ b4_dollar_popdef[]dnl
|
||||
}
|
||||
|
||||
/* Convert token to internal form. */
|
||||
if (yychar <= Lexer.EOF)
|
||||
{
|
||||
yychar = yytoken = Lexer.EOF;
|
||||
yycdebug ("Now at end of input.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
yytoken = yytranslate_ (yychar);
|
||||
yy_symbol_print ("Next token is", yytoken,
|
||||
yylval]b4_locations_if([, yylloc])[);
|
||||
}
|
||||
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
||||
yySymbolPrint ("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. */
|
||||
@@ -662,7 +644,7 @@ b4_dollar_popdef[]dnl
|
||||
/* <= 0 means reduce or error. */
|
||||
else if ((yyn = yytable_[yyn]) <= 0)
|
||||
{
|
||||
if (yy_table_value_is_error_ (yyn))
|
||||
if (yyTableValueIsError (yyn))
|
||||
label = YYERRLAB;
|
||||
else
|
||||
{
|
||||
@@ -673,10 +655,10 @@ b4_dollar_popdef[]dnl
|
||||
|
||||
else
|
||||
{
|
||||
/* Shift the lookahead token. */
|
||||
yy_symbol_print ("Shifting", yytoken,
|
||||
yylval]b4_locations_if([, yylloc])[);
|
||||
|
||||
/* Shift the lookahead token. */]b4_parse_trace_if([[
|
||||
yySymbolPrint ("Shifting", yytoken,
|
||||
yylval]b4_locations_if([, yylloc])[);
|
||||
]])[
|
||||
/* Discard the token being shifted. */
|
||||
yychar = yyempty_;
|
||||
|
||||
@@ -727,17 +709,17 @@ b4_dollar_popdef[]dnl
|
||||
]b4_locations_if([yyerrloc = yylloc;])[
|
||||
if (yyerrstatus_ == 3)
|
||||
{
|
||||
/* If just tried and failed to reuse lookahead token after an
|
||||
error, discard it. */
|
||||
/* If just tried and failed to reuse lookahead token after an
|
||||
error, discard it. */
|
||||
|
||||
if (yychar <= Lexer.EOF)
|
||||
{
|
||||
/* Return failure if at end of input. */
|
||||
if (yychar == Lexer.EOF)
|
||||
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
||||
}
|
||||
else
|
||||
yychar = yyempty_;
|
||||
if (yychar <= Lexer.EOF)
|
||||
{
|
||||
/* Return failure if at end of input. */
|
||||
if (yychar == Lexer.EOF)
|
||||
]b4_push_if([{label = YYABORT; break;}], [return false;])[
|
||||
}
|
||||
else
|
||||
yychar = yyempty_;
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token after shifting the error
|
||||
@@ -749,7 +731,6 @@ b4_dollar_popdef[]dnl
|
||||
| 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. */
|
||||
@@ -768,10 +749,10 @@ b4_dollar_popdef[]dnl
|
||||
for (;;)
|
||||
{
|
||||
yyn = yypact_[yystate];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
if (!yyPactValueIsDefault (yyn))
|
||||
{
|
||||
yyn += yyterror_;
|
||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||
yyn += yy_error_token_;
|
||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
|
||||
{
|
||||
yyn = yytable_[yyn];
|
||||
if (0 < yyn)
|
||||
@@ -786,9 +767,9 @@ b4_dollar_popdef[]dnl
|
||||
|
||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||
yystack.pop ();
|
||||
yystate = yystack.stateAt (0);
|
||||
if (yydebug > 0)
|
||||
yystack.print (yyDebugStream);
|
||||
yystate = yystack.stateAt (0);]b4_parse_trace_if([[
|
||||
if (0 < yydebug)
|
||||
yystack.print (yyDebugStream);]])[
|
||||
}
|
||||
|
||||
if (label == YYABORT)
|
||||
@@ -802,9 +783,9 @@ b4_dollar_popdef[]dnl
|
||||
yyloc = yylloc (yystack, 2);
|
||||
yystack.pop (2);])[
|
||||
|
||||
/* Shift the error token. */
|
||||
yy_symbol_print ("Shifting", yystos_[yyn],
|
||||
yylval]b4_locations_if([, yyloc])[);
|
||||
/* Shift the error token. */]b4_parse_trace_if([[
|
||||
yySymbolPrint ("Shifting", yystos_[yyn],
|
||||
yylval]b4_locations_if([, yyloc])[);]])[
|
||||
|
||||
yystate = yyn;
|
||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||
@@ -870,9 +851,9 @@ b4_dollar_popdef[]dnl
|
||||
{
|
||||
return push_parse (yylextoken, yylexval, new b4_location_type (yylexpos));
|
||||
}
|
||||
])[]])
|
||||
])[]])[
|
||||
|
||||
b4_both_if([[
|
||||
]b4_both_if([[
|
||||
/**
|
||||
* Parse input from the scanner that was specified at object construction
|
||||
* time. Return whether the end of the input was reached successfully.
|
||||
@@ -881,21 +862,21 @@ b4_both_if([[
|
||||
* @@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])])[
|
||||
{
|
||||
if (yylexer == null)
|
||||
throw new NullPointerException("Null Lexer");
|
||||
int status;
|
||||
do {
|
||||
int token = yylexer.yylex();
|
||||
]b4_yystype[ lval = yylexer.getLVal();
|
||||
public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
|
||||
{
|
||||
if (yylexer == null)
|
||||
throw new NullPointerException("Null Lexer");
|
||||
int status;
|
||||
do {
|
||||
int token = yylexer.yylex();
|
||||
]b4_yystype[ lval = yylexer.getLVal();
|
||||
]b4_locations_if([dnl
|
||||
b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (),
|
||||
yylexer.getEndPos ());])[
|
||||
]b4_locations_if([status = push_parse(token,lval,yyloc);],[
|
||||
status = push_parse(token,lval);])[
|
||||
} while (status == YYPUSH_MORE);
|
||||
return (status == YYACCEPT);
|
||||
b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (),
|
||||
yylexer.getEndPos ());])[
|
||||
]b4_locations_if([status = push_parse(token,lval,yyloc);],[
|
||||
status = push_parse(token,lval);])[
|
||||
} while (status == YYPUSH_MORE);
|
||||
return (status == YYACCEPT);
|
||||
}
|
||||
]])[
|
||||
|
||||
@@ -938,7 +919,7 @@ b4_both_if([[
|
||||
new StringBuffer ("syntax error, unexpected ");
|
||||
res.append (yytnamerr_ (yytname_[tok]));
|
||||
int yyn = yypact_[yystate];
|
||||
if (!yy_pact_value_is_default_ (yyn))
|
||||
if (!yyPactValueIsDefault (yyn))
|
||||
{
|
||||
/* Start YYX at -YYN if negative to avoid negative
|
||||
indexes in YYCHECK. In other words, skip the first
|
||||
@@ -950,15 +931,15 @@ b4_both_if([[
|
||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||
int count = 0;
|
||||
for (int x = yyxbegin; x < yyxend; ++x)
|
||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
||||
&& !yyTableValueIsError (yytable_[x + yyn]))
|
||||
++count;
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (int x = yyxbegin; x < yyxend; ++x)
|
||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
||||
&& !yyTableValueIsError (yytable_[x + yyn]))
|
||||
{
|
||||
res.append (count++ == 0 ? ", expecting " : " or ");
|
||||
res.append (yytnamerr_ (yytname_[x]));
|
||||
@@ -976,7 +957,7 @@ b4_both_if([[
|
||||
* Whether the given <code>yypact_</code> value indicates a defaulted state.
|
||||
* @@param yyvalue the value to check
|
||||
*/
|
||||
private static boolean yy_pact_value_is_default_ (int yyvalue)
|
||||
private static boolean yyPactValueIsDefault (int yyvalue)
|
||||
{
|
||||
return yyvalue == yypact_ninf_;
|
||||
}
|
||||
@@ -986,7 +967,7 @@ b4_both_if([[
|
||||
* value indicates a syntax error.
|
||||
* @@param yyvalue the value to check
|
||||
*/
|
||||
private static boolean yy_table_value_is_error_ (int yyvalue)
|
||||
private static boolean yyTableValueIsError (int yyvalue)
|
||||
{
|
||||
return yyvalue == yytable_ninf_;
|
||||
}
|
||||
@@ -995,20 +976,18 @@ b4_both_if([[
|
||||
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
||||
|
||||
]b4_parser_tables_define[
|
||||
]b4_integral_parser_table_define([token_number], [b4_toknum],
|
||||
[[YYTOKEN_NUMBER[YYLEX-NUM] -- Internal symbol number corresponding
|
||||
to YYLEX-NUM.]])[
|
||||
|
||||
/* 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])[
|
||||
|
||||
]b4_parse_trace_if([[
|
||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
||||
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
|
||||
|
||||
|
||||
// Report on the debug stream that the rule yyrule is going to be reduced.
|
||||
private void yy_reduce_print (int yyrule, YYStack yystack)
|
||||
private void yyReducePrint (int yyrule, YYStack yystack)
|
||||
{
|
||||
if (yydebug == 0)
|
||||
return;
|
||||
@@ -1021,37 +1000,44 @@ b4_both_if([[
|
||||
|
||||
/* The symbols being reduced. */
|
||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||
yy_symbol_print (" $" + (yyi + 1) + " =",
|
||||
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
||||
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||
}
|
||||
yySymbolPrint (" $" + (yyi + 1) + " =",
|
||||
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
||||
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||
}]])[
|
||||
|
||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||
as returned by yylex, with out-of-bounds checking. */
|
||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
||||
|
||||
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
||||
{
|
||||
if (t >= 0 && t <= yyuser_token_number_max_)
|
||||
]b4_api_token_raw_if(dnl
|
||||
[[ {
|
||||
return t;
|
||||
}
|
||||
]],
|
||||
[[ {
|
||||
int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
]b4_int_type_for([b4_translate])[ undef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
if (t <= 0)
|
||||
return Lexer.EOF;
|
||||
else if (t <= user_token_number_max_)
|
||||
return yytranslate_table_[t];
|
||||
else
|
||||
return yyundef_token_;
|
||||
return undef_token_;
|
||||
}
|
||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
||||
]])[
|
||||
|
||||
private static final ]b4_int_type_for([b4_translate])[ yy_error_token_ = 1;
|
||||
|
||||
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
|
||||
/* User implementation code. */
|
||||
]b4_percent_code_get[]dnl
|
||||
|
||||
}
|
||||
|
||||
|
||||
+44
-34
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018-2020 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
|
||||
@@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015, 2018-2019])
|
||||
[2002-2015, 2018-2020])
|
||||
|
||||
|
||||
# b4_position_file
|
||||
@@ -62,11 +62,14 @@ m4_define([b4_location_define],
|
||||
[[ /// A point in a source file.
|
||||
class position
|
||||
{
|
||||
public:]m4_ifdef([b4_location_constructors], [[
|
||||
public:
|
||||
/// Type for line and column numbers.
|
||||
typedef int counter_type;
|
||||
]m4_ifdef([b4_location_constructors], [[
|
||||
/// Construct a position.
|
||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
counter_type l = ]b4_location_initial_line[,
|
||||
counter_type c = ]b4_location_initial_column[)
|
||||
: filename (f)
|
||||
, line (l)
|
||||
, column (c)
|
||||
@@ -75,8 +78,8 @@ m4_define([b4_location_define],
|
||||
]])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
counter_type l = ]b4_location_initial_line[,
|
||||
counter_type c = ]b4_location_initial_column[)
|
||||
{
|
||||
filename = fn;
|
||||
line = l;
|
||||
@@ -86,17 +89,17 @@ m4_define([b4_location_define],
|
||||
/** \name Line and Column related manipulators
|
||||
** \{ */
|
||||
/// (line related) Advance to the COUNT next lines.
|
||||
void lines (int count = 1)
|
||||
void lines (counter_type count = 1)
|
||||
{
|
||||
if (count)
|
||||
{
|
||||
column = ]b4_location_initial_column[u;
|
||||
column = ]b4_location_initial_column[;
|
||||
line = add_ (line, count, ]b4_location_initial_line[);
|
||||
}
|
||||
}
|
||||
|
||||
/// (column related) Advance to the COUNT next columns.
|
||||
void columns (int count = 1)
|
||||
void columns (counter_type count = 1)
|
||||
{
|
||||
column = add_ (column, count, ]b4_location_initial_column[);
|
||||
}
|
||||
@@ -105,22 +108,21 @@ m4_define([b4_location_define],
|
||||
/// File name to which this position refers.
|
||||
]b4_percent_define_get([[filename_type]])[* filename;
|
||||
/// Current line number.
|
||||
unsigned line;
|
||||
counter_type line;
|
||||
/// Current column number.
|
||||
unsigned column;
|
||||
counter_type column;
|
||||
|
||||
private:
|
||||
/// Compute max (min, lhs+rhs).
|
||||
static unsigned add_ (unsigned lhs, int rhs, int min)
|
||||
static counter_type add_ (counter_type lhs, counter_type rhs, counter_type min)
|
||||
{
|
||||
return static_cast<unsigned> (std::max (min,
|
||||
static_cast<int> (lhs) + rhs));
|
||||
return lhs + rhs < min ? min : lhs + rhs;
|
||||
}
|
||||
};
|
||||
|
||||
/// Add \a width columns, in place.
|
||||
inline position&
|
||||
operator+= (position& res, int width)
|
||||
operator+= (position& res, position::counter_type width)
|
||||
{
|
||||
res.columns (width);
|
||||
return res;
|
||||
@@ -128,21 +130,21 @@ m4_define([b4_location_define],
|
||||
|
||||
/// Add \a width columns.
|
||||
inline position
|
||||
operator+ (position res, int width)
|
||||
operator+ (position res, position::counter_type width)
|
||||
{
|
||||
return res += width;
|
||||
}
|
||||
|
||||
/// Subtract \a width columns, in place.
|
||||
inline position&
|
||||
operator-= (position& res, int width)
|
||||
operator-= (position& res, position::counter_type width)
|
||||
{
|
||||
return res += -width;
|
||||
}
|
||||
|
||||
/// Subtract \a width columns.
|
||||
inline position
|
||||
operator- (position res, int width)
|
||||
operator- (position res, position::counter_type width)
|
||||
{
|
||||
return res -= width;
|
||||
}
|
||||
@@ -182,6 +184,8 @@ m4_define([b4_location_define],
|
||||
class location
|
||||
{
|
||||
public:
|
||||
/// 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)
|
||||
@@ -197,8 +201,8 @@ m4_define([b4_location_define],
|
||||
|
||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
counter_type l = ]b4_location_initial_line[,
|
||||
counter_type c = ]b4_location_initial_column[)
|
||||
: begin (f, l, c)
|
||||
, end (f, l, c)
|
||||
{}
|
||||
@@ -206,8 +210,8 @@ m4_define([b4_location_define],
|
||||
])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
counter_type l = ]b4_location_initial_line[,
|
||||
counter_type c = ]b4_location_initial_column[)
|
||||
{
|
||||
begin.initialize (f, l, c);
|
||||
end = begin;
|
||||
@@ -223,13 +227,13 @@ m4_define([b4_location_define],
|
||||
}
|
||||
|
||||
/// Extend the current location to the COUNT next columns.
|
||||
void columns (int count = 1)
|
||||
void columns (counter_type count = 1)
|
||||
{
|
||||
end += count;
|
||||
}
|
||||
|
||||
/// Extend the current location to the COUNT next lines.
|
||||
void lines (int count = 1)
|
||||
void lines (counter_type count = 1)
|
||||
{
|
||||
end.lines (count);
|
||||
}
|
||||
@@ -244,39 +248,45 @@ m4_define([b4_location_define],
|
||||
};
|
||||
|
||||
/// Join two locations, in place.
|
||||
inline location& operator+= (location& res, const location& end)
|
||||
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)
|
||||
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, int width)
|
||||
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, int width)
|
||||
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, int width)
|
||||
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, int width)
|
||||
inline location
|
||||
operator- (location res, location::counter_type width)
|
||||
{
|
||||
return res -= width;
|
||||
}
|
||||
@@ -305,7 +315,8 @@ m4_define([b4_location_define],
|
||||
std::basic_ostream<YYChar>&
|
||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
||||
{
|
||||
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
location::counter_type end_col
|
||||
= 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
ostr << loc.begin;
|
||||
if (loc.end.filename
|
||||
&& (!loc.begin.filename
|
||||
@@ -327,7 +338,7 @@ m4_ifdef([b4_position_file], [[
|
||||
// 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
|
||||
// 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.
|
||||
|
||||
@@ -346,7 +357,6 @@ m4_ifdef([b4_location_file], [[
|
||||
|
||||
]b4_cpp_guard_open([b4_location_path])[
|
||||
|
||||
# include <algorithm> // std::max
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
|
||||
|
||||
+20
-31
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018-2020 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
|
||||
@@ -35,6 +35,7 @@ m4_define([b4_stack_define],
|
||||
typedef typename S::reverse_iterator iterator;
|
||||
typedef typename S::const_reverse_iterator const_iterator;
|
||||
typedef typename S::size_type size_type;
|
||||
typedef typename std::ptrdiff_t index_type;
|
||||
|
||||
stack (size_type n = 200)
|
||||
: seq_ (n)
|
||||
@@ -43,37 +44,19 @@ m4_define([b4_stack_define],
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
T&
|
||||
operator[] (size_type i)
|
||||
const T&
|
||||
operator[] (index_type i) const
|
||||
{
|
||||
return seq_[size () - 1 - i];
|
||||
return seq_[size_type (size () - 1 - i)];
|
||||
}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
T&
|
||||
operator[] (int i)
|
||||
operator[] (index_type i)
|
||||
{
|
||||
return operator[] (size_type (i));
|
||||
}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
const T&
|
||||
operator[] (size_type i) const
|
||||
{
|
||||
return seq_[size () - 1 - i];
|
||||
}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
const T&
|
||||
operator[] (int i) const
|
||||
{
|
||||
return operator[] (size_type (i));
|
||||
return seq_[size_type (size () - 1 - i)];
|
||||
}
|
||||
|
||||
/// Steal the contents of \a t.
|
||||
@@ -88,7 +71,7 @@ m4_define([b4_stack_define],
|
||||
|
||||
/// Pop elements from the stack.
|
||||
void
|
||||
pop (int n = 1) YY_NOEXCEPT
|
||||
pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
|
||||
{
|
||||
for (; 0 < n; --n)
|
||||
seq_.pop_back ();
|
||||
@@ -102,10 +85,16 @@ m4_define([b4_stack_define],
|
||||
}
|
||||
|
||||
/// Number of elements on the stack.
|
||||
size_type
|
||||
index_type
|
||||
size () const YY_NOEXCEPT
|
||||
{
|
||||
return seq_.size ();
|
||||
return index_type (seq_.size ());
|
||||
}
|
||||
|
||||
std::ptrdiff_t
|
||||
ssize () const YY_NOEXCEPT
|
||||
{
|
||||
return std::ptrdiff_t (size ());
|
||||
}
|
||||
|
||||
/// Iterator on top of the stack (going downwards).
|
||||
@@ -126,20 +115,20 @@ m4_define([b4_stack_define],
|
||||
class slice
|
||||
{
|
||||
public:
|
||||
slice (const stack& stack, int range)
|
||||
slice (const stack& stack, index_type range)
|
||||
: stack_ (stack)
|
||||
, range_ (range)
|
||||
{}
|
||||
|
||||
const T&
|
||||
operator[] (int i) const
|
||||
operator[] (index_type i) const
|
||||
{
|
||||
return stack_[range_ - i];
|
||||
}
|
||||
|
||||
private:
|
||||
const stack& stack_;
|
||||
int range_;
|
||||
index_type range_;
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -157,7 +146,7 @@ m4_ifdef([b4_stack_file],
|
||||
// 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
|
||||
// 1. add '%require "3.2"' (or newer) to your grammar file
|
||||
// 2. remove references to this file from your build system.
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
+21
-21
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018-2020 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
|
||||
@@ -72,9 +72,9 @@ m4_map([ b4_symbol_tag_comment], [$@])dnl
|
||||
# The needed includes for variants support.
|
||||
m4_define([b4_variant_includes],
|
||||
[b4_parse_assert_if([[#include <typeinfo>]])[
|
||||
#ifndef YYASSERT
|
||||
#ifndef YY_ASSERT
|
||||
# include <cassert>
|
||||
# define YYASSERT assert
|
||||
# define YY_ASSERT assert
|
||||
#endif
|
||||
]])
|
||||
|
||||
@@ -111,14 +111,14 @@ m4_define([b4_value_type_declare],
|
||||
semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
||||
: yytypeid_ (&typeid (T))])[
|
||||
{
|
||||
YYASSERT (sizeof (T) <= size);
|
||||
YY_ASSERT (sizeof (T) <= size);
|
||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||
}
|
||||
|
||||
/// Destruction, allowed only if empty.
|
||||
~semantic_type () YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytypeid_);
|
||||
YY_ASSERT (!yytypeid_);
|
||||
])[}
|
||||
|
||||
# if 201103L <= YY_CPLUSPLUS
|
||||
@@ -127,8 +127,8 @@ m4_define([b4_value_type_declare],
|
||||
T&
|
||||
emplace (U&&... u)
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytypeid_);
|
||||
YYASSERT (sizeof (T) <= size);
|
||||
YY_ASSERT (!yytypeid_);
|
||||
YY_ASSERT (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);])[
|
||||
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
||||
}
|
||||
@@ -138,8 +138,8 @@ m4_define([b4_value_type_declare],
|
||||
T&
|
||||
emplace ()
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytypeid_);
|
||||
YYASSERT (sizeof (T) <= size);
|
||||
YY_ASSERT (!yytypeid_);
|
||||
YY_ASSERT (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);])[
|
||||
return *new (yyas_<T> ()) T ();
|
||||
}
|
||||
@@ -149,8 +149,8 @@ m4_define([b4_value_type_declare],
|
||||
T&
|
||||
emplace (const T& t)
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytypeid_);
|
||||
YYASSERT (sizeof (T) <= size);
|
||||
YY_ASSERT (!yytypeid_);
|
||||
YY_ASSERT (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);])[
|
||||
return *new (yyas_<T> ()) T (t);
|
||||
}
|
||||
@@ -179,9 +179,9 @@ m4_define([b4_value_type_declare],
|
||||
T&
|
||||
as () YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytypeid_);
|
||||
YYASSERT (*yytypeid_ == typeid (T));
|
||||
YYASSERT (sizeof (T) <= size);])[
|
||||
YY_ASSERT (yytypeid_);
|
||||
YY_ASSERT (*yytypeid_ == typeid (T));
|
||||
YY_ASSERT (sizeof (T) <= size);])[
|
||||
return *yyas_<T> ();
|
||||
}
|
||||
|
||||
@@ -190,9 +190,9 @@ m4_define([b4_value_type_declare],
|
||||
const T&
|
||||
as () const YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytypeid_);
|
||||
YYASSERT (*yytypeid_ == typeid (T));
|
||||
YYASSERT (sizeof (T) <= size);])[
|
||||
YY_ASSERT (yytypeid_);
|
||||
YY_ASSERT (*yytypeid_ == typeid (T));
|
||||
YY_ASSERT (sizeof (T) <= size);])[
|
||||
return *yyas_<T> ();
|
||||
}
|
||||
|
||||
@@ -208,8 +208,8 @@ m4_define([b4_value_type_declare],
|
||||
void
|
||||
swap (self_type& that) YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (yytypeid_);
|
||||
YYASSERT (*yytypeid_ == *that.yytypeid_);])[
|
||||
YY_ASSERT (yytypeid_);
|
||||
YY_ASSERT (*yytypeid_ == *that.yytypeid_);])[
|
||||
std::swap (as<T> (), that.as<T> ());
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ m4_define([_b4_token_constructor_define],
|
||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||
b4_locations_if([std::move (l)]))[)
|
||||
{
|
||||
YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
||||
YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
||||
}
|
||||
#else
|
||||
symbol_type (]b4_join(
|
||||
@@ -413,7 +413,7 @@ m4_define([_b4_token_constructor_define],
|
||||
b4_symbol_if([$1], [has_type], [v]),
|
||||
b4_locations_if([l]))[)
|
||||
{
|
||||
YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
||||
YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
||||
}
|
||||
#endif
|
||||
]])])
|
||||
|
||||
+215
-205
@@ -1,11 +1,11 @@
|
||||
-*- C -*-
|
||||
# -*- C -*-
|
||||
# Yacc compatible skeleton for Bison
|
||||
|
||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software
|
||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[1984, 1989-1990, 2000-2015, 2018-2019])
|
||||
[1984, 1989-1990, 2000-2015, 2018-2020])
|
||||
|
||||
# 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
|
||||
@@ -20,51 +20,11 @@ m4_pushdef([b4_copyright_years],
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Check the value of %define api.push-pull.
|
||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
||||
b4_percent_define_check_values([[[[api.push-pull]],
|
||||
[[pull]], [[push]], [[both]]]])
|
||||
b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
|
||||
b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
|
||||
m4_case(b4_percent_define_get([[api.push-pull]]),
|
||||
[pull], [m4_define([b4_push_flag], [[0]])],
|
||||
[push], [m4_define([b4_pull_flag], [[0]])])
|
||||
|
||||
# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing
|
||||
# tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
|
||||
# behavior of Bison at all when push parsing is already requested.
|
||||
b4_define_flag_if([use_push_for_pull])
|
||||
b4_use_push_for_pull_if([
|
||||
b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
|
||||
[m4_define([b4_push_flag], [[1]])])])
|
||||
|
||||
# Check the value of %define parse.lac and friends, where LAC stands for
|
||||
# lookahead correction.
|
||||
b4_percent_define_default([[parse.lac]], [[none]])
|
||||
b4_percent_define_default([[parse.lac.es-capacity-initial]], [[20]])
|
||||
b4_percent_define_default([[parse.lac.memory-trace]], [[failures]])
|
||||
b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]],
|
||||
[[[[parse.lac.memory-trace]],
|
||||
[[failures]], [[full]]]])
|
||||
b4_define_flag_if([lac])
|
||||
m4_define([b4_lac_flag],
|
||||
[m4_if(b4_percent_define_get([[parse.lac]]),
|
||||
[none], [[0]], [[1]])])
|
||||
|
||||
m4_include(b4_skeletonsdir/[c.m4])
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
|
||||
# Stack parameters.
|
||||
m4_define_default([b4_stack_depth_max], [10000])
|
||||
m4_define_default([b4_stack_depth_init], [200])
|
||||
|
||||
|
||||
## ------------------------ ##
|
||||
## Pure/impure interfaces. ##
|
||||
## ------------------------ ##
|
||||
## ---------- ##
|
||||
## api.pure. ##
|
||||
## ---------- ##
|
||||
|
||||
b4_percent_define_default([[api.pure]], [[false]])
|
||||
b4_percent_define_check_values([[[[api.pure]],
|
||||
@@ -84,6 +44,51 @@ m4_define([b4_pure_if],
|
||||
[2], [$1])])
|
||||
[m4_fatal([invalid api.pure value: ]$1)])])
|
||||
|
||||
## --------------- ##
|
||||
## api.push-pull. ##
|
||||
## --------------- ##
|
||||
|
||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
||||
b4_percent_define_check_values([[[[api.push-pull]],
|
||||
[[pull]], [[push]], [[both]]]])
|
||||
b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
|
||||
b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
|
||||
m4_case(b4_percent_define_get([[api.push-pull]]),
|
||||
[pull], [m4_define([b4_push_flag], [[0]])],
|
||||
[push], [m4_define([b4_pull_flag], [[0]])])
|
||||
|
||||
# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing
|
||||
# tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
|
||||
# behavior of Bison at all when push parsing is already requested.
|
||||
b4_define_flag_if([use_push_for_pull])
|
||||
b4_use_push_for_pull_if([
|
||||
b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
|
||||
[m4_define([b4_push_flag], [[1]])])])
|
||||
|
||||
## ----------- ##
|
||||
## parse.lac. ##
|
||||
## ----------- ##
|
||||
|
||||
b4_percent_define_default([[parse.lac]], [[none]])
|
||||
b4_percent_define_default([[parse.lac.es-capacity-initial]], [[20]])
|
||||
b4_percent_define_default([[parse.lac.memory-trace]], [[failures]])
|
||||
b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]],
|
||||
[[[[parse.lac.memory-trace]],
|
||||
[[failures]], [[full]]]])
|
||||
b4_define_flag_if([lac])
|
||||
m4_define([b4_lac_flag],
|
||||
[m4_if(b4_percent_define_get([[parse.lac]]),
|
||||
[none], [[0]], [[1]])])
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
|
||||
# Stack parameters.
|
||||
m4_define_default([b4_stack_depth_max], [10000])
|
||||
m4_define_default([b4_stack_depth_init], [200])
|
||||
|
||||
|
||||
# b4_yyerror_arg_loc_if(ARG)
|
||||
# --------------------------
|
||||
# Expand ARG iff yyerror is to be given a location as argument.
|
||||
@@ -101,28 +106,6 @@ m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
|
||||
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## Data Types. ##
|
||||
## ------------ ##
|
||||
|
||||
# b4_int_type(MIN, MAX)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# MIN to MAX (included). Overwrite the version from c.m4, which
|
||||
# uses only C89 types, so that the user can override the shorter
|
||||
# types, and so that pre-C89 compilers are handled correctly.
|
||||
m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [yytype_uint8],
|
||||
b4_ints_in($@, [-128], [127]), [1], [yytype_int8],
|
||||
|
||||
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
|
||||
|
||||
m4_eval([0 <= $1]), [1], [unsigned],
|
||||
|
||||
[int])])
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Semantic Values. ##
|
||||
## ----------------- ##
|
||||
@@ -199,7 +182,7 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
||||
/* Number of syntax errors so far. */
|
||||
int yynerrs;
|
||||
]])[
|
||||
int yystate;
|
||||
yy_state_fast_t yystate;
|
||||
/* Number of tokens to shift before error messages enabled. */
|
||||
int yyerrstatus;
|
||||
|
||||
@@ -212,9 +195,9 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
||||
to reallocate them elsewhere. */
|
||||
|
||||
/* The state stack. */
|
||||
yytype_int16 yyssa[YYINITDEPTH];
|
||||
yytype_int16 *yyss;
|
||||
yytype_int16 *yyssp;
|
||||
yy_state_t yyssa[YYINITDEPTH];
|
||||
yy_state_t *yyss;
|
||||
yy_state_t *yyssp;
|
||||
|
||||
/* The semantic value stack. */
|
||||
YYSTYPE yyvsa[YYINITDEPTH];
|
||||
@@ -229,11 +212,11 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
||||
/* The locations where the error started and ended. */
|
||||
YYLTYPE yyerror_range[3];]])[
|
||||
|
||||
YYSIZE_T yystacksize;]b4_lac_if([[
|
||||
YYPTRDIFF_T yystacksize;]b4_lac_if([[
|
||||
|
||||
yytype_int16 yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
|
||||
yytype_int16 *yyes;
|
||||
YYSIZE_T yyes_capacity;]])])
|
||||
yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
|
||||
yy_state_t *yyes;
|
||||
YYPTRDIFF_T yyes_capacity;]])])
|
||||
|
||||
|
||||
# _b4_declare_yyparse_push
|
||||
@@ -356,13 +339,13 @@ m4_if(b4_api_prefix, [yy], [],
|
||||
#define yylex ]b4_prefix[lex
|
||||
#define yyerror ]b4_prefix[error
|
||||
#define yydebug ]b4_prefix[debug
|
||||
#define yynerrs ]b4_prefix[nerrs
|
||||
]]b4_pure_if([], [[
|
||||
#define yynerrs ]b4_prefix[nerrs]]b4_pure_if([], [[
|
||||
#define yylval ]b4_prefix[lval
|
||||
#define yychar ]b4_prefix[char]b4_locations_if([[
|
||||
#define yylloc ]b4_prefix[lloc]])]))[
|
||||
|
||||
]b4_user_pre_prologue[
|
||||
]b4_cast_define[
|
||||
]b4_null_define[
|
||||
|
||||
/* Enabling verbose error messages. */
|
||||
@@ -386,28 +369,22 @@ m4_if(b4_api_prefix, [yy], [],
|
||||
# undef short
|
||||
#endif
|
||||
|
||||
#ifdef YYTYPE_UINT8
|
||||
typedef YYTYPE_UINT8 yytype_uint8;
|
||||
#else
|
||||
typedef unsigned char yytype_uint8;
|
||||
#endif
|
||||
]b4_c99_int_type_define[
|
||||
|
||||
#ifdef YYTYPE_INT8
|
||||
typedef YYTYPE_INT8 yytype_int8;
|
||||
#else
|
||||
typedef signed char yytype_int8;
|
||||
#endif
|
||||
|
||||
#ifdef YYTYPE_UINT16
|
||||
typedef YYTYPE_UINT16 yytype_uint16;
|
||||
#else
|
||||
typedef unsigned short yytype_uint16;
|
||||
#endif
|
||||
|
||||
#ifdef YYTYPE_INT16
|
||||
typedef YYTYPE_INT16 yytype_int16;
|
||||
#else
|
||||
typedef short yytype_int16;
|
||||
#ifndef YYPTRDIFF_T
|
||||
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
|
||||
# define YYPTRDIFF_T __PTRDIFF_TYPE__
|
||||
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
|
||||
# elif defined PTRDIFF_MAX
|
||||
# ifndef ptrdiff_t
|
||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# endif
|
||||
# define YYPTRDIFF_T ptrdiff_t
|
||||
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
|
||||
# else
|
||||
# define YYPTRDIFF_T long
|
||||
# define YYPTRDIFF_MAXIMUM LONG_MAX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef YYSIZE_T
|
||||
@@ -415,7 +392,7 @@ typedef short yytype_int16;
|
||||
# define YYSIZE_T __SIZE_TYPE__
|
||||
# elif defined size_t
|
||||
# define YYSIZE_T size_t
|
||||
# elif ! defined YYSIZE_T
|
||||
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||
# define YYSIZE_T size_t
|
||||
# else
|
||||
@@ -423,7 +400,19 @@ typedef short yytype_int16;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
|
||||
#define YYSIZE_MAXIMUM \
|
||||
YY_CAST (YYPTRDIFF_T, \
|
||||
(YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
|
||||
? YYPTRDIFF_MAXIMUM \
|
||||
: YY_CAST (YYSIZE_T, -1)))
|
||||
|
||||
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
|
||||
|
||||
/* Stored state numbers (used for stacks). */
|
||||
typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ yy_state_t;
|
||||
|
||||
/* State numbers in computations. */
|
||||
typedef int yy_state_fast_t;
|
||||
|
||||
#ifndef YY_
|
||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||
@@ -526,22 +515,23 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
{
|
||||
yytype_int16 yyss_alloc;
|
||||
yy_state_t yyss_alloc;
|
||||
YYSTYPE yyvs_alloc;]b4_locations_if([
|
||||
YYLTYPE yyls_alloc;])[
|
||||
};
|
||||
|
||||
/* The size of the maximum gap between one aligned stack and the next. */
|
||||
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
|
||||
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
|
||||
|
||||
/* The size of an array large to enough to hold all stacks, each with
|
||||
N elements. */
|
||||
]b4_locations_if(
|
||||
[# define YYSTACK_BYTES(N) \
|
||||
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
|
||||
((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
|
||||
+ YYSIZEOF (YYLTYPE)) \
|
||||
+ 2 * YYSTACK_GAP_MAXIMUM)],
|
||||
[# define YYSTACK_BYTES(N) \
|
||||
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
|
||||
((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
|
||||
+ YYSTACK_GAP_MAXIMUM)])[
|
||||
|
||||
# define YYCOPY_NEEDED 1
|
||||
@@ -554,11 +544,11 @@ union yyalloc
|
||||
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
||||
do \
|
||||
{ \
|
||||
YYSIZE_T yynewbytes; \
|
||||
YYPTRDIFF_T yynewbytes; \
|
||||
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
||||
Stack = &yyptr->Stack_alloc; \
|
||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
||||
yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
||||
yyptr += yynewbytes / YYSIZEOF (*yyptr); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@@ -570,12 +560,12 @@ union yyalloc
|
||||
# ifndef YYCOPY
|
||||
# if defined __GNUC__ && 1 < __GNUC__
|
||||
# define YYCOPY(Dst, Src, Count) \
|
||||
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
|
||||
__builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
|
||||
# else
|
||||
# define YYCOPY(Dst, Src, Count) \
|
||||
do \
|
||||
{ \
|
||||
YYSIZE_T yyi; \
|
||||
YYPTRDIFF_T yyi; \
|
||||
for (yyi = 0; yyi < (Count); yyi++) \
|
||||
(Dst)[yyi] = (Src)[yyi]; \
|
||||
} \
|
||||
@@ -601,17 +591,20 @@ union yyalloc
|
||||
#define YYUNDEFTOK ]b4_undef_token_number[
|
||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||
|
||||
|
||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||
as returned by yylex, with out-of-bounds checking. */
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
]b4_api_token_raw_if(dnl
|
||||
[[#define YYTRANSLATE(YYX) (YYX)]],
|
||||
[[#define YYTRANSLATE(YYX) \
|
||||
(0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
|
||||
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
||||
as returned by yylex. */
|
||||
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
||||
{
|
||||
]b4_translate[
|
||||
};
|
||||
};]])[
|
||||
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
||||
@@ -636,15 +629,15 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
||||
};
|
||||
# endif
|
||||
|
||||
#define YYPACT_NINF ]b4_pact_ninf[
|
||||
#define YYPACT_NINF (]b4_pact_ninf[)
|
||||
|
||||
#define yypact_value_is_default(Yystate) \
|
||||
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
||||
#define yypact_value_is_default(Yyn) \
|
||||
]b4_table_value_equals([[pact]], [[Yyn]], [b4_pact_ninf], [YYPACT_NINF])[
|
||||
|
||||
#define YYTABLE_NINF ]b4_table_ninf[
|
||||
#define YYTABLE_NINF (]b4_table_ninf[)
|
||||
|
||||
#define yytable_value_is_error(Yytable_value) \
|
||||
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
||||
#define yytable_value_is_error(Yyn) \
|
||||
]b4_table_value_equals([[table]], [[Yyn]], [b4_table_ninf], [YYTABLE_NINF])[
|
||||
|
||||
]b4_parser_tables_define[
|
||||
|
||||
@@ -722,8 +715,8 @@ do { \
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
]b4_function_define([yy_stack_print], [static void],
|
||||
[[yytype_int16 *yybottom], [yybottom]],
|
||||
[[yytype_int16 *yytop], [yytop]])[
|
||||
[[yy_state_t *yybottom], [yybottom]],
|
||||
[[yy_state_t *yytop], [yytop]])[
|
||||
{
|
||||
YYFPRINTF (stderr, "Stack now");
|
||||
for (; yybottom <= yytop; yybottom++)
|
||||
@@ -746,23 +739,23 @@ do { \
|
||||
`------------------------------------------------*/
|
||||
|
||||
]b4_function_define([yy_reduce_print], [static void],
|
||||
[[yytype_int16 *yyssp], [yyssp]],
|
||||
[[yy_state_t *yyssp], [yyssp]],
|
||||
[[YYSTYPE *yyvsp], [yyvsp]],
|
||||
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
||||
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
||||
b4_parse_param]))[
|
||||
{
|
||||
unsigned long yylno = yyrline[yyrule];
|
||||
int yylno = yyrline[yyrule];
|
||||
int yynrhs = yyr2[yyrule];
|
||||
int yyi;
|
||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
|
||||
yyrule - 1, yylno);
|
||||
/* The symbols being reduced. */
|
||||
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||
{
|
||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
||||
yy_symbol_print (stderr,
|
||||
yystos[yyssp[yyi + 1 - yynrhs]],
|
||||
yystos[+yyssp[yyi + 1 - yynrhs]],
|
||||
&]b4_rhs_value(yynrhs, yyi + 1)[
|
||||
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
||||
b4_user_args[);
|
||||
@@ -814,22 +807,22 @@ int yydebug;
|
||||
using YYSTACK_FREE. Return 0 if successful or if no reallocation is
|
||||
required. Return 1 if memory is exhausted. */
|
||||
static int
|
||||
yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
||||
yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
char const *yydebug_prefix,
|
||||
char const *yydebug_suffix,
|
||||
#endif
|
||||
yytype_int16 **yybottom,
|
||||
yytype_int16 *yybottom_no_free,
|
||||
yytype_int16 **yytop, yytype_int16 *yytop_empty)
|
||||
yy_state_t **yybottom,
|
||||
yy_state_t *yybottom_no_free,
|
||||
yy_state_t **yytop, yy_state_t *yytop_empty)
|
||||
{
|
||||
YYSIZE_T yysize_old =
|
||||
(YYSIZE_T) (*yytop == yytop_empty ? 0 : *yytop - *yybottom + 1);
|
||||
YYSIZE_T yysize_new = yysize_old + yyadd;
|
||||
YYPTRDIFF_T yysize_old =
|
||||
*yytop == yytop_empty ? 0 : *yytop - *yybottom + 1;
|
||||
YYPTRDIFF_T yysize_new = yysize_old + yyadd;
|
||||
if (*yycapacity < yysize_new)
|
||||
{
|
||||
YYSIZE_T yyalloc = 2 * yysize_new;
|
||||
yytype_int16 *yybottom_new;
|
||||
YYPTRDIFF_T yyalloc = 2 * yysize_new;
|
||||
yy_state_t *yybottom_new;
|
||||
/* Use YYMAXDEPTH for maximum stack size given that the stack
|
||||
should never need to grow larger than the main state stack
|
||||
needs to grow without LAC. */
|
||||
@@ -842,7 +835,9 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
||||
if (YYMAXDEPTH < yyalloc)
|
||||
yyalloc = YYMAXDEPTH;
|
||||
yybottom_new =
|
||||
(yytype_int16*) YYSTACK_ALLOC (yyalloc * sizeof *yybottom_new);
|
||||
YY_CAST (yy_state_t *,
|
||||
YYSTACK_ALLOC (YY_CAST (YYSIZE_T,
|
||||
yyalloc * YYSIZEOF (*yybottom_new))));
|
||||
if (!yybottom_new)
|
||||
{
|
||||
YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix,
|
||||
@@ -859,8 +854,10 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
||||
*yybottom = yybottom_new;
|
||||
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
||||
[full], [[
|
||||
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
|
||||
(unsigned long) yyalloc, yydebug_suffix));]])[
|
||||
YY_IGNORE_USELESS_CAST_BEGIN
|
||||
YYDPRINTF ((stderr, "%srealloc to %ld%s", yydebug_prefix,
|
||||
YY_CAST (long, yyalloc), yydebug_suffix));
|
||||
YY_IGNORE_USELESS_CAST_END]])[
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -945,11 +942,11 @@ do { \
|
||||
contents of either array, alter *YYES and *YYES_CAPACITY, and free
|
||||
any old *YYES other than YYESA. */
|
||||
static int
|
||||
yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
YYSIZE_T *yyes_capacity, yytype_int16 *yyssp, int yytoken)
|
||||
yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
|
||||
YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, int yytoken)
|
||||
{
|
||||
yytype_int16 *yyes_prev = yyssp;
|
||||
yytype_int16 *yyesp = yyes_prev;
|
||||
yy_state_t *yyes_prev = yyssp;
|
||||
yy_state_t *yyesp = yyes_prev;
|
||||
YYDPRINTF ((stderr, "LAC: checking lookahead %s:", yytname[yytoken]));
|
||||
if (yytoken == YYUNDEFTOK)
|
||||
{
|
||||
@@ -958,12 +955,12 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
int yyrule = yypact[*yyesp];
|
||||
int yyrule = yypact[+*yyesp];
|
||||
if (yypact_value_is_default (yyrule)
|
||||
|| (yyrule += yytoken) < 0 || YYLAST < yyrule
|
||||
|| yycheck[yyrule] != yytoken)
|
||||
{
|
||||
yyrule = yydefact[*yyesp];
|
||||
yyrule = yydefact[+*yyesp];
|
||||
if (yyrule == 0)
|
||||
{
|
||||
YYDPRINTF ((stderr, " Err\n"));
|
||||
@@ -986,11 +983,11 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
yyrule = -yyrule;
|
||||
}
|
||||
{
|
||||
YYSIZE_T yylen = yyr2[yyrule];
|
||||
YYPTRDIFF_T yylen = yyr2[yyrule];
|
||||
YYDPRINTF ((stderr, " R%d", yyrule - 1));
|
||||
if (yyesp != yyes_prev)
|
||||
{
|
||||
YYSIZE_T yysize = (YYSIZE_T) (yyesp - *yyes + 1);
|
||||
YYPTRDIFF_T yysize = yyesp - *yyes + 1;
|
||||
if (yylen < yysize)
|
||||
{
|
||||
yyesp -= yylen;
|
||||
@@ -1006,19 +1003,20 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
yyesp = yyes_prev -= yylen;
|
||||
}
|
||||
{
|
||||
yytype_int16 yystate;
|
||||
yy_state_fast_t yystate;
|
||||
{
|
||||
const int yylhs = yyr1[yyrule] - YYNTOKENS;
|
||||
const int yyi = yypgoto[yylhs] + *yyesp;
|
||||
yystate = ((yytype_int16)
|
||||
(0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyesp
|
||||
? yytable[yyi]
|
||||
: yydefgoto[yylhs]));
|
||||
yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyesp
|
||||
? yytable[yyi]
|
||||
: yydefgoto[yylhs]);
|
||||
}
|
||||
if (yyesp == yyes_prev)
|
||||
{
|
||||
yyesp = *yyes;
|
||||
*yyesp = yystate;
|
||||
YY_IGNORE_USELESS_CAST_BEGIN
|
||||
*yyesp = YY_CAST (yy_state_t, yystate);
|
||||
YY_IGNORE_USELESS_CAST_END
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1031,9 +1029,11 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
YYDPRINTF ((stderr, "\n"));
|
||||
return 2;
|
||||
}
|
||||
*++yyesp = yystate;
|
||||
YY_IGNORE_USELESS_CAST_BEGIN
|
||||
*++yyesp = YY_CAST (yy_state_t, yystate);
|
||||
YY_IGNORE_USELESS_CAST_END
|
||||
}
|
||||
YYDPRINTF ((stderr, " G%d", (int) yystate));
|
||||
YYDPRINTF ((stderr, " G%d", yystate));
|
||||
}
|
||||
}
|
||||
}]])[
|
||||
@@ -1043,13 +1043,13 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
|
||||
# ifndef yystrlen
|
||||
# if defined __GLIBC__ && defined _STRING_H
|
||||
# define yystrlen strlen
|
||||
# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
|
||||
# else
|
||||
/* Return the length of YYSTR. */
|
||||
]b4_function_define([yystrlen], [static YYSIZE_T],
|
||||
]b4_function_define([yystrlen], [static YYPTRDIFF_T],
|
||||
[[const char *yystr], [yystr]])[
|
||||
{
|
||||
YYSIZE_T yylen;
|
||||
YYPTRDIFF_T yylen;
|
||||
for (yylen = 0; yystr[yylen]; yylen++)
|
||||
continue;
|
||||
return yylen;
|
||||
@@ -1085,12 +1085,12 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
||||
null, do not copy; instead, return the length of what the result
|
||||
would have been. */
|
||||
static YYSIZE_T
|
||||
static YYPTRDIFF_T
|
||||
yytnamerr (char *yyres, const char *yystr)
|
||||
{
|
||||
if (*yystr == '"')
|
||||
{
|
||||
YYSIZE_T yyn = 0;
|
||||
YYPTRDIFF_T yyn = 0;
|
||||
char const *yyp = yystr;
|
||||
|
||||
for (;;)
|
||||
@@ -1121,10 +1121,10 @@ yytnamerr (char *yyres, const char *yystr)
|
||||
do_not_strip_quotes: ;
|
||||
}
|
||||
|
||||
if (! yyres)
|
||||
if (yyres)
|
||||
return yystpcpy (yyres, yystr) - yyres;
|
||||
else
|
||||
return yystrlen (yystr);
|
||||
|
||||
return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
|
||||
}
|
||||
# endif
|
||||
|
||||
@@ -1139,20 +1139,20 @@ yytnamerr (char *yyres, const char *yystr)
|
||||
required number of bytes is too large to store]b4_lac_if([[ or if
|
||||
yy_lac returned 2]])[. */
|
||||
static int
|
||||
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
|
||||
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
||||
]b4_lac_if([[yy_state_t *yyesa, yy_state_t **yyes,
|
||||
YYPTRDIFF_T *yyes_capacity, ]])[yy_state_t *yyssp, int yytoken)
|
||||
{
|
||||
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||
YYSIZE_T yysize = yysize0;
|
||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||
/* Internationalized format string. */
|
||||
const char *yyformat = YY_NULLPTR;
|
||||
/* Arguments of yyformat. */
|
||||
/* Arguments of yyformat: reported tokens (one for the "unexpected",
|
||||
one per "expected"). */
|
||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||
/* Number of reported tokens (one for the "unexpected", one per
|
||||
"expected"). */
|
||||
/* Actual size of YYARG. */
|
||||
int yycount = 0;
|
||||
/* Cumulated lengths of YYARG. */
|
||||
YYPTRDIFF_T yysize = 0;
|
||||
|
||||
/* There are many possibilities here to consider:
|
||||
- If this state is a consistent state with a default action, then
|
||||
@@ -1184,19 +1184,14 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
*/
|
||||
if (yytoken != YYEMPTY)
|
||||
{
|
||||
int yyn = yypact[*yyssp];]b4_lac_if([[
|
||||
int yyn = yypact[+*yyssp];
|
||||
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||
yysize = yysize0;]b4_lac_if([[
|
||||
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
|
||||
yyarg[yycount++] = yytname[yytoken];
|
||||
if (!yypact_value_is_default (yyn))
|
||||
{]b4_lac_if([], [[
|
||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||
YYCHECK. In other words, skip the first -YYN actions for
|
||||
this state because they are default actions. */
|
||||
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 yyx;]b4_lac_if([[
|
||||
{]b4_lac_if([[
|
||||
int yyx;
|
||||
|
||||
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||
if (yyx != YYTERROR && yyx != YYUNDEFTOK)
|
||||
@@ -1209,6 +1204,14 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
if (yy_lac_status == 1)
|
||||
continue;
|
||||
}]], [[
|
||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||
YYCHECK. In other words, skip the first -YYN actions for
|
||||
this state because they are default actions. */
|
||||
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 yyx;
|
||||
|
||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
||||
@@ -1222,7 +1225,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
}
|
||||
yyarg[yycount++] = yytname[yyx];
|
||||
{
|
||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||
YYPTRDIFF_T yysize1
|
||||
= yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||
yysize = yysize1;
|
||||
else
|
||||
@@ -1253,7 +1257,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
}
|
||||
|
||||
{
|
||||
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
||||
/* Don't count the "%s"s in the final size, but reserve room for
|
||||
the terminator. */
|
||||
YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
|
||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||
yysize = yysize1;
|
||||
else
|
||||
@@ -1283,8 +1289,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
}
|
||||
else
|
||||
{
|
||||
yyp++;
|
||||
yyformat++;
|
||||
++yyp;
|
||||
++yyformat;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -1350,7 +1356,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
yypstate *yyps;]b4_pure_if([], [[
|
||||
if (yypstate_allocated)
|
||||
return YY_NULLPTR;]])[
|
||||
yyps = (yypstate *) malloc (sizeof *yyps);
|
||||
yyps = YY_CAST (yypstate *, malloc (sizeof *yyps));
|
||||
if (!yyps)
|
||||
return YY_NULLPTR;
|
||||
yyps->yynew = 1;]b4_pure_if([], [[
|
||||
@@ -1434,7 +1440,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
/* Buffer for error messages, and its allocated size. */
|
||||
char yymsgbuf[128];
|
||||
char *yymsg = yymsgbuf;
|
||||
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
|
||||
YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
|
||||
#endif
|
||||
|
||||
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[)
|
||||
@@ -1455,7 +1461,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
||||
|
||||
yyes = yyesa;
|
||||
yyes_capacity = sizeof yyesa / sizeof *yyes;
|
||||
yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
|
||||
if (YYMAXDEPTH < yyes_capacity)
|
||||
yyes_capacity = YYMAXDEPTH;]])[
|
||||
|
||||
@@ -1487,12 +1493,14 @@ yynewstate:
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------.
|
||||
| yynewstate -- set current state (the top of the stack) to yystate. |
|
||||
| yysetstate -- set current state (the top of the stack) to yystate. |
|
||||
`--------------------------------------------------------------------*/
|
||||
yysetstate:
|
||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
||||
*yyssp = (yytype_int16) yystate;
|
||||
YY_IGNORE_USELESS_CAST_BEGIN
|
||||
*yyssp = YY_CAST (yy_state_t, yystate);
|
||||
YY_IGNORE_USELESS_CAST_END
|
||||
|
||||
if (yyss + yystacksize - 1 <= yyssp)
|
||||
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
||||
@@ -1500,15 +1508,15 @@ yysetstate:
|
||||
#else
|
||||
{
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
|
||||
YYPTRDIFF_T yysize = yyssp - yyss + 1;
|
||||
|
||||
# if defined yyoverflow
|
||||
{
|
||||
/* Give user a chance to reallocate the stack. Use copies of
|
||||
these so that the &'s don't force the real ones into
|
||||
memory. */
|
||||
YYSTYPE *yyvs1 = yyvs;
|
||||
yytype_int16 *yyss1 = yyss;]b4_locations_if([
|
||||
yy_state_t *yyss1 = yyss;
|
||||
YYSTYPE *yyvs1 = yyvs;]b4_locations_if([
|
||||
YYLTYPE *yyls1 = yyls;])[
|
||||
|
||||
/* Each stack pointer address is followed by the size of the
|
||||
@@ -1516,9 +1524,9 @@ yysetstate:
|
||||
conditional around just the two extra args, but that might
|
||||
be undefined if yyoverflow is a macro. */
|
||||
yyoverflow (YY_("memory exhausted"),
|
||||
&yyss1, yysize * sizeof (*yyssp),
|
||||
&yyvs1, yysize * sizeof (*yyvsp),]b4_locations_if([
|
||||
&yyls1, yysize * sizeof (*yylsp),])[
|
||||
&yyss1, yysize * YYSIZEOF (*yyssp),
|
||||
&yyvs1, yysize * YYSIZEOF (*yyvsp),]b4_locations_if([
|
||||
&yyls1, yysize * YYSIZEOF (*yylsp),])[
|
||||
&yystacksize);
|
||||
yyss = yyss1;
|
||||
yyvs = yyvs1;]b4_locations_if([
|
||||
@@ -1533,9 +1541,10 @@ yysetstate:
|
||||
yystacksize = YYMAXDEPTH;
|
||||
|
||||
{
|
||||
yytype_int16 *yyss1 = yyss;
|
||||
yy_state_t *yyss1 = yyss;
|
||||
union yyalloc *yyptr =
|
||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||
YY_CAST (union yyalloc *,
|
||||
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
|
||||
if (! yyptr)
|
||||
goto yyexhaustedlab;
|
||||
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
||||
@@ -1551,8 +1560,10 @@ yysetstate:
|
||||
yyvsp = yyvs + yysize - 1;]b4_locations_if([
|
||||
yylsp = yyls + yysize - 1;])[
|
||||
|
||||
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
||||
(unsigned long) yystacksize));
|
||||
YY_IGNORE_USELESS_CAST_BEGIN
|
||||
YYDPRINTF ((stderr, "Stack size increased to %ld\n",
|
||||
YY_CAST (long, yystacksize)));
|
||||
YY_IGNORE_USELESS_CAST_END
|
||||
|
||||
if (yyss + yystacksize - 1 <= yyssp)
|
||||
YYABORT;
|
||||
@@ -1642,16 +1653,15 @@ yyread_pushed_token:]])[
|
||||
|
||||
/* Shift the lookahead token. */
|
||||
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
||||
|
||||
/* Discard the shifted token. */
|
||||
yychar = YYEMPTY;]b4_lac_if([[
|
||||
YY_LAC_DISCARD ("shift");]])[
|
||||
|
||||
yystate = yyn;
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||
*++yyvsp = yylval;
|
||||
YY_IGNORE_MAYBE_UNINITIALIZED_END]b4_locations_if([
|
||||
*++yylsp = yylloc;])[
|
||||
|
||||
/* Discard the shifted token. */
|
||||
yychar = YYEMPTY;]b4_lac_if([[
|
||||
YY_LAC_DISCARD ("shift");]])[
|
||||
goto yynewstate;
|
||||
|
||||
|
||||
@@ -1766,7 +1776,7 @@ yyerrlab:
|
||||
{
|
||||
if (yymsg != yymsgbuf)
|
||||
YYSTACK_FREE (yymsg);
|
||||
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
|
||||
yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
|
||||
if (!yymsg)
|
||||
{
|
||||
yymsg = yymsgbuf;
|
||||
@@ -1930,7 +1940,7 @@ yyreturn:
|
||||
while (yyssp != yyss)
|
||||
{
|
||||
yydestruct ("Cleanup: popping",
|
||||
yystos[*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
||||
yystos[+*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
||||
YYPOPSTACK (1);
|
||||
}
|
||||
#ifndef yyoverflow
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
bison.xsl - common templates for Bison XSLT.
|
||||
|
||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||
|
||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2text.xsl - transform Bison XML Report into plain text.
|
||||
|
||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||
|
||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
/bison.help
|
||||
/bison.html
|
||||
/bison.info
|
||||
/bison.info.bak
|
||||
/bison.log
|
||||
/bison.pdf
|
||||
/bison.ps
|
||||
@@ -31,3 +32,5 @@
|
||||
/version.texi
|
||||
/yacc.1
|
||||
/relocatable.texi
|
||||
/figs/*.eps
|
||||
/figs/*.svg
|
||||
|
||||
+738
-590
File diff suppressed because it is too large
Load Diff
+18
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2001-2003, 2005-2015, 2018-2019 Free Software
|
||||
## Copyright (C) 2001-2003, 2005-2015, 2018-2020 Free Software
|
||||
## Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
@@ -54,6 +54,23 @@ $(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
||||
$(AM_V_at)mv $@.tmp $@
|
||||
MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
|
||||
|
||||
|
||||
# Fix Info's @code in @deftype
|
||||
# https://lists.gnu.org/archive/html/help-texinfo/2019-11/msg00004.html
|
||||
all: $(srcdir)/$(doc_bison).info.bak
|
||||
$(srcdir)/$(doc_bison).info.bak: $(srcdir)/$(doc_bison).info
|
||||
$(AM_V_GEN) $(PERL) -pi.bak -0777 \
|
||||
-e 's{(^ --.*\n(?: {10}.*\n)*)}' \
|
||||
-e '{' \
|
||||
-e ' $$def = $$1;' \
|
||||
-e ' $$def =~ s/‘|’//g;' \
|
||||
-e ' $$def;' \
|
||||
-e '}gem;' $(srcdir)/$(doc_bison).info
|
||||
@ touch $@
|
||||
EXTRA_DIST += $(srcdir)/$(doc_bison).info.bak
|
||||
MAINTAINERCLEANFILES += $(srcdir)/$(doc_bison).info.bak
|
||||
|
||||
|
||||
## ---------- ##
|
||||
## Ref card. ##
|
||||
## ---------- ##
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
\def\finalout{\overfullrule=0pt}
|
||||
%\finalout
|
||||
|
||||
% Copyright (c) 1998, 2001, 2009-2015, 2018-2019 Free Software
|
||||
% Copyright (c) 1998, 2001, 2009--2015, 2018--2020 Free Software
|
||||
% Foundation, Inc.
|
||||
%
|
||||
% This file is part of Bison.
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
|
||||
|
||||
--
|
||||
|
||||
Copyright (C) 2006, 2009-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2009-2015, 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
# Copyright (C) 2006, 2008-2015, 2018-2019 Free Software Foundation,
|
||||
# Copyright (C) 2006, 2008-2015, 2018-2020 Free Software Foundation,
|
||||
# Inc.
|
||||
#
|
||||
# This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2006, 2008-2015, 2018-2019 Free Software Foundation,
|
||||
## Copyright (C) 2006, 2008-2015, 2018-2020 Free Software Foundation,
|
||||
## Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/simple.yy
|
||||
@@ -46,7 +46,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -36,7 +36,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018-2020 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2019 Free Software
|
||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2020 Free Software
|
||||
## Foundation, Inc.
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2018-2020 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2018-2020 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2015, 2018-2020 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
|
||||
@@ -117,7 +117,7 @@ namespace yy
|
||||
static int count = 0;
|
||||
const int stage = count;
|
||||
++count;
|
||||
auto loc = parser::location_type{nullptr, unsigned (stage + 1), unsigned (stage + 1)};
|
||||
auto loc = parser::location_type{nullptr, stage + 1, stage + 1};
|
||||
if (stage == 0)
|
||||
return parser::make_TEXT (make_string_uptr ("I have numbers for you."), std::move (loc));
|
||||
else if (stage < max)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2018-2020 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2015, 2018-2020 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
|
||||
@@ -117,7 +117,7 @@ namespace yy
|
||||
static int count = 0;
|
||||
const int stage = count;
|
||||
++count;
|
||||
parser::location_type loc (NULLPTR, unsigned (stage + 1), unsigned (stage + 1));
|
||||
parser::location_type loc (NULLPTR, stage + 1, stage + 1);
|
||||
switch (stage)
|
||||
{
|
||||
case 0:
|
||||
|
||||
@@ -45,7 +45,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -9,7 +9,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2019-2020 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2019-2020 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
|
||||
|
||||
@@ -9,7 +9,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2018-2020 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2018-2020 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
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
lexcalcdir = $(docdir)/%D%
|
||||
|
||||
## ------ ##
|
||||
## Calc. ##
|
||||
## ------ ##
|
||||
## --------- ##
|
||||
## LexCalc. ##
|
||||
## --------- ##
|
||||
|
||||
if FLEX_WORKS
|
||||
check_PROGRAMS += %D%/lexcalc
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
%option nodefault noinput nounput noyywrap
|
||||
|
||||
%{
|
||||
#include <errno.h> /* errno, ERANGE */
|
||||
#include <limits.h> /* INT_MIN */
|
||||
#include <stdlib.h> /* strtol */
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2018-2020 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2019 Free Software
|
||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2020 Free Software
|
||||
## Foundation, Inc.
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018-2020 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
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
/scan.c
|
||||
/scan.h
|
||||
@@ -26,7 +26,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2019-2020 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
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
reccalcdir = $(docdir)/%D%
|
||||
|
||||
## ------ ##
|
||||
## Calc. ##
|
||||
## ------ ##
|
||||
## --------- ##
|
||||
## RecCalc. ##
|
||||
## --------- ##
|
||||
|
||||
if FLEX_WORKS
|
||||
check_PROGRAMS += %D%/reccalc
|
||||
@@ -36,16 +36,40 @@ endif FLEX_WORKS
|
||||
# additional dependency.
|
||||
DASH = -
|
||||
%D%/reccalc$(DASH)parse.o: %D%/scan.h
|
||||
# Tell Make scan.o depends on parse.h, except that Make sees only
|
||||
# parse.c, not parse.h. We can't use BUILT_SOURCES to this end, since
|
||||
# we use the built bison.
|
||||
%D%/reccalc$(DASH)scan.o: %D%/parse.c
|
||||
|
||||
# Likewise, but for Automake before 1.16.
|
||||
%D%/examples_c_reccalc_reccalc$(DASH)parse.o: %D%/scan.h
|
||||
%D%/examples_c_reccalc_reccalc$(DASH)scan.o: %D%/parse.c
|
||||
|
||||
## See "info automake 'Multiple Outputs'" for this rule.
|
||||
%D%/scan.c %D%/scan.h: %D%/scan.stamp
|
||||
@test -f $@ || rm -f %D%/scan.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/scan.stamp
|
||||
## Recover from the removal of $@
|
||||
@if test -f $@; then :; else \
|
||||
trap 'rm -rf %D%/scan.lock %D%/scan.stamp' 1 2 13 15; \
|
||||
## mkdir is a portable test-and-set
|
||||
if mkdir %D%/scan.lock 2>/dev/null; then \
|
||||
## This code is being executed by the first process.
|
||||
rm -f %D%/scan.stamp; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) %D%/scan.stamp; \
|
||||
result=$$?; rm -rf %D%/scan.lock; exit $$result; \
|
||||
else \
|
||||
## This code is being executed by the follower processes.
|
||||
## Wait until the first process is done.
|
||||
while test -d %D%/scan.lock; do sleep 1; done; \
|
||||
## Succeed if and only if the first process succeeded.
|
||||
test -f %D%/scan.stamp; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
%D%/scan.stamp: %D%/scan.l
|
||||
$(AM_V_LEX)rm -f $@ $@.tmp
|
||||
$(AM_V_at)$(MKDIR_P) %D%
|
||||
$(AM_V_at)touch $@.tmp
|
||||
$(AM_V_at)$(LEX) -o%D%/scan.c --header-file=%D%/scan.h $(srcdir)/%D%/scan.l
|
||||
$(AM_V_at)$(LEX) $(AM_LFLAGS) $(LFLAGS) -o%D%/scan.c --header-file=%D%/scan.h $(srcdir)/%D%/scan.l
|
||||
$(AM_V_at)mv $@.tmp $@
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2018-2020 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
|
||||
@@ -15,6 +15,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
seq 0 >/dev/null || exit 77
|
||||
|
||||
cat >input <<EOF
|
||||
1+2*3
|
||||
EOF
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2019 Free Software
|
||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2020 Free Software
|
||||
## Foundation, Inc.
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018-2020 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
|
||||
|
||||
@@ -15,7 +15,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2018-2020 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
|
||||
|
||||
+1
-8
@@ -3,11 +3,6 @@
|
||||
%define api.parser.class {Calc}
|
||||
%define parse.error verbose
|
||||
|
||||
%code imports {
|
||||
import std.ascii;
|
||||
import std.stdio;
|
||||
}
|
||||
|
||||
%union {
|
||||
int ival;
|
||||
}
|
||||
@@ -102,16 +97,14 @@ class CalcLexer(R) : Lexer
|
||||
|
||||
// Skip initial spaces
|
||||
while (!input.empty && input.front != '\n' && isWhite (input.front))
|
||||
{
|
||||
input.popFront;
|
||||
}
|
||||
|
||||
// Handle EOF.
|
||||
if (input.empty)
|
||||
return YYTokenType.EOF;
|
||||
|
||||
// Numbers.
|
||||
if (input.front == '.' || input.front.isNumber)
|
||||
if (input.front.isNumber)
|
||||
{
|
||||
import std.conv : parse;
|
||||
semanticVal_.ival = input.parse!int;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2018-2020 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
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
# This file is part of GNU Bison
|
||||
|
||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018-2019 Free
|
||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018-2020 Free
|
||||
# Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2018-2020 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
|
||||
|
||||
@@ -78,9 +78,9 @@ class CalcLexer implements Calc.Lexer {
|
||||
st = new StreamTokenizer (new InputStreamReader (is));
|
||||
st.resetSyntax ();
|
||||
st.eolIsSignificant (true);
|
||||
st.whitespaceChars (9, 9);
|
||||
st.whitespaceChars (32, 32);
|
||||
st.wordChars (48, 57);
|
||||
st.whitespaceChars ('\t', '\t');
|
||||
st.whitespaceChars (' ', ' ');
|
||||
st.wordChars ('0', '9');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
||||
## Copyright (C) 2018-2020 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
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2005, 2008-2015, 2018-2019 Free Software Foundation,
|
||||
## Copyright (C) 2005, 2008-2015, 2018-2020 Free Software Foundation,
|
||||
## Inc.
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
@@ -33,7 +33,7 @@
|
||||
## which guarantees that parse.y is indeed shipped.
|
||||
|
||||
dist_noinst_SCRIPTS = %D%/extexi %D%/test
|
||||
TEST_LOG_COMPILER = $(top_srcdir)/%D%/test
|
||||
TEST_LOG_COMPILER = $(SHELL) $(top_srcdir)/%D%/test
|
||||
|
||||
AM_CXXFLAGS = \
|
||||
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2005-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005-2015, 2018-2020 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
|
||||
|
||||
+1
-1
Submodule gnulib updated: d654989d8b...f5eb8cea72
@@ -1,9 +1,12 @@
|
||||
/*.gmo
|
||||
/*.po
|
||||
/LINGUAS
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/Makefile.in.in
|
||||
/Makevars
|
||||
/Makevars.template
|
||||
/POTFILES
|
||||
/POTFILES.in
|
||||
/Rules-quot
|
||||
/bison-gnulib.pot
|
||||
@@ -12,4 +15,6 @@
|
||||
/[email protected]
|
||||
/insert-header.sin
|
||||
/quot.sed
|
||||
/remove-potcdate.sed
|
||||
/remove-potcdate.sin
|
||||
/stamp-po
|
||||
|
||||
+42
-6
@@ -16,6 +16,8 @@
|
||||
/argmatch.c
|
||||
/argmatch.h
|
||||
/asnprintf.c
|
||||
/asprintf.c
|
||||
/assure.h
|
||||
/basename-lgpl.c
|
||||
/basename.c
|
||||
/binary-io.c
|
||||
@@ -38,6 +40,7 @@
|
||||
/canonicalize-lgpl.c
|
||||
/careadlinkat.c
|
||||
/careadlinkat.h
|
||||
/cdefs.h
|
||||
/charset.alias
|
||||
/cloexec.c
|
||||
/cloexec.h
|
||||
@@ -51,6 +54,7 @@
|
||||
/config.h
|
||||
/config.in.h
|
||||
/configmake.h
|
||||
/diffseq.h
|
||||
/dirname-lgpl.c
|
||||
/dirname.c
|
||||
/dirname.h
|
||||
@@ -89,9 +93,13 @@
|
||||
/fseterr.c
|
||||
/fseterr.h
|
||||
/fstat.c
|
||||
/fstrcmp.c
|
||||
/fstrcmp.h
|
||||
/fsync.c
|
||||
/getdtablesize.c
|
||||
/gethrxtime.c
|
||||
/gethrxtime.h
|
||||
/getopt-cdefs.h
|
||||
/getopt-cdefs.in.h
|
||||
/getopt-core.h
|
||||
/getopt-ext.h
|
||||
@@ -129,12 +137,17 @@
|
||||
/isnanf.c
|
||||
/isnanl-nolibm.h
|
||||
/isnanl.c
|
||||
/iswblank.c
|
||||
/itold.c
|
||||
/lc-charset-dispatch.c
|
||||
/lc-charset-dispatch.h
|
||||
/ldexpl.c
|
||||
/libc-config.h
|
||||
/limits.h
|
||||
/limits.in.h
|
||||
/localcharset.c
|
||||
/localcharset.h
|
||||
/locale.in.h
|
||||
/localtime-buffer.c
|
||||
/localtime-buffer.h
|
||||
/lstat.c
|
||||
@@ -144,10 +157,18 @@
|
||||
/math.c
|
||||
/math.h
|
||||
/math.in.h
|
||||
/mbchar.c
|
||||
/mbchar.h
|
||||
/mbfile.c
|
||||
/mbfile.h
|
||||
/mbrtowc-impl-utf8.h
|
||||
/mbrtowc-impl.h
|
||||
/mbrtowc.c
|
||||
/mbsinit.c
|
||||
/mbswidth.c
|
||||
/mbswidth.h
|
||||
/mbtowc-lock.c
|
||||
/mbtowc-lock.h
|
||||
/memchr.c
|
||||
/memchr.valgrind
|
||||
/minmax.h
|
||||
@@ -189,9 +210,15 @@
|
||||
/relocatable.c
|
||||
/relocatable.h
|
||||
/relocwrapper.c
|
||||
/rename.c
|
||||
/rmdir.c
|
||||
/same-inode.h
|
||||
/sched.h
|
||||
/sched.in.h
|
||||
/setenv.c
|
||||
/setlocale-lock.c
|
||||
/setlocale_null.c
|
||||
/setlocale_null.h
|
||||
/sig-handler.c
|
||||
/sig-handler.h
|
||||
/sigaction.c
|
||||
@@ -264,6 +291,8 @@
|
||||
/sys_types.in.h
|
||||
/sys_wait.in.h
|
||||
/sysexits.in.h
|
||||
/textstyle.h
|
||||
/textstyle.in.h
|
||||
/time.h
|
||||
/time.in.h
|
||||
/timespec.c
|
||||
@@ -285,6 +314,7 @@
|
||||
/unsetenv.c
|
||||
/vasnprintf.c
|
||||
/vasnprintf.h
|
||||
/vasprintf.c
|
||||
/verify.h
|
||||
/vfprintf.c
|
||||
/vsnprintf.c
|
||||
@@ -300,10 +330,22 @@
|
||||
/wctype.h
|
||||
/wctype.in.h
|
||||
/wcwidth.c
|
||||
/windows-initguard.h
|
||||
/windows-mutex.c
|
||||
/windows-mutex.h
|
||||
/windows-once.c
|
||||
/windows-once.h
|
||||
/windows-recmutex.c
|
||||
/windows-recmutex.h
|
||||
/windows-rwlock.c
|
||||
/windows-rwlock.h
|
||||
/windows-tls.c
|
||||
/windows-tls.h
|
||||
/xalloc-die.c
|
||||
/xalloc-oversized.h
|
||||
/xalloc.h
|
||||
/xconcat-filename.c
|
||||
/xhash.c
|
||||
/xmalloc.c
|
||||
/xmemdup0.c
|
||||
/xmemdup0.h
|
||||
@@ -315,9 +357,3 @@
|
||||
/xstrndup.h
|
||||
/xtime.c
|
||||
/xtime.h
|
||||
/rename.c
|
||||
/rmdir.c
|
||||
/same-inode.h
|
||||
/assure.h
|
||||
/fsync.c
|
||||
/textstyle.in.h
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user