mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-18 15:14:27 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcf845a716 | ||
|
|
3158164614 |
+1
-10
@@ -1,16 +1,7 @@
|
|||||||
*.eps
|
|
||||||
*.log
|
|
||||||
*.o
|
|
||||||
*.pdf
|
|
||||||
*.png
|
|
||||||
*.stamp
|
|
||||||
*.trs
|
|
||||||
*~
|
|
||||||
.deps
|
|
||||||
.dirstamp
|
|
||||||
/*.cache
|
/*.cache
|
||||||
/*.flc
|
/*.flc
|
||||||
/*.prj
|
/*.prj
|
||||||
|
/*~
|
||||||
/.tarball-version
|
/.tarball-version
|
||||||
/.version
|
/.version
|
||||||
/ABOUT-NLS
|
/ABOUT-NLS
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
3.1
|
2.7
|
||||||
|
|||||||
-293
@@ -1,293 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
# ICC serial number.
|
|
||||||
secure: ED3w6rzxuE6tVu3oyxha2MoGMRzRQCtinvr9uor1gw9TGKB80esTLx4KyX0xHemUdyQVarFDDQfVS5rf7jSDY8XiWIR6O+2Af9/30gb+8eyngyvACu7E28n+1XHmYWIEHsbvB9mic6C60FBj5sPcDnFWZeyttGL0WooSjYHiw1Egafwqbeu1mD3Aet9OI9VaLQvy0KcWAdVrYWSI9UWLvLM+xPVUjPFko4oS+dTlETzVnmn6JFbZX1OKONtfcvdoDRFBzs3iHm5dQUt/Fz+y/DtKSuvF3zvePHSgF6c8URbEPPjBdh87gkovSLyy+83fVeh4WMkF8b+dGZmikQv6kRsjKJdbQrS8tiMhZlORC5Gfmn4HXNgmapL+paUweakH7UZQHm6d5SZoBgCHNazfqMrywbZsZkGvZTDQIVG1Be7Lhh2BDFbPhPZNDvI9XYiqZP0QSb0BVfeO+AUSRcUPM7TvarxB74jYdfpTBu7sqJP6dSwhcDTEUhHmuLGjzsNm3uTZe8SUw/TGGx5uPTXNsCjJq6ClIOAIYXZTXLbBmIL/NBWCy0MUpD+9zsiknU7vzzq1RfgCCExhvYgosTjBLcX1kKI+eRSU5M44e+xCg4xx0m9WfafbKbhA20FfnWxCFIkZeVpkOOsexJ9zfe0SflVLxkd7vmci5SCBixLVbN0=
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
## ----- ##
|
|
||||||
## GCC. ##
|
|
||||||
## ----- ##
|
|
||||||
#- name: "GCC 8 with sanitizers"
|
|
||||||
# os: linux
|
|
||||||
# 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'
|
|
||||||
# - MATRIX_EVAL="CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer' CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'"
|
|
||||||
|
|
||||||
- name: "GCC 7 -O3"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-7
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'"
|
|
||||||
|
|
||||||
- name: "GCC 6"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-6
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
|
||||||
|
|
||||||
- name: "GCC 5"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-5
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
|
||||||
|
|
||||||
- name: "GCC 4.9"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.9
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
|
|
||||||
|
|
||||||
- name: "GCC 4.8"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.8
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
|
|
||||||
|
|
||||||
- name: "GCC 4.7"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.7
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-4.7 && CXX=g++-4.7"
|
|
||||||
|
|
||||||
- name: "GCC 4.6"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.6
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-4.6 && CXX=g++-4.6"
|
|
||||||
|
|
||||||
## ------- ##
|
|
||||||
## Clang. ##
|
|
||||||
## ------- ##
|
|
||||||
|
|
||||||
- name: "Clang 7 libc++ and ASAN"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-trusty-7
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- clang-7
|
|
||||||
- libc++-7-dev
|
|
||||||
- libc++abi-7-dev
|
|
||||||
env:
|
|
||||||
# Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
|
|
||||||
- MATRIX_EVAL="CC='clang-7 -fsanitize=address' CXX='clang++-7 -fsanitize=address -stdlib=libc++'"
|
|
||||||
|
|
||||||
- name: "Clang 6 -O3 and libc++"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-trusty-6.0
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- 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'
|
|
||||||
|
|
||||||
- name: "Clang 5"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-trusty-5.0
|
|
||||||
packages:
|
|
||||||
- clang-5.0
|
|
||||||
- libc++-dev
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC='clang-5.0' CXX='clang++-5.0'"
|
|
||||||
|
|
||||||
- name: "Clang 4"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-trusty-4.0
|
|
||||||
packages:
|
|
||||||
- clang-4.0
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
|
|
||||||
|
|
||||||
- name: "Clang 3.9"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-trusty-3.9
|
|
||||||
packages:
|
|
||||||
- clang-3.9
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
|
|
||||||
|
|
||||||
- name: "Clang 3.8"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.8
|
|
||||||
packages:
|
|
||||||
- clang-3.8
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
|
|
||||||
|
|
||||||
- name: "CLang 3.7"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.7
|
|
||||||
packages:
|
|
||||||
- clang-3.7
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-3.7 && CXX=clang++-3.7"
|
|
||||||
|
|
||||||
- name: "Clang 3.6"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.6
|
|
||||||
packages:
|
|
||||||
- clang-3.6
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6"
|
|
||||||
|
|
||||||
- name: "Clang 3.5"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.5
|
|
||||||
packages:
|
|
||||||
- clang-3.5
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-3.5 && CXX=clang++-3.5"
|
|
||||||
|
|
||||||
- name: "Clang 3.4"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.4
|
|
||||||
env:
|
|
||||||
# No versioned name installed, but beware that Travis installs
|
|
||||||
# a more modern clang earlier in the default PATH.
|
|
||||||
- MATRIX_EVAL='CC=/usr/bin/clang && CXX=/usr/bin/clang++'
|
|
||||||
|
|
||||||
- name: "Clang 3.3"
|
|
||||||
os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.3
|
|
||||||
env:
|
|
||||||
# See comment for 3.4.
|
|
||||||
- MATRIX_EVAL='CC=/usr/bin/clang && CXX=/usr/bin/clang++'
|
|
||||||
|
|
||||||
## ----- ##
|
|
||||||
## ICC. ##
|
|
||||||
## ----- ##
|
|
||||||
- name: "ICC"
|
|
||||||
os: linux
|
|
||||||
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='
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- eval "$MATRIX_EVAL"
|
|
||||||
- env
|
|
||||||
- sudo apt-get update -qq
|
|
||||||
- sudo apt-get install -qq autoconf automake autopoint doxygen flex gettext graphviz help2man m4 texinfo
|
|
||||||
- if [[ $CC == "icc" ]]; then build-aux/install-icc.sh; fi
|
|
||||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
|
||||||
- autoconf --version
|
|
||||||
- automake --version
|
|
||||||
- autopoint --version
|
|
||||||
- $CC --version
|
|
||||||
- $CXX --version
|
|
||||||
- doxygen --version
|
|
||||||
- flex --version
|
|
||||||
- gettext --version
|
|
||||||
- dot -V
|
|
||||||
- help2man --version
|
|
||||||
- m4 --version
|
|
||||||
- makeinfo --version
|
|
||||||
|
|
||||||
script:
|
|
||||||
- git show
|
|
||||||
- git tag -l
|
|
||||||
# For some reasons, sometimes the checkout does not have any tags,
|
|
||||||
# so `git describe` fails, so bootstrap fails.
|
|
||||||
- git describe || git tag v3.0 -m "Fake version 3.0."
|
|
||||||
- git describe
|
|
||||||
- ./bootstrap
|
|
||||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
|
||||||
- ./configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
|
|
||||||
- make -j2 $MAKE_ARGS
|
|
||||||
- make check VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
|
|
||||||
- make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
|
|
||||||
- make maintainer-check-g++ VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }
|
|
||||||
|
|
||||||
after_script:
|
|
||||||
- if [[ $CC == "icc" ]]; then uninstall_intel_software; fi
|
|
||||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1998-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 1998-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+45
-45
@@ -3671,12 +3671,12 @@
|
|||||||
2009-02-25 Akim Demaille <[email protected]>
|
2009-02-25 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
Copyright years.
|
Copyright years.
|
||||||
* data/glr.c: Add 2007 and 2008 here, consistently with the comments.
|
* data/glr.c: Add 2007 and 2008 here, consistenly with the comments.
|
||||||
|
|
||||||
2009-02-25 Akim Demaille <[email protected]>
|
2009-02-25 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
Style changes.
|
Style changes.
|
||||||
* etc/bench.pl.in (generate_grammar_list): Consistently use
|
* etc/bench.pl.in (generate_grammar_list): Consitently use
|
||||||
location_type, not yy::location.
|
location_type, not yy::location.
|
||||||
|
|
||||||
2009-02-25 Akim Demaille <[email protected]>
|
2009-02-25 Akim Demaille <[email protected]>
|
||||||
@@ -3702,7 +3702,7 @@
|
|||||||
Remove trailing blanks.
|
Remove trailing blanks.
|
||||||
The epilogue has its own ending \n, no need to add another.
|
The epilogue has its own ending \n, no need to add another.
|
||||||
|
|
||||||
* data/glr.c, data/lalr1.java, data/yacc.c: dnl when outputting the
|
* data/glr.c, data/lalr1.java, data/yacc.c: dnl when outputing the
|
||||||
epilogue.
|
epilogue.
|
||||||
* data/glr.cc: dnl when extending the epilogue.
|
* data/glr.cc: dnl when extending the epilogue.
|
||||||
Remove stray "private:".
|
Remove stray "private:".
|
||||||
@@ -3764,7 +3764,7 @@
|
|||||||
2008-12-11 Akim Demaille <[email protected]>
|
2008-12-11 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
Pass the token type to yysyntax_error.
|
Pass the token type to yysyntax_error.
|
||||||
* data/yacc.c (yysyntax_error): Take the translated token instead
|
* data/yacc.c (yysyntax_error): Take the transated token instead
|
||||||
of the raw number.
|
of the raw number.
|
||||||
Adjust callers.
|
Adjust callers.
|
||||||
* TODO: Update.
|
* TODO: Update.
|
||||||
@@ -5019,7 +5019,7 @@
|
|||||||
|
|
||||||
Now instead of monolithic tables, we define one macro per cell. For
|
Now instead of monolithic tables, we define one macro per cell. For
|
||||||
instance "b4_symbol(0, tag)" is a macro name which contents is
|
instance "b4_symbol(0, tag)" is a macro name which contents is
|
||||||
self-descriptive. The macro "b4_symbol" provides easier access to
|
self-decriptive. The macro "b4_symbol" provides easier access to
|
||||||
these cells.
|
these cells.
|
||||||
|
|
||||||
* src/output.c (type_names_output): Remove.
|
* src/output.c (type_names_output): Remove.
|
||||||
@@ -5200,7 +5200,7 @@
|
|||||||
|
|
||||||
2008-11-09 Akim Demaille <[email protected]>
|
2008-11-09 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
Aggregate yylval and yylloc.
|
Agregate yylval and yylloc.
|
||||||
* data/lalr1.cc (parser::yylval, parser::yylloc): Replace by...
|
* data/lalr1.cc (parser::yylval, parser::yylloc): Replace by...
|
||||||
(parser::yyla): this.
|
(parser::yyla): this.
|
||||||
|
|
||||||
@@ -5815,7 +5815,7 @@
|
|||||||
of members. Document that token names are added as fields.
|
of members. Document that token names are added as fields.
|
||||||
Document constructors accurately. Remove error method.
|
Document constructors accurately. Remove error method.
|
||||||
(Java Scanner Interface): Move note on %pure-parser to Java Bison
|
(Java Scanner Interface): Move note on %pure-parser to Java Bison
|
||||||
Interface. Describe %code lexer and yylex accurately.
|
Interface. Describe %code lexer and yylex accutately.
|
||||||
Remove documentation that does not match the code.
|
Remove documentation that does not match the code.
|
||||||
(Java Action Features): New.
|
(Java Action Features): New.
|
||||||
(Java Differences): Add reference. Add item on semantic values.
|
(Java Differences): Add reference. Add item on semantic values.
|
||||||
@@ -6432,7 +6432,7 @@
|
|||||||
* djgpp/config.site: Copyright timestamp adjusted.
|
* djgpp/config.site: Copyright timestamp adjusted.
|
||||||
* djgpp/config_h.sed: Copyright timestamp adjusted.
|
* djgpp/config_h.sed: Copyright timestamp adjusted.
|
||||||
* djgpp/djunpack.bat: Copyright timestamp adjusted.
|
* djgpp/djunpack.bat: Copyright timestamp adjusted.
|
||||||
* djgpp/fnchange.lst: Add filenames that are not 8.3 clean to the
|
* djgpp/fnchnage.lst: Add filenames that are not 8.3 clean to the
|
||||||
filename translation list.
|
filename translation list.
|
||||||
* djgpp/subpipe.c (init_subpipe): Check the environment variables
|
* djgpp/subpipe.c (init_subpipe): Check the environment variables
|
||||||
TMPDIR, TMP and TEMP, in that order, to determinate where the temp
|
TMPDIR, TMP and TEMP, in that order, to determinate where the temp
|
||||||
@@ -7588,7 +7588,7 @@
|
|||||||
2007-03-07 Juan Manuel Guerrero <[email protected]>
|
2007-03-07 Juan Manuel Guerrero <[email protected]>
|
||||||
|
|
||||||
DJGPP spefic issue. Inhibit the use of disallowed characters for
|
DJGPP spefic issue. Inhibit the use of disallowed characters for
|
||||||
file name generation on Win98, WinXP, etc. These are |<>":?*\
|
file name genertion on Win98, WinXP, etc. These are |<>":?*\
|
||||||
and concern testsuite case 46.
|
and concern testsuite case 46.
|
||||||
* Makefile.am: djgpp/testsuite.sed added to EXTRA_DIST
|
* Makefile.am: djgpp/testsuite.sed added to EXTRA_DIST
|
||||||
* djgpp/testsuite.sed: Inhibit the use of disallowed characters.
|
* djgpp/testsuite.sed: Inhibit the use of disallowed characters.
|
||||||
@@ -8796,7 +8796,7 @@
|
|||||||
2006-12-13 Paul Eggert <[email protected]>
|
2006-12-13 Paul Eggert <[email protected]>
|
||||||
|
|
||||||
* TODO: Add pointer to Sylvain Schmitz's work on static detection
|
* TODO: Add pointer to Sylvain Schmitz's work on static detection
|
||||||
of potential ambiguities in GLR grammars.
|
of potential ambiguities in GLR grammers.
|
||||||
|
|
||||||
2006-12-12 Joel E. Denny <[email protected]>
|
2006-12-12 Joel E. Denny <[email protected]>
|
||||||
|
|
||||||
@@ -9059,7 +9059,7 @@
|
|||||||
* src/scan-gram.l (<SC_BRACED_CODE>): Use val->code for BRACED_CODE,
|
* src/scan-gram.l (<SC_BRACED_CODE>): Use val->code for BRACED_CODE,
|
||||||
which is "{...}" in the parser.
|
which is "{...}" in the parser.
|
||||||
* tests/Makefile.am (maintainer-check-valgrind): Set
|
* tests/Makefile.am (maintainer-check-valgrind): Set
|
||||||
VALGRIND_OPTS='--leak-check=full --show-reachable=yes' before invoking
|
VALGRIND_OPTS='--leak-check=full --show-reacheable=yes' before invoking
|
||||||
Valgrind.
|
Valgrind.
|
||||||
* tests/calc.at (_AT_DATA_CALC_Y): fclose the FILE* so Valgrind doesn't
|
* tests/calc.at (_AT_DATA_CALC_Y): fclose the FILE* so Valgrind doesn't
|
||||||
complain.
|
complain.
|
||||||
@@ -12349,7 +12349,7 @@
|
|||||||
* data/lalr1.cc: here.
|
* data/lalr1.cc: here.
|
||||||
(location.hh): Include it after the user prologue, in case the
|
(location.hh): Include it after the user prologue, in case the
|
||||||
filename type is defined by the user.
|
filename type is defined by the user.
|
||||||
Forward declaration location and position before the pre-prologue.
|
Forward declation location and position before the pre-prologue.
|
||||||
(yyresult_): Rename as...
|
(yyresult_): Rename as...
|
||||||
(yyresult): this, it's a local variable, not an attribute.
|
(yyresult): this, it's a local variable, not an attribute.
|
||||||
* data/Makefile.am (dist_pkgdata_DATA): Adjust.
|
* data/Makefile.am (dist_pkgdata_DATA): Adjust.
|
||||||
@@ -12439,8 +12439,8 @@
|
|||||||
(Table of Symbols): Under YYSTACK_USE_ALLOCA, Don't claim that the
|
(Table of Symbols): Under YYSTACK_USE_ALLOCA, Don't claim that the
|
||||||
user must declare alloca.
|
user must declare alloca.
|
||||||
|
|
||||||
* HACKING (release): Forewarn the Translation Project about
|
* HACKING (release): Forwarn the Translation Project about
|
||||||
stable releases.
|
stable releses.
|
||||||
|
|
||||||
2005-09-20 Akim Demaille <[email protected]>
|
2005-09-20 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
@@ -13165,7 +13165,7 @@
|
|||||||
not GNU M4, and that it works with any POSIX-compatible Awk.
|
not GNU M4, and that it works with any POSIX-compatible Awk.
|
||||||
* examples/calc++/Makefile.am (run_extexi): Remove; not used.
|
* examples/calc++/Makefile.am (run_extexi): Remove; not used.
|
||||||
($(calc_extracted)): Renamed from $(calc_sources_extracted),
|
($(calc_extracted)): Renamed from $(calc_sources_extracted),
|
||||||
so that we also get calc++-parser.yy. Generate it.
|
so that we also get calc++-parser.yy. Geneate it.
|
||||||
Use $(AWK), not gawk, since any conforming Awk will do.
|
Use $(AWK), not gawk, since any conforming Awk will do.
|
||||||
Put comment before action, since older 'make' can't handle comment
|
Put comment before action, since older 'make' can't handle comment
|
||||||
in action.
|
in action.
|
||||||
@@ -13993,7 +13993,7 @@
|
|||||||
* src/LR0.c (allocate_itemsets): Use xnmalloc, not xcalloc,
|
* src/LR0.c (allocate_itemsets): Use xnmalloc, not xcalloc,
|
||||||
to allocate kernel_base, kernel_items, kernel_size, since
|
to allocate kernel_base, kernel_items, kernel_size, since
|
||||||
they needn't be initialized to 0.
|
they needn't be initialized to 0.
|
||||||
(allocate_storage): Likewise, for shiftset, redset, shift_symbol.
|
(allocate_storgae): Likewise, for shiftset, redset, shift_symbol.
|
||||||
* src/closure.c (new_closure): Likewise, for itemset.
|
* src/closure.c (new_closure): Likewise, for itemset.
|
||||||
* src/derives.c (derives_compute): Likewise, for delts, derives, q.
|
* src/derives.c (derives_compute): Likewise, for delts, derives, q.
|
||||||
* src/lalr.c (set_goto_map): Likewise, for temp_map.
|
* src/lalr.c (set_goto_map): Likewise, for temp_map.
|
||||||
@@ -14181,7 +14181,7 @@
|
|||||||
2004-10-05 Akim Demaille <[email protected]>
|
2004-10-05 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
In Bison 1.875's yacc.c, YYLLOC_DEFAULT was called regardless
|
In Bison 1.875's yacc.c, YYLLOC_DEFAULT was called regardless
|
||||||
whether the reduction was empty or not. This leaves room to
|
whether the reducion was empty or not. This leaves room to
|
||||||
improve the use of YYLLOC_DEFAULT in such a case.
|
improve the use of YYLLOC_DEFAULT in such a case.
|
||||||
lalr1.cc is still experimental, so changing this is acceptable.
|
lalr1.cc is still experimental, so changing this is acceptable.
|
||||||
And finally, there are probably not many users who changed the
|
And finally, there are probably not many users who changed the
|
||||||
@@ -16524,7 +16524,7 @@
|
|||||||
(struct state): Renamed from struct state_s.
|
(struct state): Renamed from struct state_s.
|
||||||
(state): Renamed from state_t.
|
(state): Renamed from state_t.
|
||||||
(transitions): Renamed from transitions_t. Unused (and
|
(transitions): Renamed from transitions_t. Unused (and
|
||||||
misspelled) transition_s tag removed.
|
misspelled) transtion_s tag removed.
|
||||||
(errs): Renamed from errs_t. Unused errs_s tag removed.
|
(errs): Renamed from errs_t. Unused errs_s tag removed.
|
||||||
(reductions): Renamed from reductions_t. Unused tag
|
(reductions): Renamed from reductions_t. Unused tag
|
||||||
reductions_s removed.
|
reductions_s removed.
|
||||||
@@ -16612,9 +16612,9 @@
|
|||||||
|
|
||||||
|
|
||||||
Fix misspelling in names.
|
Fix misspelling in names.
|
||||||
* src/vcg.h (enum_alignment_e): Renamed from enum_alignment_e.
|
* src/vcg.h (enum_alignment_e): Renamed from enum_alignement_e.
|
||||||
* src/vcg_defaults.h (G_NODE_ALIGNMENT): Renamed from
|
* src/vcg_defaults.h (G_NODE_ALIGNMENT): Renamed from
|
||||||
G_NODE_ALIGNMENT.
|
G_NODE_ALIGNEMENT.
|
||||||
|
|
||||||
|
|
||||||
* lib/timevar.c (timevar_report): Renamed from time_report,
|
* lib/timevar.c (timevar_report): Renamed from time_report,
|
||||||
@@ -16866,7 +16866,7 @@
|
|||||||
* src/tables.c (conflict_row, pack_vector): Likewise.
|
* src/tables.c (conflict_row, pack_vector): Likewise.
|
||||||
* src/vcg.c (get_color_str, get_textmode_str, get_shape_str,
|
* src/vcg.c (get_color_str, get_textmode_str, get_shape_str,
|
||||||
get_layoutalgorithm_str, get_decision_str, get_orientation_str,
|
get_layoutalgorithm_str, get_decision_str, get_orientation_str,
|
||||||
get_node_alignment_str, get_arrow_mode_str, get_crossing_type_str,
|
get_node_alignement_str, get_arrow_mode_str, get_crossing_type_str,
|
||||||
get_view_str, get_linestyle_str, get_arrowstyle_str): Likewise.
|
get_view_str, get_linestyle_str, get_arrowstyle_str): Likewise.
|
||||||
|
|
||||||
* lib/argmatch.h (ARRAY_CARDINALITY): Do not bother to #undef.
|
* lib/argmatch.h (ARRAY_CARDINALITY): Do not bother to #undef.
|
||||||
@@ -17365,7 +17365,7 @@
|
|||||||
(scanner_last_string_free): Remove; not used.
|
(scanner_last_string_free): Remove; not used.
|
||||||
(percent_percent_count): Move decl to just before use.
|
(percent_percent_count): Move decl to just before use.
|
||||||
(SC_ESCAPED_CHARACTER): Return ID at unexpected end of file,
|
(SC_ESCAPED_CHARACTER): Return ID at unexpected end of file,
|
||||||
not the (never otherwise-used) CHARACTER.
|
not the (never otherwised-used) CHARACTER.
|
||||||
|
|
||||||
2002-11-07 Akim Demaille <[email protected]>
|
2002-11-07 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
@@ -18052,7 +18052,7 @@
|
|||||||
suite using a GLR parser driven by LALR tables. It fails with -O2
|
suite using a GLR parser driven by LALR tables. It fails with -O2
|
||||||
because `struct stat' gives two different answers on my machine:
|
because `struct stat' gives two different answers on my machine:
|
||||||
88 (definition of an auto var) and later 96 (memset on this var).
|
88 (definition of an auto var) and later 96 (memset on this var).
|
||||||
Hence the stack is badly corrupted. The headers inclusion is to
|
Hence the stack is badly corrumpted. The headers inclusion is to
|
||||||
blame: if I move the awk.h inclusion before GLR's system header
|
blame: if I move the awk.h inclusion before GLR's system header
|
||||||
inclusion, the two struct stat have the same size.
|
inclusion, the two struct stat have the same size.
|
||||||
|
|
||||||
@@ -18962,7 +18962,7 @@
|
|||||||
|
|
||||||
2002-07-16 Akim Demaille <[email protected]>
|
2002-07-16 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
* src/assoc.c, src/assoc.h (assoc_t, assoc_to_string): New.
|
* src/assoc.c, src/asssoc.h (assoc_t, assoc_to_string): New.
|
||||||
Adjust all former `associativity' dependencies.
|
Adjust all former `associativity' dependencies.
|
||||||
* src/symtab.c (symbol_new): Default associativity is `undef', not
|
* src/symtab.c (symbol_new): Default associativity is `undef', not
|
||||||
`right'.
|
`right'.
|
||||||
@@ -20105,7 +20105,7 @@
|
|||||||
|
|
||||||
* data/bison.c++: Catch up with bison.simple:
|
* data/bison.c++: Catch up with bison.simple:
|
||||||
2002-05-24 Paul Hilfinger <[email protected]>
|
2002-05-24 Paul Hilfinger <[email protected]>
|
||||||
and Paul Eggert <[email protected]>: `error' handling.
|
and Paul Eggert <[email protected]>: `error' handing.
|
||||||
2002-05-26 Akim Demaille <[email protected]>: stos_, token_number_,
|
2002-05-26 Akim Demaille <[email protected]>: stos_, token_number_,
|
||||||
and popping traces.
|
and popping traces.
|
||||||
|
|
||||||
@@ -20455,7 +20455,7 @@
|
|||||||
single characters while replacing `[' and `]' with quadrigraphs, to
|
single characters while replacing `[' and `]' with quadrigraphs, to
|
||||||
avoid troubles with M4 quotes.
|
avoid troubles with M4 quotes.
|
||||||
(copy_comment): Output characters with copy_character.
|
(copy_comment): Output characters with copy_character.
|
||||||
(read_additional_code): Likewise.
|
(read_additionnal_code): Likewise.
|
||||||
(copy_string2): Likewise.
|
(copy_string2): Likewise.
|
||||||
(copy_definition): Likewise.
|
(copy_definition): Likewise.
|
||||||
|
|
||||||
@@ -20638,7 +20638,7 @@
|
|||||||
* data/bison.simple, data/bison.c++: Adjust.
|
* data/bison.simple, data/bison.c++: Adjust.
|
||||||
* tests/torture.at (Big triangle): Move the limit from 254 to
|
* tests/torture.at (Big triangle): Move the limit from 254 to
|
||||||
500.
|
500.
|
||||||
* tests/regression.at (Web2c Actions): Adjust.
|
* tests/regression.at (Web2c Actions): Ajust.
|
||||||
|
|
||||||
Trying with bigger grammars shows various phenomena: at 3000 (28Mb
|
Trying with bigger grammars shows various phenomena: at 3000 (28Mb
|
||||||
of grammar file) bison is killed by my system, at 2000 (12Mb) bison
|
of grammar file) bison is killed by my system, at 2000 (12Mb) bison
|
||||||
@@ -20949,7 +20949,7 @@
|
|||||||
|
|
||||||
2002-03-05 Robert Anisko <[email protected]>
|
2002-03-05 Robert Anisko <[email protected]>
|
||||||
|
|
||||||
* src/reader.c (read_additional_code): `c' should be an integer, not
|
* src/reader.c (read_additionnal_code): `c' should be an integer, not
|
||||||
a character.
|
a character.
|
||||||
Reported by Nicolas Tisserand and Nicolas Burrus.
|
Reported by Nicolas Tisserand and Nicolas Burrus.
|
||||||
|
|
||||||
@@ -21070,7 +21070,7 @@
|
|||||||
|
|
||||||
* src/L0.c, src/LR0.h (nstates): Be size_t.
|
* src/L0.c, src/LR0.h (nstates): Be size_t.
|
||||||
Adjust comparisons (signed vs unsigned).
|
Adjust comparisons (signed vs unsigned).
|
||||||
* src/conflicts.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a
|
* src/conflics.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a
|
||||||
bitset*.
|
bitset*.
|
||||||
Adjust all dependencies.
|
Adjust all dependencies.
|
||||||
|
|
||||||
@@ -22337,7 +22337,7 @@
|
|||||||
|
|
||||||
* src/bison.simple: Remove #line just before %%epilogue. It
|
* src/bison.simple: Remove #line just before %%epilogue. It
|
||||||
is now handled in ...
|
is now handled in ...
|
||||||
* src/reader.c (read_additional_code): Add the output of a
|
* src/reader.c (read_additionnal_code): Add the output of a
|
||||||
#line for the epilogue.
|
#line for the epilogue.
|
||||||
|
|
||||||
2001-12-10 Marc Autret <[email protected]>
|
2001-12-10 Marc Autret <[email protected]>
|
||||||
@@ -22797,7 +22797,7 @@
|
|||||||
on user names when possible.
|
on user names when possible.
|
||||||
|
|
||||||
(YYSTACK_USE_ALLOCA): Do not define; just use any existing defn.
|
(YYSTACK_USE_ALLOCA): Do not define; just use any existing defn.
|
||||||
Simplify test for whether <alloca.h> exists.
|
Simplify test for whather <alloca.h> exists.
|
||||||
|
|
||||||
(<stdlib.h>): Include if we will use malloc, and if standard C or C++.
|
(<stdlib.h>): Include if we will use malloc, and if standard C or C++.
|
||||||
|
|
||||||
@@ -23563,7 +23563,7 @@
|
|||||||
|
|
||||||
2001-10-04 Akim Demaille <[email protected]>
|
2001-10-04 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
* src/reader.c (parse_union_decl): Push the characters in
|
* src/reader.c (parse_union_decl): Push the caracters in
|
||||||
union_obstack, not attrs_obstack.
|
union_obstack, not attrs_obstack.
|
||||||
|
|
||||||
2001-10-04 Akim Demaille <[email protected]>
|
2001-10-04 Akim Demaille <[email protected]>
|
||||||
@@ -23844,7 +23844,7 @@
|
|||||||
|
|
||||||
* src/vcg.h (graph_s): color, textcolor, bordercolor are now
|
* src/vcg.h (graph_s): color, textcolor, bordercolor are now
|
||||||
enum color_e.
|
enum color_e.
|
||||||
* src/print_graph.c (print_graph): Initialize graph.layoutalgorithm
|
* src/print_graph.c (print_graph): Initalize graph.layoutalgorithm
|
||||||
to `normal'.
|
to `normal'.
|
||||||
* src/reader.c (parse_token_decl): Initialize token with tok_eof.
|
* src/reader.c (parse_token_decl): Initialize token with tok_eof.
|
||||||
* src/lex.h: Adjust prototype.
|
* src/lex.h: Adjust prototype.
|
||||||
@@ -23999,7 +23999,7 @@
|
|||||||
|
|
||||||
* src/vcg.c: Remove includes of `complain.h' and `xalloc.h'.
|
* src/vcg.c: Remove includes of `complain.h' and `xalloc.h'.
|
||||||
(get_xxxx_str): Use assert () instead of complain ().
|
(get_xxxx_str): Use assert () instead of complain ().
|
||||||
Remove return invocations in default cases.
|
Remove return invokations in default cases.
|
||||||
(get_decision_str): Modify default behaviour. Remove second argument.
|
(get_decision_str): Modify default behaviour. Remove second argument.
|
||||||
Echo modifications on calls.
|
Echo modifications on calls.
|
||||||
(output_graph): Fix.
|
(output_graph): Fix.
|
||||||
@@ -24030,7 +24030,7 @@
|
|||||||
informations about %union.
|
informations about %union.
|
||||||
(parse_union_decl): Copy the union_obstack in the muscle stype.
|
(parse_union_decl): Copy the union_obstack in the muscle stype.
|
||||||
* src/bison.simple: Add new #line directive.
|
* src/bison.simple: Add new #line directive.
|
||||||
Add typedef %%stype YYSTYPE.
|
Add typdef %%stype YYSTYPE.
|
||||||
|
|
||||||
2001-09-23 Pascal Bart <[email protected]>
|
2001-09-23 Pascal Bart <[email protected]>
|
||||||
|
|
||||||
@@ -24115,7 +24115,7 @@
|
|||||||
(parse_union_decl): Update.
|
(parse_union_decl): Update.
|
||||||
(parse_macro_decl): Rename parse_muscle_decl.
|
(parse_macro_decl): Rename parse_muscle_decl.
|
||||||
Update to use renamed functions and variable.
|
Update to use renamed functions and variable.
|
||||||
(read_declarations, copy_action, read_additional_code, : Updated
|
(read_declarations, copy_action, read_additionnal_code, : Updated
|
||||||
with correct variables and functions names.
|
with correct variables and functions names.
|
||||||
(packsymbols, reader): Likewise.
|
(packsymbols, reader): Likewise.
|
||||||
|
|
||||||
@@ -24196,7 +24196,7 @@
|
|||||||
|
|
||||||
2001-08-31 Pascal Bart <[email protected]>, Marc Autret <[email protected]>
|
2001-08-31 Pascal Bart <[email protected]>, Marc Autret <[email protected]>
|
||||||
|
|
||||||
* src/reader.c (read_additional_code): Rename %%user_code to
|
* src/reader.c (read_additionnal_code): Rename %%user_code to
|
||||||
%%epilogue.
|
%%epilogue.
|
||||||
* src/output.c (output): Rename %%declarations to %%prologue.
|
* src/output.c (output): Rename %%declarations to %%prologue.
|
||||||
* src/bison.simple: Echo modifications.
|
* src/bison.simple: Echo modifications.
|
||||||
@@ -24240,7 +24240,7 @@
|
|||||||
2001-08-29 Marc Autret <[email protected]>
|
2001-08-29 Marc Autret <[email protected]>
|
||||||
|
|
||||||
* src/bison.simple: Add %%user_code directive at the end.
|
* src/bison.simple: Add %%user_code directive at the end.
|
||||||
* src/reader.c (read_additional_code): New.
|
* src/reader.c (read_additionnal_code): New.
|
||||||
(reader): Use it.
|
(reader): Use it.
|
||||||
* src/output.c (output_program): Remove.
|
* src/output.c (output_program): Remove.
|
||||||
(output): Update.
|
(output): Update.
|
||||||
@@ -24303,7 +24303,7 @@
|
|||||||
(readgram): Disable a piece of code that was writing a default
|
(readgram): Disable a piece of code that was writing a default
|
||||||
definition for 'YYSTYPE'.
|
definition for 'YYSTYPE'.
|
||||||
(reader_output_yylsp): Remove.
|
(reader_output_yylsp): Remove.
|
||||||
(packsymbols): Output token definitions to a macro.
|
(packsymbols): Output token defintions to a macro.
|
||||||
(copy_definition): Disable C output.
|
(copy_definition): Disable C output.
|
||||||
|
|
||||||
* src/reader.c (parse_macro_decl): New function used to parse macro
|
* src/reader.c (parse_macro_decl): New function used to parse macro
|
||||||
@@ -24641,7 +24641,7 @@
|
|||||||
|
|
||||||
2001-07-08 Pascal Bart <[email protected]>
|
2001-07-08 Pascal Bart <[email protected]>
|
||||||
|
|
||||||
* src/bison.simple (yyparse): Suppress warning `comparison
|
* src/bison.simple (yyparse): Suppress warning `comparaison
|
||||||
between signed and unsigned'.
|
between signed and unsigned'.
|
||||||
|
|
||||||
2001-07-05 Pascal Bart <[email protected]>
|
2001-07-05 Pascal Bart <[email protected]>
|
||||||
@@ -25128,7 +25128,7 @@
|
|||||||
* tests/calc.m4: Test it.
|
* tests/calc.m4: Test it.
|
||||||
|
|
||||||
For regularity of the names, replace each
|
For regularity of the names, replace each
|
||||||
(nolineflag, toknumflag, rawtoknumflag, noparserflag): with...
|
(nolineflag, toknumflag, rawtokenumflag, noparserflag): with...
|
||||||
(no_lineflag, token_tableflag, rawflag, no_parserflag): this.
|
(no_lineflag, token_tableflag, rawflag, no_parserflag): this.
|
||||||
In addition replace each `flag' with `_flag'.
|
In addition replace each `flag' with `_flag'.
|
||||||
|
|
||||||
@@ -25731,7 +25731,7 @@
|
|||||||
|
|
||||||
* src/getargs.c, src/Makefile.am, src/reader.c, src/version.c:
|
* src/getargs.c, src/Makefile.am, src/reader.c, src/version.c:
|
||||||
Have configure build version string instead of relying on ANSI string
|
Have configure build version string instead of relying on ANSI string
|
||||||
concatenation.
|
concatentation.
|
||||||
|
|
||||||
1999-06-14 Jesse Thilo <[email protected]>
|
1999-06-14 Jesse Thilo <[email protected]>
|
||||||
|
|
||||||
@@ -25741,7 +25741,7 @@
|
|||||||
|
|
||||||
* acconfig.h, configure.in:
|
* acconfig.h, configure.in:
|
||||||
Have configure build version string instead of relying on ANSI string
|
Have configure build version string instead of relying on ANSI string
|
||||||
concatenation.
|
concatentation.
|
||||||
|
|
||||||
1999-06-08 Jesse Thilo <[email protected]>
|
1999-06-08 Jesse Thilo <[email protected]>
|
||||||
|
|
||||||
@@ -26733,8 +26733,8 @@
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1987-1988, 1991-2015, 2018 Free Software
|
Copyright (C) 1987-1988, 1991-2013 Free Software Foundation,
|
||||||
Foundation, Inc.
|
Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without
|
Copying and distribution of this file, with or without
|
||||||
modification, are permitted provided the copyright notice and this
|
modification, are permitted provided the copyright notice and this
|
||||||
|
|||||||
+9
-16
@@ -1,6 +1,6 @@
|
|||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in.
|
||||||
|
|
||||||
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,26 +24,22 @@ SUBDIRS = po runtime-po .
|
|||||||
aclocaldir = @aclocaldir@
|
aclocaldir = @aclocaldir@
|
||||||
aclocal_DATA = m4/bison-i18n.m4
|
aclocal_DATA = m4/bison-i18n.m4
|
||||||
|
|
||||||
EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \
|
EXTRA_DIST = .prev-version .version \
|
||||||
ChangeLog-1998 ChangeLog-2012 ChangeLog
|
cfg.mk ChangeLog-1998 ChangeLog-2012 PACKAGING
|
||||||
|
|
||||||
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
|
|
||||||
|
|
||||||
## Running the bison from this tarball. To generate our own parser,
|
## Running the bison from this tarball. To generate our own parser,
|
||||||
## but also to run the tests. Of course, you ought to keep a sane
|
## but also to run the tests. Of course, you ought to keep a sane
|
||||||
## version of Bison nearby...
|
## version of Bison nearby...
|
||||||
BISON = $(top_builddir)/tests/bison
|
BISON = $(top_builddir)/tests/bison
|
||||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||||
YACC = $(BISON) -o y.tab.c
|
YACC = $(BISON) -y
|
||||||
AM_YFLAGS = -d -v -Werror -Wall -Wno-yacc --report=all
|
AM_YFLAGS = -d -v --warnings=all,error --report=all
|
||||||
|
|
||||||
# Initialization before completion by local.mk's.
|
# Initialization before completion by local.mk's.
|
||||||
AM_CFLAGS = $(WARN_CFLAGS)
|
AM_CFLAGS = $(WARN_CFLAGS)
|
||||||
# Find builddir/src/scan-code.c etc. For some reason "-I./lib"
|
# Find builddir/src/scan-code.c etc.
|
||||||
# instead of "-Ilib" avoids infinite recursions on #include_next.
|
AM_CPPFLAGS = -I. -Ilib -I$(top_srcdir) -I$(top_srcdir)/lib
|
||||||
AM_CPPFLAGS = -I. -I./lib -I$(top_srcdir) -I$(top_srcdir)/lib
|
|
||||||
BUILT_SOURCES =
|
BUILT_SOURCES =
|
||||||
CLEANDIRS =
|
|
||||||
CLEANFILES =
|
CLEANFILES =
|
||||||
DISTCLEANFILES =
|
DISTCLEANFILES =
|
||||||
EXTRA_DIST += $(dist_TESTS)
|
EXTRA_DIST += $(dist_TESTS)
|
||||||
@@ -65,9 +61,6 @@ include lib/local.mk
|
|||||||
include src/local.mk
|
include src/local.mk
|
||||||
include tests/local.mk
|
include tests/local.mk
|
||||||
|
|
||||||
clean-local:
|
|
||||||
rm -rf $(CLEANDIRS)
|
|
||||||
|
|
||||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
# See comments in build-aux/git-version-gen. However, we make .version depend
|
||||||
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
||||||
# working copy (for example, when you run autoreconf && make). Allowing these
|
# working copy (for example, when you run autoreconf && make). Allowing these
|
||||||
@@ -85,11 +78,11 @@ dist-hook: gen-ChangeLog
|
|||||||
|
|
||||||
.PHONY: update-b4-copyright update-package-copyright-year
|
.PHONY: update-b4-copyright update-package-copyright-year
|
||||||
update-b4-copyright:
|
update-b4-copyright:
|
||||||
$(AM_V_GEN)find $(srcdir)/data -type f \
|
find $(srcdir)/data -type f \
|
||||||
| xargs $(srcdir)/build-aux/$@
|
| xargs $(srcdir)/build-aux/$@
|
||||||
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
||||||
update-package-copyright-year:
|
update-package-copyright-year:
|
||||||
$(AM_V_GEN)$(srcdir)/build-aux/$@ $(srcdir)/configure.ac
|
$(srcdir)/build-aux/$@ $(srcdir)/configure.ac
|
||||||
|
|
||||||
gen_start_date = 2012-01-16
|
gen_start_date = 2012-01-16
|
||||||
.PHONY: gen-ChangeLog
|
.PHONY: gen-ChangeLog
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2005, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ 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
|
ftp://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
||||||
|
|
||||||
** Internationalization
|
** Internationalization
|
||||||
Bison supports two catalogues: one for Bison itself (i.e., for the
|
Bison supports two catalogues: one for Bison itself (i.e., for the
|
||||||
@@ -30,24 +30,24 @@ not answer them, please send mail to <[email protected]>.
|
|||||||
|
|
||||||
* Bug reports
|
* Bug reports
|
||||||
Please send bug reports to <[email protected]>. Please include the
|
Please send bug reports to <[email protected]>. Please include the
|
||||||
version number from 'bison --version', and a complete, self-contained
|
version number from `bison --version', and a complete, self-contained
|
||||||
test case in each bug report.
|
test case in each bug report.
|
||||||
|
|
||||||
* Copyright statements
|
* Copyright statements
|
||||||
For any copyright year range specified as YYYY-ZZZZ in this package,
|
For any copyright year range specified as YYYY-ZZZZ in this package,
|
||||||
note that the range specifies every single year in that closed interval.
|
note that the range specifies every single year in that closed interval.
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
fill-column: 76
|
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018 Free Software
|
-----
|
||||||
|
|
||||||
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2013 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+105
-113
@@ -9,19 +9,19 @@ Everything related to the development of Bison is on Savannah:
|
|||||||
* 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
|
First, if it is a large change, you must make sure they have signed
|
||||||
appropriate paperwork. Second, be sure to add their name and email address
|
the appropriate paperwork. Second, be sure to add their name and
|
||||||
to THANKS.
|
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
|
If somebody reports a new bug, mention his name in the commit message
|
||||||
the test case you write. Put him into THANKS.
|
and in the test case you write. Put him into THANKS.
|
||||||
|
|
||||||
The correct response to most actual bugs is to write a new test case which
|
The correct response to most actual bugs is to write a new test case
|
||||||
demonstrates the bug. Then fix the bug, re-run the test suite, and check
|
which demonstrates the bug. Then fix the bug, re-run the test suite,
|
||||||
everything in.
|
and check everything in.
|
||||||
|
|
||||||
|
|
||||||
* Hacking
|
* Hacking
|
||||||
@@ -30,17 +30,17 @@ everything in.
|
|||||||
Which include serious bug fixes, must be mentioned in NEWS.
|
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
|
Only user visible strings are to be translated: error messages, bits
|
||||||
.output file etc. This excludes impossible error messages (comparable to
|
of the .output file etc. This excludes impossible error messages
|
||||||
assert/abort), and all the --trace output which is meant for the maintainers
|
(comparable to assert/abort), and all the --trace output which is
|
||||||
only.
|
meant for the maintainers only.
|
||||||
|
|
||||||
** Horizontal tabs
|
** Horizontal tabs
|
||||||
Do not add horizontal tab characters to any file in Bison's repository
|
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.
|
except where required. For example, do not use tabs to format C code.
|
||||||
However, make files, ChangeLog, and some regular expressions require tabs.
|
However, make files, ChangeLog, and some regular expressions require
|
||||||
Also, test cases might need to contain tabs to check that Bison properly
|
tabs. Also, test cases might need to contain tabs to check that Bison
|
||||||
processes tabs in its input.
|
properly processes tabs in its input.
|
||||||
|
|
||||||
|
|
||||||
* Working from the repository
|
* Working from the repository
|
||||||
@@ -62,22 +62,13 @@ tools we depend upon, including:
|
|||||||
- Gettext <http://www.gnu.org/software/gettext/>
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
- Graphviz <http://www.graphviz.org>
|
- Graphviz <http://www.graphviz.org>
|
||||||
- Gzip <http://www.gnu.org/software/gzip/>
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
- Help2man <http://www.gnu.org/software/help2man/>
|
|
||||||
- Perl <http://www.cpan.org/>
|
- Perl <http://www.cpan.org/>
|
||||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||||
- Tar <http://www.gnu.org/software/tar/>
|
- Tar <http://www.gnu.org/software/tar/>
|
||||||
- Texinfo <http://www.gnu.org/software/texinfo/>
|
|
||||||
|
|
||||||
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
||||||
your architecture.
|
your architecture.
|
||||||
|
|
||||||
If you're using a GNU/Linux distribution, the easiest way to install the
|
|
||||||
above packages depends on your system. The following shell command should
|
|
||||||
work for Debian-based systems such as Ubuntu:
|
|
||||||
|
|
||||||
sudo apt-get install \
|
|
||||||
autoconf automake autopoint flex graphviz help2man texinfo valgrind
|
|
||||||
|
|
||||||
Bison is written using Bison grammars, so there are bootstrapping issues.
|
Bison is written using Bison grammars, so there are bootstrapping issues.
|
||||||
The bootstrap script attempts to discover when the C code generated from the
|
The bootstrap script attempts to discover when the C code generated from the
|
||||||
grammars is out of date, and to bootstrap with an out-of-date version of the
|
grammars is out of date, and to bootstrap with an out-of-date version of the
|
||||||
@@ -103,19 +94,15 @@ to perform the first checkout of the submodules, run
|
|||||||
|
|
||||||
$ git submodule update --init
|
$ git submodule update --init
|
||||||
|
|
||||||
|
Git submodule support is weak before versions 1.6 and later, you
|
||||||
|
should probably upgrade Git if your version is older.
|
||||||
|
|
||||||
The next step is to get other files needed to build, which are
|
The next step is to get other files needed to build, which are
|
||||||
extracted from other source packages:
|
extracted from other source packages:
|
||||||
|
|
||||||
$ ./bootstrap
|
$ ./bootstrap
|
||||||
|
|
||||||
Bootstrapping updates the submodules to the versions registered in the
|
And there you are! Just
|
||||||
top-level directory. To change gnulib, first check out the version you want
|
|
||||||
in `gnulib`, then commit this change in Bison's repository, and finally run
|
|
||||||
bootstrap.
|
|
||||||
|
|
||||||
If it fails with missing symbols (e.g., "error: possibly undefined macro:
|
|
||||||
AC_PROG_GNU_M4"), you are likely to have forgotten the submodule
|
|
||||||
initialization part. Otherwise, there you are! Just
|
|
||||||
|
|
||||||
$ ./configure
|
$ ./configure
|
||||||
$ make
|
$ make
|
||||||
@@ -139,12 +126,13 @@ explicitly by the user.
|
|||||||
*** Updating Bison
|
*** Updating Bison
|
||||||
|
|
||||||
If you pull a newer version of a branch, say via "git pull", you might
|
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
|
import requests for updated submodules. A simple "git diff" will
|
||||||
the current version of the submodule (i.e., the actual contents of the
|
reveal if the current version of the submodule (i.e., the actual
|
||||||
gnulib directory) and the current request from the subscriber (i.e., the
|
contents of the gnulib directory) and the current request from the
|
||||||
reference of the version of gnulib that the Bison repository requests)
|
subscriber (i.e., the reference of the version of gnulib that the
|
||||||
differ. To upgrade the submodules (i.e., to check out the version that is
|
Bison repository requests) differ. To upgrade the submodules (i.e.,
|
||||||
actually requested by the subscriber, run "git submodule update".
|
to check out the version that is actually requested by the subscriber,
|
||||||
|
run "git submodule update".
|
||||||
|
|
||||||
$ git pull
|
$ git pull
|
||||||
$ git submodule update
|
$ git submodule update
|
||||||
@@ -168,8 +156,8 @@ Register your changes.
|
|||||||
|
|
||||||
$ git checkin ...
|
$ git checkin ...
|
||||||
|
|
||||||
For a suggestion of what gnulib commit might be stable enough for a formal
|
For a suggestion of what gnulib commit might be stable enough for a
|
||||||
release, see the ChangeLog in the latest gnulib snapshot at:
|
formal release, see the ChangeLog in the latest gnulib snapshot at:
|
||||||
|
|
||||||
http://erislabs.net/ianb/projects/gnulib/
|
http://erislabs.net/ianb/projects/gnulib/
|
||||||
|
|
||||||
@@ -179,9 +167,9 @@ The Autoconf files we use are currently:
|
|||||||
lib/m4sugar/m4sugar.m4
|
lib/m4sugar/m4sugar.m4
|
||||||
lib/m4sugar/foreach.m4
|
lib/m4sugar/foreach.m4
|
||||||
|
|
||||||
These files don't change very often in Autoconf, so it should be relatively
|
These files don't change very often in Autoconf, so it should be
|
||||||
straight-forward to examine the differences in order to decide whether to
|
relatively straight-forward to examine the differences in order to
|
||||||
update.
|
decide whether to update.
|
||||||
|
|
||||||
* Test suite
|
* Test suite
|
||||||
|
|
||||||
@@ -190,15 +178,12 @@ Use liberally.
|
|||||||
|
|
||||||
** TESTSUITEFLAGS
|
** TESTSUITEFLAGS
|
||||||
|
|
||||||
To run just the testsuite (not the tests related to the examples), run `make
|
The default is for make check to run all tests sequentially. This can be
|
||||||
check-local`.
|
very time consumming when checking repeatedly or on slower setups. This can
|
||||||
|
be sped up in two ways:
|
||||||
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:
|
Using -j, in a make-like fashion, for example:
|
||||||
$ make check-local TESTSUITEFLAGS='-j8'
|
$ make check TESTSUITEFLAGS='-j8'
|
||||||
|
|
||||||
Running only the tests of a certain category, as specified in the AT files
|
Running only the tests of a certain category, as specified in the AT files
|
||||||
with AT_KEYWORDS([[category]]). Categories include:
|
with AT_KEYWORDS([[category]]). Categories include:
|
||||||
@@ -209,7 +194,7 @@ with AT_KEYWORDS([[category]]). Categories include:
|
|||||||
- report, for automaton dumps
|
- report, for automaton dumps
|
||||||
|
|
||||||
To run a specific set of tests, use -k (for "keyword"). For example:
|
To run a specific set of tests, use -k (for "keyword"). For example:
|
||||||
$ make check-local TESTSUITEFLAGS='-k c++'
|
$ make check TESTSUITEFLAGS='-k c++'
|
||||||
|
|
||||||
Both can be combined.
|
Both can be combined.
|
||||||
|
|
||||||
@@ -247,96 +232,102 @@ suite. So currently, do not try to run valgrind on Mac OS X.
|
|||||||
Try to run the test suite with more severe conditions before a
|
Try to run the test suite with more severe conditions before a
|
||||||
release:
|
release:
|
||||||
|
|
||||||
- Configure the package with --enable-gcc-warnings, so that one checks that
|
- Configure the package with --enable-gcc-warnings, so that one checks
|
||||||
1. Bison compiles cleanly, 2. the parsers it produces compile cleanly too.
|
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
||||||
|
cleanly too.
|
||||||
|
|
||||||
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules that
|
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules
|
||||||
can fix portability issues. See if you really want to pay attention to
|
that can fix portability issues. See if you really want to pay
|
||||||
its warnings; there's no need to obey blindly to it
|
attention to its warnings; there's no need to obey blindly to it
|
||||||
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
|
(<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:
|
- run "make maintainer-check" which:
|
||||||
- runs "valgrind -q bison" to run Bison under Valgrind.
|
- runs "valgrind -q bison" to run Bison under Valgrind.
|
||||||
- runs the parsers under Valgrind.
|
- runs the parsers under Valgrind.
|
||||||
- runs the test suite with G++ as C compiler...
|
- runs the test suite with G++ as C compiler...
|
||||||
|
|
||||||
- run "make maintainer-check-push", which runs "make maintainer-check" while
|
- run "make maintainer-push-check", which runs "make maintainer-check"
|
||||||
activating the push implementation and its pull interface wrappers in many
|
while activating the push implementation and its pull interface wrappers
|
||||||
test cases that were originally written to exercise only the pull
|
in many test cases that were originally written to exercise only the
|
||||||
implementation. This makes certain the push implementation can perform
|
pull implementation. This makes certain the push implementation can
|
||||||
every task the pull implementation can.
|
perform every task the pull implementation can.
|
||||||
|
|
||||||
- run "make maintainer-check-xml", which runs "make maintainer-check" while
|
- run "make maintainer-xml-check", which runs "make maintainer-check"
|
||||||
checking Bison's XML automaton report for every working grammar passed to
|
while checking Bison's XML automaton report for every working grammar
|
||||||
Bison in the test suite. The check just diffs the output of Bison's
|
passed to Bison in the test suite. The check just diffs the output of
|
||||||
included XSLT style sheets with the output of --report=all and --graph.
|
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-release-check" takes care of running
|
||||||
maintainer-check, maintainer-check-push and maintainer-check-xml.
|
maintainer-check, maintainer-push-check and maintainer-xml-check.
|
||||||
|
|
||||||
- Change tests/atlocal/CFLAGS to add your preferred options.
|
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||||
|
instance, "-traditional" to check that the parsers are K&R. Note
|
||||||
|
that it does not make sense for glr.c, which should be ANSI, but
|
||||||
|
currently is actually GNU C, nor for lalr1.cc.
|
||||||
|
|
||||||
- Test with a very recent version of GCC for both C and C++. Testing with
|
- Test with a very recent version of GCC for both C and C++. Testing
|
||||||
older versions that are still in use is nice too.
|
with older versions that are still in use is nice too.
|
||||||
|
|
||||||
|
|
||||||
* Release Procedure
|
* Release Procedure
|
||||||
This section needs to be updated to take into account features from gnulib.
|
This section needs to be updated to take into account features from
|
||||||
In particular, be sure to read README-release.
|
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
|
week before a stable release, to give them time to translate them.
|
||||||
generating the *.pot files, make sure that po/POTFILES.in and
|
Before generating the *.pot files, make sure that po/POTFILES.in and
|
||||||
runtime-po/POTFILES.in list all files with translatable strings. This
|
runtime-po/POTFILES.in list all files with translatable strings.
|
||||||
helps: grep -l '\<_(' *.
|
This helps: grep -l '\<_(' *
|
||||||
|
|
||||||
** Tests
|
** Tests
|
||||||
See above.
|
See above.
|
||||||
|
|
||||||
** Update the foreign files
|
** Update the foreign files
|
||||||
Running "./bootstrap" in the top level should update them all for you. This
|
Running "./bootstrap" in the top level should update them all for you.
|
||||||
covers PO files too. Sometimes a PO file contains problems that causes it
|
This covers PO files too. Sometimes a PO file contains problems that
|
||||||
to be rejected by recent Gettext releases; please report these to the
|
causes it to be rejected by recent Gettext releases; please report
|
||||||
Translation Project.
|
these to the Translation Project.
|
||||||
|
|
||||||
** Update README
|
** Update README
|
||||||
Make sure the information in README is current. Most notably, make sure it
|
Make sure the information in README is current. Most notably, make sure
|
||||||
recommends a version of GNU M4 that is compatible with the latest Bison
|
it recommends a version of GNU M4 that is compatible with the latest
|
||||||
sources.
|
Bison sources.
|
||||||
|
|
||||||
** Check copyright years.
|
** Check copyright years.
|
||||||
We update years in copyright statements throughout Bison once at the start
|
We update years in copyright statements throughout Bison once at the
|
||||||
of every year by running "make update-copyright". However, before a
|
start of every year by running "make update-copyright". However, before
|
||||||
release, it's good to verify that it's actually been run. Besides the
|
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
|
copyright statement for each Bison file, check the copyright statements
|
||||||
the skeletons insert into generated parsers, and check all occurrences of
|
that the skeletons insert into generated parsers, and check all
|
||||||
PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
occurrences of 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
|
See do-release-commit-and-tag in README-release. For a while, we used
|
||||||
names such as "2.6_rc1". Now that we use gnulib in the release procedure,
|
beta names such as "2.6_rc1". Now that we use gnulib in the release
|
||||||
we must use "2.5.90", which has the additional benefit of being properly
|
procedure, we must use "2.5.90", which has the additional benefit of
|
||||||
sorted in "git tag -l".
|
being properly sorted in "git tag -l".
|
||||||
|
|
||||||
** make alpha, beta, or stable
|
** make alpha, beta, or stable
|
||||||
See README-release.
|
See README-release.
|
||||||
|
|
||||||
** Upload
|
** Upload
|
||||||
There are two ways to upload the tarballs to the GNU servers: using gnupload
|
There are two ways to upload the tarballs to the GNU servers: using
|
||||||
(from gnulib), or by hand. Obviously prefer the former. But in either
|
gnupload (from gnulib), or by hand. Obviously prefer the former. But
|
||||||
case, be sure to read the following paragraph.
|
in either case, be sure to read the following paragraph.
|
||||||
|
|
||||||
*** Setup
|
*** Setup
|
||||||
You need "gnupg".
|
You need "gnupg".
|
||||||
|
|
||||||
Make sure your public key has been uploaded at least to keys.gnupg.net. You
|
Make sure your public key has been uploaded at least to
|
||||||
can upload it with:
|
keys.gnupg.net. You can upload it with:
|
||||||
|
|
||||||
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
||||||
|
|
||||||
@@ -345,8 +336,8 @@ where F125BDF3 should be replaced with your key ID.
|
|||||||
*** Using gnupload
|
*** Using gnupload
|
||||||
You need "ncftp".
|
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
|
||||||
Just copy and paste it in your shell.
|
run. Just copy and paste it in your shell.
|
||||||
|
|
||||||
*** By hand
|
*** By hand
|
||||||
|
|
||||||
@@ -408,9 +399,9 @@ sections that have been removed or renamed):
|
|||||||
$ ls -lt
|
$ ls -lt
|
||||||
|
|
||||||
Remove these files and commit their removal to CVS. For each of these
|
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
|
files, add a line to the file .symlinks. This will ensure that
|
||||||
to the removed files will redirect to the entire manual; this is better than
|
hyperlinks to the removed files will redirect to the entire manual; this
|
||||||
a 404 error.
|
is better than a 404 error.
|
||||||
|
|
||||||
There is a problem with 'index.html' being written twice (once for POSIX
|
There is a problem with 'index.html' being written twice (once for POSIX
|
||||||
function 'index', once for the table of contents); you can ignore this
|
function 'index', once for the table of contents); you can ignore this
|
||||||
@@ -429,18 +420,19 @@ Complete/fix the announcement file. The generated list of recipients
|
|||||||
([email protected], [email protected], [email protected],
|
([email protected], [email protected], [email protected],
|
||||||
[email protected], and [email protected]) is
|
[email protected], and [email protected]) is
|
||||||
appropriate for a stable release or a "serious beta". For any other
|
appropriate for a stable release or a "serious beta". For any other
|
||||||
release, drop at least [email protected]. For an example of how to fill out
|
release, drop at least [email protected]. For an example of how to
|
||||||
the rest of the template, search the mailing list archives for the most
|
fill out the rest of the template, search the mailing list archives
|
||||||
recent release announcement.
|
for the most recent release announcement.
|
||||||
|
|
||||||
For a stable release, send the same announcement on the comp.compilers
|
For a stable release, send the same announcement on the comp.compilers
|
||||||
newsgroup by sending email to [email protected]. Do not make any Cc as the
|
newsgroup by sending email to [email protected]. Do not make any Cc as
|
||||||
moderator will throw away anything cross-posted or Cc'ed. It really needs
|
the moderator will throw away anything cross-posted or Cc'ed. It really
|
||||||
to be a separate message.
|
needs to be a separate message.
|
||||||
|
|
||||||
** Prepare NEWS
|
** Prepare NEWS
|
||||||
So that developers don't accidentally add new items to the old NEWS entry,
|
So that developers don't accidentally add new items to the old NEWS
|
||||||
create a new empty entry in line 3 (without the two leading spaces):
|
entry, create a new empty entry in line 3 (without the two leading
|
||||||
|
spaces):
|
||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||||
|
|
||||||
@@ -448,7 +440,7 @@ Push these changes.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2002-2005, 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ Bison supports the @N construction, which gives you access to
|
|||||||
the starting and ending line number and character number associated
|
the starting and ending line number and character number associated
|
||||||
with any of the symbols in the current rule.
|
with any of the symbols in the current rule.
|
||||||
|
|
||||||
Also, Bison supports the command '%expect N' which says not to mention
|
Also, Bison supports the command `%expect N' which says not to mention
|
||||||
the conflicts if there are N shift/reduce conflicts and no reduce/reduce
|
the conflicts if there are N shift/reduce conflicts and no reduce/reduce
|
||||||
conflicts.
|
conflicts.
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
Bison was originally written by Robert Corbett. It would not be what
|
Bison was originally written by Robert Corbett. It would not be what
|
||||||
it is today without the invaluable help of these people:
|
it is today without the invaluable help of these people:
|
||||||
|
|
||||||
Aaro Koskinen [email protected]
|
Аскар Сафин [email protected]
|
||||||
Аскар Сафин [email protected]
|
|
||||||
Airy Andre [email protected]
|
Airy Andre [email protected]
|
||||||
Akim Demaille [email protected]
|
Akim Demaille [email protected]
|
||||||
Albert Chin-A-Young [email protected]
|
Albert Chin-A-Young [email protected]
|
||||||
@@ -12,77 +11,58 @@ Andreas Schwab [email protected]
|
|||||||
Andrew Suffield [email protected]
|
Andrew Suffield [email protected]
|
||||||
Angelo Borsotti [email protected]
|
Angelo Borsotti [email protected]
|
||||||
Anthony Heading [email protected]
|
Anthony Heading [email protected]
|
||||||
Antonio Silva Correia [email protected]
|
|
||||||
Arnold Robbins [email protected]
|
Arnold Robbins [email protected]
|
||||||
Art Haas [email protected]
|
Art Haas [email protected]
|
||||||
Askar Safin [email protected]
|
|
||||||
Baron Schwartz [email protected]
|
Baron Schwartz [email protected]
|
||||||
Ben Pfaff [email protected]
|
Ben Pfaff [email protected]
|
||||||
Benoit Perrot [email protected]
|
Benoit Perrot [email protected]
|
||||||
Bernd Edlinger [email protected]
|
|
||||||
Bernd Kiefer [email protected]
|
Bernd Kiefer [email protected]
|
||||||
Bert Deknuydt [email protected]
|
Bert Deknuydt [email protected]
|
||||||
Bill Allombert [email protected]
|
Bill Allombert [email protected]
|
||||||
Bob Rossi [email protected]
|
Bob Rossi [email protected]
|
||||||
Brandon Lucia [email protected]
|
Brandon Lucia [email protected]
|
||||||
Brooks Moses [email protected]
|
|
||||||
Bruce Lilly [email protected]
|
Bruce Lilly [email protected]
|
||||||
Bruno Haible [email protected]
|
Bruno Haible [email protected]
|
||||||
Charles-Henri de Boysson [email protected]
|
Charles-Henri de Boysson [email protected]
|
||||||
Christian Burger [email protected]
|
Christian Burger [email protected]
|
||||||
Colin Daley [email protected]
|
|
||||||
Cris Bailiff [email protected]
|
Cris Bailiff [email protected]
|
||||||
Cris van Pelt [email protected]
|
Cris van Pelt [email protected]
|
||||||
Csaba Raduly [email protected]
|
Csaba Raduly [email protected]
|
||||||
Dagobert Michelsen [email protected]
|
Dagobert Michelsen [email protected]
|
||||||
Daniel Frużyński [email protected]
|
|
||||||
Daniel Galloway [email protected]
|
|
||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
David Kastrup [email protected]
|
David Kastrup [email protected]
|
||||||
David Michael [email protected]
|
|
||||||
Dengke Du [email protected]
|
|
||||||
Dennis Clarke [email protected]
|
Dennis Clarke [email protected]
|
||||||
Derek Clegg [email protected]
|
|
||||||
Derek M. Jones [email protected]
|
Derek M. Jones [email protected]
|
||||||
Di-an Jan [email protected]
|
Di-an Jan [email protected]
|
||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
Didier Godefroy [email protected]
|
||||||
Efi Fogel [email protected]
|
|
||||||
Enrico Scholz [email protected]
|
Enrico Scholz [email protected]
|
||||||
Eric Blake [email protected]
|
Eric Blake [email protected]
|
||||||
Étienne Renault [email protected]
|
|
||||||
Evgeny Stambulchik [email protected]
|
Evgeny Stambulchik [email protected]
|
||||||
Fabrice Bauzac [email protected]
|
Fabrice Bauzac [email protected]
|
||||||
Ferdinand Thiessen [email protected]
|
|
||||||
Florian Krohm [email protected]
|
Florian Krohm [email protected]
|
||||||
Frank Heckenbach [email protected]
|
Frank Heckenbach [email protected]
|
||||||
Frans Englich [email protected]
|
Frans Englich [email protected]
|
||||||
Gabriel Rassoul [email protected]
|
|
||||||
Gary L Peskin [email protected]
|
|
||||||
Georg Sauthoff [email protected]
|
Georg Sauthoff [email protected]
|
||||||
George Neuner [email protected]
|
George Neuner [email protected]
|
||||||
Gilles Espinasse [email protected]
|
Gilles Espinasse [email protected]
|
||||||
Goran Uddeborg [email protected]
|
Goran Uddeborg [email protected]
|
||||||
Guido Trentalancia [email protected]
|
Guido Trentalancia [email protected]
|
||||||
H. Merijn Brand [email protected]
|
H. Merijn Brand [email protected]
|
||||||
Hans Åberg haberg[email protected]
|
Hans Aberg haberg@matematik.su.se
|
||||||
Jan Nieuwenhuizen [email protected]
|
Jan Nieuwenhuizen [email protected]
|
||||||
Jannick [email protected]
|
|
||||||
Jerry Quinn [email protected]
|
Jerry Quinn [email protected]
|
||||||
Jesse Thilo [email protected]
|
Jesse Thilo [email protected]
|
||||||
Jim Kent [email protected]
|
Jim Kent [email protected]
|
||||||
Jim Meyering [email protected]
|
Jim Meyering [email protected]
|
||||||
Joel E. Denny [email protected]
|
Joel E. Denny [email protected]
|
||||||
Johan van Selst [email protected]
|
Johan van Selst [email protected]
|
||||||
John Horigan [email protected]
|
|
||||||
Jonathan Fabrizio [email protected]
|
Jonathan Fabrizio [email protected]
|
||||||
Jonathan Nieder [email protected]
|
Jonathan Nieder [email protected]
|
||||||
Josh Soref [email protected]
|
|
||||||
Juan Manuel Guerrero [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
Kees Zeelenberg [email protected]
|
Kees Zeelenberg [email protected]
|
||||||
Keith Browne [email protected]
|
Keith Browne [email protected]
|
||||||
Ken Moffat [email protected]
|
|
||||||
Laurent Mascherpa [email protected]
|
Laurent Mascherpa [email protected]
|
||||||
Lie Yan [email protected]
|
Lie Yan [email protected]
|
||||||
Magnus Fromreide [email protected]
|
Magnus Fromreide [email protected]
|
||||||
@@ -94,21 +74,14 @@ Martin Mokrejs [email protected]
|
|||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
Matt Kraai [email protected]
|
Matt Kraai [email protected]
|
||||||
Matt Rosing [email protected]
|
Matt Rosing [email protected]
|
||||||
Maxim Prohorenko [email protected]
|
|
||||||
Michael Catanzaro [email protected]
|
|
||||||
Michael Felt [email protected]
|
|
||||||
Michael Hayes [email protected]
|
Michael Hayes [email protected]
|
||||||
Michael Raskin [email protected]
|
Michael Raskin [email protected]
|
||||||
Michel d'Hooge [email protected]
|
|
||||||
Michiel De Wilde [email protected]
|
Michiel De Wilde [email protected]
|
||||||
Mickael Labau [email protected]
|
Mickael Labau [email protected]
|
||||||
Mike Castle [email protected]
|
Mike Castle [email protected]
|
||||||
Mike Sullivan [email protected]
|
|
||||||
Nate Guerin [email protected]
|
|
||||||
Neil Booth [email protected]
|
Neil Booth [email protected]
|
||||||
Nelson H. F. Beebe [email protected]
|
Nelson H. F. Beebe [email protected]
|
||||||
Nick Bowler [email protected]
|
Nick Bowler [email protected]
|
||||||
Nicolas Bedon [email protected]
|
|
||||||
Nicolas Burrus [email protected]
|
Nicolas Burrus [email protected]
|
||||||
Nicolas Tisserand [email protected]
|
Nicolas Tisserand [email protected]
|
||||||
Noah Friedman [email protected]
|
Noah Friedman [email protected]
|
||||||
@@ -116,7 +89,6 @@ Odd Arild Olsen [email protected]
|
|||||||
Oleg Smolsky [email protected]
|
Oleg Smolsky [email protected]
|
||||||
Oleksii Taran [email protected]
|
Oleksii Taran [email protected]
|
||||||
Paolo Bonzini [email protected]
|
Paolo Bonzini [email protected]
|
||||||
Paolo Simone Gasparello [email protected]
|
|
||||||
Pascal Bart [email protected]
|
Pascal Bart [email protected]
|
||||||
Paul Eggert [email protected]
|
Paul Eggert [email protected]
|
||||||
Paul Hilfinger [email protected]
|
Paul Hilfinger [email protected]
|
||||||
@@ -125,47 +97,35 @@ Peter Eisentraut [email protected]
|
|||||||
Peter Fales [email protected]
|
Peter Fales [email protected]
|
||||||
Peter Hamorsky [email protected]
|
Peter Hamorsky [email protected]
|
||||||
Peter Simons [email protected]
|
Peter Simons [email protected]
|
||||||
Petr Machata [email protected]
|
|
||||||
Pho [email protected]
|
|
||||||
Piotr Gackiewicz [email protected]
|
Piotr Gackiewicz [email protected]
|
||||||
Piotr Marcińczyk [email protected]
|
|
||||||
Quentin Hocquet [email protected]
|
Quentin Hocquet [email protected]
|
||||||
Quoc Peyrot [email protected]
|
Quoc Peyrot [email protected]
|
||||||
R Blake [email protected]
|
R Blake [email protected]
|
||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
Rich Wilson [email protected]
|
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
Rici Lake [email protected]
|
|
||||||
Rob Conde [email protected]
|
|
||||||
Rob Vermaas [email protected]
|
Rob Vermaas [email protected]
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
Robert Yang [email protected]
|
|
||||||
Roland Levillain [email protected]
|
Roland Levillain [email protected]
|
||||||
Satya Kiran Popuri [email protected]
|
Satya Kiran Popuri [email protected]
|
||||||
Sebastian Setzer [email protected]
|
Sebastian Setzer [email protected]
|
||||||
Sebastien Fricker [email protected]
|
Sebastien Fricker [email protected]
|
||||||
Sergei Steshenko [email protected]
|
Sergei Steshenko [email protected]
|
||||||
Shura [email protected]
|
Shura [email protected]
|
||||||
Simon Sobisch [email protected]
|
|
||||||
Stefano Lattarini [email protected]
|
Stefano Lattarini [email protected]
|
||||||
Stephen Cameron [email protected]
|
|
||||||
Steve Murphy [email protected]
|
Steve Murphy [email protected]
|
||||||
Sum Wu [email protected]
|
Sum Wu [email protected]
|
||||||
Théophile Ranquet [email protected]
|
Théophile Ranquet [email protected]
|
||||||
Thiru Ramakrishnan [email protected]
|
Thiru Ramakrishnan [email protected]
|
||||||
Thomas Jahns [email protected]
|
|
||||||
Tim Josling [email protected]
|
Tim Josling [email protected]
|
||||||
Tim Landscheidt [email protected]
|
Tim Landscheidt [email protected]
|
||||||
Tim Van Holder [email protected]
|
Tim Van Holder [email protected]
|
||||||
Tobias Frost [email protected]
|
|
||||||
Tom Lane [email protected]
|
Tom Lane [email protected]
|
||||||
Tom Tromey [email protected]
|
Tom Tromey [email protected]
|
||||||
Tommy Nordgren [email protected]
|
Tommy Nordgren [email protected]
|
||||||
Troy A. Johnson [email protected]
|
Troy A. Johnson [email protected]
|
||||||
Tys Lefering [email protected]
|
Tys Lefering [email protected]
|
||||||
Valentin Tolmer [email protected]
|
Valentin Tolmer [email protected]
|
||||||
Victor Khomenko [email protected]
|
|
||||||
Vin Shelton [email protected]
|
Vin Shelton [email protected]
|
||||||
W.C.A. Wijngaards [email protected]
|
W.C.A. Wijngaards [email protected]
|
||||||
Wayne Green [email protected]
|
Wayne Green [email protected]
|
||||||
@@ -174,9 +134,7 @@ Wojciech Polak [email protected]
|
|||||||
Wolfgang S. Kechel [email protected]
|
Wolfgang S. Kechel [email protected]
|
||||||
Wolfram Wagner [email protected]
|
Wolfram Wagner [email protected]
|
||||||
Wwp [email protected]
|
Wwp [email protected]
|
||||||
xolodho [email protected]
|
|
||||||
Zack Weinberg [email protected]
|
Zack Weinberg [email protected]
|
||||||
長田偉伸 [email protected]
|
|
||||||
|
|
||||||
Many people are not named here because we lost track of them. We
|
Many people are not named here because we lost track of them. We
|
||||||
thank them! Please, help us keeping this list up to date.
|
thank them! Please, help us keeping this list up to date.
|
||||||
@@ -188,7 +146,7 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
This file is part of Bison, the GNU Parser Generator.
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,16 @@
|
|||||||
* Short term
|
* Short term
|
||||||
** Graphviz display code thoughts
|
** Graphviz display code thoughts
|
||||||
The code for the --graph option is over two files: print_graph, and
|
The code for the --graph option is over two files: print_graph, and
|
||||||
graphviz. This is because Bison used to also produce VCG graphs, but since
|
graphviz. I believe this is because Bison used to also produce VCG graphs,
|
||||||
this is no longer true, maybe we could consider these files for fusion.
|
but since this is no longer true, maybe we could consider these files for
|
||||||
|
fusion.
|
||||||
|
|
||||||
An other consideration worth noting is that print_graph.c (correct me if I
|
Little effort factoring seems to have been given to factoring in these files,
|
||||||
am wrong) should contain generic functions, whereas graphviz.c and other
|
and their print-xml and print counterpart. We would very much like to re-use
|
||||||
potential files should contain just the specific code for that output
|
the pretty format of states from .output in the .dot
|
||||||
format. It will probably prove difficult to tell if the implementation is
|
|
||||||
actually generic whilst only having support for a single format, but it
|
|
||||||
would be nice to keep stuff a bit tidier: right now, the construction of the
|
|
||||||
bitset used to show reductions is in the graphviz-specific code, and on the
|
|
||||||
opposite side we have some use of \l, which is graphviz-specific, in what
|
|
||||||
should be generic code.
|
|
||||||
|
|
||||||
Little effort seems to have been given to factoring these files and their
|
Also, the underscore in print_graph.[ch] isn't very fitting considering
|
||||||
rint{,-xml} counterpart. We would very much like to re-use the pretty format
|
the dashes in the other filenames.
|
||||||
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
|
** push-parser
|
||||||
Check it too when checking the different kinds of parsers. And be
|
Check it too when checking the different kinds of parsers. And be
|
||||||
@@ -112,7 +101,7 @@ We could (should?) also treat the case of the undef_token, which is
|
|||||||
numbered 257 for yylex, and 2 internal. Both appear for instance in
|
numbered 257 for yylex, and 2 internal. Both appear for instance in
|
||||||
toknum:
|
toknum:
|
||||||
|
|
||||||
const unsigned short
|
const unsigned short int
|
||||||
parser::yytoken_number_[] =
|
parser::yytoken_number_[] =
|
||||||
{
|
{
|
||||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
||||||
@@ -176,13 +165,13 @@ part of $default. Should we make the two reductions explicit, or just
|
|||||||
keep $default? See the following point.
|
keep $default? See the following point.
|
||||||
|
|
||||||
** Disabled Reductions
|
** Disabled Reductions
|
||||||
See 'tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
See `tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
||||||
what we want to do.
|
what we want to do.
|
||||||
|
|
||||||
** Documentation
|
** Documentation
|
||||||
Extend with error productions. The hard part will probably be finding
|
Extend with error productions. The hard part will probably be finding
|
||||||
the right rule so that a single state does not exhibit too many yet
|
the right rule so that a single state does not exhibit too many yet
|
||||||
undocumented ''features''. Maybe an empty action ought to be
|
undocumented ``features''. Maybe an empty action ought to be
|
||||||
presented too. Shall we try to make a single grammar with all these
|
presented too. Shall we try to make a single grammar with all these
|
||||||
features, or should we have several very small grammars?
|
features, or should we have several very small grammars?
|
||||||
|
|
||||||
@@ -196,24 +185,6 @@ DeRemer and Penello: they already provide the algorithm.
|
|||||||
|
|
||||||
|
|
||||||
* Extensions
|
* Extensions
|
||||||
** Multiple start symbols
|
|
||||||
Would be very useful when parsing closely related languages.
|
|
||||||
|
|
||||||
** Better error messages
|
|
||||||
The users are not provided with enough tools to forge their error messages.
|
|
||||||
See for instance "Is there an option to change the message produced by
|
|
||||||
YYERROR_VERBOSE?" by Simon Sobisch, on bison-help.
|
|
||||||
|
|
||||||
** %include
|
|
||||||
This is a popular demand. We already made many changes in the parser that
|
|
||||||
should make this reasonably easy to implement.
|
|
||||||
|
|
||||||
** Push parsers
|
|
||||||
There is demand for push parsers in Java and C++. And GLR I guess.
|
|
||||||
|
|
||||||
** Generate code instead of tables
|
|
||||||
This is certainly quite a lot of work. See
|
|
||||||
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4539.
|
|
||||||
|
|
||||||
** $-1
|
** $-1
|
||||||
We should find a means to provide an access to values deep in the
|
We should find a means to provide an access to values deep in the
|
||||||
@@ -249,10 +220,6 @@ XML output for GNU Bison and gcc
|
|||||||
XML output for GNU Bison
|
XML output for GNU Bison
|
||||||
http://yaxx.sourceforge.net/
|
http://yaxx.sourceforge.net/
|
||||||
|
|
||||||
** Counterexample generation
|
|
||||||
https://lists.gnu.org/archive/html/bug-bison/2016-06/msg00000.html
|
|
||||||
http://www.cs.cornell.edu/andru/papers/cupex/
|
|
||||||
|
|
||||||
* Unit rules
|
* Unit rules
|
||||||
Maybe we could expand unit rules, i.e., transform
|
Maybe we could expand unit rules, i.e., transform
|
||||||
|
|
||||||
@@ -265,9 +232,9 @@ into
|
|||||||
exp: exp '+' exp | exp '&' exp;
|
exp: exp '+' exp | exp '&' exp;
|
||||||
|
|
||||||
when there are no actions. This can significantly speed up some
|
when there are no actions. This can significantly speed up some
|
||||||
grammars. I can't find the papers. In particular the book 'LR
|
grammars. I can't find the papers. In particular the book `LR
|
||||||
parsing: Theory and Practice' is impossible to find, but according to
|
parsing: Theory and Practice' is impossible to find, but according to
|
||||||
'Parsing Techniques: a Practical Guide', it includes information about
|
`Parsing Techniques: a Practical Guide', it includes information about
|
||||||
this issue. Does anybody have it?
|
this issue. Does anybody have it?
|
||||||
|
|
||||||
|
|
||||||
@@ -387,13 +354,11 @@ Here's a proposal for how a new implementation might look:
|
|||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
coding: utf-8
|
coding: utf-8
|
||||||
fill-column: 76
|
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018 Free Software Foundation,
|
Copyright (C) 2001-2004, 2006, 2008-2013 Free Software Foundation, Inc.
|
||||||
Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2018-10-13.05; # UTC
|
scriptversion=2012-12-28.10; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,7 +17,7 @@ scriptversion=2018-10-13.05; # UTC
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Originally written by Paul Eggert. The canonical version of this
|
# Originally written by Paul Eggert. The canonical version of this
|
||||||
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
||||||
@@ -42,13 +42,8 @@ export LC_ALL
|
|||||||
|
|
||||||
local_gl_dir=gl
|
local_gl_dir=gl
|
||||||
|
|
||||||
# Honor $PERL, but work even if there is none.
|
|
||||||
PERL="${PERL-perl}"
|
|
||||||
|
|
||||||
me=$0
|
me=$0
|
||||||
|
|
||||||
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $me [OPTION]...
|
Usage: $me [OPTION]...
|
||||||
@@ -78,37 +73,6 @@ contents are read as shell variables to configure the bootstrap.
|
|||||||
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||||
are honored.
|
are honored.
|
||||||
|
|
||||||
Gnulib sources can be fetched in various ways:
|
|
||||||
|
|
||||||
* If this package is in a git repository with a 'gnulib' submodule
|
|
||||||
configured, then that submodule is initialized and updated and sources
|
|
||||||
are fetched from there. If \$GNULIB_SRCDIR is set (directly or via
|
|
||||||
--gnulib-srcdir) and is a git repository, then it is used as a reference.
|
|
||||||
|
|
||||||
* Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
|
|
||||||
then sources are fetched from that local directory. If it is a git
|
|
||||||
repository and \$GNULIB_REVISION is set, then that revision is checked
|
|
||||||
out.
|
|
||||||
|
|
||||||
* Otherwise, if this package is in a git repository with a 'gnulib'
|
|
||||||
submodule configured, then that submodule is initialized and updated and
|
|
||||||
sources are fetched from there.
|
|
||||||
|
|
||||||
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources are
|
|
||||||
cloned into that directory using git from \$GNULIB_URL, defaulting to
|
|
||||||
$default_gnulib_url.
|
|
||||||
If \$GNULIB_REVISION is set, then that revision is checked out.
|
|
||||||
|
|
||||||
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
|
|
||||||
used. If it is a git repository and \$GNULIB_REVISION is set, then that
|
|
||||||
revision is checked out.
|
|
||||||
|
|
||||||
If you maintain a package and want to pin a particular revision of the
|
|
||||||
Gnulib sources that has been tested with your package, then there are two
|
|
||||||
possible approaches: either configure a 'gnulib' submodule with the
|
|
||||||
appropriate revision, or set \$GNULIB_REVISION (and if necessary
|
|
||||||
\$GNULIB_URL) in $me.conf.
|
|
||||||
|
|
||||||
Running without arguments will suffice in most cases.
|
Running without arguments will suffice in most cases.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -162,28 +126,34 @@ bootstrap_post_import_hook() { :; }
|
|||||||
# Override it via your own definition in bootstrap.conf.
|
# Override it via your own definition in bootstrap.conf.
|
||||||
bootstrap_epilogue() { :; }
|
bootstrap_epilogue() { :; }
|
||||||
|
|
||||||
# The command to download all .po files for a specified domain into a
|
# The command to download all .po files for a specified domain into
|
||||||
# specified directory. Fill in the first %s with the destination
|
# a specified directory. Fill in the first %s is the domain name, and
|
||||||
# directory and the second with the domain name.
|
# the second with the destination directory. Use rsync's -L and -r
|
||||||
|
# options because the latest/%s directory and the .po files within are
|
||||||
|
# all symlinks.
|
||||||
po_download_command_format=\
|
po_download_command_format=\
|
||||||
"wget --mirror --level=1 -nd -q -A.po -P '%s' \
|
"rsync --delete --exclude '*.s1' -Lrtvz \
|
||||||
https://translationproject.org/latest/%s/"
|
'translationproject.org::tp/latest/%s/' '%s'"
|
||||||
|
|
||||||
|
# Fallback for downloading .po files (if rsync fails).
|
||||||
|
po_download_command_format2=\
|
||||||
|
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||||
|
http://translationproject.org/latest/%s/"
|
||||||
|
|
||||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
|
||||||
# fall back to the package name (1st argument with munging)
|
|
||||||
extract_package_name='
|
extract_package_name='
|
||||||
/^AC_INIT(\[*/{
|
/^AC_INIT(/{
|
||||||
s///
|
/.*,.*,.*, */{
|
||||||
/^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
|
s///
|
||||||
s//\1/
|
s/[][]//g
|
||||||
s/[],)].*//
|
s/)$//
|
||||||
p
|
p
|
||||||
q
|
q
|
||||||
}
|
}
|
||||||
s/[],)].*//
|
s/AC_INIT(\[*//
|
||||||
|
s/]*,.*//
|
||||||
s/^GNU //
|
s/^GNU //
|
||||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||||
s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
|
s/[^A-Za-z0-9_]/-/g
|
||||||
p
|
p
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
@@ -196,15 +166,7 @@ source_base=lib
|
|||||||
m4_base=m4
|
m4_base=m4
|
||||||
doc_base=doc
|
doc_base=doc
|
||||||
tests_base=tests
|
tests_base=tests
|
||||||
gnulib_extra_files="
|
gnulib_extra_files=''
|
||||||
build-aux/install-sh
|
|
||||||
build-aux/mdate-sh
|
|
||||||
build-aux/texinfo.tex
|
|
||||||
build-aux/depcomp
|
|
||||||
build-aux/config.guess
|
|
||||||
build-aux/config.sub
|
|
||||||
doc/INSTALL
|
|
||||||
"
|
|
||||||
|
|
||||||
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
||||||
gnulib_tool_option_extras=
|
gnulib_tool_option_extras=
|
||||||
@@ -246,26 +208,12 @@ bootstrap_sync=false
|
|||||||
# Use git to update gnulib sources
|
# Use git to update gnulib sources
|
||||||
use_git=true
|
use_git=true
|
||||||
|
|
||||||
check_exists() {
|
|
||||||
if test "$1" = "--verbose"; then
|
|
||||||
($2 --version </dev/null) >/dev/null 2>&1
|
|
||||||
if test $? -ge 126; then
|
|
||||||
# If not found, run with diagnostics as one may be
|
|
||||||
# presented with env variables to set to find the right version
|
|
||||||
($2 --version </dev/null)
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
($1 --version </dev/null) >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
test $? -lt 126
|
|
||||||
}
|
|
||||||
|
|
||||||
# find_tool ENVVAR NAMES...
|
# find_tool ENVVAR NAMES...
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# Search for a required program. Use the value of ENVVAR, if set,
|
# Search for a required program. Use the value of ENVVAR, if set,
|
||||||
# otherwise find the first of the NAMES that can be run.
|
# otherwise find the first of the NAMES that can be run (i.e.,
|
||||||
# If found, set ENVVAR to the program name, die otherwise.
|
# supports --version). If found, set ENVVAR to the program name,
|
||||||
|
# die otherwise.
|
||||||
#
|
#
|
||||||
# FIXME: code duplication, see also gnu-web-doc-update.
|
# FIXME: code duplication, see also gnu-web-doc-update.
|
||||||
find_tool ()
|
find_tool ()
|
||||||
@@ -275,21 +223,27 @@ find_tool ()
|
|||||||
find_tool_names=$@
|
find_tool_names=$@
|
||||||
eval "find_tool_res=\$$find_tool_envvar"
|
eval "find_tool_res=\$$find_tool_envvar"
|
||||||
if test x"$find_tool_res" = x; then
|
if test x"$find_tool_res" = x; then
|
||||||
for i; do
|
for i
|
||||||
if check_exists $i; then
|
do
|
||||||
find_tool_res=$i
|
if ($i --version </dev/null) >/dev/null 2>&1; then
|
||||||
break
|
find_tool_res=$i
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||||
fi
|
fi
|
||||||
if test x"$find_tool_res" = x; then
|
test x"$find_tool_res" != x \
|
||||||
warn_ "one of these is required: $find_tool_names;"
|
|| die "one of these is required: $find_tool_names"
|
||||||
die "alternatively set $find_tool_envvar to a compatible tool"
|
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
||||||
fi
|
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||||
eval "$find_tool_envvar=\$find_tool_res"
|
eval "$find_tool_envvar=\$find_tool_res"
|
||||||
eval "export $find_tool_envvar"
|
eval "export $find_tool_envvar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
|
||||||
|
find_tool SHA1SUM sha1sum gsha1sum shasum
|
||||||
|
|
||||||
# Override the default configuration, if necessary.
|
# Override the default configuration, if necessary.
|
||||||
# Make sure that bootstrap.conf is sourced from the current directory
|
# Make sure that bootstrap.conf is sourced from the current directory
|
||||||
# if we were invoked as "sh bootstrap".
|
# if we were invoked as "sh bootstrap".
|
||||||
@@ -298,18 +252,24 @@ case "$0" in
|
|||||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Extra files from gnulib, which override files from other sources.
|
||||||
|
test -z "${gnulib_extra_files}" && \
|
||||||
|
gnulib_extra_files="
|
||||||
|
$build_aux/install-sh
|
||||||
|
$build_aux/mdate-sh
|
||||||
|
$build_aux/texinfo.tex
|
||||||
|
$build_aux/depcomp
|
||||||
|
$build_aux/config.guess
|
||||||
|
$build_aux/config.sub
|
||||||
|
doc/INSTALL
|
||||||
|
"
|
||||||
|
|
||||||
if test "$vc_ignore" = auto; then
|
if test "$vc_ignore" = auto; then
|
||||||
vc_ignore=
|
vc_ignore=
|
||||||
test -d .git && vc_ignore=.gitignore
|
test -d .git && vc_ignore=.gitignore
|
||||||
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
|
|
||||||
use_gnulib=false
|
|
||||||
else
|
|
||||||
use_gnulib=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Translate configuration into internal form.
|
# Translate configuration into internal form.
|
||||||
|
|
||||||
# Parse options.
|
# Parse options.
|
||||||
@@ -346,34 +306,34 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
|||||||
die "Bootstrapping from a non-checked-out distribution is risky."
|
die "Bootstrapping from a non-checked-out distribution is risky."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Strip blank and comment lines to leave significant entries.
|
# Ensure that lines starting with ! sort last, per gitignore conventions
|
||||||
gitignore_entries() {
|
# for whitelisting exceptions after a more generic blacklist pattern.
|
||||||
sed '/^#/d; /^$/d' "$@"
|
sort_patterns() {
|
||||||
|
sort -u "$@" | sed '/^!/ {
|
||||||
|
H
|
||||||
|
d
|
||||||
|
}
|
||||||
|
$ {
|
||||||
|
P
|
||||||
|
x
|
||||||
|
s/^\n//
|
||||||
|
}' | sed '/^$/d'
|
||||||
}
|
}
|
||||||
|
|
||||||
# If $STR is not already on a line by itself in $FILE, insert it at the start.
|
# If $STR is not already on a line by itself in $FILE, insert it,
|
||||||
# Entries are inserted at the start of the ignore list to ensure existing
|
# sorting the new contents of the file and replacing $FILE with the result.
|
||||||
# entries starting with ! are not overridden. Such entries support
|
insert_sorted_if_absent() {
|
||||||
# whitelisting exceptions after a more generic blacklist pattern.
|
|
||||||
insert_if_absent() {
|
|
||||||
file=$1
|
file=$1
|
||||||
str=$2
|
str=$2
|
||||||
test -f $file || touch $file
|
test -f $file || touch $file
|
||||||
test -r $file || die "Error: failed to read ignore file: $file"
|
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|
||||||
duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
|
|| { echo "$str" | sort_patterns - $file > $file.bak \
|
||||||
if [ "$duplicate_entries" ] ; then
|
&& mv $file.bak $file; } \
|
||||||
die "Error: Duplicate entries in $file: " $duplicate_entries
|
|| die "insert_sorted_if_absent $file $str: failed"
|
||||||
fi
|
|
||||||
linesold=$(gitignore_entries $file | wc -l)
|
|
||||||
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
|
|
||||||
if [ $linesold != $linesnew ] ; then
|
|
||||||
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
|
||||||
|| die "insert_if_absent $file $str: failed"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
||||||
# insert_if_absent.
|
# insert_sorted_if_absent.
|
||||||
insert_vc_ignore() {
|
insert_vc_ignore() {
|
||||||
vc_ignore_file="$1"
|
vc_ignore_file="$1"
|
||||||
pattern="$2"
|
pattern="$2"
|
||||||
@@ -384,7 +344,7 @@ insert_vc_ignore() {
|
|||||||
# .gitignore entry.
|
# .gitignore entry.
|
||||||
pattern=$(echo "$pattern" | sed s,^,/,);;
|
pattern=$(echo "$pattern" | sed s,^,/,);;
|
||||||
esac
|
esac
|
||||||
insert_if_absent "$vc_ignore_file" "$pattern"
|
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
||||||
@@ -446,30 +406,28 @@ sort_ver() { # sort -V is not generally available
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
get_version_sed='
|
|
||||||
# Move version to start of line.
|
|
||||||
s/.*[v ]\([0-9]\)/\1/
|
|
||||||
|
|
||||||
# Skip lines that do not start with version.
|
|
||||||
/^[0-9]/!d
|
|
||||||
|
|
||||||
# Remove characters after the version.
|
|
||||||
s/[^.a-z0-9-].*//
|
|
||||||
|
|
||||||
# The first component must be digits only.
|
|
||||||
s/^\([0-9]*\)[a-z-].*/\1/
|
|
||||||
|
|
||||||
#the following essentially does s/5.005/5.5/
|
|
||||||
s/\.0*\([1-9]\)/.\1/g
|
|
||||||
p
|
|
||||||
q'
|
|
||||||
|
|
||||||
get_version() {
|
get_version() {
|
||||||
app=$1
|
app=$1
|
||||||
|
|
||||||
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
|
$app --version >/dev/null 2>&1 || return 1
|
||||||
|
|
||||||
$app --version 2>&1 | sed -n "$get_version_sed"
|
$app --version 2>&1 |
|
||||||
|
sed -n '# Move version to start of line.
|
||||||
|
s/.*[v ]\([0-9]\)/\1/
|
||||||
|
|
||||||
|
# Skip lines that do not start with version.
|
||||||
|
/^[0-9]/!d
|
||||||
|
|
||||||
|
# Remove characters after the version.
|
||||||
|
s/[^.a-z0-9-].*//
|
||||||
|
|
||||||
|
# The first component must be digits only.
|
||||||
|
s/^\([0-9]*\)[a-z-].*/\1/
|
||||||
|
|
||||||
|
#the following essentially does s/5.005/5.5/
|
||||||
|
s/\.0*\([1-9]\)/.\1/g
|
||||||
|
p
|
||||||
|
q'
|
||||||
}
|
}
|
||||||
|
|
||||||
check_versions() {
|
check_versions() {
|
||||||
@@ -489,7 +447,6 @@ check_versions() {
|
|||||||
test "$appvar" = TAR && appvar=AMTAR
|
test "$appvar" = TAR && appvar=AMTAR
|
||||||
case $appvar in
|
case $appvar in
|
||||||
GZIP) ;; # Do not use $GZIP: it contains gzip options.
|
GZIP) ;; # Do not use $GZIP: it contains gzip options.
|
||||||
PERL::*) ;; # Keep perl modules as-is
|
|
||||||
*) eval "app=\${$appvar-$app}" ;;
|
*) eval "app=\${$appvar-$app}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -507,22 +464,12 @@ check_versions() {
|
|||||||
ret=1
|
ret=1
|
||||||
continue
|
continue
|
||||||
} ;;
|
} ;;
|
||||||
# Another check is for perl modules. These can be written as
|
|
||||||
# e.g. perl::XML::XPath in case of XML::XPath module, etc.
|
|
||||||
perl::*)
|
|
||||||
# Extract module name
|
|
||||||
app="${app#perl::}"
|
|
||||||
if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then
|
|
||||||
warn_ "Error: perl module '$app' not found"
|
|
||||||
ret=1
|
|
||||||
fi
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
if [ "$req_ver" = "-" ]; then
|
if [ "$req_ver" = "-" ]; then
|
||||||
# Merely require app to exist; not all prereq apps are well-behaved
|
# Merely require app to exist; not all prereq apps are well-behaved
|
||||||
# so we have to rely on $? rather than get_version.
|
# so we have to rely on $? rather than get_version.
|
||||||
if ! check_exists --verbose $app; then
|
$app --version >/dev/null 2>&1
|
||||||
|
if [ 126 -le $? ]; then
|
||||||
warn_ "Error: '$app' not found"
|
warn_ "Error: '$app' not found"
|
||||||
ret=1
|
ret=1
|
||||||
fi
|
fi
|
||||||
@@ -555,12 +502,6 @@ print_versions() {
|
|||||||
# can't depend on column -t
|
# can't depend on column -t
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
|
|
||||||
# Also find the compatible sha1 utility on the BSDs
|
|
||||||
if test x"$SKIP_PO" = x; then
|
|
||||||
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
|
|
||||||
fi
|
|
||||||
|
|
||||||
use_libtool=0
|
use_libtool=0
|
||||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||||
@@ -606,21 +547,13 @@ if ! printf "$buildreq" | check_versions; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Warn the user if autom4te appears to be broken; this causes known
|
|
||||||
# issues with at least gettext 0.18.3.
|
|
||||||
probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -)
|
|
||||||
if test "x$probe" != xhi; then
|
|
||||||
warn_ "WARNING: your autom4te wrapper eats stdin;"
|
|
||||||
warn_ "if bootstrap fails, consider upgrading your autotools"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||||
|
|
||||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
# See if we can use gnulib's git-merge-changelog merge driver.
|
||||||
if $use_git && test -d .git && check_exists git; then
|
if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
||||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
if git config merge.merge-changelog.driver >/dev/null ; then
|
||||||
:
|
:
|
||||||
elif check_exists git-merge-changelog; then
|
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
||||||
echo "$0: initializing git-merge-changelog driver"
|
echo "$0: initializing git-merge-changelog driver"
|
||||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
||||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
||||||
@@ -640,101 +573,83 @@ git_modules_config () {
|
|||||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
if $use_gnulib; then
|
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||||
if $use_git; then
|
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
|
||||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
# Get gnulib files.
|
||||||
|
|
||||||
|
case ${GNULIB_SRCDIR--} in
|
||||||
|
-)
|
||||||
|
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||||
|
echo "$0: getting gnulib files..."
|
||||||
|
git submodule init || exit $?
|
||||||
|
git submodule update || exit $?
|
||||||
|
|
||||||
|
elif [ ! -d "$gnulib_path" ]; then
|
||||||
|
echo "$0: getting gnulib files..."
|
||||||
|
|
||||||
|
trap cleanup_gnulib 1 2 13 15
|
||||||
|
|
||||||
|
shallow=
|
||||||
|
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||||
|
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
|
||||||
|
cleanup_gnulib
|
||||||
|
|
||||||
|
trap - 1 2 13 15
|
||||||
fi
|
fi
|
||||||
|
GNULIB_SRCDIR=$gnulib_path
|
||||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
;;
|
||||||
# submodule, for use in the rest of the script.
|
*)
|
||||||
|
# Use GNULIB_SRCDIR as a reference.
|
||||||
case ${GNULIB_SRCDIR--} in
|
if test -d "$GNULIB_SRCDIR"/.git && \
|
||||||
-)
|
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||||
# Note that $use_git is necessarily true in this case.
|
echo "$0: getting gnulib files..."
|
||||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
if git submodule -h|grep -- --reference > /dev/null; then
|
||||||
echo "$0: getting gnulib files..."
|
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||||
git submodule init -- "$gnulib_path" || exit $?
|
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||||
git submodule update -- "$gnulib_path" || exit $?
|
"$gnulib_path" || exit $?
|
||||||
|
else
|
||||||
elif [ ! -d "$gnulib_path" ]; then
|
# This fallback allows at least git 1.5.5.
|
||||||
echo "$0: getting gnulib files..."
|
if test -f "$gnulib_path"/gnulib-tool; then
|
||||||
|
# Since file already exists, assume submodule init already complete.
|
||||||
trap cleanup_gnulib 1 2 13 15
|
git submodule update || exit $?
|
||||||
|
else
|
||||||
shallow=
|
# Older git can't clone into an empty directory.
|
||||||
if test -z "$GNULIB_REVISION"; then
|
rmdir "$gnulib_path" 2>/dev/null
|
||||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
git clone --reference "$GNULIB_SRCDIR" \
|
||||||
|
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||||
|
&& git submodule init && git submodule update \
|
||||||
|
|| exit $?
|
||||||
fi
|
fi
|
||||||
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
|
||||||
|| cleanup_gnulib
|
|
||||||
|
|
||||||
trap - 1 2 13 15
|
|
||||||
fi
|
fi
|
||||||
GNULIB_SRCDIR=$gnulib_path
|
GNULIB_SRCDIR=$gnulib_path
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Use GNULIB_SRCDIR directly or as a reference.
|
|
||||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
|
||||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
|
||||||
echo "$0: getting gnulib files..."
|
|
||||||
if git submodule -h|grep -- --reference > /dev/null; then
|
|
||||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
|
||||||
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
|
||||||
"$gnulib_path" || exit $?
|
|
||||||
else
|
|
||||||
# This fallback allows at least git 1.5.5.
|
|
||||||
if test -f "$gnulib_path"/gnulib-tool; then
|
|
||||||
# Since file already exists, assume submodule init already complete.
|
|
||||||
git submodule update -- "$gnulib_path" || exit $?
|
|
||||||
else
|
|
||||||
# Older git can't clone into an empty directory.
|
|
||||||
rmdir "$gnulib_path" 2>/dev/null
|
|
||||||
git clone --reference "$GNULIB_SRCDIR" \
|
|
||||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
|
||||||
&& git submodule init -- "$gnulib_path" \
|
|
||||||
&& git submodule update -- "$gnulib_path" \
|
|
||||||
|| exit $?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
GNULIB_SRCDIR=$gnulib_path
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
|
|
||||||
&& ! git_modules_config submodule.gnulib.url >/dev/null; then
|
|
||||||
(cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
|
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
if $bootstrap_sync; then
|
||||||
# we no longer need to use git or $gnulib_path below here.
|
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||||
|
echo "$0: updating bootstrap and restarting..."
|
||||||
if $bootstrap_sync; then
|
exec sh -c \
|
||||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||||
echo "$0: updating bootstrap and restarting..."
|
-- "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||||
case $(sh -c 'echo "$1"' -- a) in
|
"$0" "$@" --no-bootstrap-sync
|
||||||
a) ignored=--;;
|
}
|
||||||
*) ignored=ignored;;
|
|
||||||
esac
|
|
||||||
exec sh -c \
|
|
||||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
|
||||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
|
||||||
"$0" "$@" --no-bootstrap-sync
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
|
||||||
<$gnulib_tool || exit $?
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||||
|
<$gnulib_tool || exit $?
|
||||||
|
|
||||||
# Get translations.
|
# Get translations.
|
||||||
|
|
||||||
download_po_files() {
|
download_po_files() {
|
||||||
subdir=$1
|
subdir=$1
|
||||||
domain=$2
|
domain=$2
|
||||||
echo "$me: getting translations into $subdir for $domain..."
|
echo "$me: getting translations into $subdir for $domain..."
|
||||||
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
|
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
||||||
|
eval "$cmd" && return
|
||||||
|
# Fallback to HTTP.
|
||||||
|
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,10 +680,11 @@ update_po_files() {
|
|||||||
cksum_file="$ref_po_dir/$po.s1"
|
cksum_file="$ref_po_dir/$po.s1"
|
||||||
if ! test -f "$cksum_file" ||
|
if ! test -f "$cksum_file" ||
|
||||||
! test -f "$po_dir/$po.po" ||
|
! test -f "$po_dir/$po.po" ||
|
||||||
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
|
! $SHA1SUM -c --status "$cksum_file" \
|
||||||
|
< "$new_po" > /dev/null; then
|
||||||
echo "$me: updated $po_dir/$po.po..."
|
echo "$me: updated $po_dir/$po.po..."
|
||||||
cp "$new_po" "$po_dir/$po.po" \
|
cp "$new_po" "$po_dir/$po.po" \
|
||||||
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
|
&& $SHA1SUM < "$new_po" > "$cksum_file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -824,9 +740,9 @@ symlink_to_dir()
|
|||||||
# Leave any existing symlink alone, if it already points to the source,
|
# Leave any existing symlink alone, if it already points to the source,
|
||||||
# so that broken build tools that care about symlink times
|
# so that broken build tools that care about symlink times
|
||||||
# aren't confused into doing unnecessary builds. Conversely, if the
|
# aren't confused into doing unnecessary builds. Conversely, if the
|
||||||
# existing symlink's timestamp is older than the source, make it afresh,
|
# existing symlink's time stamp is older than the source, make it afresh,
|
||||||
# so that broken tools aren't confused into skipping needed builds. See
|
# so that broken tools aren't confused into skipping needed builds. See
|
||||||
# <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
|
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
|
||||||
test -h "$dst" &&
|
test -h "$dst" &&
|
||||||
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
||||||
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
||||||
@@ -932,33 +848,31 @@ fi
|
|||||||
|
|
||||||
# Import from gnulib.
|
# Import from gnulib.
|
||||||
|
|
||||||
if $use_gnulib; then
|
gnulib_tool_options="\
|
||||||
gnulib_tool_options="\
|
--import\
|
||||||
--no-changelog\
|
--no-changelog\
|
||||||
--aux-dir=$build_aux\
|
--aux-dir $build_aux\
|
||||||
--doc-base=$doc_base\
|
--doc-base $doc_base\
|
||||||
--lib=$gnulib_name\
|
--lib $gnulib_name\
|
||||||
--m4-base=$m4_base/\
|
--m4-base $m4_base/\
|
||||||
--source-base=$source_base/\
|
--source-base $source_base/\
|
||||||
--tests-base=$tests_base\
|
--tests-base $tests_base\
|
||||||
--local-dir=$local_gl_dir\
|
--local-dir $local_gl_dir\
|
||||||
$gnulib_tool_option_extras\
|
$gnulib_tool_option_extras\
|
||||||
"
|
"
|
||||||
if test $use_libtool = 1; then
|
if test $use_libtool = 1; then
|
||||||
case "$gnulib_tool_options " in
|
case "$gnulib_tool_options " in
|
||||||
*' --libtool '*) ;;
|
*' --libtool '*) ;;
|
||||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
|
||||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
|
||||||
|| die "gnulib-tool failed"
|
|
||||||
|
|
||||||
for file in $gnulib_files; do
|
|
||||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
|
||||||
|| die "failed to symlink $file"
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||||
|
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
||||||
|
|
||||||
|
for file in $gnulib_files; do
|
||||||
|
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||||
|
|| die "failed to symlink $file"
|
||||||
|
done
|
||||||
|
|
||||||
bootstrap_post_import_hook \
|
bootstrap_post_import_hook \
|
||||||
|| die "bootstrap_post_import_hook failed"
|
|| die "bootstrap_post_import_hook failed"
|
||||||
@@ -1055,9 +969,9 @@ bootstrap_epilogue
|
|||||||
echo "$0: done. Now you can run './configure'."
|
echo "$0: done. Now you can run './configure'."
|
||||||
|
|
||||||
# Local variables:
|
# Local variables:
|
||||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
# time-stamp-start: "scriptversion="
|
# time-stamp-start: "scriptversion="
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
# time-stamp-time-zone: "UTC0"
|
# time-stamp-time-zone: "UTC"
|
||||||
# time-stamp-end: "; # UTC"
|
# time-stamp-end: "; # UTC"
|
||||||
# End:
|
# End:
|
||||||
|
|||||||
+5
-8
@@ -1,6 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,8 +17,7 @@
|
|||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
argmatch assert
|
argmatch assert calloc-posix close closeout config-h c-strcase
|
||||||
calloc-posix close closeout config-h c-strcase
|
|
||||||
configmake
|
configmake
|
||||||
dirname
|
dirname
|
||||||
error extensions fdl fopen-safer
|
error extensions fdl fopen-safer
|
||||||
@@ -34,10 +33,8 @@ gnulib_modules='
|
|||||||
quote quotearg
|
quote quotearg
|
||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
||||||
timevar
|
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
||||||
unistd unistd-safer unlink unlocked-io
|
|
||||||
update-copyright unsetenv verify
|
|
||||||
warnings
|
warnings
|
||||||
xalloc
|
xalloc
|
||||||
xalloc-die
|
xalloc-die
|
||||||
@@ -83,7 +80,7 @@ gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
|
|||||||
bootstrap_post_import_hook()
|
bootstrap_post_import_hook()
|
||||||
{
|
{
|
||||||
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
||||||
build-aux/prefix-gnulib-mk --lib-name="$gnulib_name" "lib/$gnulib_mk"
|
build-aux/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
|
||||||
|
|
||||||
# Ensure that ChangeLog exists, for automake.
|
# Ensure that ChangeLog exists, for automake.
|
||||||
test -f ChangeLog || touch ChangeLog
|
test -f ChangeLog || touch ChangeLog
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
/announce-gen
|
/announce-gen
|
||||||
|
/arg-nonnull.h
|
||||||
|
/c++defs.h
|
||||||
/compile
|
/compile
|
||||||
/config.guess
|
/config.guess
|
||||||
/config.rpath
|
/config.rpath
|
||||||
@@ -14,12 +16,14 @@
|
|||||||
/install-sh
|
/install-sh
|
||||||
/javacomp.sh.in
|
/javacomp.sh.in
|
||||||
/javaexec.sh.in
|
/javaexec.sh.in
|
||||||
|
/link-warning.h
|
||||||
/mdate-sh
|
/mdate-sh
|
||||||
/missing
|
/missing
|
||||||
/prefix-gnulib-mk
|
|
||||||
/test-driver
|
/test-driver
|
||||||
/texinfo.tex
|
/texinfo.tex
|
||||||
/update-copyright
|
/update-copyright
|
||||||
/useless-if-before-free
|
/useless-if-before-free
|
||||||
/vc-list-files
|
/vc-list-files
|
||||||
|
/warn-on-use.h
|
||||||
/ylwrap
|
/ylwrap
|
||||||
|
/prefix-gnulib-mk
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Valgrind suppression file for Bison.
|
|
||||||
|
|
||||||
# Travis Trusty, 2018-09-07.
|
|
||||||
{
|
|
||||||
libstdcxx_init
|
|
||||||
Memcheck:Leak
|
|
||||||
match-leak-kinds: reachable
|
|
||||||
fun:malloc
|
|
||||||
obj:/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
|
|
||||||
fun:call_init.part.0
|
|
||||||
fun:call_init
|
|
||||||
fun:_dl_init
|
|
||||||
obj:/lib/x86_64-linux-gnu/ld-2.19.so
|
|
||||||
}
|
|
||||||
|
|
||||||
# Linux prague 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015
|
|
||||||
# x86_64 GNU/Linux
|
|
||||||
{
|
|
||||||
Probably exception handling from G++ 5.1.
|
|
||||||
Memcheck:Leak
|
|
||||||
match-leak-kinds: reachable
|
|
||||||
fun:malloc
|
|
||||||
fun:pool
|
|
||||||
fun:__static_initialization_and_destruction_0
|
|
||||||
fun:_GLOBAL__sub_I_eh_alloc.cc
|
|
||||||
fun:call_init.part.0
|
|
||||||
fun:_dl_init
|
|
||||||
obj:/usr/lib/ld-2.21.so
|
|
||||||
}
|
|
||||||
|
|
||||||
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
|
|
||||||
# x86_64 GNU/Linux
|
|
||||||
{
|
|
||||||
index
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:index
|
|
||||||
fun:expand_dynamic_string_token
|
|
||||||
fun:_dl_map_object
|
|
||||||
fun:map_doit
|
|
||||||
fun:_dl_catch_error
|
|
||||||
fun:do_preload
|
|
||||||
fun:dl_main
|
|
||||||
fun:_dl_sysdep_start
|
|
||||||
fun:_dl_start
|
|
||||||
obj:/lib/ld-2.11.3.so
|
|
||||||
}
|
|
||||||
@@ -35,7 +35,7 @@ while (<STDIN>)
|
|||||||
$arg =~ s/^=//;
|
$arg =~ s/^=//;
|
||||||
$arg = lc ($arg);
|
$arg = lc ($arg);
|
||||||
my $dir_arg = $arg;
|
my $dir_arg = $arg;
|
||||||
# If the argument is complete (e.g., for --define[=NAME[=VALUE]]),
|
# If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
|
||||||
# put each word in @var, to build @var{name}[=@var{value}], not
|
# put each word in @var, to build @var{name}[=@var{value}], not
|
||||||
# @var{name[=value]}].
|
# @var{name[=value]}].
|
||||||
$arg =~ s/(\w+)/\@var{$1}/g;
|
$arg =~ s/(\w+)/\@var{$1}/g;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -2,9 +2,6 @@
|
|||||||
# option. It specifies what changes to make to each given SHA1's commit
|
# option. It specifies what changes to make to each given SHA1's commit
|
||||||
# log and metadata, using Perl-eval'able expressions.
|
# log and metadata, using Perl-eval'able expressions.
|
||||||
|
|
||||||
975bb564319aa4f4204c48aba265757ba207a80f
|
|
||||||
s/Edligner/Edlinger/;
|
|
||||||
|
|
||||||
0db2648930e3b6c376a539aabe368aade83ee29a
|
0db2648930e3b6c376a539aabe368aade83ee29a
|
||||||
s/--flags/--feature/;
|
s/--flags/--feature/;
|
||||||
s/flag_flag/feature_flag/;
|
s/flag_flag/feature_flag/;
|
||||||
|
|||||||
@@ -1,234 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Install Intel Parallel Studio on Travis CI
|
|
||||||
# https://github.com/nemequ/icc-travis
|
|
||||||
#
|
|
||||||
# Originally written for Squash <https://github.com/quixdb/squash> by
|
|
||||||
# Evan Nemerson. For documentation, bug reports, support requests,
|
|
||||||
# etc. please use <https://github.com/nemequ/icc-travis>.
|
|
||||||
#
|
|
||||||
# To the extent possible under law, the author(s) of this script have
|
|
||||||
# waived all copyright and related or neighboring rights to this work.
|
|
||||||
# See <https://creativecommons.org/publicdomain/zero/1.0/> for
|
|
||||||
# details.
|
|
||||||
|
|
||||||
# Tools - Not very useful in non-interactive mode.
|
|
||||||
COMPONENTS_VTUNE="intel-vtune-amplifier-xe-2016-cli__x86_64;intel-vtune-amplifier-xe-2016-common__noarch;intel-vtune-amplifier-xe-2016-cli-common__noarch;intel-vtune-amplifier-xe-2016-collector-64linux__x86_64;intel-vtune-amplifier-xe-2016-sep__noarch;intel-vtune-amplifier-xe-2016-gui-common__noarch;intel-vtune-amplifier-xe-2016-gui__x86_64;intel-vtune-amplifier-xe-2016-common-pset__noarch"
|
|
||||||
COMPONENTS_INSPECTOR="intel-inspector-xe-2016-cli__x86_64;intel-inspector-xe-2016-cli-common__noarch;intel-inspector-xe-2016-gui-common__noarch;intel-inspector-xe-2016-gui__x86_64;intel-inspector-xe-2016-cli-pset__noarch"
|
|
||||||
COMPONENTS_ADVISOR="intel-advisor-xe-2016-cli__x86_64;intel-advisor-xe-2016-cli-common__noarch;intel-advisor-xe-2016-gui-common__noarch;intel-advisor-xe-2016-gui__x86_64;intel-advisor-xe-2016-cli-pset__noarch"
|
|
||||||
COMPONENTS_GDB="intel-gdb-gt__x86_64;intel-gdb-gt-src__noarch;intel-gdb-gt-libelfdwarf__x86_64;intel-gdb-gt-devel__x86_64;intel-gdb-gt-common__noarch;intel-gdb-ps-cdt__x86_64;intel-gdb-ps-cdt-source__x86_64;intel-gdb-ps-mic__x86_64;intel-gdb-ps-mpm__x86_64;intel-gdb__x86_64;intel-gdb-source__noarch;intel-gdb-python-source__noarch;intel-gdb-common__noarch;intel-gdb-ps-common__noarch"
|
|
||||||
|
|
||||||
# Parallel libraries
|
|
||||||
COMPONENTS_MPI="intel-mpi-rt-core__x86_64;intel-mpi-rt-mic__x86_64;intel-mpi-sdk-core__x86_64;intel-mpi-sdk-mic__x86_64;intel-mpi-psxe__x86_64;intel-mpi-rt-psxe__x86_64"
|
|
||||||
COMPONENTS_TBB="intel-tbb-libs__noarch;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-tbb-source__noarch;intel-tbb-devel__noarch;intel-tbb-common__noarch;intel-tbb-ps-common__noarch;intel-tbb-psxe__noarch"
|
|
||||||
COMPONENTS_MKL="intel-mkl__x86_64;intel-mkl-ps__x86_64;intel-mkl-common__noarch;intel-mkl-ps-common__noarch;intel-mkl-devel__x86_64;intel-mkl-ps-mic-devel__x86_64;intel-mkl-ps-f95-devel__x86_64;intel-mkl-gnu-devel__x86_64;intel-mkl-ps-gnu-devel__x86_64;intel-mkl-ps-pgi-devel__x86_64;intel-mkl-sp2dp-devel__x86_64;intel-mkl-ps-cluster-devel__x86_64;intel-mkl-ps-cluster-common__noarch;intel-mkl-ps-f95-common__noarch;intel-mkl-ps-cluster__x86_64;intel-mkl-gnu__x86_64;intel-mkl-ps-gnu__x86_64;intel-mkl-ps-pgi__x86_64;intel-mkl-sp2dp__x86_64;intel-mkl-ps-mic__x86_64;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-mkl-psxe__noarch"
|
|
||||||
COMPONENTS_IPP="intel-ipp-l-common__noarch;intel-ipp-l-ps-common__noarch;intel-ipp-l-st__x86_64;intel-ipp-l-mt__x86_64;intel-ipp-l-st-devel__x86_64;intel-ipp-l-ps-st-devel__x86_64;intel-ipp-l-mt-devel__x86_64;intel-ipp-psxe__noarch"
|
|
||||||
COMPONENTS_IPP_CRYPTO="intel-crypto-ipp-st-devel__x86_64;intel-crypto-ipp-ps-st-devel__x86_64;intel-crypto-ipp-st__x86_64;intel-crypto-ipp-mt-devel__x86_64;intel-crypto-ipp-mt__x86_64;intel-crypto-ipp-ss-st-devel__x86_64;intel-crypto-ipp-common__noarch"
|
|
||||||
COMPONENTS_DAAL="intel-daal__x86_64;intel-daal-common__noarch"
|
|
||||||
|
|
||||||
# Compilers
|
|
||||||
COMPONENTS_OPENMP="intel-openmp-l-all__x86_64;intel-openmp-l-ps-mic__x86_64;intel-openmp-l-ps__x86_64;intel-openmp-l-ps-ss__x86_64;intel-openmp-l-all-devel__x86_64;intel-openmp-l-ps-mic-devel__x86_64;intel-openmp-l-ps-devel__x86_64;intel-openmp-l-ps-ss-devel__x86_64"
|
|
||||||
COMPONENTS_COMPILER_COMMON="intel-comp-l-all-vars__noarch;intel-comp-l-all-common;intel-comp-l-ps-common;intel-comp-l-all-devel;intel-comp-l-ps-ss-devel;intel-comp-l-ps-ss-wrapper;intel-comp-l-all-devel;intel-comp-l-ps-devel__x86_64;intel-comp-l-ps-ss-devel__x86_64;intel-psf-intel__x86_64;intel-icsxe-pset;intel-ipsf__noarch;intel-ccompxe__noarch;${COMPONENTS_OPENMP}"
|
|
||||||
COMPONENTS_IFORT="intel-ifort-l-ps__x86_64;intel-ifort-l-ps-vars__noarch;intel-ifort-l-ps-common__noarch;intel-ifort-l-ps-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
|
|
||||||
COMPONENTS_ICC="intel-icc-l-all__x86_64;intel-icc-l-ps-ss__x86_64;intel-icc-l-all-vars__noarch;intel-icc-l-all-common__noarch;intel-icc-l-ps-common__noarch;intel-icc-l-all-devel__x86_64;intel-icc-l-ps-devel__x86_64;intel-icc-l-ps-ss-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
|
|
||||||
|
|
||||||
DESTINATION="${HOME}/intel"
|
|
||||||
TEMPORARY_FILES="/tmp"
|
|
||||||
PHONE_INTEL="no"
|
|
||||||
COMPONENTS=""
|
|
||||||
|
|
||||||
add_components() {
|
|
||||||
if [ ! -z "${COMPONENTS}" ]; then
|
|
||||||
COMPONENTS="${COMPONENTS};$1"
|
|
||||||
else
|
|
||||||
COMPONENTS="$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
while [ $# != 0 ]; do
|
|
||||||
case "$1" in
|
|
||||||
"--dest")
|
|
||||||
DESTINATION="$(realpath "$2")"; shift
|
|
||||||
;;
|
|
||||||
"--tmpdir")
|
|
||||||
TEMPORARY_FILES="$2"; shift
|
|
||||||
;;
|
|
||||||
"--components")
|
|
||||||
shift
|
|
||||||
OLD_IFS="${IFS}"
|
|
||||||
IFS=","
|
|
||||||
for component in $1; do
|
|
||||||
case "$component" in
|
|
||||||
"icc")
|
|
||||||
add_components "${COMPONENTS_ICC}"
|
|
||||||
;;
|
|
||||||
"mpi")
|
|
||||||
add_components "${COMPONENTS_MPI}"
|
|
||||||
;;
|
|
||||||
"vtune")
|
|
||||||
add_components "${COMPONENTS_VTUNE}"
|
|
||||||
;;
|
|
||||||
"inspector")
|
|
||||||
add_components "${COMPONENTS_INSPECTOR}"
|
|
||||||
;;
|
|
||||||
"advisor")
|
|
||||||
add_components "${COMPONENTS_ADVISOR}"
|
|
||||||
;;
|
|
||||||
"tbb")
|
|
||||||
add_components "${COMPONENTS_TBB}"
|
|
||||||
;;
|
|
||||||
"ifort")
|
|
||||||
add_components "${COMPONENTS_IFORT}"
|
|
||||||
;;
|
|
||||||
"mkl")
|
|
||||||
add_components "${COMPONENTS_MKL}"
|
|
||||||
;;
|
|
||||||
"openmp")
|
|
||||||
# Noop, here for compatability. OpenMP is installed with icc and ifort now.
|
|
||||||
;;
|
|
||||||
"ipp")
|
|
||||||
add_components "${COMPONENTS_IPP}"
|
|
||||||
;;
|
|
||||||
"ipp-crypto")
|
|
||||||
add_components "${COMPONENTS_IPP_CRYPTO}"
|
|
||||||
;;
|
|
||||||
"gdb")
|
|
||||||
add_components "${COMPONENTS_GDB}"
|
|
||||||
;;
|
|
||||||
"daal")
|
|
||||||
add_components "${COMPONENTS_DAAL}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown component '$component'"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
IFS="${OLD_IFS}"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized argument '$1'"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "${COMPONENTS}" ]; then
|
|
||||||
COMPONENTS="${COMPONENTS_ICC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
INSTALLER_SCRIPT="parallel_studio_xe_2016_update3_online.sh"
|
|
||||||
INSTALLER="${TEMPORARY_FILES}/${INSTALLER_SCRIPT}"
|
|
||||||
INSTALLER_URL="http://registrationcenter-download.intel.com/akdlm/irc_nas/9061/${INSTALLER_SCRIPT}"
|
|
||||||
SILENT_CFG="${TEMPORARY_FILES}/silent.cfg"
|
|
||||||
SUCCESS_INDICATOR="${TEMPORARY_FILES}/icc-travis-success"
|
|
||||||
|
|
||||||
if [ ! -e "${TEMPORARY_FILES}" ]; then
|
|
||||||
echo "${TEMPORARY_FILES} does not exist, creating..."
|
|
||||||
mkdir -p "${TEMPORARY_FILES}" || (sudo mkdir -p "${TEMPORARY_FILES}" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${DESTINATION}" ]; then
|
|
||||||
echo "${DESTINATION} does not exist, creating..."
|
|
||||||
mkdir -p "${DESTINATION}" || (sudo mkdir -p "${DESTINATION}" && sudo chown -R "${USER}:${USER}" "${DESTINATION}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${INSTALLER}" ]; then
|
|
||||||
wget -O "${INSTALLER}" "${INSTALLER_URL}" || exit 1
|
|
||||||
fi
|
|
||||||
chmod u+x "${INSTALLER}"
|
|
||||||
|
|
||||||
# See https://software.intel.com/en-us/articles/intel-composer-xe-2015-silent-installation-guide
|
|
||||||
echo "# Generated silent configuration file" > "${SILENT_CFG}"
|
|
||||||
echo "ACCEPT_EULA=accept" >> "${SILENT_CFG}"
|
|
||||||
echo "INSTALL_MODE=NONRPM" >> "${SILENT_CFG}"
|
|
||||||
echo "CONTINUE_WITH_OPTIONAL_ERROR=yes" >> "${SILENT_CFG}"
|
|
||||||
echo "PSET_INSTALL_DIR=${DESTINATION}" >> "${SILENT_CFG}"
|
|
||||||
echo "CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes" >> "${SILENT_CFG}"
|
|
||||||
echo "COMPONENTS=${COMPONENTS}" >> "${SILENT_CFG}"
|
|
||||||
echo "PSET_MODE=install" >> "${SILENT_CFG}"
|
|
||||||
echo "PHONEHOME_SEND_USAGE_DATA=${PHONE_INTEL}" >> "${SILENT_CFG}"
|
|
||||||
if [ "x" != "x${INTEL_SERIAL_NUMBER}" ]; then
|
|
||||||
echo "ACTIVATION_SERIAL_NUMBER=${INTEL_SERIAL_NUMBER}" >> "${SILENT_CFG}"
|
|
||||||
echo "ACTIVATION_TYPE=serial_number" >> "${SILENT_CFG}"
|
|
||||||
else
|
|
||||||
echo "ACTIVATION_TYPE=trial_lic" >> "${SILENT_CFG}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
attempt=1;
|
|
||||||
while [ $attempt -le 3 ]; do
|
|
||||||
if [ ! -e "${TEMPORARY_FILES}/parallel-studio-install-data" ]; then
|
|
||||||
mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" || (sudo mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
("${INSTALLER}" \
|
|
||||||
-t "${TEMPORARY_FILES}/parallel-studio-install-data" \
|
|
||||||
-s "${SILENT_CFG}" \
|
|
||||||
--cli-mode \
|
|
||||||
--user-mode && \
|
|
||||||
touch "${SUCCESS_INDICATOR}") &
|
|
||||||
|
|
||||||
# So Travis doesn't die in case of a long download/installation.
|
|
||||||
#
|
|
||||||
# NOTE: a watched script never terminates.
|
|
||||||
elapsed=0;
|
|
||||||
while kill -0 $! 2>/dev/null; do
|
|
||||||
sleep 1
|
|
||||||
elapsed=$(expr $elapsed + 1)
|
|
||||||
if [ $(expr $elapsed % 60) -eq 0 ]; then
|
|
||||||
mins_elapsed=$(expr $elapsed / 60)
|
|
||||||
if [ $mins_elapsed = 1 ]; then
|
|
||||||
minute_string="minute"
|
|
||||||
else
|
|
||||||
minute_string="minutes"
|
|
||||||
fi
|
|
||||||
echo "Still running... (about $(expr $elapsed / 60) ${minute_string} so far)."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -e "${SUCCESS_INDICATOR}" ]; then
|
|
||||||
echo "Installation failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
|
|
||||||
# Sometimes the installer returns successfully without actually
|
|
||||||
# installing anything. Let's try again…
|
|
||||||
echo "Installation attempt #${attempt} completed, but unable to find compilervars.sh."
|
|
||||||
find "${DESTINATION}"
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -vrf "${TEMPORARY_FILES}/parallel-studio-install-data"
|
|
||||||
echo "Trying again..."
|
|
||||||
|
|
||||||
attempt=$(expr $attempt + 1)
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
|
|
||||||
echo "Installation failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Apparently the installer drops the license file in a location it
|
|
||||||
# doesn't know to check.
|
|
||||||
ln -s "${DESTINATION}"/licenses ~/Licenses
|
|
||||||
|
|
||||||
# Add configuration information to ~/.bashrc. Unfortunately this will
|
|
||||||
# not be picked up automatically by Travis, so you'll still need to
|
|
||||||
# source ~/.bashrc in your .travis.yml
|
|
||||||
#
|
|
||||||
# Container-based builds include a `[ -z "$PS1" ] && return` near the
|
|
||||||
# beginning of the file, so appending won't work, we'll need to
|
|
||||||
# prepend.
|
|
||||||
echo "export INTEL_INSTALL_PATH=\"${DESTINATION}\"" >> ~/.bashrc-intel
|
|
||||||
echo ". \"\${INTEL_INSTALL_PATH}/bin/compilervars.sh\" intel64" >> ~/.bashrc-intel
|
|
||||||
echo "export LD_LIBRARY_PATH=\"\${INTEL_INSTALL_PATH}/ism/bin/intel64:\${INTEL_INSTALL_PATH}/lib/intel64_lin:\$LD_LIBRARY_PATH\"" >> ~/.bashrc-intel
|
|
||||||
echo "export PATH=\"\${INTEL_INSTALL_PATH}/bin:\$PATH\"" >> ~/.bashrc-intel
|
|
||||||
echo "function uninstall_intel_software {" >> ~/.bashrc-intel
|
|
||||||
echo " find \"\${INTEL_INSTALL_PATH}\" -name 'uninstall.sh' -not -path '*/ism/uninstall.sh' -exec {} -s \;" >> ~/.bashrc-intel
|
|
||||||
echo "}" >> ~/.bashrc-intel
|
|
||||||
cat ~/.bashrc >> ~/.bashrc-intel
|
|
||||||
mv ~/.bashrc-intel ~/.bashrc
|
|
||||||
+8
-7
@@ -1,4 +1,6 @@
|
|||||||
# Copyright (C) 2000-2015, 2018 Free Software Foundation, Inc.
|
## Makefile for Bison testsuite.
|
||||||
|
|
||||||
|
# Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,10 +15,9 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
build-aux/Darwin.valgrind \
|
build-aux/cross-options.pl \
|
||||||
build-aux/Linux.valgrind \
|
build-aux/darwin11.4.0.valgrind \
|
||||||
build-aux/cross-options.pl \
|
build-aux/move-if-change \
|
||||||
build-aux/move-if-change \
|
build-aux/prev-version.txt \
|
||||||
build-aux/prev-version.txt \
|
|
||||||
build-aux/update-b4-copyright
|
build-aux/update-b4-copyright
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
/_Noreturn.h
|
||||||
|
/arg-nonnull.h
|
||||||
|
/c++defs.h
|
||||||
|
/warn-on-use.h
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
# Update b4_copyright invocations or b4_copyright_years definitions to
|
||||||
# include the current year.
|
# include the current year.
|
||||||
|
|
||||||
# Copyright (C) 2009-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
||||||
|
|
||||||
# Copyright (C) 2010-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2010-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Customize maint.mk -*- makefile -*-
|
# Customize maint.mk -*- makefile -*-
|
||||||
# Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,15 +26,15 @@ regen: _version
|
|||||||
manual_title = The Yacc-compatible Parser Generator
|
manual_title = The Yacc-compatible Parser Generator
|
||||||
gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
|
gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
|
||||||
|
|
||||||
# It's useful to run maintainer-check* targets during development, but we
|
# It's useful to run maintainer-*check* targets during development, but we
|
||||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
||||||
# override the _is-dist-target from GNUmakefile so that maintainer-check*
|
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
|
||||||
# targets are filtered out.
|
# targets are filtered out.
|
||||||
_is-dist-target = $(filter-out %clean maintainer-check%, \
|
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
||||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
||||||
|
|
||||||
url_dir_list = \
|
url_dir_list = \
|
||||||
https://$(gnu_rel_host)/gnu/bison
|
ftp://$(gnu_rel_host)/gnu/bison
|
||||||
|
|
||||||
# Tests not to run as part of "make distcheck".
|
# Tests not to run as part of "make distcheck".
|
||||||
local-checks-to-skip = \
|
local-checks-to-skip = \
|
||||||
@@ -135,7 +135,7 @@ _sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
|||||||
|
|
||||||
_space_before_paren_exempt =? \\n\\$$
|
_space_before_paren_exempt =? \\n\\$$
|
||||||
_space_before_paren_exempt = \
|
_space_before_paren_exempt = \
|
||||||
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init)|symbol)
|
(^ *\#|\\n\\$$|%s\(to %s|(date|group|character)\(s\))
|
||||||
# Ensure that there is a space before each open parenthesis in C code.
|
# Ensure that there is a space before each open parenthesis in C code.
|
||||||
sc_space_before_open_paren:
|
sc_space_before_open_paren:
|
||||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
||||||
@@ -158,24 +158,22 @@ sc_space_before_open_paren:
|
|||||||
|
|
||||||
exclude = \
|
exclude = \
|
||||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
||||||
$(call exclude, \
|
$(call exclude, \
|
||||||
bindtextdomain=^lib/main.c$$ \
|
bindtextdomain=^lib/main.c$$ \
|
||||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||||
program_name=^lib/main.c$$ \
|
program_name=^lib/main.c$$ \
|
||||||
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
|
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
|
||||||
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
||||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||||
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
|
prohibit_always_true_header_tests=^djgpp/subpipe.h$$|^lib/timevar.c$$ \
|
||||||
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
|
prohibit_always_true_header_tests+=?|^m4/timevar.m4$$ \
|
||||||
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
||||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||||
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
||||||
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
||||||
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
|
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
|
||||||
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^djgpp/|^\.git|Makefile$$ \
|
prohibit_tab_based_indentation=\.(am|mk)$$|^djgpp/|^\.git \
|
||||||
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||||
space_before_open_paren=^(data/|djgpp/) \
|
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||||
two_space_separator_in_usage=^(bootstrap|build-aux/install-icc.sh) \
|
|
||||||
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
|
||||||
)
|
)
|
||||||
|
|||||||
+34
-63
@@ -1,6 +1,6 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,23 +18,26 @@
|
|||||||
# In order for some versions of Sun Studio to compile our C++ test cases
|
# In order for some versions of Sun Studio to compile our C++ test cases
|
||||||
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
# correctly, we need Autoconf 2.64 or better to handle the restrict
|
||||||
# keyword in at least string.h from gnulib. We need Autoconf 2.68 or
|
# keyword in at least string.h from gnulib. We need Autoconf 2.68 or
|
||||||
# better to avoid a typo in the 'configure --help' entry for the YACC
|
# better to avoid a typo in the `configure --help' entry for the YACC
|
||||||
# environment variable.
|
# environment variable.
|
||||||
AC_PREREQ([2.68])
|
AC_PREREQ([2.68])
|
||||||
m4_pattern_forbid([^_?(gl_[A-Z]|AX_|BISON_)])
|
m4_pattern_forbid([^gl_[A-Z]])
|
||||||
m4_pattern_allow([^BISON_USE_NLS$])
|
|
||||||
|
|
||||||
AC_INIT([GNU Bison],
|
AC_INIT([GNU Bison],
|
||||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||||
[[email protected]])
|
[[email protected]])
|
||||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2018])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2013])
|
||||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||||
[The copyright year for this package])
|
[The copyright year for this package])
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
# We use Automake 1.14's %D% and %C%.
|
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here:
|
||||||
|
#
|
||||||
|
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
|
||||||
|
#
|
||||||
|
# To avoid 1.11, we make 1.11.1 the minimum version.
|
||||||
#
|
#
|
||||||
# We want gnits strictness only when rolling a stable release. For
|
# We want gnits strictness only when rolling a stable release. For
|
||||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
||||||
@@ -42,7 +45,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||||||
# releases, we want to be able run make dist without being required to
|
# releases, we want to be able run make dist without being required to
|
||||||
# add a bogus NEWS entry. In that case, the version string
|
# add a bogus NEWS entry. In that case, the version string
|
||||||
# automatically contains a dash, which we also let disable gnits.
|
# automatically contains a dash, which we also let disable gnits.
|
||||||
AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc
|
AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
|
||||||
color-tests parallel-tests
|
color-tests parallel-tests
|
||||||
silent-rules]
|
silent-rules]
|
||||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
||||||
@@ -71,31 +74,16 @@ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
|||||||
[lv_cv_gcc_pragma_push_works=no])
|
[lv_cv_gcc_pragma_push_works=no])
|
||||||
CFLAGS=$save_CFLAGS])
|
CFLAGS=$save_CFLAGS])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
|
||||||
gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
|
|
||||||
BISON_CXXSTD([98])
|
|
||||||
BISON_CXXSTD([03])
|
|
||||||
BISON_CXXSTD([11])
|
|
||||||
BISON_CXXSTD([14])
|
|
||||||
BISON_CXXSTD([17])
|
|
||||||
BISON_CXXSTD([2a])
|
|
||||||
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([gcc-warnings],
|
AC_ARG_ENABLE([gcc-warnings],
|
||||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended).
|
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
||||||
Also, issue synclines from the examples/ to
|
|
||||||
the corresponding source in the Texinfo doc.],
|
|
||||||
[case $enable_gcc_warnings in
|
[case $enable_gcc_warnings in
|
||||||
yes|no) ;;
|
yes|no) ;;
|
||||||
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
|
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
|
||||||
esac],
|
esac],
|
||||||
[enable_gcc_warnings=no])
|
[enable_gcc_warnings=no])
|
||||||
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
|
||||||
if test "$enable_gcc_warnings" = yes; then
|
if test "$enable_gcc_warnings" = yes; then
|
||||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
||||||
-fparse-all-comments -Wdocumentation
|
-Wformat -Wpointer-arith -Wwrite-strings'
|
||||||
-Wformat -Wnull-dereference -Wpointer-arith -Wwrite-strings'
|
|
||||||
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||||
warn_cxx='-Wnoexcept'
|
warn_cxx='-Wnoexcept'
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
@@ -103,12 +91,7 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
# -fno-color-diagnostics: Clang's use of colors in the error
|
# -fno-color-diagnostics: Clang's use of colors in the error
|
||||||
# messages is confusing the tests looking at the compiler's output
|
# messages is confusing the tests looking at the compiler's output
|
||||||
# (e.g., synclines.at).
|
# (e.g., synclines.at).
|
||||||
#
|
warn_tests='-Wundef -pedantic -fno-color-diagnostics'
|
||||||
# -Wno-keyword-macro: We use the "#define private public" dirty
|
|
||||||
# trick in the test suite to check some private implementation
|
|
||||||
# details for lalr1.cc.
|
|
||||||
warn_tests='-Wundef -pedantic -Wdeprecated -Wsign-compare -fno-color-diagnostics
|
|
||||||
-Wno-keyword-macro'
|
|
||||||
|
|
||||||
AC_LANG_PUSH([C])
|
AC_LANG_PUSH([C])
|
||||||
# Clang supports many of GCC's -W options, but only issues warnings
|
# Clang supports many of GCC's -W options, but only issues warnings
|
||||||
@@ -160,18 +143,13 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS_TEST])
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS_TEST])
|
||||||
done
|
done
|
||||||
# Clang++ 3.2+ reject C code generated by Flex.
|
# Clang++ 3.2+ reject C code generated by Flex.
|
||||||
gl_WARN_ADD([-Wno-null-conversion], [FLEX_SCANNER_CXXFLAGS])
|
gl_WARN_ADD([-Wno-null-conversion], [WARN_NO_NULL_CONVERSION_CXXFLAGS])
|
||||||
# So does G++ 4.8...
|
# Variants break strict aliasing analysis.
|
||||||
gl_WARN_ADD([-Wno-sign-compare], [FLEX_SCANNER_CXXFLAGS])
|
gl_WARN_ADD([-fno-strict-aliasing], [NO_STRICT_ALIAS_CXXFLAGS])
|
||||||
# ... possibly in std=c++11 mode.
|
|
||||||
gl_WARN_ADD([-Wno-zero-as-null-pointer-constant], [FLEX_SCANNER_CXXFLAGS])
|
|
||||||
CXXFLAGS=$save_CXXFLAGS
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
# Clang++ deprecates compiling C.
|
|
||||||
gl_WARN_ADD([-Wno-deprecated], [WNO_DEPRECATED_CXXFLAGS])
|
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||||
BISON_C_COMPILER_POSIXLY_CORRECT
|
BISON_C_COMPILER_POSIXLY_CORRECT
|
||||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
@@ -181,17 +159,21 @@ AC_ARG_ENABLE([yacc],
|
|||||||
[AC_HELP_STRING([--disable-yacc],
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
[do not build a yacc command or an -ly library])],
|
[do not build a yacc command or an -ly library])],
|
||||||
, [enable_yacc=yes])
|
, [enable_yacc=yes])
|
||||||
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
case $enable_yacc in
|
||||||
|
yes)
|
||||||
|
YACC_SCRIPT=src/yacc
|
||||||
|
YACC_LIBRARY=lib/liby.a;;
|
||||||
|
*)
|
||||||
|
YACC_SCRIPT=
|
||||||
|
YACC_LIBRARY=;;
|
||||||
|
esac
|
||||||
|
AC_SUBST([YACC_SCRIPT])
|
||||||
|
AC_SUBST([YACC_LIBRARY])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AM_MISSING_PROG([DOT], [dot])
|
AM_MISSING_PROG([DOT], [dot])
|
||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
$LEX_IS_FLEX || test "X$LEX" = X: || {
|
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
|
||||||
AC_MSG_WARN([bypassing lex because flex is required])
|
|
||||||
LEX=:
|
|
||||||
}
|
|
||||||
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
|
||||||
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
|
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
AC_PROG_GNU_M4
|
||||||
@@ -219,6 +201,7 @@ gl_INIT
|
|||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_CHECK_FUNCS_ONCE([setlocale])
|
AC_CHECK_FUNCS_ONCE([setlocale])
|
||||||
AM_WITH_DMALLOC
|
AM_WITH_DMALLOC
|
||||||
|
BISON_PREREQ_TIMEVAR
|
||||||
|
|
||||||
# Gettext.
|
# Gettext.
|
||||||
# We use gnulib, which is only guaranteed to work properly with the
|
# We use gnulib, which is only guaranteed to work properly with the
|
||||||
@@ -237,37 +220,25 @@ AC_SUBST([aclocaldir])
|
|||||||
AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
||||||
|
|
||||||
# Initialize the test suite.
|
# Initialize the test suite.
|
||||||
AC_CONFIG_TESTDIR(tests)
|
AC_CONFIG_TESTDIR([tests], [$ac_abs_top_builddir/tests])
|
||||||
AC_CONFIG_FILES([tests/atlocal])
|
AC_CONFIG_FILES([tests/atlocal])
|
||||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||||
|
|
||||||
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
||||||
# Use something simpler that $host_os to select our suppression file.
|
case $VALGRIND:$host_os in
|
||||||
uname=`uname`
|
|
||||||
case $VALGRIND:$uname in
|
|
||||||
'':*) ;;
|
'':*) ;;
|
||||||
*:Darwin)
|
*:darwin*)
|
||||||
# See README-hacking.
|
# See README-hacking.
|
||||||
|
# VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
|
||||||
VALGRIND=;;
|
VALGRIND=;;
|
||||||
*:*)
|
*:*)
|
||||||
suppfile=build-aux/$uname.valgrind
|
AC_SUBST([VALGRIND_PREBISON], ["$VALGRIND -q"]);;
|
||||||
if test -f "$srcdir/$suppfile"; then
|
|
||||||
AC_SUBST([VALGRIND_OPTS_SUPPRESSION],
|
|
||||||
["--suppressions=\$(abs_top_srcdir)/$suppfile"])
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
AC_MSG_CHECKING([Valgrind suppression file])
|
|
||||||
AC_MSG_RESULT([$suppfile])
|
|
||||||
|
|
||||||
# Whether we cannot run the compiled bison.
|
|
||||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
|
||||||
|
|
||||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
# Needed by tests/atlocal.in.
|
# Needed by tests/atlocal.in.
|
||||||
AC_SUBST([GCC])
|
AC_SUBST([GCC])
|
||||||
|
|
||||||
gt_JAVACOMP([1.7], [1.7])
|
gt_JAVACOMP([1.3], [1.4])
|
||||||
gt_JAVAEXEC
|
gt_JAVAEXEC
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
|
|||||||
+4
-6
@@ -1,3 +1,5 @@
|
|||||||
|
-*- outline -*-
|
||||||
|
|
||||||
This directory contains data needed by Bison.
|
This directory contains data needed by Bison.
|
||||||
|
|
||||||
* Skeletons
|
* Skeletons
|
||||||
@@ -25,7 +27,7 @@ Currently, the supported skeletons are:
|
|||||||
These skeletons are the only ones supported by the Bison team.
|
These skeletons are the only ones supported by the Bison team.
|
||||||
Because the interface between skeletons and the bison program is not
|
Because the interface between skeletons and the bison program is not
|
||||||
finished, *we are not bound to it*. In particular, Bison is not
|
finished, *we are not bound to it*. In particular, Bison is not
|
||||||
mature enough for us to consider that "foreign skeletons" are
|
mature enough for us to consider that ``foreign skeletons'' are
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
* m4sugar
|
* m4sugar
|
||||||
@@ -50,11 +52,7 @@ into various formats.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Local Variables:
|
Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc.
|
||||||
mode: outline
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+50
-210
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Language-independent M4 Macros for Bison.
|
# Language-independent M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -61,35 +61,23 @@ This special exception was added by the Free Software Foundation in
|
|||||||
version 2.2 of Bison.])])
|
version 2.2 of Bison.])])
|
||||||
|
|
||||||
|
|
||||||
# b4_required_version_if(VERSION, IF_NEWER, IF_OLDER)
|
|
||||||
# ---------------------------------------------------
|
|
||||||
# If the version %require'd by the user is VERSION (or newer) expand
|
|
||||||
# IF_NEWER, otherwise IF_OLDER. VERSION should be an integer, e.g.,
|
|
||||||
# 302 for 3.2.
|
|
||||||
m4_define([b4_required_version_if],
|
|
||||||
[m4_if(m4_eval($1 <= b4_required_version),
|
|
||||||
[1], [$2], [$3])])
|
|
||||||
|
|
||||||
|
|
||||||
## -------- ##
|
## -------- ##
|
||||||
## Output. ##
|
## Output. ##
|
||||||
## -------- ##
|
## -------- ##
|
||||||
|
|
||||||
# b4_output_begin(FILE1, FILE2)
|
# b4_output_begin(FILE)
|
||||||
# -----------------------------
|
# ---------------------
|
||||||
# Enable output, i.e., send to diversion 0, expand after "#", and
|
# Enable output, i.e., send to diversion 0, expand after "#", and
|
||||||
# generate the tag to output into FILE. Must be followed by EOL.
|
# generate the tag to output into FILE. Must be followed by EOL.
|
||||||
# FILE is FILE1 concatenated to FILE2. FILE2 can be empty, or be
|
|
||||||
# absolute: do the right thing.
|
|
||||||
m4_define([b4_output_begin],
|
m4_define([b4_output_begin],
|
||||||
[m4_changecom()
|
[m4_changecom()
|
||||||
m4_divert_push(0)dnl
|
m4_divert_push(0)dnl
|
||||||
@output(m4_unquote([$1])@,m4_unquote([$2])@)@dnl
|
@output(m4_unquote([$1])@)@dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_output_end
|
# b4_output_end()
|
||||||
# -------------
|
# ---------------
|
||||||
# Output nothing, restore # as comment character (no expansions after #).
|
# Output nothing, restore # as comment character (no expansions after #).
|
||||||
m4_define([b4_output_end],
|
m4_define([b4_output_end],
|
||||||
[m4_divert_pop(0)
|
[m4_divert_pop(0)
|
||||||
@@ -97,20 +85,6 @@ m4_changecom([#])
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_divert_kill(CODE)
|
|
||||||
# --------------------
|
|
||||||
# Expand CODE for its side effects, discard its output.
|
|
||||||
m4_define([b4_divert_kill],
|
|
||||||
[m4_divert_text([KILL], [$1])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_define_silent(MACRO, CODE)
|
|
||||||
# -----------------------------
|
|
||||||
# Same as m4_define, but throw away the expansion of CODE.
|
|
||||||
m4_define([b4_define_silent],
|
|
||||||
[m4_define([$1], [b4_divert_kill([$2])])])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Error handling. ##
|
## Error handling. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -339,7 +313,7 @@ m4_define([b4_define_flag_if],
|
|||||||
# _b4_define_flag_if($1, $2, FLAG)
|
# _b4_define_flag_if($1, $2, FLAG)
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# Work around the impossibility to define macros inside macros,
|
# Work around the impossibility to define macros inside macros,
|
||||||
# because issuing '[$1]' is not possible in M4. GNU M4 should provide
|
# because issuing `[$1]' is not possible in M4. GNU M4 should provide
|
||||||
# $$1 a la M5/TeX.
|
# $$1 a la M5/TeX.
|
||||||
m4_define([_b4_define_flag_if],
|
m4_define([_b4_define_flag_if],
|
||||||
[m4_if([$1$2], $[1]$[2], [],
|
[m4_if([$1$2], $[1]$[2], [],
|
||||||
@@ -373,7 +347,6 @@ b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
|||||||
# Whether the symbol has an id.
|
# Whether the symbol has an id.
|
||||||
# - id: string
|
# - id: string
|
||||||
# If has_id, the id. Guaranteed to be usable as a C identifier.
|
# If has_id, the id. Guaranteed to be usable as a C identifier.
|
||||||
# Prefixed by api.token.prefix if defined.
|
|
||||||
# - tag: string.
|
# - tag: string.
|
||||||
# A representat of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
# A representat of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||||
# - user_number: integer
|
# - user_number: integer
|
||||||
@@ -384,13 +357,9 @@ b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
|||||||
# The internalized number (used after yytranslate).
|
# The internalized number (used after yytranslate).
|
||||||
# - has_type: 0, 1
|
# - has_type: 0, 1
|
||||||
# Whether has a semantic value.
|
# Whether has a semantic value.
|
||||||
# - type_tag: string
|
|
||||||
# When api.value.type=union, the generated name for the union member.
|
|
||||||
# yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
|
||||||
# - type
|
# - type
|
||||||
# If it has a semantic value, its type tag, or, if variant are used,
|
# If it has a semantic value, its type tag, or, if variant are used,
|
||||||
# its type.
|
# its type.
|
||||||
# In the case of api.value.type=union, type is the real type (e.g. int).
|
|
||||||
# - has_printer: 0, 1
|
# - has_printer: 0, 1
|
||||||
# - printer: string
|
# - printer: string
|
||||||
# - printer_file: string
|
# - printer_file: string
|
||||||
@@ -401,11 +370,11 @@ b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
|||||||
#
|
#
|
||||||
# The following macros provide access to these values.
|
# The following macros provide access to these values.
|
||||||
|
|
||||||
# _b4_symbol(NUM, FIELD)
|
# b4_symbol_(NUM, FIELD)
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||||
# undefined.
|
# undefined.
|
||||||
m4_define([_b4_symbol],
|
m4_define([b4_symbol_],
|
||||||
[m4_indir([b4_symbol($1, $2)])])
|
[m4_indir([b4_symbol($1, $2)])])
|
||||||
|
|
||||||
|
|
||||||
@@ -416,8 +385,8 @@ m4_define([_b4_symbol],
|
|||||||
m4_define([b4_symbol],
|
m4_define([b4_symbol],
|
||||||
[m4_case([$2],
|
[m4_case([$2],
|
||||||
[id], [m4_do([b4_percent_define_get([api.token.prefix])],
|
[id], [m4_do([b4_percent_define_get([api.token.prefix])],
|
||||||
[_b4_symbol([$1], [id])])],
|
[b4_symbol_([$1], [id])])],
|
||||||
[_b4_symbol($@)])])
|
[b4_symbol_($@)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
||||||
@@ -449,14 +418,15 @@ m4_define([b4_symbol_action_location],
|
|||||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
# b4_symbol_action(SYMBOL-NUM, KIND)
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
||||||
|
# Same as in C, but using references instead of pointers.
|
||||||
m4_define([b4_symbol_action],
|
m4_define([b4_symbol_action],
|
||||||
[b4_symbol_if([$1], [has_$2],
|
[b4_symbol_if([$1], [has_$2],
|
||||||
[b4_dollar_pushdef([(*yyvaluep)],
|
[b4_dollar_pushdef([(*yyvaluep)],
|
||||||
b4_symbol_if([$1], [has_type],
|
b4_symbol_if([$1], [has_type],
|
||||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||||
[(*yylocationp)])dnl
|
[(*yylocationp)])dnl
|
||||||
_b4_symbol_case([$1])[]dnl
|
b4_symbol_case_([$1])[]dnl
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||||
b4_symbol([$1], [$2])
|
b4_symbol([$1], [$2])
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;
|
break;
|
||||||
@@ -472,28 +442,10 @@ m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])])
|
|||||||
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_actions(KIND, [TYPE = yytype])
|
# b4_symbol_case_(SYMBOL-NUM)
|
||||||
# ----------------------------------------
|
|
||||||
# Emit the symbol actions for KIND ("printer" or "destructor").
|
|
||||||
# Dispatch on TYPE.
|
|
||||||
m4_define([b4_symbol_actions],
|
|
||||||
[m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl
|
|
||||||
m4_ifval(m4_defn([b4_actions_]),
|
|
||||||
[switch (m4_default([$2], [yytype]))
|
|
||||||
{
|
|
||||||
m4_defn([b4_actions_])
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}dnl
|
|
||||||
],
|
|
||||||
[YYUSE (m4_default([$2], [yytype]));])dnl
|
|
||||||
m4_popdef([b4_actions_])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# _b4_symbol_case(SYMBOL-NUM)
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# Issue a "case NUM" for SYMBOL-NUM.
|
# Issue a "case NUM" for SYMBOL-NUM.
|
||||||
m4_define([_b4_symbol_case],
|
m4_define([b4_symbol_case_],
|
||||||
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -548,16 +500,16 @@ m4_define([b4_token_format],
|
|||||||
## Types. ##
|
## Types. ##
|
||||||
## ------- ##
|
## ------- ##
|
||||||
|
|
||||||
# _b4_type_action(NUMS)
|
# b4_type_action_(NUMS)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Run actions for the symbol NUMS that all have the same type-name.
|
# Run actions for the symbol NUMS that all have the same type-name.
|
||||||
# Skip NUMS that have no type-name.
|
# Skip NUMS that have no type-name.
|
||||||
#
|
#
|
||||||
# To specify the action to run, define b4_dollar_dollar(NUMBER,
|
# To specify the action to run, define b4_dollar_dollar(NUMBER,
|
||||||
# TAG, TYPE).
|
# TAG, TYPE).
|
||||||
m4_define([_b4_type_action],
|
m4_define([b4_type_action_],
|
||||||
[b4_symbol_if([$1], [has_type],
|
[b4_symbol_if([$1], [has_type],
|
||||||
[m4_map([ _b4_symbol_case], [$@])[]dnl
|
[m4_map([ b4_symbol_case_], [$@])[]dnl
|
||||||
b4_dollar_dollar([b4_symbol([$1], [number])],
|
b4_dollar_dollar([b4_symbol([$1], [number])],
|
||||||
[b4_symbol([$1], [tag])],
|
[b4_symbol([$1], [tag])],
|
||||||
[b4_symbol([$1], [type])]);
|
[b4_symbol([$1], [type])]);
|
||||||
@@ -625,14 +577,14 @@ m4_define([b4_define_user_code],
|
|||||||
# b4_user_initial_action
|
# b4_user_initial_action
|
||||||
# b4_user_post_prologue
|
# b4_user_post_prologue
|
||||||
# b4_user_pre_prologue
|
# b4_user_pre_prologue
|
||||||
# b4_user_union_members
|
# b4_user_stype
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Macros that issue user code, ending with synclines.
|
# Macros that issue user code, ending with synclines.
|
||||||
b4_define_user_code([actions])
|
b4_define_user_code([actions])
|
||||||
b4_define_user_code([initial_action])
|
b4_define_user_code([initial_action])
|
||||||
b4_define_user_code([post_prologue])
|
b4_define_user_code([post_prologue])
|
||||||
b4_define_user_code([pre_prologue])
|
b4_define_user_code([pre_prologue])
|
||||||
b4_define_user_code([union_members])
|
b4_define_user_code([stype])
|
||||||
|
|
||||||
|
|
||||||
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
|
||||||
@@ -713,16 +665,16 @@ m4_define([b4_percent_define_use],
|
|||||||
# b4_percent_define_get([[foo]])
|
# b4_percent_define_get([[foo]])
|
||||||
m4_define([b4_percent_define_get],
|
m4_define([b4_percent_define_get],
|
||||||
[b4_percent_define_use([$1])dnl
|
[b4_percent_define_use([$1])dnl
|
||||||
_b4_percent_define_ifdef([$1],
|
m4_ifdef([b4_percent_define(]$1[)],
|
||||||
[m4_indir([b4_percent_define(]$1[)])],
|
[m4_indir([b4_percent_define(]$1[)])],
|
||||||
[$2])])
|
[$2])])
|
||||||
|
|
||||||
# b4_percent_define_get_loc(VARIABLE)
|
# b4_percent_define_get_loc(VARIABLE)
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly. That is,
|
||||||
# if the %define variable VARIABLE is undefined, complain fatally since that's
|
# if the %define variable VARIABLE is undefined, complain fatally since that's
|
||||||
# a Bison or skeleton error. Otherwise, return its definition location in a
|
# a Bison or skeleton error. Otherwise, return its definition location in a
|
||||||
# form appropriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or
|
||||||
# b4_fatal_at. Don't record this as a Bison usage of VARIABLE as there's no
|
# b4_fatal_at. Don't record this as a Bison usage of VARIABLE as there's no
|
||||||
# reason to suspect that the user-supplied value has yet influenced the output.
|
# reason to suspect that the user-supplied value has yet influenced the output.
|
||||||
#
|
#
|
||||||
@@ -734,21 +686,7 @@ m4_define([b4_percent_define_get_loc],
|
|||||||
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
|
[m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
|
||||||
b4_loc[]dnl
|
b4_loc[]dnl
|
||||||
m4_popdef([b4_loc])],
|
m4_popdef([b4_loc])],
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_get_loc: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
# b4_percent_define_get_kind(VARIABLE)
|
|
||||||
# ------------------------------------
|
|
||||||
# Get the kind (code, keyword, string) of VARIABLE, i.e., how its
|
|
||||||
# value was defined (braces, not delimiters, quotes).
|
|
||||||
#
|
|
||||||
# If the %define variable VARIABLE is undefined, complain fatally
|
|
||||||
# since that's a Bison or skeleton error. Don't record this as a
|
|
||||||
# Bison usage of VARIABLE as there's no reason to suspect that the
|
|
||||||
# user-supplied value has yet influenced the output.
|
|
||||||
m4_define([b4_percent_define_get_kind],
|
|
||||||
[m4_ifdef([b4_percent_define_kind(]$1[)],
|
|
||||||
[m4_indir([b4_percent_define_kind(]$1[)])],
|
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
|
||||||
|
|
||||||
# b4_percent_define_get_syncline(VARIABLE)
|
# b4_percent_define_get_syncline(VARIABLE)
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
@@ -765,20 +703,7 @@ m4_define([b4_percent_define_get_kind],
|
|||||||
m4_define([b4_percent_define_get_syncline],
|
m4_define([b4_percent_define_get_syncline],
|
||||||
[m4_ifdef([b4_percent_define_syncline(]$1[)],
|
[m4_ifdef([b4_percent_define_syncline(]$1[)],
|
||||||
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
[m4_indir([b4_percent_define_syncline(]$1[)])],
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_get_syncline: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
# _b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
|
||||||
# ------------------------------------------------------
|
|
||||||
# If the %define variable VARIABLE is defined, expand IF-TRUE, else expand
|
|
||||||
# IF-FALSE. Don't record usage of VARIABLE.
|
|
||||||
#
|
|
||||||
# For example:
|
|
||||||
#
|
|
||||||
# _b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
|
||||||
m4_define([_b4_percent_define_ifdef],
|
|
||||||
[m4_ifdef([b4_percent_define(]$1[)],
|
|
||||||
[$2],
|
|
||||||
[$3])])
|
|
||||||
|
|
||||||
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
@@ -791,42 +716,9 @@ m4_define([_b4_percent_define_ifdef],
|
|||||||
#
|
#
|
||||||
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||||
m4_define([b4_percent_define_ifdef],
|
m4_define([b4_percent_define_ifdef],
|
||||||
[_b4_percent_define_ifdef([$1],
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
[b4_percent_define_use([$1])$2],
|
[b4_percent_define_use([$1])$2],
|
||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_file_complain(VARIABLE)
|
|
||||||
# -----------------------------------------------
|
|
||||||
# Warn about %define variable VARIABLE having an incorrect
|
|
||||||
# value.
|
|
||||||
m4_define([b4_percent_define_check_file_complain],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([$1]),
|
|
||||||
[[%%define variable '%s' requires 'none' or '"..."' values]],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_file(MACRO, VARIABLE, DEFAULT)
|
|
||||||
# ------------------------------------------------------
|
|
||||||
# If the %define variable VARIABLE:
|
|
||||||
# - is undefined, then if DEFAULT is non-empty, define MACRO to DEFAULT
|
|
||||||
# - is a string, define MACRO to its value
|
|
||||||
# - is the keyword 'none', do nothing
|
|
||||||
# - otherwise, warn about the incorrect value.
|
|
||||||
m4_define([b4_percent_define_check_file],
|
|
||||||
[b4_percent_define_ifdef([$2],
|
|
||||||
[m4_case(b4_percent_define_get_kind([$2]),
|
|
||||||
[string],
|
|
||||||
[m4_define([$1], b4_percent_define_get([$2]))],
|
|
||||||
[keyword],
|
|
||||||
[m4_if(b4_percent_define_get([$2]), [none], [],
|
|
||||||
[b4_percent_define_check_file_complain([$2])])],
|
|
||||||
[b4_percent_define_check_file_complain([$2])])
|
|
||||||
],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
[m4_define([$1], [$3])])])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
## --------- ##
|
||||||
@@ -855,11 +747,11 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
[[invalid value for %%define Boolean variable '%s']],
|
[[invalid value for %%define Boolean variable '%s']],
|
||||||
[$1])],
|
[$1])],
|
||||||
[[b4_percent_define_flag_if($1)]])])],
|
[[b4_percent_define_flag_if($1)]])])],
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_flag_if: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_default(VARIABLE, DEFAULT, [KIND = keyword])
|
# b4_percent_define_default(VARIABLE, DEFAULT)
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------
|
||||||
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
||||||
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
|
||||||
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
# Don't record this as a Bison usage of VARIABLE as there's no reason to
|
||||||
@@ -869,10 +761,8 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
#
|
#
|
||||||
# b4_percent_define_default([[foo]], [[default value]])
|
# b4_percent_define_default([[foo]], [[default value]])
|
||||||
m4_define([b4_percent_define_default],
|
m4_define([b4_percent_define_default],
|
||||||
[_b4_percent_define_ifdef([$1], [],
|
[m4_ifndef([b4_percent_define(]$1[)],
|
||||||
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
[m4_define([b4_percent_define(]$1[)], [$2])dnl
|
||||||
m4_define([b4_percent_define_kind(]$1[)],
|
|
||||||
[m4_default([$3], [keyword])])dnl
|
|
||||||
m4_define([b4_percent_define_loc(]$1[)],
|
m4_define([b4_percent_define_loc(]$1[)],
|
||||||
[[[[<skeleton default value>:-1.-1]],
|
[[[[<skeleton default value>:-1.-1]],
|
||||||
[[<skeleton default value>:-1.-1]]]])dnl
|
[[<skeleton default value>:-1.-1]]]])dnl
|
||||||
@@ -882,30 +772,15 @@ m4_define([b4_percent_define_default],
|
|||||||
# b4_percent_define_if_define(NAME, [VARIABLE = NAME])
|
# b4_percent_define_if_define(NAME, [VARIABLE = NAME])
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# Define b4_NAME_if that executes its $1 or $2 depending whether
|
# Define b4_NAME_if that executes its $1 or $2 depending whether
|
||||||
# VARIABLE was %defined. The characters '.' and `-' in VARIABLE are mapped
|
# VARIABLE was %defined. The characters `.' and `-' in VARIABLE are mapped
|
||||||
# to '_'.
|
# to `_'.
|
||||||
m4_define([_b4_percent_define_if_define],
|
m4_define([b4_percent_define_if_define_],
|
||||||
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
||||||
[b4_percent_define_flag_if(m4_default([$2], [$1]),
|
[b4_percent_define_flag_if(m4_default([$2], [$1]),
|
||||||
[$3], [$4])])])
|
[$3], [$4])])])
|
||||||
m4_define([b4_percent_define_if_define],
|
m4_define([b4_percent_define_if_define],
|
||||||
[b4_percent_define_default([m4_default([$2], [$1])], [[false]])
|
[b4_percent_define_default([m4_default([$2], [$1])], [[false]])
|
||||||
_b4_percent_define_if_define([$1], [$2], $[1], $[2])])
|
b4_percent_define_if_define_([$1], [$2], $[1], $[2])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain])
|
|
||||||
# ---------------------------------------------------------------------
|
|
||||||
m4_define([b4_percent_define_check_kind],
|
|
||||||
[_b4_percent_define_ifdef([$1],
|
|
||||||
[m4_if(b4_percent_define_get_kind([$1]), [$2], [],
|
|
||||||
[b4_error([m4_default([$3], [complain])],
|
|
||||||
b4_percent_define_get_loc([$1]),
|
|
||||||
[m4_case([$2],
|
|
||||||
[code], [[%%define variable '%s' requires '{...}' values]],
|
|
||||||
[keyword], [[%%define variable '%s' requires keyword values]],
|
|
||||||
[string], [[%%define variable '%s' requires '"..."' values]])],
|
|
||||||
[$1])])])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_values(VALUES)
|
# b4_percent_define_check_values(VALUES)
|
||||||
@@ -929,9 +804,8 @@ m4_define([b4_percent_define_check_values],
|
|||||||
[_b4_percent_define_check_values(b4_sublist)])])
|
[_b4_percent_define_check_values(b4_sublist)])])
|
||||||
|
|
||||||
m4_define([_b4_percent_define_check_values],
|
m4_define([_b4_percent_define_check_values],
|
||||||
[_b4_percent_define_ifdef([$1],
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
[b4_percent_define_check_kind(]$1[, [keyword], [deprecated])dnl
|
[m4_pushdef([b4_good_value], [0])dnl
|
||||||
m4_pushdef([b4_good_value], [0])dnl
|
|
||||||
m4_if($#, 1, [],
|
m4_if($#, 1, [],
|
||||||
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
[m4_foreach([b4_value], m4_dquote(m4_shift($@)),
|
||||||
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
|
[m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
|
||||||
@@ -946,7 +820,7 @@ m4_define([_b4_percent_define_check_values],
|
|||||||
[[accepted value: '%s']],
|
[[accepted value: '%s']],
|
||||||
m4_dquote(b4_value))])])dnl
|
m4_dquote(b4_value))])])dnl
|
||||||
m4_popdef([b4_good_value])],
|
m4_popdef([b4_good_value])],
|
||||||
[b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_check_values: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
# b4_percent_code_get([QUALIFIER])
|
# b4_percent_code_get([QUALIFIER])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
@@ -987,11 +861,15 @@ m4_define([b4_percent_code_ifdef],
|
|||||||
## Common variables. ##
|
## Common variables. ##
|
||||||
## ------------------ ##
|
## ------------------ ##
|
||||||
|
|
||||||
|
# Default values for %define.
|
||||||
|
# ---------------------------
|
||||||
|
# If the api.token.prefix, it is empty.
|
||||||
|
m4_percent_define_default([[api.token.prefix]], [[]])
|
||||||
|
|
||||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
||||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
||||||
# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
|
# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------
|
||||||
b4_percent_define_if_define([token_ctor], [api.token.constructor])
|
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([locations]) # Whether locations are tracked.
|
||||||
b4_percent_define_if_define([parse.assert])
|
b4_percent_define_if_define([parse.assert])
|
||||||
@@ -1026,11 +904,9 @@ b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
|
|||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
b4_percent_define_if_define([variant])
|
b4_percent_define_if_define([variant])
|
||||||
m4_define([b4_variant_flag], [[0]])
|
m4_case(b4_percent_define_get([[api.value.type]]),
|
||||||
b4_percent_define_ifdef([[api.value.type]],
|
[variant], [m4_define([b4_variant_flag], [[1]])],
|
||||||
[m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword],
|
[m4_define([b4_variant_flag], [[0]])])
|
||||||
[m4_case(b4_percent_define_get([[api.value.type]]), [variant],
|
|
||||||
[m4_define([b4_variant_flag], [[1]])])])])
|
|
||||||
b4_define_flag_if([variant])
|
b4_define_flag_if([variant])
|
||||||
|
|
||||||
|
|
||||||
@@ -1065,46 +941,10 @@ m4_define_default([b4_parse_param], [])
|
|||||||
m4_define_default([b4_location_initial_column], [1])
|
m4_define_default([b4_location_initial_column], [1])
|
||||||
m4_define_default([b4_location_initial_line], [1])
|
m4_define_default([b4_location_initial_line], [1])
|
||||||
|
|
||||||
|
# Sanity checks.
|
||||||
## --------------- ##
|
|
||||||
## Sanity checks. ##
|
|
||||||
## --------------- ##
|
|
||||||
|
|
||||||
# api.location.prefix={...} (Java and C++).
|
|
||||||
b4_percent_define_check_kind([api.location.type], [code], [deprecated])
|
|
||||||
|
|
||||||
# api.position.prefix={...} (Java).
|
|
||||||
b4_percent_define_check_kind([api.position.type], [code], [deprecated])
|
|
||||||
|
|
||||||
# api.prefix >< %name-prefix.
|
|
||||||
b4_percent_define_check_kind([api.prefix], [code], [deprecated])
|
|
||||||
b4_percent_define_ifdef([api.prefix],
|
b4_percent_define_ifdef([api.prefix],
|
||||||
[m4_ifdef([b4_prefix],
|
[m4_ifdef([b4_prefix],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
|
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
|
||||||
[['%s' and '%s' cannot be used together]],
|
[['%s' and '%s' cannot be used together]],
|
||||||
[%name-prefix],
|
[%name-prefix],
|
||||||
[%define api.prefix])])])
|
[%define api.prefix])])])
|
||||||
|
|
||||||
# api.token.prefix={...}
|
|
||||||
# Make it a warning for those who used betas of Bison 3.0.
|
|
||||||
b4_percent_define_check_kind([api.token.prefix], [code], [deprecated])
|
|
||||||
|
|
||||||
# api.value.type >< %union.
|
|
||||||
b4_percent_define_ifdef([api.value.type],
|
|
||||||
[m4_ifdef([b4_union_members],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
|
|
||||||
[['%s' and '%s' cannot be used together]],
|
|
||||||
[%union],
|
|
||||||
[%define api.value.type])])])
|
|
||||||
|
|
||||||
# api.value.type=union >< %yacc.
|
|
||||||
b4_percent_define_ifdef([api.value.type],
|
|
||||||
[m4_if(b4_percent_define_get([api.value.type]), [union],
|
|
||||||
[b4_yacc_if(dnl
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
|
|
||||||
[['%s' and '%s' cannot be used together]],
|
|
||||||
[%yacc],
|
|
||||||
[%define api.value.type "union"])])])])
|
|
||||||
|
|
||||||
# api.value.union.name.
|
|
||||||
b4_percent_define_check_kind([api.value.union.name], [keyword])
|
|
||||||
|
|||||||
+1
-2
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton dispatching for Bison.
|
# C++ skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
|
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
|
||||||
# Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+91
-181
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,57 +17,13 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Sanity checks, before defaults installed by c.m4.
|
|
||||||
b4_percent_define_ifdef([[api.value.union.name]],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
|
|
||||||
[named %union is invalid in C++])])
|
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c.m4])
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
|
|
||||||
|
|
||||||
|
|
||||||
## ----- ##
|
|
||||||
## C++. ##
|
|
||||||
## ----- ##
|
|
||||||
|
|
||||||
# b4_comment(TEXT, [PREFIX])
|
# b4_comment(TEXT, [PREFIX])
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||||
m4_define([b4_comment],
|
m4_define([b4_comment],
|
||||||
[_b4_comment([$1], [$2// ], [$2// ])])
|
[b4_comment_([$1], [$2// ], [$2// ])])
|
||||||
|
|
||||||
|
|
||||||
# b4_inline(hh|cc)
|
|
||||||
# ----------------
|
|
||||||
# Expand to `inline\n ` if $1 is hh.
|
|
||||||
m4_define([b4_inline],
|
|
||||||
[m4_case([$1],
|
|
||||||
[cc], [],
|
|
||||||
[hh], [[inline
|
|
||||||
]],
|
|
||||||
[m4_fatal([$0: invalid argument: $1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_cxx_portability
|
|
||||||
# ------------------
|
|
||||||
m4_define([b4_cxx_portability],
|
|
||||||
[// Support move semantics when possible.
|
|
||||||
#if defined __cplusplus && 201103L <= __cplusplus
|
|
||||||
# define YY_MOVE std::move
|
|
||||||
# define YY_MOVE_OR_COPY move
|
|
||||||
# define YY_MOVE_REF(Type) Type&&
|
|
||||||
# define YY_RVREF(Type) Type&&
|
|
||||||
# define YY_COPY(Type) Type
|
|
||||||
#else
|
|
||||||
# define YY_MOVE
|
|
||||||
# define YY_MOVE_OR_COPY copy
|
|
||||||
# define YY_MOVE_REF(Type) Type&
|
|
||||||
# define YY_RVREF(Type) const Type&
|
|
||||||
# define YY_COPY(Type) const Type&
|
|
||||||
#endif[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -82,7 +38,6 @@ b4_percent_define_default([[parser_class_name]], [[parser]])
|
|||||||
# b4_percent_define_default([[api.location.type]], [[location]])
|
# b4_percent_define_default([[api.location.type]], [[location]])
|
||||||
|
|
||||||
b4_percent_define_default([[filename_type]], [[std::string]])
|
b4_percent_define_default([[filename_type]], [[std::string]])
|
||||||
# Make it a warning for those who used betas of Bison 3.0.
|
|
||||||
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
||||||
|
|
||||||
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
||||||
@@ -99,8 +54,8 @@ b4_percent_define_default([[define_location_comparison]],
|
|||||||
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
||||||
|
|
||||||
|
|
||||||
# Don't permit an empty b4_namespace_ref. Any '::parser::foo' appended to it
|
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
|
||||||
# would compile as an absolute reference with 'parser' in the global namespace.
|
# would compile as an absolute reference with `parser' in the global namespace.
|
||||||
# b4_namespace_open would open an anonymous namespace and thus establish
|
# b4_namespace_open would open an anonymous namespace and thus establish
|
||||||
# internal linkage. This would compile. However, it's cryptic, and internal
|
# internal linkage. This would compile. However, it's cryptic, and internal
|
||||||
# linkage for the parser would be specified in all translation units that
|
# linkage for the parser would be specified in all translation units that
|
||||||
@@ -111,7 +66,7 @@ m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
|||||||
[[namespace reference is empty]])])
|
[[namespace reference is empty]])])
|
||||||
|
|
||||||
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
||||||
# invalid b4_namespace_ref that would be converted to a valid
|
# invalid b4_namepsace_ref that would be converted to a valid
|
||||||
# b4_namespace_open. The problem is that Bison doesn't always output
|
# b4_namespace_open. The problem is that Bison doesn't always output
|
||||||
# b4_namespace_ref to uncommented code but should reserve the ability to do so
|
# b4_namespace_ref to uncommented code but should reserve the ability to do so
|
||||||
# in future releases without risking breaking any existing user grammars.
|
# in future releases without risking breaking any existing user grammars.
|
||||||
@@ -157,24 +112,19 @@ m4_define([b4_token_enums],
|
|||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
# b4_semantic_type_declare
|
||||||
|
# ------------------------
|
||||||
# b4_value_type_declare
|
|
||||||
# ---------------------
|
|
||||||
# Declare semantic_type.
|
# Declare semantic_type.
|
||||||
m4_define([b4_value_type_declare],
|
m4_define([b4_semantic_type_declare],
|
||||||
[b4_value_type_setup[]dnl
|
|
||||||
[ /// Symbol semantic values.
|
[ /// Symbol semantic values.
|
||||||
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
m4_ifdef([b4_stype],
|
||||||
[code],
|
[ union semantic_type
|
||||||
[[ typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]],
|
|
||||||
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
|
||||||
[union\|union-directive],
|
|
||||||
[[ union semantic_type
|
|
||||||
{
|
{
|
||||||
]b4_user_union_members[
|
b4_user_stype
|
||||||
};]])])dnl
|
};],
|
||||||
])
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[[ typedef int semantic_type;]],
|
||||||
|
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_declare
|
# b4_public_types_declare
|
||||||
@@ -183,7 +133,7 @@ m4_define([b4_value_type_declare],
|
|||||||
# Depending on %define token_lex, may be output in the header or source file.
|
# Depending on %define token_lex, may be output in the header or source file.
|
||||||
m4_define([b4_public_types_declare],
|
m4_define([b4_public_types_declare],
|
||||||
[[#ifndef ]b4_api_PREFIX[STYPE
|
[[#ifndef ]b4_api_PREFIX[STYPE
|
||||||
]b4_value_type_declare[
|
]b4_semantic_type_declare[
|
||||||
#else
|
#else
|
||||||
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
||||||
#endif]b4_locations_if([
|
#endif]b4_locations_if([
|
||||||
@@ -207,26 +157,16 @@ m4_define([b4_public_types_declare],
|
|||||||
/// (External) token type, as returned by yylex.
|
/// (External) token type, as returned by yylex.
|
||||||
typedef token::yytokentype token_type;
|
typedef token::yytokentype token_type;
|
||||||
|
|
||||||
/// Symbol type: an internal symbol number.
|
/// Internal symbol number.
|
||||||
typedef int symbol_number_type;
|
typedef int symbol_number_type;
|
||||||
|
|
||||||
/// The symbol type number to denote an empty symbol.
|
|
||||||
enum { empty_symbol = -2 };
|
|
||||||
|
|
||||||
/// Internal symbol number for tokens (subsumed by symbol_number_type).
|
/// Internal symbol number for tokens (subsumed by symbol_number_type).
|
||||||
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
||||||
]])
|
|
||||||
|
|
||||||
|
/// A complete symbol.
|
||||||
# b4_symbol_type_declare
|
|
||||||
# ----------------------
|
|
||||||
# Define symbol_type, the external type for symbols used for symbol
|
|
||||||
# constructors.
|
|
||||||
m4_define([b4_symbol_type_declare],
|
|
||||||
[[ /// A complete symbol.
|
|
||||||
///
|
///
|
||||||
/// Expects its Base type to provide access to the symbol type
|
/// Expects its Base type to provide access to the symbol type
|
||||||
/// via type_get ().
|
/// via type_get().
|
||||||
///
|
///
|
||||||
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
@@ -238,30 +178,22 @@ m4_define([b4_symbol_type_declare],
|
|||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
basic_symbol ();
|
basic_symbol ();
|
||||||
|
|
||||||
/// Move or copy constructor.
|
/// Copy constructor.
|
||||||
basic_symbol (YY_RVREF (basic_symbol) other);
|
basic_symbol (const basic_symbol& other);
|
||||||
|
|
||||||
]b4_variant_if([[
|
]b4_variant_if([[
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
/// Constructor for valueless symbols, and symbols from each type.
|
||||||
]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[
|
]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[
|
||||||
/// Constructor for valueless symbols.
|
/// Constructor for valueless symbols.
|
||||||
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
||||||
YY_MOVE_REF (location_type) l])[);
|
const location_type& l])[);]])[
|
||||||
|
|
||||||
/// Constructor for symbols with semantic value.
|
/// Constructor for symbols with semantic value.
|
||||||
basic_symbol (typename Base::kind_type t,
|
basic_symbol (typename Base::kind_type t,
|
||||||
YY_RVREF (semantic_type) v]b4_locations_if([,
|
const semantic_type& v]b4_locations_if([,
|
||||||
YY_RVREF (location_type) l])[);]])[
|
const location_type& l])[);
|
||||||
|
|
||||||
/// Destroy the symbol.
|
|
||||||
~basic_symbol ();
|
~basic_symbol ();
|
||||||
|
|
||||||
/// Destroy contents, and record that is empty.
|
|
||||||
void clear ();
|
|
||||||
|
|
||||||
/// Whether empty.
|
|
||||||
bool empty () const;
|
|
||||||
|
|
||||||
/// Destructive move, \a s is emptied into this.
|
/// Destructive move, \a s is emptied into this.
|
||||||
void move (basic_symbol& s);
|
void move (basic_symbol& s);
|
||||||
|
|
||||||
@@ -272,10 +204,8 @@ m4_define([b4_symbol_type_declare],
|
|||||||
location_type location;])[
|
location_type location;])[
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined __cplusplus && __cplusplus < 201103L
|
|
||||||
/// Assignment operator.
|
/// Assignment operator.
|
||||||
basic_symbol& operator= (const basic_symbol& other);
|
basic_symbol& operator= (const basic_symbol& other);
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Type access provider for token (enum) based symbols.
|
/// Type access provider for token (enum) based symbols.
|
||||||
@@ -293,95 +223,92 @@ m4_define([b4_symbol_type_declare],
|
|||||||
/// Constructor from (external) token numbers.
|
/// Constructor from (external) token numbers.
|
||||||
by_type (kind_type t);
|
by_type (kind_type t);
|
||||||
|
|
||||||
/// Record that this symbol is empty.
|
|
||||||
void clear ();
|
|
||||||
|
|
||||||
/// Steal the symbol type from \a that.
|
/// Steal the symbol type from \a that.
|
||||||
void move (by_type& that);
|
void move (by_type& that);
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a type).
|
/// The (internal) type number (corresponding to \a type).
|
||||||
/// \a empty when empty.
|
/// -1 when this symbol is empty.
|
||||||
symbol_number_type type_get () const;
|
symbol_number_type type_get () const;
|
||||||
|
|
||||||
/// The token.
|
/// The token.
|
||||||
token_type token () const;
|
token_type token () const;
|
||||||
|
|
||||||
|
enum { empty = 0 };
|
||||||
|
|
||||||
/// The symbol type.
|
/// The symbol type.
|
||||||
/// \a empty_symbol when empty.
|
/// -1 when this symbol is empty.
|
||||||
/// An int, not token_number_type, to be able to store empty_symbol.
|
token_number_type type;
|
||||||
int type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
/// "External" symbols: returned by the scanner.
|
||||||
typedef basic_symbol<by_type> symbol_type;
|
typedef basic_symbol<by_type> symbol_type;
|
||||||
]])
|
|
||||||
|
]b4_symbol_constructor_declare])
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_define(hh|cc)
|
# b4_public_types_define
|
||||||
# -----------------------------
|
# ----------------------
|
||||||
# Provide the implementation needed by the public types.
|
# Provide the implementation needed by the public types.
|
||||||
m4_define([b4_public_types_define],
|
m4_define([b4_public_types_define],
|
||||||
[ b4_inline([$1])b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
[[ inline
|
||||||
|
]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||||
: std::runtime_error (m)]b4_locations_if([
|
: std::runtime_error (m)]b4_locations_if([
|
||||||
, location (l)])[
|
, location (l)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// basic_symbol.
|
// basic_symbol.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
|
inline
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
|
||||||
: value ()]b4_locations_if([
|
: value ()
|
||||||
, location ()])[
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (YY_RVREF (basic_symbol) other)
|
inline
|
||||||
: Base (YY_MOVE (other))
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
|
||||||
, value (]b4_variant_if([], [YY_MOVE (other.value)]))b4_locations_if([
|
: Base (other)
|
||||||
, location (YY_MOVE (other.location))])[
|
, value ()]b4_locations_if([
|
||||||
{]b4_variant_if([
|
, location (other.location)])[
|
||||||
b4_symbol_variant([other.type_get ()], [value], [YY_MOVE_OR_COPY],
|
{
|
||||||
[YY_MOVE (other.value)])])[
|
]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy],
|
||||||
|
[other.value])],
|
||||||
|
[value = other.value;])[
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename Base>
|
||||||
|
inline
|
||||||
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
|
[typename Base::kind_type t],
|
||||||
|
[const semantic_type& v],
|
||||||
|
b4_locations_if([const location_type& l]))[)
|
||||||
|
: Base (t)
|
||||||
|
, value (]b4_variant_if([], [v])[)]b4_locations_if([
|
||||||
|
, location (l)])[
|
||||||
|
{]b4_variant_if([[
|
||||||
|
(void) v;
|
||||||
|
]b4_symbol_variant([this->type_get ()], [value], [copy], [v])])[}
|
||||||
|
|
||||||
]b4_variant_if([[
|
]b4_variant_if([[
|
||||||
// Implementation of basic_symbol constructor for each type.
|
// Implementation of basic_symbol constructor for each type.
|
||||||
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
||||||
/// Constructor for valueless symbols.
|
/// Constructor for valueless symbols.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
|
inline
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
b4_locations_if([YY_MOVE_REF (location_type) l]))[)
|
b4_locations_if([const location_type& l]))[)
|
||||||
: Base (t)
|
: Base (t)
|
||||||
, value ()]b4_locations_if([
|
, value ()]b4_locations_if([
|
||||||
, location (l)])[
|
, location (l)])[
|
||||||
{}
|
{}]])[
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
|
||||||
[typename Base::kind_type t],
|
|
||||||
[YY_RVREF (semantic_type) v],
|
|
||||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
|
||||||
: Base (t)
|
|
||||||
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
|
||||||
, location (YY_MOVE (l))])[
|
|
||||||
{]b4_variant_if([[
|
|
||||||
(void) v;
|
|
||||||
]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
|
inline
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
|
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
|
||||||
{
|
|
||||||
clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
void
|
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::clear ()
|
|
||||||
{]b4_variant_if([[
|
{]b4_variant_if([[
|
||||||
// User destructor.
|
// User destructor.
|
||||||
symbol_number_type yytype = this->type_get ();
|
symbol_number_type yytype = this->type_get ();
|
||||||
basic_symbol<Base>& yysym = *this;
|
|
||||||
(void) yysym;
|
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
{
|
{
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
@@ -391,60 +318,53 @@ m4_define([b4_public_types_define],
|
|||||||
|
|
||||||
// Type destructor.
|
// Type destructor.
|
||||||
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
||||||
Base::clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
bool
|
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::empty () const
|
|
||||||
{
|
|
||||||
return Base::type_get () == empty_symbol;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
|
inline
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
|
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
|
||||||
{
|
{
|
||||||
super_type::move (s);
|
super_type::move(s);
|
||||||
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
|
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
|
||||||
[YY_MOVE (s.value)])],
|
[s.value])],
|
||||||
[value = YY_MOVE (s.value);])[]b4_locations_if([
|
[value = s.value;])[]b4_locations_if([
|
||||||
location = YY_MOVE (s.location);])[
|
location = s.location;])[
|
||||||
}
|
}
|
||||||
|
|
||||||
// by_type.
|
// by_type.
|
||||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type ()
|
inline
|
||||||
: type (empty_symbol)
|
]b4_parser_class_name[::by_type::by_type ()
|
||||||
|
: type (empty)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
|
inline
|
||||||
|
]b4_parser_class_name[::by_type::by_type (const by_type& other)
|
||||||
: type (other.type)
|
: type (other.type)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
|
inline
|
||||||
|
]b4_parser_class_name[::by_type::by_type (token_type t)
|
||||||
: type (yytranslate_ (t))
|
: type (yytranslate_ (t))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
inline
|
||||||
]b4_parser_class_name[::by_type::clear ()
|
void
|
||||||
{
|
|
||||||
type = empty_symbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
|
||||||
]b4_parser_class_name[::by_type::move (by_type& that)
|
]b4_parser_class_name[::by_type::move (by_type& that)
|
||||||
{
|
{
|
||||||
type = that.type;
|
type = that.type;
|
||||||
that.clear ();
|
that.type = empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[int
|
inline
|
||||||
|
int
|
||||||
]b4_parser_class_name[::by_type::type_get () const
|
]b4_parser_class_name[::by_type::type_get () const
|
||||||
{
|
{
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
]b4_token_ctor_if([[
|
]b4_token_ctor_if([[
|
||||||
]b4_inline([$1])b4_parser_class_name[::token_type
|
inline
|
||||||
|
]b4_parser_class_name[::token_type
|
||||||
]b4_parser_class_name[::by_type::token () const
|
]b4_parser_class_name[::by_type::token () const
|
||||||
{
|
{
|
||||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
||||||
@@ -458,7 +378,6 @@ m4_define([b4_public_types_define],
|
|||||||
return static_cast<token_type> (yytoken_number_[type]);
|
return static_cast<token_type> (yytoken_number_[type]);
|
||||||
}
|
}
|
||||||
]])[]dnl
|
]])[]dnl
|
||||||
|
|
||||||
b4_symbol_constructor_define])
|
b4_symbol_constructor_define])
|
||||||
|
|
||||||
|
|
||||||
@@ -471,13 +390,14 @@ m4_define([b4_symbol_constructor_declare], [])
|
|||||||
m4_define([b4_symbol_constructor_define], [])
|
m4_define([b4_symbol_constructor_define], [])
|
||||||
|
|
||||||
|
|
||||||
# b4_yytranslate_define(cc|hh)
|
# b4_yytranslate_define
|
||||||
# ----------------------------
|
# ---------------------
|
||||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
# Define yytranslate_. Sometimes used in the header file,
|
||||||
# sometimes in the cc file.
|
# sometimes in the cc file.
|
||||||
m4_define([b4_yytranslate_define],
|
m4_define([b4_yytranslate_define],
|
||||||
[[ // Symbol number corresponding to token number t.
|
[[ // Symbol number corresponding to token number t.
|
||||||
]b4_inline([$1])b4_parser_class_name[::token_number_type
|
inline
|
||||||
|
]b4_parser_class_name[::token_number_type
|
||||||
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
|
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
|
||||||
[int])[ t)
|
[int])[ t)
|
||||||
{
|
{
|
||||||
@@ -487,12 +407,12 @@ m4_define([b4_yytranslate_define],
|
|||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
const unsigned user_token_number_max_ = ]b4_user_token_number_max[;
|
const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
||||||
|
|
||||||
if (static_cast<int> (t) <= yyeof_)
|
if (static_cast<int>(t) <= yyeof_)
|
||||||
return yyeof_;
|
return yyeof_;
|
||||||
else if (static_cast<unsigned> (t) <= user_token_number_max_)
|
else if (static_cast<unsigned int> (t) <= user_token_number_max_)
|
||||||
return translate_table[t];
|
return translate_table[t];
|
||||||
else
|
else
|
||||||
return undef_token_;
|
return undef_token_;
|
||||||
@@ -600,13 +520,3 @@ m4_define([b4_yylloc_default_define],
|
|||||||
while (/*CONSTCOND*/ false)
|
while (/*CONSTCOND*/ false)
|
||||||
# endif
|
# endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
## -------- ##
|
|
||||||
## Checks. ##
|
|
||||||
## -------- ##
|
|
||||||
|
|
||||||
b4_token_ctor_if([b4_variant_if([],
|
|
||||||
[b4_fatal_at(b4_percent_define_get_loc(api.token.constructor),
|
|
||||||
[cannot use '%s' without '%s'],
|
|
||||||
[%define api.token.constructor],
|
|
||||||
[%define api.value.type variant]))])])
|
|
||||||
|
|||||||
+7
-7
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Common code for C-like languages (C, C++, Java, etc.)
|
# Common code for C-like languages (C, C++, Java, etc.)
|
||||||
|
|
||||||
# Copyright (C) 2012-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,14 +17,14 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
# b4_comment_(TEXT, OPEN, CONTINUE, END)
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
# Avoid adding indentation to the first line, as the indentation comes
|
||||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
||||||
#
|
#
|
||||||
# Prefix all the output lines with PREFIX.
|
# Prefix all the output lines with PREFIX.
|
||||||
m4_define([_b4_comment],
|
m4_define([b4_comment_],
|
||||||
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
|
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
|
||||||
\(.\)], [
|
\(.\)], [
|
||||||
$3\1])$4])
|
$3\1])$4])
|
||||||
@@ -34,17 +34,17 @@ $3\1])$4])
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||||
m4_define([b4_comment],
|
m4_define([b4_comment],
|
||||||
[_b4_comment([$1], [$2/* ], [$2 ], [ */])])
|
[b4_comment_([$1], [$2/* ], [$2 ], [ */])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_dollar_dollar(VALUE, FIELD, DEFAULT-FIELD)
|
# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
|
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
|
||||||
# otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
|
# otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
|
||||||
# pointer.
|
# pointer.
|
||||||
m4_define([_b4_dollar_dollar],
|
m4_define([b4_dollar_dollar_],
|
||||||
[b4_symbol_value([$1],
|
[b4_symbol_value([$1],
|
||||||
m4_if([$2], [[]],
|
m4_if([$2], [[]],
|
||||||
[[$3]], [[$2]]))])
|
[[$3]], [[$2]]))])
|
||||||
@@ -56,7 +56,7 @@ m4_define([_b4_dollar_dollar],
|
|||||||
# and b4_at_dollar for LOCATION.
|
# and b4_at_dollar for LOCATION.
|
||||||
m4_define([b4_dollar_pushdef],
|
m4_define([b4_dollar_pushdef],
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
[_b4_dollar_dollar([$1], m4_dquote($][1), [$2])])dnl
|
[b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
|
||||||
m4_pushdef([b4_at_dollar], [$3])dnl
|
m4_pushdef([b4_at_dollar], [$3])dnl
|
||||||
])
|
])
|
||||||
m4_define([b4_dollar_popdef],
|
m4_define([b4_dollar_popdef],
|
||||||
|
|||||||
+1
-2
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
# C skeleton dispatching for Bison.
|
# C skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
|
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
|
||||||
# Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C M4 Macros for Bison.
|
# C M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -97,8 +97,7 @@ m4_define([b4_api_PREFIX],
|
|||||||
m4_define_default([b4_prefix], [b4_api_prefix])
|
m4_define_default([b4_prefix], [b4_api_prefix])
|
||||||
|
|
||||||
# If the %union is not named, its name is YYSTYPE.
|
# If the %union is not named, its name is YYSTYPE.
|
||||||
b4_percent_define_default([[api.value.union.name]],
|
m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
|
||||||
[b4_api_PREFIX[][STYPE]])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
@@ -151,7 +150,7 @@ m4_popdef([$1])dnl
|
|||||||
|
|
||||||
# b4_parse_param_use([VAL], [LOC])
|
# b4_parse_param_use([VAL], [LOC])
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# 'YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
# `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
||||||
m4_define([b4_parse_param_use],
|
m4_define([b4_parse_param_use],
|
||||||
[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl
|
[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl
|
||||||
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
||||||
@@ -172,10 +171,10 @@ m4_define([b4_int_type],
|
|||||||
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
|
||||||
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
b4_ints_in($@, [-128], [127]), [1], [signed char],
|
||||||
|
|
||||||
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
|
b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
b4_ints_in($@, [-32768], [32767]), [1], [short int],
|
||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned],
|
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
@@ -183,7 +182,7 @@ m4_define([b4_int_type],
|
|||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
# 'NAME_min' to 'NAME_max' (included).
|
# `NAME_min' to `NAME_max' (included).
|
||||||
m4_define([b4_int_type_for],
|
m4_define([b4_int_type_for],
|
||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
@@ -200,86 +199,21 @@ m4_define([b4_table_value_equals],
|
|||||||
[(!!(($2) == ($3)))])])
|
[(!!(($2) == ($3)))])])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ---------##
|
||||||
## Compiler issues. ##
|
## Values. ##
|
||||||
## ----------------- ##
|
## ---------##
|
||||||
|
|
||||||
# b4_attribute_define
|
|
||||||
# -------------------
|
|
||||||
# Provide portable compiler "attributes".
|
|
||||||
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)
|
|
||||||
# else
|
|
||||||
# define YY_ATTRIBUTE(Spec) /* empty */
|
|
||||||
# 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__))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined _Noreturn \
|
|
||||||
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
|
|
||||||
# if defined _MSC_VER && 1200 <= _MSC_VER
|
|
||||||
# define _Noreturn __declspec (noreturn)
|
|
||||||
# else
|
|
||||||
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
|
||||||
#if ! defined lint || defined __GNUC__
|
|
||||||
# define YYUSE(E) ((void) (E))
|
|
||||||
#else
|
|
||||||
# define YYUSE(E) /* empty */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#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\"")\
|
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
|
||||||
_Pragma ("GCC diagnostic pop")
|
|
||||||
#else
|
|
||||||
# define YY_INITIAL_VALUE(Value) Value
|
|
||||||
#endif
|
|
||||||
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
|
||||||
#endif
|
|
||||||
#ifndef YY_INITIAL_VALUE
|
|
||||||
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
|
||||||
#endif
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_null_define
|
# b4_null_define
|
||||||
# --------------
|
# --------------
|
||||||
# Portability issues: define a YY_NULLPTR appropriate for the current
|
# Portability issues: define a YY_NULL appropriate for the current
|
||||||
# language (C, C++98, or C++11).
|
# language (C, C++98, or C++11).
|
||||||
#
|
|
||||||
# In C++ pre C++11 it is standard practice to use 0 (not NULL) for the
|
|
||||||
# null pointer. In C, prefer ((void*)0) to avoid having to include stdlib.h.
|
|
||||||
m4_define([b4_null_define],
|
m4_define([b4_null_define],
|
||||||
[# ifndef YY_NULLPTR
|
[# ifndef YY_NULL
|
||||||
# if defined __cplusplus
|
# if defined __cplusplus && 201103L <= __cplusplus
|
||||||
# if 201103L <= __cplusplus
|
# define YY_NULL nullptr
|
||||||
# define YY_NULLPTR nullptr
|
|
||||||
# else
|
|
||||||
# define YY_NULLPTR 0
|
|
||||||
# endif
|
|
||||||
# else
|
# else
|
||||||
# define YY_NULLPTR ((void*)0)
|
# define YY_NULL 0
|
||||||
# endif
|
# endif
|
||||||
# endif[]dnl
|
# endif[]dnl
|
||||||
])
|
])
|
||||||
@@ -288,13 +222,7 @@ m4_define([b4_null_define],
|
|||||||
# b4_null
|
# b4_null
|
||||||
# -------
|
# -------
|
||||||
# Return a null pointer constant.
|
# Return a null pointer constant.
|
||||||
m4_define([b4_null], [YY_NULLPTR])
|
m4_define([b4_null], [YY_NULL])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
|
||||||
## Values. ##
|
|
||||||
## ---------##
|
|
||||||
|
|
||||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
@@ -369,7 +297,7 @@ m4_define([b4_token_enums_defines],
|
|||||||
# ----------------------------
|
# ----------------------------
|
||||||
# Given a semantic value VAL ($$, $1 etc.), extract its value of type
|
# Given a semantic value VAL ($$, $1 etc.), extract its value of type
|
||||||
# TYPE if TYPE is given, otherwise just return VAL. The result can be
|
# TYPE if TYPE is given, otherwise just return VAL. The result can be
|
||||||
# used safely, it is put in parens to avoid nasty precedence issues.
|
# used safetly, it is put in parens to avoid nasty precedence issues.
|
||||||
# TYPE is *not* put in braces, provide some if needed.
|
# TYPE is *not* put in braces, provide some if needed.
|
||||||
m4_define([b4_symbol_value],
|
m4_define([b4_symbol_value],
|
||||||
[($1[]m4_ifval([$2], [.$2]))])
|
[($1[]m4_ifval([$2], [.$2]))])
|
||||||
@@ -467,8 +395,7 @@ b4_syncline([@oline@], [@ofile@])
|
|||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
m4_define([b4_predicate_case],
|
m4_define([b4_predicate_case],
|
||||||
[ case $1:
|
[ case $1:
|
||||||
if (! (
|
if (! ($2)) YYERROR;
|
||||||
$2)) YYERROR;
|
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
@@ -494,9 +421,12 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
|||||||
yymsg = "Deleting";
|
yymsg = "Deleting";
|
||||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||||
|
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
switch (yytype)
|
||||||
]b4_symbol_actions([destructor])[
|
{
|
||||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -506,9 +436,9 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
|||||||
# Define the "yy_symbol_print" function.
|
# Define the "yy_symbol_print" function.
|
||||||
m4_define_default([b4_yy_symbol_print_define],
|
m4_define_default([b4_yy_symbol_print_define],
|
||||||
[[
|
[[
|
||||||
/*----------------------------------------.
|
/*--------------------------------.
|
||||||
| Print this symbol's value on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`----------------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
]b4_function_define([yy_symbol_value_print],
|
]b4_function_define([yy_symbol_value_print],
|
||||||
[static void],
|
[static void],
|
||||||
@@ -529,7 +459,12 @@ m4_if(b4_skeleton, ["yacc.c"],
|
|||||||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||||
# endif
|
# endif
|
||||||
]])dnl
|
]])dnl
|
||||||
b4_symbol_actions([printer])[
|
[ switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_printer])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -557,155 +492,28 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
|
|||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## api.value.type. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------- #
|
|
||||||
# api.value.type=union. #
|
|
||||||
# ---------------------- #
|
|
||||||
|
|
||||||
# b4_symbol_type_register(SYMBOL-NUM)
|
|
||||||
# -----------------------------------
|
|
||||||
# Symbol SYMBOL-NUM has a type (for variant) instead of a type-tag.
|
|
||||||
# Extend the definition of %union's body (b4_union_members) with a
|
|
||||||
# field of that type, and extend the symbol's "type" field to point to
|
|
||||||
# the field name, instead of the type name.
|
|
||||||
m4_define([b4_symbol_type_register],
|
|
||||||
[m4_define([b4_symbol($1, type_tag)],
|
|
||||||
[b4_symbol_if([$1], [has_id],
|
|
||||||
[b4_symbol([$1], [id])],
|
|
||||||
[yytype_[]b4_symbol([$1], [number])])])dnl
|
|
||||||
m4_append([b4_union_members],
|
|
||||||
m4_expand([
|
|
||||||
b4_symbol_tag_comment([$1])dnl
|
|
||||||
b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]))
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_type_define_tag(SYMBOL1-NUM, ...)
|
|
||||||
# ------------------------------------
|
|
||||||
# For the batch of symbols SYMBOL1-NUM... (which all have the same
|
|
||||||
# type), enhance the %union definition for each of them, and set
|
|
||||||
# there "type" field to the field tag name, instead of the type name.
|
|
||||||
m4_define([b4_type_define_tag],
|
|
||||||
[b4_symbol_if([$1], [has_type],
|
|
||||||
[m4_map([b4_symbol_type_register], [$@])])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value_union(VAL, [TYPE])
|
|
||||||
# ----------------------------------
|
|
||||||
# Same of b4_symbol_value, but when api.value.type=union.
|
|
||||||
m4_define([b4_symbol_value_union],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[(*($2*)(&$1))],
|
|
||||||
[$1])])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_setup_union
|
|
||||||
# -------------------------
|
|
||||||
# Setup support for api.value.type=union. Symbols are defined with a
|
|
||||||
# type instead of a union member name: build the corresponding union,
|
|
||||||
# and give the symbols their tag.
|
|
||||||
m4_define([b4_value_type_setup_union],
|
|
||||||
[m4_define([b4_union_members])
|
|
||||||
b4_type_foreach([b4_type_define_tag])
|
|
||||||
m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------- #
|
|
||||||
# api.value.type = variant. #
|
|
||||||
# -------------------------- #
|
|
||||||
|
|
||||||
# b4_value_type_setup_variant
|
|
||||||
# ---------------------------
|
|
||||||
# Setup support for api.value.type=variant. By default, fail, specialized
|
|
||||||
# by other skeletons.
|
|
||||||
m4_define([b4_value_type_setup_variant],
|
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.value.type]]),
|
|
||||||
[['%s' does not support '%s']],
|
|
||||||
[b4_skeleton],
|
|
||||||
[%define api.value.type variant])])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_value_type_setup_keyword
|
|
||||||
# ----------------------------
|
|
||||||
# api.value.type is defined with a keyword/string syntax. Check if
|
|
||||||
# that is properly defined, and prepare its use.
|
|
||||||
m4_define([_b4_value_type_setup_keyword],
|
|
||||||
[b4_percent_define_check_values([[[[api.value.type]],
|
|
||||||
[[none]],
|
|
||||||
[[union]],
|
|
||||||
[[union-directive]],
|
|
||||||
[[variant]],
|
|
||||||
[[yystype]]]])dnl
|
|
||||||
m4_case(b4_percent_define_get([[api.value.type]]),
|
|
||||||
[union], [b4_value_type_setup_union],
|
|
||||||
[variant], [b4_value_type_setup_variant])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_setup
|
|
||||||
# -------------------
|
|
||||||
# Check if api.value.type is properly defined, and possibly prepare
|
|
||||||
# its use.
|
|
||||||
b4_define_silent([b4_value_type_setup],
|
|
||||||
[# Define default value.
|
|
||||||
b4_percent_define_ifdef([[api.value.type]], [],
|
|
||||||
[# %union => api.value.type=union-directive
|
|
||||||
m4_ifdef([b4_union_members],
|
|
||||||
[m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [union-directive])],
|
|
||||||
[# no tag seen => api.value.type={int}
|
|
||||||
m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[m4_define([b4_percent_define_kind(api.value.type)], [code])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [int])],
|
|
||||||
[# otherwise api.value.type=yystype
|
|
||||||
m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
|
||||||
m4_define([b4_percent_define(api.value.type)], [yystype])])])])
|
|
||||||
|
|
||||||
# Set up.
|
|
||||||
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
|
||||||
[keyword\|string], [_b4_value_type_setup_keyword])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Declarations. ##
|
## Declarations. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_define
|
# b4_value_type_define
|
||||||
# --------------------
|
# --------------------
|
||||||
m4_define([b4_value_type_define],
|
m4_define([b4_value_type_define],
|
||||||
[b4_value_type_setup[]dnl
|
[[/* Value type. */
|
||||||
/* Value type. */
|
#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
||||||
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
]m4_ifdef([b4_stype],
|
||||||
[code],
|
[[typedef union ]b4_union_name[ ]b4_api_PREFIX[STYPE;
|
||||||
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
union ]b4_union_name[
|
||||||
typedef ]b4_percent_define_get([[api.value.type]])[ ]b4_api_PREFIX[STYPE;
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
|
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
|
||||||
#endif
|
|
||||||
]],
|
|
||||||
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
|
||||||
[union\|union-directive],
|
|
||||||
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
|
||||||
]b4_percent_define_get_syncline([[api.value.union.name]])[
|
|
||||||
union ]b4_percent_define_get([[api.value.union.name]])[
|
|
||||||
{
|
{
|
||||||
]b4_user_union_members[
|
]b4_user_stype[
|
||||||
};
|
};
|
||||||
]b4_percent_define_get_syncline([[api.value.union.name]])[
|
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
|
||||||
typedef union ]b4_percent_define_get([[api.value.union.name]])[ ]b4_api_PREFIX[STYPE;
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1
|
[[typedef int ]b4_api_PREFIX[STYPE;
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]])])[
|
||||||
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
||||||
#endif
|
#endif
|
||||||
]])])])
|
]])
|
||||||
|
|
||||||
|
|
||||||
# b4_location_type_define
|
# b4_location_type_define
|
||||||
@@ -741,7 +549,7 @@ b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
|
|||||||
|
|
||||||
|
|
||||||
# b4_YYDEBUG_define
|
# b4_YYDEBUG_define
|
||||||
# -----------------
|
# ------------------
|
||||||
m4_define([b4_YYDEBUG_define],
|
m4_define([b4_YYDEBUG_define],
|
||||||
[[/* Debug traces. */
|
[[/* Debug traces. */
|
||||||
]m4_if(b4_api_prefix, [yy],
|
]m4_if(b4_api_prefix, [yy],
|
||||||
@@ -813,7 +621,7 @@ m4_define([b4_yy_location_print_define],
|
|||||||
|
|
||||||
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
||||||
|
|
||||||
YY_ATTRIBUTE_UNUSED
|
__attribute__((__unused__))
|
||||||
]b4_function_define([yy_location_print_],
|
]b4_function_define([yy_location_print_],
|
||||||
[static unsigned],
|
[static unsigned],
|
||||||
[[FILE *yyo], [yyo]],
|
[[FILE *yyo], [yyo]],
|
||||||
|
|||||||
+181
-183
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# GLR skeleton for Bison
|
# GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -178,48 +178,15 @@ m4_if(b4_skeleton, ["glr.c"],
|
|||||||
## Output files. ##
|
## Output files. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
# Unfortunately the order of generation between the header and the
|
|
||||||
# implementation file matters (for glr.c) because of the current
|
|
||||||
# implementation of api.value.type=union. In that case we still use a
|
|
||||||
# union for YYSTYPE, but we generate the contents of this union when
|
|
||||||
# setting up YYSTYPE. This is needed for other aspects, such as
|
|
||||||
# defining yy_symbol_value_print, since we need to now the name of the
|
|
||||||
# members of this union.
|
|
||||||
#
|
|
||||||
# To avoid this issue, just generate the header before the
|
|
||||||
# implementation file. But we should also make them more independant.
|
|
||||||
|
|
||||||
# ----------------- #
|
|
||||||
# The header file. #
|
|
||||||
# ----------------- #
|
|
||||||
|
|
||||||
# glr.cc produces its own header.
|
|
||||||
m4_if(b4_skeleton, ["glr.c"],
|
|
||||||
[b4_defines_if(
|
|
||||||
[b4_output_begin([b4_spec_defines_file])
|
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
|
||||||
[2002-2015, 2018])[
|
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
|
||||||
]b4_shared_declarations[
|
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
|
||||||
]b4_output_end
|
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# ------------------------- #
|
|
||||||
# The implementation file. #
|
|
||||||
# ------------------------- #
|
|
||||||
|
|
||||||
b4_output_begin([b4_parser_file_name])
|
b4_output_begin([b4_parser_file_name])
|
||||||
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||||
[2002-2015, 2018])[
|
[2002-2013])[
|
||||||
|
|
||||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||||
|
|
||||||
]b4_identification[
|
]b4_identification
|
||||||
|
|
||||||
]b4_percent_code_get([[top]])[
|
b4_percent_code_get([[top]])[
|
||||||
]m4_if(b4_api_prefix, [yy], [],
|
]m4_if(b4_api_prefix, [yy], [],
|
||||||
[[/* Substitute the type names. */
|
[[/* Substitute the type names. */
|
||||||
#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
|
#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
|
||||||
@@ -279,6 +246,13 @@ b4_percent_code_get[]dnl
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# define YYUSE(E) ((void) (E))
|
||||||
|
#else
|
||||||
|
# define YYUSE(E) /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef YYFREE
|
#ifndef YYFREE
|
||||||
# define YYFREE free
|
# define YYFREE free
|
||||||
#endif
|
#endif
|
||||||
@@ -292,28 +266,32 @@ b4_percent_code_get[]dnl
|
|||||||
#define YYSIZEMAX ((size_t) -1)
|
#define YYSIZEMAX ((size_t) -1)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
typedef bool yybool;
|
typedef bool yybool;
|
||||||
# define yytrue true
|
|
||||||
# define yyfalse false
|
|
||||||
#else
|
#else
|
||||||
typedef unsigned char yybool;
|
typedef unsigned char yybool;
|
||||||
# define yytrue 1
|
|
||||||
# define yyfalse 0
|
|
||||||
#endif
|
#endif
|
||||||
|
#define yytrue 1
|
||||||
|
#define yyfalse 0
|
||||||
|
|
||||||
#ifndef YYSETJMP
|
#ifndef YYSETJMP
|
||||||
# include <setjmp.h>
|
# include <setjmp.h>
|
||||||
# define YYJMP_BUF jmp_buf
|
# define YYJMP_BUF jmp_buf
|
||||||
# define YYSETJMP(Env) setjmp (Env)
|
# define YYSETJMP(Env) setjmp (Env)
|
||||||
/* Pacify Clang and ICC. */
|
/* Pacify clang. */
|
||||||
# define YYLONGJMP(Env, Val) \
|
# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
|
||||||
do { \
|
|
||||||
longjmp (Env, Val); \
|
|
||||||
YYASSERT (0); \
|
|
||||||
} while (yyfalse)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_attribute_define[
|
/*-----------------.
|
||||||
|
| GCC extensions. |
|
||||||
|
`-----------------*/
|
||||||
|
|
||||||
|
#ifndef __attribute__
|
||||||
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
|
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||||
|
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
||||||
|
# define __attribute__(Spec) /* empty */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef YYASSERT
|
#ifndef YYASSERT
|
||||||
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
|
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
|
||||||
@@ -343,7 +321,7 @@ b4_percent_code_get[]dnl
|
|||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||||
|
|
||||||
#define YYTRANSLATE(YYX) \
|
#define YYTRANSLATE(YYX) \
|
||||||
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||||
|
|
||||||
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||||||
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
||||||
@@ -404,9 +382,9 @@ static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
|
|||||||
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
|
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
|
||||||
0, pointed into by YYCONFLP. */
|
0, pointed into by YYCONFLP. */
|
||||||
]dnl Do not use b4_int_type_for here, since there are places where
|
]dnl Do not use b4_int_type_for here, since there are places where
|
||||||
dnl pointers onto yyconfl are taken, whose type is "short*".
|
dnl pointers onto yyconfl are taken, whose type is "short int *".
|
||||||
dnl We probably ought to introduce a type for confl.
|
dnl We probably ought to introduce a type for confl.
|
||||||
[static const short yyconfl[] =
|
[static const short int yyconfl[] =
|
||||||
{
|
{
|
||||||
]b4_conflicting_rules[
|
]b4_conflicting_rules[
|
||||||
};
|
};
|
||||||
@@ -484,9 +462,9 @@ int yydebug;
|
|||||||
|
|
||||||
struct yyGLRStack;
|
struct yyGLRStack;
|
||||||
static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
|
static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
|
||||||
YY_ATTRIBUTE_UNUSED;
|
__attribute__ ((__unused__));
|
||||||
static void yypdumpstack (struct yyGLRStack* yystackp)
|
static void yypdumpstack (struct yyGLRStack* yystackp)
|
||||||
YY_ATTRIBUTE_UNUSED;
|
__attribute__ ((__unused__));
|
||||||
|
|
||||||
#else /* !]b4_api_PREFIX[DEBUG */
|
#else /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
@@ -619,7 +597,7 @@ typedef int yyRuleNum;
|
|||||||
typedef int yySymbol;
|
typedef int yySymbol;
|
||||||
|
|
||||||
/** Item references, as in LALR(1) machine */
|
/** Item references, as in LALR(1) machine */
|
||||||
typedef short yyItemNum;
|
typedef short int yyItemNum;
|
||||||
|
|
||||||
typedef struct yyGLRState yyGLRState;
|
typedef struct yyGLRState yyGLRState;
|
||||||
typedef struct yyGLRStateSet yyGLRStateSet;
|
typedef struct yyGLRStateSet yyGLRStateSet;
|
||||||
@@ -708,15 +686,19 @@ struct yyGLRStack {
|
|||||||
static void yyexpandGLRStack (yyGLRStack* yystackp);
|
static void yyexpandGLRStack (yyGLRStack* yystackp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static _Noreturn void
|
static void yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
|
||||||
|
__attribute__ ((__noreturn__));
|
||||||
|
static void
|
||||||
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
|
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
|
||||||
{
|
{
|
||||||
if (yymsg != YY_NULLPTR)
|
if (yymsg != YY_NULL)
|
||||||
yyerror (]b4_yyerror_args[yymsg);
|
yyerror (]b4_yyerror_args[yymsg);
|
||||||
YYLONGJMP (yystackp->yyexception_buffer, 1);
|
YYLONGJMP (yystackp->yyexception_buffer, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static _Noreturn void
|
static void yyMemoryExhausted (yyGLRStack* yystackp)
|
||||||
|
__attribute__ ((__noreturn__));
|
||||||
|
static void
|
||||||
yyMemoryExhausted (yyGLRStack* yystackp)
|
yyMemoryExhausted (yyGLRStack* yystackp)
|
||||||
{
|
{
|
||||||
YYLONGJMP (yystackp->yyexception_buffer, 2);
|
YYLONGJMP (yystackp->yyexception_buffer, 2);
|
||||||
@@ -737,7 +719,7 @@ yytokenName (yySymbol yytoken)
|
|||||||
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
|
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
|
||||||
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
|
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
|
||||||
* containing the pointer to the next state in the chain. */
|
* containing the pointer to the next state in the chain. */
|
||||||
static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
|
static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__));
|
||||||
static void
|
static void
|
||||||
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
||||||
{
|
{
|
||||||
@@ -754,7 +736,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
|||||||
else
|
else
|
||||||
/* The effect of using yysval or yyloc (in an immediate rule) is
|
/* The effect of using yysval or yyloc (in an immediate rule) is
|
||||||
* undefined. */
|
* undefined. */
|
||||||
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[
|
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[
|
||||||
yyvsp[i].yystate.yyloc = s->yyloc;]])[
|
yyvsp[i].yystate.yyloc = s->yyloc;]])[
|
||||||
s = yyvsp[i].yystate.yypred = s->yypred;
|
s = yyvsp[i].yystate.yypred = s->yypred;
|
||||||
}
|
}
|
||||||
@@ -764,7 +746,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
|||||||
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
|
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
|
||||||
* For convenience, always return YYLOW1. */
|
* For convenience, always return YYLOW1. */
|
||||||
static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
|
static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
|
||||||
YY_ATTRIBUTE_UNUSED;
|
__attribute__ ((__unused__));
|
||||||
static inline int
|
static inline int
|
||||||
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
|
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
|
||||||
{
|
{
|
||||||
@@ -786,7 +768,8 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
yyGLRStack* yystackp,
|
yyGLRStack* yystackp,
|
||||||
YYSTYPE* yyvalp]b4_locuser_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
yybool yynormal YY_ATTRIBUTE_UNUSED = (yystackp->yysplitPoint == YY_NULLPTR);
|
yybool yynormal __attribute__ ((__unused__)) =
|
||||||
|
(yystackp->yysplitPoint == YY_NULL);
|
||||||
int yylow;
|
int yylow;
|
||||||
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
||||||
[ YYUSE (yyrhslen);
|
[ YYUSE (yyrhslen);
|
||||||
@@ -814,7 +797,6 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
*yyvalp = yyval_default;
|
*yyvalp = yyval_default;
|
||||||
else
|
else
|
||||||
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
|
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
|
||||||
/* Default location. */
|
|
||||||
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
|
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
|
||||||
yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
|
yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
|
||||||
]])[
|
]])[
|
||||||
@@ -871,10 +853,12 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
if (yys->yysemantics.yyfirstVal)
|
if (yys->yysemantics.yyfirstVal)
|
||||||
YYFPRINTF (stderr, "%s unresolved", yymsg);
|
YYFPRINTF (stderr, "%s unresolved ", yymsg);
|
||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%s incomplete", yymsg);
|
YYFPRINTF (stderr, "%s incomplete ", yymsg);
|
||||||
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc);
|
yy_symbol_print (stderr, yystos[yys->yylrState],
|
||||||
|
YY_NULL]b4_locuser_args([&yys->yyloc])[);
|
||||||
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -929,7 +913,7 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
yygetLRActions (yyStateNum yystate, int yytoken,
|
yygetLRActions (yyStateNum yystate, int yytoken,
|
||||||
int* yyaction, const short** yyconflicts)
|
int* yyaction, const short int** yyconflicts)
|
||||||
{
|
{
|
||||||
int yyindex = yypact[yystate] + yytoken;
|
int yyindex = yypact[yystate] + yytoken;
|
||||||
if (yypact_value_is_default (yypact[yystate])
|
if (yypact_value_is_default (yypact[yystate])
|
||||||
@@ -950,18 +934,14 @@ yygetLRActions (yyStateNum yystate, int yytoken,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compute post-reduction state.
|
|
||||||
* \param yystate the current state
|
|
||||||
* \param yysym the nonterminal to push on the stack
|
|
||||||
*/
|
|
||||||
static inline yyStateNum
|
static inline yyStateNum
|
||||||
yyLRgotoState (yyStateNum yystate, yySymbol yysym)
|
yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
|
||||||
{
|
{
|
||||||
int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
|
int yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
|
||||||
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
|
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
|
||||||
return yytable[yyr];
|
return yytable[yyr];
|
||||||
else
|
else
|
||||||
return yydefgoto[yysym - YYNTOKENS];
|
return yydefgoto[yylhs - YYNTOKENS];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline yybool
|
static inline yybool
|
||||||
@@ -1003,7 +983,6 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
|
|||||||
{
|
{
|
||||||
yySemanticOption* yynewOption =
|
yySemanticOption* yynewOption =
|
||||||
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
||||||
YYASSERT (!yynewOption->yyisState);
|
|
||||||
yynewOption->yystate = yyrhs;
|
yynewOption->yystate = yyrhs;
|
||||||
yynewOption->yyrule = yyrule;
|
yynewOption->yyrule = yyrule;
|
||||||
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
||||||
@@ -1031,7 +1010,7 @@ yyinitStateSet (yyGLRStateSet* yyset)
|
|||||||
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
|
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
|
||||||
if (! yyset->yystates)
|
if (! yyset->yystates)
|
||||||
return yyfalse;
|
return yyfalse;
|
||||||
yyset->yystates[0] = YY_NULLPTR;
|
yyset->yystates[0] = YY_NULL;
|
||||||
yyset->yylookaheadNeeds =
|
yyset->yylookaheadNeeds =
|
||||||
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
|
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
|
||||||
if (! yyset->yylookaheadNeeds)
|
if (! yyset->yylookaheadNeeds)
|
||||||
@@ -1061,8 +1040,8 @@ yyinitGLRStack (yyGLRStack* yystackp, size_t yysize)
|
|||||||
if (!yystackp->yyitems)
|
if (!yystackp->yyitems)
|
||||||
return yyfalse;
|
return yyfalse;
|
||||||
yystackp->yynextFree = yystackp->yyitems;
|
yystackp->yynextFree = yystackp->yyitems;
|
||||||
yystackp->yysplitPoint = YY_NULLPTR;
|
yystackp->yysplitPoint = YY_NULL;
|
||||||
yystackp->yylastDeleted = YY_NULLPTR;
|
yystackp->yylastDeleted = YY_NULL;
|
||||||
return yyinitStateSet (&yystackp->yytops);
|
return yyinitStateSet (&yystackp->yytops);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1101,10 +1080,10 @@ yyexpandGLRStack (yyGLRStack* yystackp)
|
|||||||
{
|
{
|
||||||
yyGLRState* yys0 = &yyp0->yystate;
|
yyGLRState* yys0 = &yyp0->yystate;
|
||||||
yyGLRState* yys1 = &yyp1->yystate;
|
yyGLRState* yys1 = &yyp1->yystate;
|
||||||
if (yys0->yypred != YY_NULLPTR)
|
if (yys0->yypred != YY_NULL)
|
||||||
yys1->yypred =
|
yys1->yypred =
|
||||||
YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
|
YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
|
||||||
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR)
|
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL)
|
||||||
yys1->yysemantics.yyfirstVal =
|
yys1->yysemantics.yyfirstVal =
|
||||||
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
|
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
|
||||||
}
|
}
|
||||||
@@ -1112,18 +1091,18 @@ yyexpandGLRStack (yyGLRStack* yystackp)
|
|||||||
{
|
{
|
||||||
yySemanticOption* yyv0 = &yyp0->yyoption;
|
yySemanticOption* yyv0 = &yyp0->yyoption;
|
||||||
yySemanticOption* yyv1 = &yyp1->yyoption;
|
yySemanticOption* yyv1 = &yyp1->yyoption;
|
||||||
if (yyv0->yystate != YY_NULLPTR)
|
if (yyv0->yystate != YY_NULL)
|
||||||
yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
|
yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
|
||||||
if (yyv0->yynext != YY_NULLPTR)
|
if (yyv0->yynext != YY_NULL)
|
||||||
yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
|
yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (yystackp->yysplitPoint != YY_NULLPTR)
|
if (yystackp->yysplitPoint != YY_NULL)
|
||||||
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
|
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
|
||||||
yystackp->yysplitPoint, yystate);
|
yystackp->yysplitPoint, yystate);
|
||||||
|
|
||||||
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
|
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
|
||||||
if (yystackp->yytops.yystates[yyn] != YY_NULLPTR)
|
if (yystackp->yytops.yystates[yyn] != YY_NULL)
|
||||||
yystackp->yytops.yystates[yyn] =
|
yystackp->yytops.yystates[yyn] =
|
||||||
YYRELOC (yystackp->yyitems, yynewItems,
|
YYRELOC (yystackp->yyitems, yynewItems,
|
||||||
yystackp->yytops.yystates[yyn], yystate);
|
yystackp->yytops.yystates[yyn], yystate);
|
||||||
@@ -1147,7 +1126,7 @@ yyfreeGLRStack (yyGLRStack* yystackp)
|
|||||||
static inline void
|
static inline void
|
||||||
yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
||||||
{
|
{
|
||||||
if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys)
|
if (yystackp->yysplitPoint != YY_NULL && yystackp->yysplitPoint > yys)
|
||||||
yystackp->yysplitPoint = yys;
|
yystackp->yysplitPoint = yys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1155,9 +1134,9 @@ yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
|||||||
static inline void
|
static inline void
|
||||||
yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
|
yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
|
||||||
{
|
{
|
||||||
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
if (yystackp->yytops.yystates[yyk] != YY_NULL)
|
||||||
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
|
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
|
||||||
yystackp->yytops.yystates[yyk] = YY_NULLPTR;
|
yystackp->yytops.yystates[yyk] = YY_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
|
/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
|
||||||
@@ -1166,12 +1145,12 @@ yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
|
|||||||
static void
|
static void
|
||||||
yyundeleteLastStack (yyGLRStack* yystackp)
|
yyundeleteLastStack (yyGLRStack* yystackp)
|
||||||
{
|
{
|
||||||
if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0)
|
if (yystackp->yylastDeleted == YY_NULL || yystackp->yytops.yysize != 0)
|
||||||
return;
|
return;
|
||||||
yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
|
yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
|
||||||
yystackp->yytops.yysize = 1;
|
yystackp->yytops.yysize = 1;
|
||||||
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
|
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
|
||||||
yystackp->yylastDeleted = YY_NULLPTR;
|
yystackp->yylastDeleted = YY_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -1181,7 +1160,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
|||||||
yyi = yyj = 0;
|
yyi = yyj = 0;
|
||||||
while (yyj < yystackp->yytops.yysize)
|
while (yyj < yystackp->yytops.yysize)
|
||||||
{
|
{
|
||||||
if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
|
if (yystackp->yytops.yystates[yyi] == YY_NULL)
|
||||||
{
|
{
|
||||||
if (yyi == yyj)
|
if (yyi == yyj)
|
||||||
{
|
{
|
||||||
@@ -1202,7 +1181,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
|||||||
if (yyj != yyi)
|
if (yyj != yyi)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n",
|
YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n",
|
||||||
(unsigned long) yyi, (unsigned long) yyj));
|
(unsigned long int) yyi, (unsigned long int) yyj));
|
||||||
}
|
}
|
||||||
yyj += 1;
|
yyj += 1;
|
||||||
}
|
}
|
||||||
@@ -1239,13 +1218,12 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
||||||
{
|
{
|
||||||
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
||||||
YYASSERT (yynewState->yyisState);
|
|
||||||
|
|
||||||
yynewState->yylrState = yylrState;
|
yynewState->yylrState = yylrState;
|
||||||
yynewState->yyposn = yyposn;
|
yynewState->yyposn = yyposn;
|
||||||
yynewState->yyresolved = yyfalse;
|
yynewState->yyresolved = yyfalse;
|
||||||
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
||||||
yynewState->yysemantics.yyfirstVal = YY_NULLPTR;
|
yynewState->yysemantics.yyfirstVal = YY_NULL;
|
||||||
yystackp->yytops.yystates[yyk] = yynewState;
|
yystackp->yytops.yystates[yyk] = yynewState;
|
||||||
|
|
||||||
/* Invokes YY_RESERVE_GLRSTACK. */
|
/* Invokes YY_RESERVE_GLRSTACK. */
|
||||||
@@ -1273,8 +1251,8 @@ yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk,
|
|||||||
int yylow = 1;])[
|
int yylow = 1;])[
|
||||||
int yyi;
|
int yyi;
|
||||||
YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
||||||
(unsigned long) yyk, yyrule - 1,
|
(unsigned long int) yyk, yyrule - 1,
|
||||||
(unsigned long) yyrline[yyrule]);
|
(unsigned long int) yyrline[yyrule]);
|
||||||
if (! yynormal)
|
if (! yynormal)
|
||||||
yyfillin (yyvsp, 1, -yynrhs);
|
yyfillin (yyvsp, 1, -yynrhs);
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
@@ -1305,7 +1283,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
{
|
{
|
||||||
int yynrhs = yyrhsLength (yyrule);
|
int yynrhs = yyrhsLength (yyrule);
|
||||||
|
|
||||||
if (yystackp->yysplitPoint == YY_NULLPTR)
|
if (yystackp->yysplitPoint == YY_NULL)
|
||||||
{
|
{
|
||||||
/* Standard special case: single stack. */
|
/* Standard special case: single stack. */
|
||||||
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
||||||
@@ -1357,16 +1335,17 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
{
|
{
|
||||||
size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
|
size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
|
||||||
|
|
||||||
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
|
if (yyforceEval || yystackp->yysplitPoint == YY_NULL)
|
||||||
{
|
{
|
||||||
YYSTYPE yysval;]b4_locations_if([[
|
YYRESULTTAG yyflag;
|
||||||
YYLTYPE yyloc;]])[
|
YYSTYPE yysval;]b4_locations_if([
|
||||||
|
YYLTYPE yyloc;])[
|
||||||
|
|
||||||
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
||||||
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
|
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULL)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
|
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
|
||||||
(unsigned long) yyk, yyrule - 1));
|
(unsigned long int) yyk, yyrule - 1));
|
||||||
}
|
}
|
||||||
if (yyflag != yyok)
|
if (yyflag != yyok)
|
||||||
return yyflag;
|
return yyflag;
|
||||||
@@ -1394,9 +1373,9 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
YYDPRINTF ((stderr,
|
YYDPRINTF ((stderr,
|
||||||
"Reduced stack %lu by rule #%d; action deferred. "
|
"Reduced stack %lu by rule #%d; action deferred. "
|
||||||
"Now in state %d.\n",
|
"Now in state %d.\n",
|
||||||
(unsigned long) yyk, yyrule - 1, yynewLRState));
|
(unsigned long int) yyk, yyrule - 1, yynewLRState));
|
||||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||||
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
|
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL)
|
||||||
{
|
{
|
||||||
yyGLRState *yysplit = yystackp->yysplitPoint;
|
yyGLRState *yysplit = yystackp->yysplitPoint;
|
||||||
yyGLRState *yyp = yystackp->yytops.yystates[yyi];
|
yyGLRState *yyp = yystackp->yytops.yystates[yyi];
|
||||||
@@ -1407,8 +1386,8 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule);
|
yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule);
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n",
|
YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n",
|
||||||
(unsigned long) yyk,
|
(unsigned long int) yyk,
|
||||||
(unsigned long) yyi));
|
(unsigned long int) yyi));
|
||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
yyp = yyp->yypred;
|
yyp = yyp->yypred;
|
||||||
@@ -1423,7 +1402,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
static size_t
|
static size_t
|
||||||
yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
||||||
{
|
{
|
||||||
if (yystackp->yysplitPoint == YY_NULLPTR)
|
if (yystackp->yysplitPoint == YY_NULL)
|
||||||
{
|
{
|
||||||
YYASSERT (yyk == 0);
|
YYASSERT (yyk == 0);
|
||||||
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
||||||
@@ -1433,7 +1412,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
|||||||
yyGLRState** yynewStates;
|
yyGLRState** yynewStates;
|
||||||
yybool* yynewLookaheadNeeds;
|
yybool* yynewLookaheadNeeds;
|
||||||
|
|
||||||
yynewStates = YY_NULLPTR;
|
yynewStates = YY_NULL;
|
||||||
|
|
||||||
if (yystackp->yytops.yycapacity
|
if (yystackp->yytops.yycapacity
|
||||||
> (YYSIZEMAX / (2 * sizeof yynewStates[0])))
|
> (YYSIZEMAX / (2 * sizeof yynewStates[0])))
|
||||||
@@ -1444,7 +1423,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
|||||||
(yyGLRState**) YYREALLOC (yystackp->yytops.yystates,
|
(yyGLRState**) YYREALLOC (yystackp->yytops.yystates,
|
||||||
(yystackp->yytops.yycapacity
|
(yystackp->yytops.yycapacity
|
||||||
* sizeof yynewStates[0]));
|
* sizeof yynewStates[0]));
|
||||||
if (yynewStates == YY_NULLPTR)
|
if (yynewStates == YY_NULL)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yystates = yynewStates;
|
yystackp->yytops.yystates = yynewStates;
|
||||||
|
|
||||||
@@ -1452,7 +1431,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
|||||||
(yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
(yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
||||||
(yystackp->yytops.yycapacity
|
(yystackp->yytops.yycapacity
|
||||||
* sizeof yynewLookaheadNeeds[0]));
|
* sizeof yynewLookaheadNeeds[0]));
|
||||||
if (yynewLookaheadNeeds == YY_NULLPTR)
|
if (yynewLookaheadNeeds == YY_NULL)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
||||||
}
|
}
|
||||||
@@ -1516,9 +1495,9 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
|
|||||||
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
|
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
|
||||||
while (yytrue)
|
while (yytrue)
|
||||||
{
|
{
|
||||||
if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR)
|
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
|
||||||
break;
|
break;
|
||||||
else if (*yyz0p == YY_NULLPTR)
|
else if (*yyz0p == YY_NULL)
|
||||||
{
|
{
|
||||||
*yyz0p = yyz1;
|
*yyz0p = yyz1;
|
||||||
break;
|
break;
|
||||||
@@ -1639,7 +1618,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
|||||||
|
|
||||||
for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
|
for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
|
||||||
yystates[yyi] = yys;
|
yystates[yyi] = yys;
|
||||||
if (yys == YY_NULLPTR)
|
if (yys == YY_NULL)
|
||||||
{
|
{
|
||||||
yyleftmost_state.yyposn = 0;
|
yyleftmost_state.yyposn = 0;
|
||||||
yystates[0] = &yyleftmost_state;
|
yystates[0] = &yyleftmost_state;
|
||||||
@@ -1654,8 +1633,8 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
|||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n",
|
YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n",
|
||||||
yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
|
yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
|
||||||
yyx->yyrule - 1, (unsigned long) (yys->yyposn + 1),
|
yyx->yyrule - 1, (unsigned long int) (yys->yyposn + 1),
|
||||||
(unsigned long) yyx->yystate->yyposn);
|
(unsigned long int) yyx->yystate->yyposn);
|
||||||
for (yyi = 1; yyi <= yynrhs; yyi += 1)
|
for (yyi = 1; yyi <= yynrhs; yyi += 1)
|
||||||
{
|
{
|
||||||
if (yystates[yyi]->yyresolved)
|
if (yystates[yyi]->yyresolved)
|
||||||
@@ -1666,8 +1645,8 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
|||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
|
YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
|
||||||
yytokenName (yystos[yystates[yyi]->yylrState]),
|
yytokenName (yystos[yystates[yyi]->yylrState]),
|
||||||
(unsigned long) (yystates[yyi-1]->yyposn + 1),
|
(unsigned long int) (yystates[yyi-1]->yyposn + 1),
|
||||||
(unsigned long) yystates[yyi]->yyposn);
|
(unsigned long int) yystates[yyi]->yyposn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
|
yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
|
||||||
@@ -1699,7 +1678,7 @@ yyreportAmbiguity (yySemanticOption* yyx0,
|
|||||||
* ending at YYS1. Has no effect on previously resolved states.
|
* ending at YYS1. Has no effect on previously resolved states.
|
||||||
* The first semantic option of a state is always chosen. */
|
* The first semantic option of a state is always chosen. */
|
||||||
static void
|
static void
|
||||||
yyresolveLocations (yyGLRState *yys1, int yyn1,
|
yyresolveLocations (yyGLRState* yys1, int yyn1,
|
||||||
yyGLRStack *yystackp]b4_user_formals[)
|
yyGLRStack *yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
if (0 < yyn1)
|
if (0 < yyn1)
|
||||||
@@ -1710,9 +1689,9 @@ yyresolveLocations (yyGLRState *yys1, int yyn1,
|
|||||||
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
||||||
int yynrhs;
|
int yynrhs;
|
||||||
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
||||||
YYASSERT (yyoption);
|
YYASSERT (yyoption != YY_NULL);
|
||||||
yynrhs = yyrhsLength (yyoption->yyrule);
|
yynrhs = yyrhsLength (yyoption->yyrule);
|
||||||
if (0 < yynrhs)
|
if (yynrhs > 0)
|
||||||
{
|
{
|
||||||
yyGLRState *yys;
|
yyGLRState *yys;
|
||||||
int yyn;
|
int yyn;
|
||||||
@@ -1735,7 +1714,18 @@ yyresolveLocations (yyGLRState *yys1, int yyn1,
|
|||||||
yyGLRState *yyprevious = yyoption->yystate;
|
yyGLRState *yyprevious = yyoption->yystate;
|
||||||
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
|
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
|
||||||
}
|
}
|
||||||
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
|
{
|
||||||
|
int yychar_current = yychar;
|
||||||
|
YYSTYPE yylval_current = yylval;
|
||||||
|
YYLTYPE yylloc_current = yylloc;
|
||||||
|
yychar = yyoption->yyrawchar;
|
||||||
|
yylval = yyoption->yyval;
|
||||||
|
yylloc = yyoption->yyloc;
|
||||||
|
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
|
||||||
|
yychar = yychar_current;
|
||||||
|
yylval = yylval_current;
|
||||||
|
yylloc = yylloc_current;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]])[
|
}]])[
|
||||||
@@ -1758,7 +1748,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YYRESULTTAG yyflag;]b4_locations_if([
|
YYRESULTTAG yyflag;]b4_locations_if([
|
||||||
YYLTYPE *yylocp = &yys->yyloc;])[
|
YYLTYPE *yylocp = &yys->yyloc;])[
|
||||||
|
|
||||||
for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; )
|
for (yypp = &yyoptionList->yynext; *yypp != YY_NULL; )
|
||||||
{
|
{
|
||||||
yySemanticOption* yyp = *yypp;
|
yySemanticOption* yyp = *yypp;
|
||||||
|
|
||||||
@@ -1800,7 +1790,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
int yyprec = yydprec[yybest->yyrule];
|
int yyprec = yydprec[yybest->yyrule];
|
||||||
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
|
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
|
||||||
if (yyflag == yyok)
|
if (yyflag == yyok)
|
||||||
for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
|
for (yyp = yybest->yynext; yyp != YY_NULL; yyp = yyp->yynext)
|
||||||
{
|
{
|
||||||
if (yyprec == yydprec[yyp->yyrule])
|
if (yyprec == yydprec[yyp->yyrule])
|
||||||
{
|
{
|
||||||
@@ -1827,14 +1817,14 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yys->yysemantics.yysval = yysval;
|
yys->yysemantics.yysval = yysval;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yys->yysemantics.yyfirstVal = YY_NULLPTR;
|
yys->yysemantics.yyfirstVal = YY_NULL;
|
||||||
return yyflag;
|
return yyflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
static YYRESULTTAG
|
static YYRESULTTAG
|
||||||
yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
|
yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
if (yystackp->yysplitPoint != YY_NULLPTR)
|
if (yystackp->yysplitPoint != YY_NULL)
|
||||||
{
|
{
|
||||||
yyGLRState* yys;
|
yyGLRState* yys;
|
||||||
int yyn;
|
int yyn;
|
||||||
@@ -1854,10 +1844,10 @@ yycompressStack (yyGLRStack* yystackp)
|
|||||||
{
|
{
|
||||||
yyGLRState* yyp, *yyq, *yyr;
|
yyGLRState* yyp, *yyq, *yyr;
|
||||||
|
|
||||||
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
|
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
|
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULL;
|
||||||
yyp != yystackp->yysplitPoint;
|
yyp != yystackp->yysplitPoint;
|
||||||
yyr = yyp, yyp = yyq, yyq = yyp->yypred)
|
yyr = yyp, yyp = yyq, yyq = yyp->yypred)
|
||||||
yyp->yypred = yyr;
|
yyp->yypred = yyr;
|
||||||
@@ -1865,10 +1855,10 @@ yycompressStack (yyGLRStack* yystackp)
|
|||||||
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
|
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
|
||||||
yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1;
|
yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1;
|
||||||
yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
|
yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
|
||||||
yystackp->yysplitPoint = YY_NULLPTR;
|
yystackp->yysplitPoint = YY_NULL;
|
||||||
yystackp->yylastDeleted = YY_NULLPTR;
|
yystackp->yylastDeleted = YY_NULL;
|
||||||
|
|
||||||
while (yyr != YY_NULLPTR)
|
while (yyr != YY_NULL)
|
||||||
{
|
{
|
||||||
yystackp->yynextFree->yystate = *yyr;
|
yystackp->yynextFree->yystate = *yyr;
|
||||||
yyr = yyr->yypred;
|
yyr = yyr->yypred;
|
||||||
@@ -1883,11 +1873,11 @@ static YYRESULTTAG
|
|||||||
yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||||
size_t yyposn]b4_pure_formals[)
|
size_t yyposn]b4_pure_formals[)
|
||||||
{
|
{
|
||||||
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
while (yystackp->yytops.yystates[yyk] != YY_NULL)
|
||||||
{
|
{
|
||||||
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
|
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
|
||||||
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
|
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
|
||||||
(unsigned long) yyk, yystate));
|
(unsigned long int) yyk, yystate));
|
||||||
|
|
||||||
YYASSERT (yystate != YYFINAL);
|
YYASSERT (yystate != YYFINAL);
|
||||||
|
|
||||||
@@ -1898,7 +1888,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
if (yyrule == 0)
|
if (yyrule == 0)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
||||||
(unsigned long) yyk));
|
(unsigned long int) yyk));
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
@@ -1908,7 +1898,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
YYDPRINTF ((stderr,
|
YYDPRINTF ((stderr,
|
||||||
"Stack %lu dies "
|
"Stack %lu dies "
|
||||||
"(predicate failure or explicit user error).\n",
|
"(predicate failure or explicit user error).\n",
|
||||||
(unsigned long) yyk));
|
(unsigned long int) yyk));
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
@@ -1919,7 +1909,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
{
|
{
|
||||||
yySymbol yytoken;
|
yySymbol yytoken;
|
||||||
int yyaction;
|
int yyaction;
|
||||||
const short* yyconflicts;
|
const short int* yyconflicts;
|
||||||
|
|
||||||
yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
|
yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
|
||||||
if (yychar == YYEMPTY)
|
if (yychar == YYEMPTY)
|
||||||
@@ -1946,8 +1936,8 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
YYRESULTTAG yyflag;
|
YYRESULTTAG yyflag;
|
||||||
size_t yynewStack = yysplitStack (yystackp, yyk);
|
size_t yynewStack = yysplitStack (yystackp, yyk);
|
||||||
YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n",
|
YYDPRINTF ((stderr, "Splitting off stack %lu from %lu.\n",
|
||||||
(unsigned long) yynewStack,
|
(unsigned long int) yynewStack,
|
||||||
(unsigned long) yyk));
|
(unsigned long int) yyk));
|
||||||
yyflag = yyglrReduce (yystackp, yynewStack,
|
yyflag = yyglrReduce (yystackp, yynewStack,
|
||||||
*yyconflicts,
|
*yyconflicts,
|
||||||
yyimmediate[*yyconflicts]]b4_user_args[);
|
yyimmediate[*yyconflicts]]b4_user_args[);
|
||||||
@@ -1957,7 +1947,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
else if (yyflag == yyerr)
|
else if (yyflag == yyerr)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
||||||
(unsigned long) yynewStack));
|
(unsigned long int) yynewStack));
|
||||||
yymarkStackDeleted (yystackp, yynewStack);
|
yymarkStackDeleted (yystackp, yynewStack);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1970,7 +1960,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
else if (yyisErrorAction (yyaction))
|
else if (yyisErrorAction (yyaction))
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
YYDPRINTF ((stderr, "Stack %lu dies.\n",
|
||||||
(unsigned long) yyk));
|
(unsigned long int) yyk));
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1983,7 +1973,7 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
YYDPRINTF ((stderr,
|
YYDPRINTF ((stderr,
|
||||||
"Stack %lu dies "
|
"Stack %lu dies "
|
||||||
"(predicate failure or explicit user error).\n",
|
"(predicate failure or explicit user error).\n",
|
||||||
(unsigned long) yyk));
|
(unsigned long int) yyk));
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2005,13 +1995,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
||||||
size_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken));
|
size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken));
|
||||||
size_t yysize = yysize0;
|
size_t yysize = yysize0;
|
||||||
yybool yysize_overflow = yyfalse;
|
yybool yysize_overflow = yyfalse;
|
||||||
char* yymsg = YY_NULLPTR;
|
char* yymsg = YY_NULL;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULLPTR;
|
const char *yyformat = YY_NULL;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat. */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* Number of reported tokens (one for the "unexpected", one per
|
||||||
@@ -2067,7 +2057,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
yyarg[yycount++] = yytokenName (yyx);
|
yyarg[yycount++] = yytokenName (yyx);
|
||||||
{
|
{
|
||||||
size_t yysz = yysize + yytnamerr (YY_NULLPTR, yytokenName (yyx));
|
size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx));
|
||||||
yysize_overflow |= yysz < yysize;
|
yysize_overflow |= yysz < yysize;
|
||||||
yysize = yysz;
|
yysize = yysz;
|
||||||
}
|
}
|
||||||
@@ -2081,7 +2071,6 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
case N: \
|
case N: \
|
||||||
yyformat = S; \
|
yyformat = S; \
|
||||||
break
|
break
|
||||||
default: /* Avoid compiler warnings. */
|
|
||||||
YYCASE_(0, YY_("syntax error"));
|
YYCASE_(0, YY_("syntax error"));
|
||||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||||
@@ -2146,7 +2135,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yySymbol yytoken;
|
yySymbol yytoken;
|
||||||
if (yychar == YYEOF)
|
if (yychar == YYEOF)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
/* We throw away the lookahead, but the error range
|
/* We throw away the lookahead, but the error range
|
||||||
@@ -2187,10 +2176,10 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
|
|
||||||
/* Reduce to one stack. */
|
/* Reduce to one stack. */
|
||||||
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
if (yystackp->yytops.yystates[yyk] != YY_NULL)
|
||||||
break;
|
break;
|
||||||
if (yyk >= yystackp->yytops.yysize)
|
if (yyk >= yystackp->yytops.yysize)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
||||||
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
yyremoveDeletes (yystackp);
|
yyremoveDeletes (yystackp);
|
||||||
@@ -2198,7 +2187,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
|
|
||||||
/* Now pop stack until we find a state that shifts the error token. */
|
/* Now pop stack until we find a state that shifts the error token. */
|
||||||
yystackp->yyerrState = 3;
|
yystackp->yyerrState = 3;
|
||||||
while (yystackp->yytops.yystates[0] != YY_NULLPTR)
|
while (yystackp->yytops.yystates[0] != YY_NULL)
|
||||||
{
|
{
|
||||||
yyGLRState *yys = yystackp->yytops.yystates[0];
|
yyGLRState *yys = yystackp->yytops.yystates[0];
|
||||||
yyj = yypact[yys->yylrState];
|
yyj = yypact[yys->yylrState];
|
||||||
@@ -2222,14 +2211,14 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
}]b4_locations_if([[
|
}]b4_locations_if([[
|
||||||
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||||
if (yys->yypred != YY_NULLPTR)
|
if (yys->yypred != YY_NULL)
|
||||||
yydestroyGLRState ("Error: popping", yys]b4_user_args[);
|
yydestroyGLRState ("Error: popping", yys]b4_user_args[);
|
||||||
yystackp->yytops.yystates[0] = yys->yypred;
|
yystackp->yytops.yystates[0] = yys->yypred;
|
||||||
yystackp->yynextFree -= 1;
|
yystackp->yynextFree -= 1;
|
||||||
yystackp->yyspaceLeft += 1;
|
yystackp->yyspaceLeft += 1;
|
||||||
}
|
}
|
||||||
if (yystackp->yytops.yystates[0] == YY_NULLPTR)
|
if (yystackp->yytops.yystates[0] == YY_NULL)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define YYCHK1(YYE) \
|
#define YYCHK1(YYE) \
|
||||||
@@ -2292,7 +2281,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
{
|
{
|
||||||
yyRuleNum yyrule;
|
yyRuleNum yyrule;
|
||||||
int yyaction;
|
int yyaction;
|
||||||
const short* yyconflicts;
|
const short int* yyconflicts;
|
||||||
|
|
||||||
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
|
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
|
||||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||||
@@ -2302,8 +2291,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
{
|
{
|
||||||
yyrule = yydefaultAction (yystate);
|
yyrule = yydefaultAction (yystate);
|
||||||
if (yyrule == 0)
|
if (yyrule == 0)
|
||||||
{]b4_locations_if([[
|
{
|
||||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -2342,8 +2331,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
yystack.yyerrState -= 1;
|
yystack.yyerrState -= 1;
|
||||||
}
|
}
|
||||||
else if (yyisErrorAction (yyaction))
|
else if (yyisErrorAction (yyaction))
|
||||||
{]b4_locations_if([[
|
{
|
||||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -2388,8 +2377,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (yystack.yytops.yysize == 0)
|
if (yystack.yytops.yysize == 0)
|
||||||
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
|
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
|
||||||
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
||||||
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[
|
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
|
||||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -2405,17 +2394,17 @@ b4_dollar_popdef])[]dnl
|
|||||||
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
||||||
{
|
{
|
||||||
int yyaction;
|
int yyaction;
|
||||||
const short* yyconflicts;
|
const short int* yyconflicts;
|
||||||
yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState;
|
yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState;
|
||||||
yygetLRActions (yystate, yytoken_to_shift, &yyaction,
|
yygetLRActions (yystate, yytoken_to_shift, &yyaction,
|
||||||
&yyconflicts);
|
&yyconflicts);
|
||||||
/* Note that yyconflicts were handled by yyprocessOneStack. */
|
/* Note that yyconflicts were handled by yyprocessOneStack. */
|
||||||
YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long) yys));
|
YYDPRINTF ((stderr, "On stack %lu, ", (unsigned long int) yys));
|
||||||
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
||||||
yyglrShift (&yystack, yys, yyaction, yyposn,
|
yyglrShift (&yystack, yys, yyaction, yyposn,
|
||||||
&yylval]b4_locations_if([, &yylloc])[);
|
&yylval]b4_locations_if([, &yylloc])[);
|
||||||
YYDPRINTF ((stderr, "Stack %lu now in state #%d\n",
|
YYDPRINTF ((stderr, "Stack %lu now in state #%d\n",
|
||||||
(unsigned long) yys,
|
(unsigned long int) yys,
|
||||||
yystack.yytops.yystates[yys]->yylrState));
|
yystack.yytops.yystates[yys]->yylrState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2470,9 +2459,9 @@ b4_dollar_popdef])[]dnl
|
|||||||
{
|
{
|
||||||
while (yystates[yyk])
|
while (yystates[yyk])
|
||||||
{
|
{
|
||||||
yyGLRState *yys = yystates[yyk];]b4_locations_if([[
|
yyGLRState *yys = yystates[yyk];
|
||||||
yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
|
||||||
if (yys->yypred != YY_NULLPTR)
|
)[ if (yys->yypred != YY_NULL)
|
||||||
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
|
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
|
||||||
yystates[yyk] = yys->yypred;
|
yystates[yyk] = yys->yypred;
|
||||||
yystack.yynextFree -= 1;
|
yystack.yynextFree -= 1;
|
||||||
@@ -2498,13 +2487,13 @@ yy_yypstack (yyGLRState* yys)
|
|||||||
YYFPRINTF (stderr, " -> ");
|
YYFPRINTF (stderr, " -> ");
|
||||||
}
|
}
|
||||||
YYFPRINTF (stderr, "%d@@%lu", yys->yylrState,
|
YYFPRINTF (stderr, "%d@@%lu", yys->yylrState,
|
||||||
(unsigned long) yys->yyposn);
|
(unsigned long int) yys->yyposn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
yypstates (yyGLRState* yyst)
|
yypstates (yyGLRState* yyst)
|
||||||
{
|
{
|
||||||
if (yyst == YY_NULLPTR)
|
if (yyst == YY_NULL)
|
||||||
YYFPRINTF (stderr, "<null>");
|
YYFPRINTF (stderr, "<null>");
|
||||||
else
|
else
|
||||||
yy_yypstack (yyst);
|
yy_yypstack (yyst);
|
||||||
@@ -2518,7 +2507,7 @@ yypstack (yyGLRStack* yystackp, size_t yyk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define YYINDEX(YYX) \
|
#define YYINDEX(YYX) \
|
||||||
((YYX) == YY_NULLPTR ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
|
((YYX) == YY_NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2529,35 +2518,31 @@ yypdumpstack (yyGLRStack* yystackp)
|
|||||||
for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
|
for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
|
||||||
{
|
{
|
||||||
YYFPRINTF (stderr, "%3lu. ",
|
YYFPRINTF (stderr, "%3lu. ",
|
||||||
(unsigned long) (yyp - yystackp->yyitems));
|
(unsigned long int) (yyp - yystackp->yyitems));
|
||||||
if (*(yybool *) yyp)
|
if (*(yybool *) yyp)
|
||||||
{
|
{
|
||||||
YYASSERT (yyp->yystate.yyisState);
|
|
||||||
YYASSERT (yyp->yyoption.yyisState);
|
|
||||||
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
|
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
|
||||||
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
||||||
(unsigned long) yyp->yystate.yyposn,
|
(unsigned long int) yyp->yystate.yyposn,
|
||||||
(long) YYINDEX (yyp->yystate.yypred));
|
(long int) YYINDEX (yyp->yystate.yypred));
|
||||||
if (! yyp->yystate.yyresolved)
|
if (! yyp->yystate.yyresolved)
|
||||||
YYFPRINTF (stderr, ", firstVal: %ld",
|
YYFPRINTF (stderr, ", firstVal: %ld",
|
||||||
(long) YYINDEX (yyp->yystate
|
(long int) YYINDEX (yyp->yystate
|
||||||
.yysemantics.yyfirstVal));
|
.yysemantics.yyfirstVal));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YYASSERT (!yyp->yystate.yyisState);
|
|
||||||
YYASSERT (!yyp->yyoption.yyisState);
|
|
||||||
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
|
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
|
||||||
yyp->yyoption.yyrule - 1,
|
yyp->yyoption.yyrule - 1,
|
||||||
(long) YYINDEX (yyp->yyoption.yystate),
|
(long int) YYINDEX (yyp->yyoption.yystate),
|
||||||
(long) YYINDEX (yyp->yyoption.yynext));
|
(long int) YYINDEX (yyp->yyoption.yynext));
|
||||||
}
|
}
|
||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
YYFPRINTF (stderr, "Tops:");
|
YYFPRINTF (stderr, "Tops:");
|
||||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||||
YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long) yyi,
|
YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi,
|
||||||
(long) YYINDEX (yystackp->yytops.yystates[yyi]));
|
(long int) YYINDEX (yystackp->yytops.yystates[yyi]));
|
||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2579,4 +2564,17 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#define yylloc ]b4_prefix[lloc]])])[
|
#define yylloc ]b4_prefix[lloc]])])[
|
||||||
|
|
||||||
]b4_epilogue[]dnl
|
]b4_epilogue[]dnl
|
||||||
b4_output_end
|
b4_output_end()
|
||||||
|
|
||||||
|
# glr.cc produces its own header.
|
||||||
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
|
[b4_defines_if(
|
||||||
|
[b4_output_begin([b4_spec_defines_file])
|
||||||
|
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||||
|
[2002-2013])[
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
|
]b4_shared_declarations[
|
||||||
|
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||||
|
]b4_output_end()
|
||||||
|
])])
|
||||||
|
|||||||
+26
-18
@@ -1,6 +1,6 @@
|
|||||||
# C++ GLR skeleton for Bison
|
# C++ GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -43,6 +43,12 @@
|
|||||||
# user must initialize the first positions (in particular the
|
# user must initialize the first positions (in particular the
|
||||||
# filename member).
|
# filename member).
|
||||||
|
|
||||||
|
b4_token_ctor_if([b4_variant_if([],
|
||||||
|
[b4_fatal_at(b4_percent_define_get_loc(api.token.constructor),
|
||||||
|
[cannot use '%s' without '%s'],
|
||||||
|
[%define api.token.constructor],
|
||||||
|
[%define api.value.type variant]))])])
|
||||||
|
|
||||||
# We require a pure interface.
|
# We require a pure interface.
|
||||||
m4_define([b4_pure_flag], [1])
|
m4_define([b4_pure_flag], [1])
|
||||||
|
|
||||||
@@ -177,7 +183,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
| Print this symbol. |
|
| Print this symbol. |
|
||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
void
|
inline void
|
||||||
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[)
|
const location_type* yylocationp]])[)
|
||||||
@@ -187,7 +193,12 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
std::ostream& yyoutput = debug_stream ();
|
std::ostream& yyoutput = debug_stream ();
|
||||||
std::ostream& yyo = yyoutput;
|
std::ostream& yyo = yyoutput;
|
||||||
YYUSE (yyo);
|
YYUSE (yyo);
|
||||||
]b4_symbol_actions([printer])[
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_printer])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -234,28 +245,25 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
b4_namespace_close
|
b4_namespace_close
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# b4_shared_declarations
|
||||||
# b4_shared_declarations(hh|cc)
|
# ----------------------
|
||||||
# -----------------------------
|
# Declaration that might either go into the header (if --defines)
|
||||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
# or open coded in the parser body.
|
||||||
# or in the implementation file.
|
|
||||||
m4_define([b4_shared_declarations],
|
m4_define([b4_shared_declarations],
|
||||||
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||||
b4_percent_code_get([[requires]])[
|
b4_percent_code_get([[requires]])[
|
||||||
#include <iostream>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iostream>]b4_defines_if([
|
||||||
]m4_ifdef([b4_location_file],
|
b4_bison_locations_if([[#include "location.hh"]])])[
|
||||||
[[# include ]b4_location_include])[
|
|
||||||
|
|
||||||
]b4_null_define[
|
|
||||||
|
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
]b4_defines_if([],
|
||||||
[b4_location_define])])[
|
[b4_bison_locations_if([b4_position_define
|
||||||
|
b4_location_define])])[
|
||||||
|
|
||||||
/// A Bison parser.
|
/// A Bison parser.
|
||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
@@ -332,14 +340,14 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|||||||
b4_defines_if(
|
b4_defines_if(
|
||||||
[b4_output_begin([b4_spec_defines_file])
|
[b4_output_begin([b4_spec_defines_file])
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||||
[2002-2015, 2018])[
|
[2002-2013])[
|
||||||
|
|
||||||
// C++ GLR parser skeleton written by Akim Demaille.
|
// C++ GLR parser skeleton written by Akim Demaille.
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||||
]b4_output_end])
|
]b4_output_end()])
|
||||||
|
|
||||||
# Let glr.c (and b4_shared_declarations) believe that the user
|
# Let glr.c (and b4_shared_declarations) believe that the user
|
||||||
# arguments include the parser itself.
|
# arguments include the parser itself.
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java skeleton dispatching for Bison.
|
# Java skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2007, 2009-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-18
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java language support for Bison
|
# Java language support for Bison
|
||||||
|
|
||||||
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -103,7 +103,7 @@ m4_define([b4_int_type],
|
|||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
# Return the smallest int type able to handle numbers ranging from
|
||||||
# 'NAME_min' to 'NAME_max' (included).
|
# `NAME_min' to `NAME_max' (included).
|
||||||
m4_define([b4_int_type_for],
|
m4_define([b4_int_type_for],
|
||||||
[b4_int_type($1_min, $1_max)])
|
[b4_int_type($1_min, $1_max)])
|
||||||
|
|
||||||
@@ -169,22 +169,6 @@ m4_define([b4_predicate_case], [ case $1:
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## -------- ##
|
|
||||||
## Checks. ##
|
|
||||||
## -------- ##
|
|
||||||
|
|
||||||
b4_percent_define_check_kind([[api.value.type]], [code], [deprecated])
|
|
||||||
|
|
||||||
b4_percent_define_check_kind([[annotations]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[extends]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[implements]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[init_throws]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[lex_throws]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[parser_class_name]], [code], [deprecated])
|
|
||||||
b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|||||||
+208
-245
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,9 +17,6 @@
|
|||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
|
|
||||||
# api.value.type=variant is valid.
|
|
||||||
m4_define([b4_value_type_setup_variant])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
# b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
@@ -41,14 +38,13 @@ m4_define([b4_integral_parser_table_define],
|
|||||||
};dnl
|
};dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, [TYPE])
|
# b4_symbol_value_template(VAL, [TYPE])
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Same as b4_symbol_value, but used in a template method. It makes
|
# Same as b4_symbol_value, but used in a template method. It makes
|
||||||
# a difference when using variants. Note that b4_value_type_setup_union
|
# a difference when using variants.
|
||||||
# overrides b4_symbol_value, so we must override it again.
|
|
||||||
m4_copy([b4_symbol_value], [b4_symbol_value_template])
|
m4_copy([b4_symbol_value], [b4_symbol_value_template])
|
||||||
m4_append([b4_value_type_setup_union],
|
|
||||||
[m4_copy_force([b4_symbol_value_union], [b4_symbol_value_template])])
|
|
||||||
|
|
||||||
# b4_lhs_value([TYPE])
|
# b4_lhs_value([TYPE])
|
||||||
# --------------------
|
# --------------------
|
||||||
@@ -84,13 +80,8 @@ m4_define([b4_rhs_state],
|
|||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
# symbols on RHS.
|
# symbols on RHS.
|
||||||
m4_define([_b4_rhs_value],
|
|
||||||
[b4_symbol_value([b4_rhs_data([$1], [$2]).value], [$3])])
|
|
||||||
|
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_percent_define_ifdef([api.value.automove],
|
[b4_symbol_value([b4_rhs_data([$1], [$2]).value], [$3])])
|
||||||
[YY_MOVE (_b4_rhs_value($@))],
|
|
||||||
[_b4_rhs_value($@)])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, NUM)
|
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||||
@@ -112,8 +103,8 @@ b4_dollar_pushdef([yysym.value],
|
|||||||
b4_symbol_if([$1], [has_type],
|
b4_symbol_if([$1], [has_type],
|
||||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||||
[yysym.location])dnl
|
[yysym.location])dnl
|
||||||
_b4_symbol_case([$1])
|
b4_symbol_case_([$1])
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
||||||
b4_symbol([$1], [$2])
|
b4_symbol([$1], [$2])
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;
|
break;
|
||||||
@@ -137,7 +128,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
|||||||
|
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2015, 2018])
|
[2002-2013])
|
||||||
|
|
||||||
m4_define([b4_parser_class_name],
|
m4_define([b4_parser_class_name],
|
||||||
[b4_percent_define_get([[parser_class_name]])])
|
[b4_percent_define_get([[parser_class_name]])])
|
||||||
@@ -148,35 +139,29 @@ b4_bison_locations_if([# Backward compatibility.
|
|||||||
m4_include(b4_pkgdatadir/[stack.hh])
|
m4_include(b4_pkgdatadir/[stack.hh])
|
||||||
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
|
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
|
||||||
|
|
||||||
|
# b4_shared_declarations
|
||||||
# b4_shared_declarations(hh|cc)
|
# ----------------------
|
||||||
# -----------------------------
|
# Declaration that might either go into the header (if --defines)
|
||||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
# or open coded in the parser body.
|
||||||
# or in the implementation file.
|
|
||||||
m4_define([b4_shared_declarations],
|
m4_define([b4_shared_declarations],
|
||||||
[b4_percent_code_get([[requires]])[
|
[b4_percent_code_get([[requires]])[
|
||||||
]b4_parse_assert_if([# include <cassert>])[
|
]b4_parse_assert_if([# include <cassert>])[
|
||||||
# include <cstdlib> // std::abort
|
# include <vector>
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <stdexcept>
|
# include <stdexcept>
|
||||||
# include <string>
|
# include <string>]b4_defines_if([[
|
||||||
# include <vector>
|
# include "stack.hh"
|
||||||
|
]b4_bison_locations_if([[# include "location.hh"]])])[
|
||||||
]b4_cxx_portability[
|
|
||||||
]m4_ifdef([b4_location_include],
|
|
||||||
[[# include ]b4_location_include])[
|
|
||||||
]b4_variant_if([b4_variant_includes])[
|
]b4_variant_if([b4_variant_includes])[
|
||||||
|
|
||||||
]b4_attribute_define[
|
|
||||||
]b4_null_define[
|
|
||||||
|
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|
||||||
]b4_stack_define[
|
]b4_defines_if([],
|
||||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
[b4_stack_define
|
||||||
[b4_location_define])])[
|
b4_bison_locations_if([b4_position_define
|
||||||
|
b4_location_define])])[
|
||||||
|
|
||||||
]b4_variant_if([b4_variant_define])[
|
]b4_variant_if([b4_variant_define])[
|
||||||
|
|
||||||
@@ -185,7 +170,6 @@ m4_define([b4_shared_declarations],
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
]b4_public_types_declare[
|
]b4_public_types_declare[
|
||||||
]b4_symbol_type_declare[
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
virtual ~]b4_parser_class_name[ ();
|
virtual ~]b4_parser_class_name[ ();
|
||||||
@@ -196,14 +180,14 @@ m4_define([b4_shared_declarations],
|
|||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/// The current debugging stream.
|
/// The current debugging stream.
|
||||||
std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
|
std::ostream& debug_stream () const;
|
||||||
/// Set the current debugging stream.
|
/// Set the current debugging stream.
|
||||||
void set_debug_stream (std::ostream &);
|
void set_debug_stream (std::ostream &);
|
||||||
|
|
||||||
/// Type for debugging levels.
|
/// Type for debugging levels.
|
||||||
typedef int debug_level_type;
|
typedef int debug_level_type;
|
||||||
/// The current debugging level.
|
/// The current debugging level.
|
||||||
debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
|
debug_level_type debug_level () const;
|
||||||
/// Set the current debugging level.
|
/// Set the current debugging level.
|
||||||
void set_debug_level (debug_level_type l);
|
void set_debug_level (debug_level_type l);
|
||||||
#endif
|
#endif
|
||||||
@@ -216,26 +200,20 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Report a syntax error.
|
/// Report a syntax error.
|
||||||
void error (const syntax_error& err);
|
void error (const syntax_error& err);
|
||||||
|
|
||||||
]b4_symbol_constructor_declare[
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// This class is not copyable.
|
|
||||||
]b4_parser_class_name[ (const ]b4_parser_class_name[&);
|
|
||||||
]b4_parser_class_name[& operator= (const ]b4_parser_class_name[&);
|
|
||||||
|
|
||||||
/// State numbers.
|
/// State numbers.
|
||||||
typedef int state_type;
|
typedef int state_type;
|
||||||
|
|
||||||
/// Generate an error message.
|
/// Generate an error message.
|
||||||
/// \param yystate the state where the error occurred.
|
/// \param yystate the state where the error occurred.
|
||||||
/// \param yyla the lookahead token.
|
/// \param yytoken the lookahead token type, or yyempty_.
|
||||||
virtual std::string yysyntax_error_ (state_type yystate,
|
virtual std::string yysyntax_error_ (state_type yystate,
|
||||||
const symbol_type& yyla) const;
|
symbol_number_type yytoken) const;
|
||||||
|
|
||||||
/// Compute post-reduction state.
|
/// Compute post-reduction state.
|
||||||
/// \param yystate the current state
|
/// \param yystate the current state
|
||||||
/// \param yysym the nonterminal to push on the stack
|
/// \param yylhs the nonterminal to push on the stack
|
||||||
state_type yy_lr_goto_state_ (state_type yystate, int yysym);
|
state_type yy_lr_goto_state_ (state_type yystate, int yylhs);
|
||||||
|
|
||||||
/// Whether the given \c yypact_ value indicates a defaulted state.
|
/// Whether the given \c yypact_ value indicates a defaulted state.
|
||||||
/// \param yyvalue the value to check
|
/// \param yyvalue the value to check
|
||||||
@@ -282,7 +260,7 @@ m4_define([b4_shared_declarations],
|
|||||||
/// \brief Reclaim the memory associated to a symbol.
|
/// \brief Reclaim the memory associated to a symbol.
|
||||||
/// \param yymsg Why this token is reclaimed.
|
/// \param yymsg Why this token is reclaimed.
|
||||||
/// If null, print nothing.
|
/// If null, print nothing.
|
||||||
/// \param yysym The symbol.
|
/// \param s The symbol.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
|
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
|
||||||
|
|
||||||
@@ -302,21 +280,16 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Copy constructor.
|
/// Copy constructor.
|
||||||
by_state (const by_state& other);
|
by_state (const by_state& other);
|
||||||
|
|
||||||
/// Record that this symbol is empty.
|
|
||||||
void clear ();
|
|
||||||
|
|
||||||
/// Steal the symbol type from \a that.
|
/// Steal the symbol type from \a that.
|
||||||
void move (by_state& that);
|
void move (by_state& that);
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a state).
|
/// The (internal) type number (corresponding to \a state).
|
||||||
/// \a empty_symbol when empty.
|
/// "empty" when empty.
|
||||||
symbol_number_type type_get () const;
|
symbol_number_type type_get () const;
|
||||||
|
|
||||||
/// The state number used to denote an empty symbol.
|
enum { empty = 0 };
|
||||||
enum { empty_state = -1 };
|
|
||||||
|
|
||||||
/// The state.
|
/// The state.
|
||||||
/// \a empty when empty.
|
|
||||||
state_type state;
|
state_type state;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -327,14 +300,10 @@ m4_define([b4_shared_declarations],
|
|||||||
typedef basic_symbol<by_state> super_type;
|
typedef basic_symbol<by_state> super_type;
|
||||||
/// Construct an empty symbol.
|
/// Construct an empty symbol.
|
||||||
stack_symbol_type ();
|
stack_symbol_type ();
|
||||||
/// Move or copy construction.
|
|
||||||
stack_symbol_type (YY_RVREF (stack_symbol_type) that);
|
|
||||||
/// Steal the contents from \a sym to build this.
|
/// Steal the contents from \a sym to build this.
|
||||||
stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
|
stack_symbol_type (state_type s, symbol_type& sym);
|
||||||
#if defined __cplusplus && __cplusplus < 201103L
|
/// Assignment, needed by push_back.
|
||||||
/// Assignment, needed by push_back by some old implementations.
|
stack_symbol_type& operator= (const stack_symbol_type& that);
|
||||||
stack_symbol_type& operator= (YY_MOVE_REF (stack_symbol_type) that);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Stack type.
|
/// Stack type.
|
||||||
@@ -346,38 +315,39 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Push a new state on the stack.
|
/// Push a new state on the stack.
|
||||||
/// \param m a debug message to display
|
/// \param m a debug message to display
|
||||||
/// if null, no trace is output.
|
/// if null, no trace is output.
|
||||||
/// \param sym the symbol
|
/// \param s the symbol
|
||||||
/// \warning the contents of \a s.value is stolen.
|
/// \warning the contents of \a s.value is stolen.
|
||||||
void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
|
void yypush_ (const char* m, stack_symbol_type& s);
|
||||||
|
|
||||||
/// Push a new look ahead token on the state on the stack.
|
/// Push a new look ahead token on the state on the stack.
|
||||||
/// \param m a debug message to display
|
/// \param m a debug message to display
|
||||||
/// if null, no trace is output.
|
/// if null, no trace is output.
|
||||||
/// \param s the state
|
/// \param s the state
|
||||||
/// \param sym the symbol (for its value and location).
|
/// \param sym the symbol (for its value and location).
|
||||||
/// \warning the contents of \a sym.value is stolen.
|
/// \warning the contents of \a s.value is stolen.
|
||||||
void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
|
void yypush_ (const char* m, state_type s, symbol_type& sym);
|
||||||
|
|
||||||
/// Pop \a n symbols the three stacks.
|
/// Pop \a n symbols the three stacks.
|
||||||
void yypop_ (unsigned n = 1);
|
void yypop_ (unsigned int n = 1);
|
||||||
|
|
||||||
/// Constants.
|
// Constants.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
yyeof_ = 0,
|
yyeof_ = 0,
|
||||||
yylast_ = ]b4_last[, ///< Last index in yytable_.
|
yylast_ = ]b4_last[, //< Last index in yytable_.
|
||||||
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
|
yynnts_ = ]b4_nterms_number[, //< Number of nonterminal symbols.
|
||||||
yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
|
yyempty_ = -2,
|
||||||
|
yyfinal_ = ]b4_final_state_number[, //< Termination state number.
|
||||||
yyterror_ = 1,
|
yyterror_ = 1,
|
||||||
yyerrcode_ = 256,
|
yyerrcode_ = 256,
|
||||||
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
|
yyntokens_ = ]b4_tokens_number[ //< Number of tokens.
|
||||||
};
|
};
|
||||||
|
|
||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
};
|
};
|
||||||
|
|
||||||
]b4_token_ctor_if([b4_yytranslate_define([$1])[
|
]b4_token_ctor_if([b4_yytranslate_define
|
||||||
]b4_public_types_define([$1])])[
|
b4_public_types_define])[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||||
@@ -403,9 +373,9 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
|
|||||||
// C++ LALR(1) parser skeleton written by Akim Demaille.
|
// C++ LALR(1) parser skeleton written by Akim Demaille.
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
]b4_shared_declarations(hh)[
|
]b4_shared_declarations[
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])
|
]b4_cpp_guard_close([b4_spec_defines_file])
|
||||||
b4_output_end
|
b4_output_end()
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -415,13 +385,15 @@ b4_percent_code_get([[top]])[]dnl
|
|||||||
m4_if(b4_prefix, [yy], [],
|
m4_if(b4_prefix, [yy], [],
|
||||||
[
|
[
|
||||||
// Take the name prefix into account.
|
// Take the name prefix into account.
|
||||||
[#]define yylex b4_prefix[]lex])[
|
#define yylex b4_prefix[]lex])[
|
||||||
|
|
||||||
// First part of user declarations.
|
// First part of user declarations.
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
|
|
||||||
|
]b4_null_define[
|
||||||
|
|
||||||
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
||||||
[b4_shared_declarations([cc])])[
|
[b4_shared_declarations])[
|
||||||
|
|
||||||
// User implementation prologue.
|
// User implementation prologue.
|
||||||
]b4_user_post_prologue[
|
]b4_user_post_prologue[
|
||||||
@@ -439,15 +411,6 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Whether we are compiled with exception support.
|
|
||||||
#ifndef YY_EXCEPTIONS
|
|
||||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
|
||||||
# define YY_EXCEPTIONS 0
|
|
||||||
# else
|
|
||||||
# define YY_EXCEPTIONS 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_locations_if([dnl
|
]b4_locations_if([dnl
|
||||||
[#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
|
[#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
|
||||||
]b4_yylloc_default_define])[
|
]b4_yylloc_default_define])[
|
||||||
@@ -467,7 +430,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
{ \
|
{ \
|
||||||
*yycdebug_ << Title << ' '; \
|
*yycdebug_ << Title << ' '; \
|
||||||
yy_print_ (*yycdebug_, Symbol); \
|
yy_print_ (*yycdebug_, Symbol); \
|
||||||
*yycdebug_ << '\n'; \
|
*yycdebug_ << std::endl; \
|
||||||
} \
|
} \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
@@ -486,14 +449,14 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#else // !]b4_api_PREFIX[DEBUG
|
#else // !]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
# define YYCDEBUG if (false) std::cerr
|
# define YYCDEBUG if (false) std::cerr
|
||||||
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
|
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
|
||||||
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
|
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
|
||||||
# define YY_STACK_PRINT() static_cast<void> (0)
|
# define YY_STACK_PRINT() static_cast<void>(0)
|
||||||
|
|
||||||
#endif // !]b4_api_PREFIX[DEBUG
|
#endif // !]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
#define yyerrok (yyerrstatus_ = 0)
|
#define yyerrok (yyerrstatus_ = 0)
|
||||||
#define yyclearin (yyla.clear ())
|
#define yyclearin (yyempty = true)
|
||||||
|
|
||||||
#define YYACCEPT goto yyacceptlab
|
#define YYACCEPT goto yyacceptlab
|
||||||
#define YYABORT goto yyabortlab
|
#define YYABORT goto yyabortlab
|
||||||
@@ -557,76 +520,70 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
| Symbol types. |
|
| Symbol types. |
|
||||||
`---------------*/
|
`---------------*/
|
||||||
|
|
||||||
]b4_token_ctor_if([], [b4_public_types_define([cc])])[
|
]b4_token_ctor_if([], [b4_public_types_define])[
|
||||||
|
|
||||||
// by_state.
|
// by_state.
|
||||||
|
inline
|
||||||
]b4_parser_class_name[::by_state::by_state ()
|
]b4_parser_class_name[::by_state::by_state ()
|
||||||
: state (empty_state)
|
: state (empty)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
inline
|
||||||
]b4_parser_class_name[::by_state::by_state (const by_state& other)
|
]b4_parser_class_name[::by_state::by_state (const by_state& other)
|
||||||
: state (other.state)
|
: state (other.state)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
inline
|
||||||
]b4_parser_class_name[::by_state::clear ()
|
|
||||||
{
|
|
||||||
state = empty_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::by_state::move (by_state& that)
|
]b4_parser_class_name[::by_state::move (by_state& that)
|
||||||
{
|
{
|
||||||
state = that.state;
|
state = that.state;
|
||||||
that.clear ();
|
that.state = empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
]b4_parser_class_name[::by_state::by_state (state_type s)
|
]b4_parser_class_name[::by_state::by_state (state_type s)
|
||||||
: state (s)
|
: state (s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
inline
|
||||||
]b4_parser_class_name[::symbol_number_type
|
]b4_parser_class_name[::symbol_number_type
|
||||||
]b4_parser_class_name[::by_state::type_get () const
|
]b4_parser_class_name[::by_state::type_get () const
|
||||||
{
|
{
|
||||||
if (state == empty_state)
|
return state == empty ? 0 : yystos_[state];
|
||||||
return empty_symbol;
|
|
||||||
else
|
|
||||||
return yystos_[state];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
|
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
|
|
||||||
: super_type (YY_MOVE (that.state)]b4_variant_if([], [, YY_MOVE (that.value)])b4_locations_if([, YY_MOVE (that.location)])[)
|
|
||||||
{]b4_variant_if([
|
|
||||||
b4_symbol_variant([that.type_get ()],
|
|
||||||
[value], [YY_MOVE_OR_COPY], [YY_MOVE (that.value)])])[
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
|
inline
|
||||||
: super_type (s]b4_variant_if([], [, YY_MOVE (that.value)])[]b4_locations_if([, YY_MOVE (that.location)])[)
|
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
|
||||||
{]b4_variant_if([
|
: super_type (s]b4_locations_if([, that.location])[)
|
||||||
b4_symbol_variant([that.type_get ()],
|
{
|
||||||
[value], [move], [YY_MOVE (that.value)])])[
|
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
||||||
|
[value], [move], [that.value])],
|
||||||
|
[[value = that.value;]])[
|
||||||
// that is emptied.
|
// that is emptied.
|
||||||
that.type = empty_symbol;
|
that.type = empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined __cplusplus && __cplusplus < 201103L
|
inline
|
||||||
]b4_parser_class_name[::stack_symbol_type&
|
]b4_parser_class_name[::stack_symbol_type&
|
||||||
]b4_parser_class_name[::stack_symbol_type::operator= (YY_MOVE_REF (stack_symbol_type) that)
|
]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that)
|
||||||
{
|
{
|
||||||
state = that.state;
|
state = that.state;
|
||||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
||||||
[value], [move], [YY_MOVE (that.value)])],
|
[value], [copy], [that.value])],
|
||||||
[[value = YY_MOVE (that.value);]])[]b4_locations_if([
|
[[value = that.value;]])[]b4_locations_if([
|
||||||
location = YY_MOVE (that.location);])[
|
location = that.location;])[
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
|
inline
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
|
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
|
||||||
{
|
{
|
||||||
@@ -634,7 +591,13 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
|
YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
|
||||||
|
|
||||||
// User destructor.
|
// User destructor.
|
||||||
b4_symbol_actions([destructor], [yysym.type_get ()])])[
|
symbol_number_type yytype = yysym.type_get ();
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}])[
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -646,39 +609,39 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YYUSE (yyoutput);
|
||||||
symbol_number_type yytype = yysym.type_get ();
|
symbol_number_type yytype = yysym.type_get ();
|
||||||
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
|
||||||
// below array bounds".
|
|
||||||
if (yysym.empty ())
|
|
||||||
std::abort ();
|
|
||||||
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
||||||
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
||||||
<< yysym.location << ": "])[;
|
<< yysym.location << ": "])[;
|
||||||
]b4_symbol_actions([printer])[
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_printer])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
yyo << ')';
|
yyo << ')';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inline
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
|
]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
|
||||||
|
{
|
||||||
|
stack_symbol_type t (s, sym);
|
||||||
|
yypush_ (m, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void
|
||||||
|
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
|
||||||
{
|
{
|
||||||
if (m)
|
if (m)
|
||||||
YY_SYMBOL_PRINT (m, sym);
|
YY_SYMBOL_PRINT (m, s);
|
||||||
yystack_.push (YY_MOVE (sym));
|
yystack_.push (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
|
]b4_parser_class_name[::yypop_ (unsigned int n)
|
||||||
{
|
|
||||||
#if defined __cplusplus && 201103L <= __cplusplus
|
|
||||||
yypush_ (m, stack_symbol_type (s, YY_MOVE (sym)));
|
|
||||||
#else
|
|
||||||
stack_symbol_type ss (s, sym);
|
|
||||||
yypush_ (m, ss);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
]b4_parser_class_name[::yypop_ (unsigned n)
|
|
||||||
{
|
{
|
||||||
yystack_.pop (n);
|
yystack_.pop (n);
|
||||||
}
|
}
|
||||||
@@ -710,23 +673,23 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
}
|
}
|
||||||
#endif // ]b4_api_PREFIX[DEBUG
|
#endif // ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
]b4_parser_class_name[::state_type
|
inline ]b4_parser_class_name[::state_type
|
||||||
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
|
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs)
|
||||||
{
|
{
|
||||||
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
int yyr = yypgoto_[yylhs - yyntokens_] + yystate;
|
||||||
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
||||||
return yytable_[yyr];
|
return yytable_[yyr];
|
||||||
else
|
else
|
||||||
return yydefgoto_[yysym - yyntokens_];
|
return yydefgoto_[yylhs - yyntokens_];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
inline bool
|
||||||
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
|
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
|
||||||
{
|
{
|
||||||
return yyvalue == yypact_ninf_;
|
return yyvalue == yypact_ninf_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
inline bool
|
||||||
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
|
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
|
||||||
{
|
{
|
||||||
return yyvalue == yytable_ninf_;
|
return yyvalue == yytable_ninf_;
|
||||||
@@ -735,9 +698,11 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
int
|
int
|
||||||
]b4_parser_class_name[::parse ()
|
]b4_parser_class_name[::parse ()
|
||||||
{
|
{
|
||||||
|
/// Whether yyla contains a lookahead.
|
||||||
|
bool yyempty = true;
|
||||||
|
|
||||||
// State.
|
// State.
|
||||||
int yyn;
|
int yyn;
|
||||||
/// Length of the RHS of the rule being reduced.
|
|
||||||
int yylen = 0;
|
int yylen = 0;
|
||||||
|
|
||||||
// Error handling.
|
// Error handling.
|
||||||
@@ -750,14 +715,17 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
/// The locations where the error started and ended.
|
/// The locations where the error started and ended.
|
||||||
stack_symbol_type yyerror_range[3];]])[
|
stack_symbol_type yyerror_range[3];]])[
|
||||||
|
|
||||||
|
/// $$ and @@$.
|
||||||
|
stack_symbol_type yylhs;
|
||||||
|
|
||||||
/// The return value of parse ().
|
/// The return value of parse ().
|
||||||
int yyresult;
|
int yyresult;
|
||||||
|
|
||||||
#if YY_EXCEPTIONS
|
// FIXME: This shoud be completely indented. It is not yet to
|
||||||
|
// avoid gratuitous conflicts when merging into the master branch.
|
||||||
try
|
try
|
||||||
#endif // YY_EXCEPTIONS
|
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Starting parse\n";
|
YYCDEBUG << "Starting parse" << std::endl;
|
||||||
|
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
|
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
|
||||||
@@ -769,12 +737,12 @@ b4_dollar_popdef])[]dnl
|
|||||||
yynewstate, since the latter expects the semantical and the
|
yynewstate, since the latter expects the semantical and the
|
||||||
location values to have been already stored, initialize these
|
location values to have been already stored, initialize these
|
||||||
stacks with a primary value. */
|
stacks with a primary value. */
|
||||||
yystack_.clear ();
|
yystack_ = stack_type (0);
|
||||||
yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
|
yypush_ (YY_NULL, 0, yyla);
|
||||||
|
|
||||||
// A new symbol was pushed on the stack.
|
// A new symbol was pushed on the stack.
|
||||||
yynewstate:
|
yynewstate:
|
||||||
YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
|
YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
|
||||||
|
|
||||||
// Accept?
|
// Accept?
|
||||||
if (yystack_[0].state == yyfinal_)
|
if (yystack_[0].state == yyfinal_)
|
||||||
@@ -784,30 +752,28 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
// Backup.
|
// Backup.
|
||||||
yybackup:
|
yybackup:
|
||||||
|
|
||||||
// Try to take a decision without lookahead.
|
// Try to take a decision without lookahead.
|
||||||
yyn = yypact_[yystack_[0].state];
|
yyn = yypact_[yystack_[0].state];
|
||||||
if (yy_pact_value_is_default_ (yyn))
|
if (yy_pact_value_is_default_ (yyn))
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
// Read a lookahead token.
|
// Read a lookahead token.
|
||||||
if (yyla.empty ())
|
if (yyempty)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Reading a token: ";
|
YYCDEBUG << "Reading a token: ";
|
||||||
#if YY_EXCEPTIONS
|
|
||||||
try
|
try
|
||||||
#endif // YY_EXCEPTIONS
|
|
||||||
{]b4_token_ctor_if([[
|
{]b4_token_ctor_if([[
|
||||||
symbol_type yylookahead (]b4_lex[);
|
symbol_type yylookahead (]b4_lex[);
|
||||||
yyla.move (yylookahead);]], [[
|
yyla.move (yylookahead);]], [[
|
||||||
yyla.type = yytranslate_ (]b4_lex[);]])[
|
yyla.type = yytranslate_ (]b4_lex[);]])[
|
||||||
}
|
}
|
||||||
#if YY_EXCEPTIONS
|
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
error (yyexc);
|
error (yyexc);
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
}
|
}
|
||||||
#endif // YY_EXCEPTIONS
|
yyempty = false;
|
||||||
}
|
}
|
||||||
YY_SYMBOL_PRINT ("Next token is", yyla);
|
YY_SYMBOL_PRINT ("Next token is", yyla);
|
||||||
|
|
||||||
@@ -827,12 +793,15 @@ b4_dollar_popdef])[]dnl
|
|||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Discard the token being shifted.
|
||||||
|
yyempty = true;
|
||||||
|
|
||||||
// Count tokens shifted since error; after three, turn off error status.
|
// Count tokens shifted since error; after three, turn off error status.
|
||||||
if (yyerrstatus_)
|
if (yyerrstatus_)
|
||||||
--yyerrstatus_;
|
--yyerrstatus_;
|
||||||
|
|
||||||
// Shift the lookahead token.
|
// Shift the lookahead token.
|
||||||
yypush_ ("Shifting", yyn, YY_MOVE (yyla));
|
yypush_ ("Shifting", yyn, yyla);
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
/*-----------------------------------------------------------.
|
/*-----------------------------------------------------------.
|
||||||
@@ -849,60 +818,52 @@ b4_dollar_popdef])[]dnl
|
|||||||
`-----------------------------*/
|
`-----------------------------*/
|
||||||
yyreduce:
|
yyreduce:
|
||||||
yylen = yyr2_[yyn];
|
yylen = yyr2_[yyn];
|
||||||
{
|
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
||||||
stack_symbol_type yylhs;
|
/* Variants are always initialized to an empty instance of the
|
||||||
yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
correct type. The default $$=$1 action is NOT applied when using
|
||||||
/* Variants are always initialized to an empty instance of the
|
variants. */
|
||||||
correct type. The default '$$ = $1' action is NOT applied
|
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])],[
|
||||||
when using variants. */
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])], [
|
`$$ = $1'. Otherwise, use the top of the stack.
|
||||||
/* If YYLEN is nonzero, implement the default value of the
|
|
||||||
action: '$$ = $1'. Otherwise, use the top of the stack.
|
|
||||||
|
|
||||||
Otherwise, the following line sets YYLHS.VALUE to garbage.
|
Otherwise, the following line sets YYLHS.VALUE to garbage.
|
||||||
This behavior is undocumented and Bison users should not rely
|
This behavior is undocumented and Bison
|
||||||
upon it. */
|
users should not rely upon it. */
|
||||||
if (yylen)
|
if (yylen)
|
||||||
yylhs.value = yystack_@{yylen - 1@}.value;
|
yylhs.value = yystack_@{yylen - 1@}.value;
|
||||||
else
|
else
|
||||||
yylhs.value = yystack_@{0@}.value;])[
|
yylhs.value = yystack_@{0@}.value;])[
|
||||||
]b4_locations_if([dnl
|
]b4_locations_if([dnl
|
||||||
[
|
[
|
||||||
// Default location.
|
// Compute the default @@$.
|
||||||
|
{
|
||||||
|
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
|
||||||
|
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
|
||||||
|
}]])[
|
||||||
|
|
||||||
|
// Perform the reduction.
|
||||||
|
YY_REDUCE_PRINT (yyn);
|
||||||
|
try
|
||||||
{
|
{
|
||||||
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
|
switch (yyn)
|
||||||
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
|
{
|
||||||
yyerror_range[1].location = yylhs.location;
|
|
||||||
}]])[
|
|
||||||
|
|
||||||
// Perform the reduction.
|
|
||||||
YY_REDUCE_PRINT (yyn);
|
|
||||||
#if YY_EXCEPTIONS
|
|
||||||
try
|
|
||||||
#endif // YY_EXCEPTIONS
|
|
||||||
{
|
|
||||||
switch (yyn)
|
|
||||||
{
|
|
||||||
]b4_user_actions[
|
]b4_user_actions[
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if YY_EXCEPTIONS
|
catch (const syntax_error& yyexc)
|
||||||
catch (const syntax_error& yyexc)
|
{
|
||||||
{
|
error (yyexc);
|
||||||
error (yyexc);
|
YYERROR;
|
||||||
YYERROR;
|
}
|
||||||
}
|
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
||||||
#endif // YY_EXCEPTIONS
|
yypop_ (yylen);
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
yylen = 0;
|
||||||
yypop_ (yylen);
|
YY_STACK_PRINT ();
|
||||||
yylen = 0;
|
|
||||||
YY_STACK_PRINT ();
|
|
||||||
|
|
||||||
// Shift the result of the reduction.
|
// Shift the result of the reduction.
|
||||||
yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
|
yypush_ (YY_NULL, yylhs);
|
||||||
}
|
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
/*--------------------------------------.
|
/*--------------------------------------.
|
||||||
@@ -914,7 +875,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
error (]b4_join(b4_locations_if([yyla.location]),
|
error (]b4_join(b4_locations_if([yyla.location]),
|
||||||
[[yysyntax_error_ (yystack_[0].state, yyla)]])[);
|
[[yysyntax_error_ (yystack_[0].state,
|
||||||
|
yyempty ? yyempty_ : yyla.type_get ())]])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
@@ -927,10 +889,10 @@ b4_dollar_popdef])[]dnl
|
|||||||
// Return failure if at end of input.
|
// Return failure if at end of input.
|
||||||
if (yyla.type_get () == yyeof_)
|
if (yyla.type_get () == yyeof_)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
else if (!yyla.empty ())
|
else if (!yyempty)
|
||||||
{
|
{
|
||||||
yy_destroy_ ("Error: discarding", yyla);
|
yy_destroy_ ("Error: discarding", yyla);
|
||||||
yyla.clear ();
|
yyempty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -947,7 +909,11 @@ b4_dollar_popdef])[]dnl
|
|||||||
YYERROR and the label yyerrorlab therefore never appears in user
|
YYERROR and the label yyerrorlab therefore never appears in user
|
||||||
code. */
|
code. */
|
||||||
if (false)
|
if (false)
|
||||||
goto yyerrorlab;
|
goto yyerrorlab;]b4_locations_if([[
|
||||||
|
yyerror_range[1].location = yystack_[yylen - 1].location;]])b4_variant_if([[
|
||||||
|
/* $$ was initialized before running the user action. */
|
||||||
|
YY_SYMBOL_PRINT ("Error: discarding", yylhs);
|
||||||
|
yylhs.~stack_symbol_type();]])[
|
||||||
/* Do not reclaim the symbols of the rule whose action triggered
|
/* Do not reclaim the symbols of the rule whose action triggered
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
@@ -990,7 +956,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
// Shift the error token.
|
// Shift the error token.
|
||||||
error_token.state = yyn;
|
error_token.state = yyn;
|
||||||
yypush_ ("Shifting", YY_MOVE (error_token));
|
yypush_ ("Shifting", error_token);
|
||||||
}
|
}
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -1005,7 +971,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
yyreturn:
|
yyreturn:
|
||||||
if (!yyla.empty ())
|
if (!yyempty)
|
||||||
yy_destroy_ ("Cleanup: discarding lookahead", yyla);
|
yy_destroy_ ("Cleanup: discarding lookahead", yyla);
|
||||||
|
|
||||||
/* Do not reclaim the symbols of the rule whose action triggered
|
/* Do not reclaim the symbols of the rule whose action triggered
|
||||||
@@ -1019,38 +985,38 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
return yyresult;
|
return yyresult;
|
||||||
}
|
}
|
||||||
#if YY_EXCEPTIONS
|
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
|
YYCDEBUG << "Exception caught: cleaning lookahead and stack"
|
||||||
|
<< std::endl;
|
||||||
// Do not try to display the values of the reclaimed symbols,
|
// Do not try to display the values of the reclaimed symbols,
|
||||||
// as their printers might throw an exception.
|
// as their printer might throw an exception.
|
||||||
if (!yyla.empty ())
|
if (!yyempty)
|
||||||
yy_destroy_ (YY_NULLPTR, yyla);
|
yy_destroy_ (YY_NULL, yyla);
|
||||||
|
|
||||||
while (1 < yystack_.size ())
|
while (1 < yystack_.size ())
|
||||||
{
|
{
|
||||||
yy_destroy_ (YY_NULLPTR, yystack_[0]);
|
yy_destroy_ (YY_NULL, yystack_[0]);
|
||||||
yypop_ ();
|
yypop_ ();
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
#endif // YY_EXCEPTIONS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::error (const syntax_error& yyexc)
|
]b4_parser_class_name[::error (const syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
error (]b4_join(b4_locations_if([yyexc.location]),
|
error (]b4_join(b4_locations_if([yyexc.location]),
|
||||||
[[yyexc.what ()]])[);
|
[[yyexc.what()]])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
std::string
|
std::string
|
||||||
]b4_parser_class_name[::yysyntax_error_ (]dnl
|
]b4_parser_class_name[::yysyntax_error_ (]dnl
|
||||||
b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
||||||
[state_type, const symbol_type&])[) const
|
[state_type, symbol_number_type])[) const
|
||||||
{]b4_error_verbose_if([[
|
{]b4_error_verbose_if([[
|
||||||
|
std::string yyres;
|
||||||
// Number of reported tokens (one for the "unexpected", one per
|
// Number of reported tokens (one for the "unexpected", one per
|
||||||
// "expected").
|
// "expected").
|
||||||
size_t yycount = 0;
|
size_t yycount = 0;
|
||||||
@@ -1064,7 +1030,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
the only way this function was invoked is if the default action
|
the only way this function was invoked is if the default action
|
||||||
is an error action. In that case, don't check for expected
|
is an error action. In that case, don't check for expected
|
||||||
tokens because there are none.
|
tokens because there are none.
|
||||||
- The only way there can be no lookahead present (in yyla) is
|
- The only way there can be no lookahead present (in yytoken) is
|
||||||
if this state is a consistent state with a default action.
|
if this state is a consistent state with a default action.
|
||||||
Thus, detecting the absence of a lookahead is sufficient to
|
Thus, detecting the absence of a lookahead is sufficient to
|
||||||
determine that there is no unexpected or expected token to
|
determine that there is no unexpected or expected token to
|
||||||
@@ -1084,9 +1050,8 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
token that will not be accepted due to an error action in a
|
token that will not be accepted due to an error action in a
|
||||||
later state.
|
later state.
|
||||||
*/
|
*/
|
||||||
if (!yyla.empty ())
|
if (yytoken != yyempty_)
|
||||||
{
|
{
|
||||||
int yytoken = yyla.type_get ();
|
|
||||||
yyarg[yycount++] = yytname_[yytoken];
|
yyarg[yycount++] = yytname_[yytoken];
|
||||||
int yyn = yypact_[yystate];
|
int yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
@@ -1113,24 +1078,22 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* yyformat = YY_NULLPTR;
|
char const* yyformat = YY_NULL;
|
||||||
switch (yycount)
|
switch (yycount)
|
||||||
{
|
{
|
||||||
#define YYCASE_(N, S) \
|
#define YYCASE_(N, S) \
|
||||||
case N: \
|
case N: \
|
||||||
yyformat = S; \
|
yyformat = S; \
|
||||||
break
|
break
|
||||||
default: // Avoid compiler warnings.
|
YYCASE_(0, YY_("syntax error"));
|
||||||
YYCASE_ (0, YY_("syntax error"));
|
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||||
YYCASE_ (1, YY_("syntax error, unexpected %s"));
|
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||||
YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
|
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
||||||
YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
||||||
YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
||||||
YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
|
||||||
#undef YYCASE_
|
#undef YYCASE_
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string yyres;
|
|
||||||
// Argument number.
|
// Argument number.
|
||||||
size_t yyi = 0;
|
size_t yyi = 0;
|
||||||
for (char const* yyp = yyformat; *yyp; ++yyp)
|
for (char const* yyp = yyformat; *yyp; ++yyp)
|
||||||
@@ -1174,18 +1137,18 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
i_end = yystack_.end ();
|
i_end = yystack_.end ();
|
||||||
i != i_end; ++i)
|
i != i_end; ++i)
|
||||||
*yycdebug_ << ' ' << i->state;
|
*yycdebug_ << ' ' << i->state;
|
||||||
*yycdebug_ << '\n';
|
*yycdebug_ << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report on the debug stream that the rule \a yyrule is going to be reduced.
|
// Report on the debug stream that the rule \a yyrule is going to be reduced.
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::yy_reduce_print_ (int yyrule)
|
]b4_parser_class_name[::yy_reduce_print_ (int yyrule)
|
||||||
{
|
{
|
||||||
unsigned yylno = yyrline_[yyrule];
|
unsigned int yylno = yyrline_[yyrule];
|
||||||
int yynrhs = yyr2_[yyrule];
|
int yynrhs = yyr2_[yyrule];
|
||||||
// Print the symbols being reduced, and their result.
|
// Print the symbols being reduced, and their result.
|
||||||
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
||||||
<< " (line " << yylno << "):\n";
|
<< " (line " << yylno << "):" << std::endl;
|
||||||
// The symbols being reduced.
|
// The symbols being reduced.
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
|
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
|
||||||
@@ -1193,10 +1156,10 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
}
|
}
|
||||||
#endif // ]b4_api_PREFIX[DEBUG
|
#endif // ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[
|
]b4_token_ctor_if([], [b4_yytranslate_define])[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_epilogue[]dnl
|
]b4_epilogue[]dnl
|
||||||
b4_output_end
|
b4_output_end()
|
||||||
|
|
||||||
|
|
||||||
m4_popdef([b4_copyright_years])dnl
|
m4_popdef([b4_copyright_years])dnl
|
||||||
|
|||||||
+82
-277
@@ -1,6 +1,6 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
# Java skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,8 +20,7 @@ m4_include(b4_pkgdatadir/[java.m4])
|
|||||||
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
|
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
|
||||||
[b4_skeleton])])
|
[b4_skeleton])])
|
||||||
|
|
||||||
# We do not depend on %debug in Java, but pacify warnings about
|
# We don't depend on %debug in Java, but pacify warnings about non-used flags.
|
||||||
# non-used flags.
|
|
||||||
b4_parse_trace_if([0], [0])
|
b4_parse_trace_if([0], [0])
|
||||||
|
|
||||||
m4_define([b4_symbol_no_destructor_assert],
|
m4_define([b4_symbol_no_destructor_assert],
|
||||||
@@ -31,60 +30,9 @@ m4_define([b4_symbol_no_destructor_assert],
|
|||||||
[b4_symbol_action_location([$1], [destructor])])])])
|
[b4_symbol_action_location([$1], [destructor])])])])
|
||||||
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
||||||
|
|
||||||
# Setup some macros for api.push-pull.
|
|
||||||
b4_percent_define_default([[api.push-pull]], [[pull]])
|
|
||||||
b4_percent_define_check_values([[[[api.push-pull]],
|
|
||||||
[[pull]], [[push]], [[both]]]])
|
|
||||||
|
|
||||||
# Define m4 conditional macros that encode the value
|
|
||||||
# of the api.push-pull flag.
|
|
||||||
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]])])
|
|
||||||
|
|
||||||
# Define a macro to be true when api.push-pull has the value "both".
|
|
||||||
m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])])
|
|
||||||
|
|
||||||
# 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]])])])
|
|
||||||
|
|
||||||
# Define a macro to encapsulate the parse state variables.
|
|
||||||
# This allows them to be defined either in parse() when doing
|
|
||||||
# pull parsing, or as class instance variable when doing push parsing.
|
|
||||||
m4_define([b4_define_state],[[
|
|
||||||
/* Lookahead and lookahead in internal form. */
|
|
||||||
int yychar = yyempty_;
|
|
||||||
int yytoken = 0;
|
|
||||||
|
|
||||||
/* State. */
|
|
||||||
int yyn = 0;
|
|
||||||
int yylen = 0;
|
|
||||||
int yystate = 0;
|
|
||||||
YYStack yystack = new YYStack ();
|
|
||||||
int label = YYNEWSTATE;
|
|
||||||
|
|
||||||
/* Error handling. */
|
|
||||||
int yynerrs_ = 0;
|
|
||||||
]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);])[
|
|
||||||
|
|
||||||
/* 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],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007-2015, 2018])
|
[2007-2013])
|
||||||
|
|
||||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||||
])[/* First part of user declarations. */
|
])[/* First part of user declarations. */
|
||||||
@@ -107,9 +55,7 @@ b4_percent_define_get3([implements], [ implements ])[
|
|||||||
{
|
{
|
||||||
]b4_identification[
|
]b4_identification[
|
||||||
]b4_error_verbose_if([[
|
]b4_error_verbose_if([[
|
||||||
/**
|
/** True if verbose error messages are enabled. */
|
||||||
* True if verbose error messages are enabled.
|
|
||||||
*/
|
|
||||||
private boolean yyErrorVerbose = true;
|
private boolean yyErrorVerbose = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,24 +76,18 @@ b4_locations_if([[
|
|||||||
* A class defining a pair of positions. Positions, defined by the
|
* A class defining a pair of positions. Positions, defined by the
|
||||||
* <code>]b4_position_type[</code> class, denote a point in the input.
|
* <code>]b4_position_type[</code> class, denote a point in the input.
|
||||||
* Locations represent a part of the input through the beginning
|
* Locations represent a part of the input through the beginning
|
||||||
* and ending positions.
|
* and ending positions. */
|
||||||
*/
|
|
||||||
public class ]b4_location_type[ {
|
public class ]b4_location_type[ {
|
||||||
/**
|
/** The first, inclusive, position in the range. */
|
||||||
* The first, inclusive, position in the range.
|
|
||||||
*/
|
|
||||||
public ]b4_position_type[ begin;
|
public ]b4_position_type[ begin;
|
||||||
|
|
||||||
/**
|
/** The first position beyond the range. */
|
||||||
* The first position beyond the range.
|
|
||||||
*/
|
|
||||||
public ]b4_position_type[ end;
|
public ]b4_position_type[ end;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
||||||
* a given point.
|
* a given point.
|
||||||
* @@param loc The position at which the range is anchored.
|
* @@param loc The position at which the range is anchored. */
|
||||||
*/
|
|
||||||
public ]b4_location_type[ (]b4_position_type[ loc) {
|
public ]b4_location_type[ (]b4_position_type[ loc) {
|
||||||
this.begin = this.end = loc;
|
this.begin = this.end = loc;
|
||||||
}
|
}
|
||||||
@@ -155,8 +95,7 @@ b4_locations_if([[
|
|||||||
/**
|
/**
|
||||||
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
||||||
* @@param begin The first position included in the range.
|
* @@param begin The first position included in the range.
|
||||||
* @@param end The first position beyond the range.
|
* @@param end The first position beyond the range. */
|
||||||
*/
|
|
||||||
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ end) {
|
||||||
this.begin = begin;
|
this.begin = begin;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
@@ -165,8 +104,7 @@ b4_locations_if([[
|
|||||||
/**
|
/**
|
||||||
* Print a representation of the location. For this to be correct,
|
* Print a representation of the location. For this to be correct,
|
||||||
* <code>]b4_position_type[</code> should override the <code>equals</code>
|
* <code>]b4_position_type[</code> should override the <code>equals</code>
|
||||||
* method.
|
* method. */
|
||||||
*/
|
|
||||||
public String toString () {
|
public String toString () {
|
||||||
if (begin.equals (end))
|
if (begin.equals (end))
|
||||||
return begin.toString ();
|
return begin.toString ();
|
||||||
@@ -198,28 +136,24 @@ b4_locations_if([[
|
|||||||
|
|
||||||
]b4_locations_if([[/**
|
]b4_locations_if([[/**
|
||||||
* Method to retrieve the beginning position of the last scanned token.
|
* Method to retrieve the beginning position of the last scanned token.
|
||||||
* @@return the position at which the last scanned token starts.
|
* @@return the position at which the last scanned token starts. */
|
||||||
*/
|
|
||||||
]b4_position_type[ getStartPos ();
|
]b4_position_type[ getStartPos ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to retrieve the ending position of the last scanned token.
|
* Method to retrieve the ending position of the last scanned token.
|
||||||
* @@return the first position beyond the last scanned token.
|
* @@return the first position beyond the last scanned token. */
|
||||||
*/
|
|
||||||
]b4_position_type[ getEndPos ();]])[
|
]b4_position_type[ getEndPos ();]])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to retrieve the semantic value of the last scanned token.
|
* Method to retrieve the semantic value of the last scanned token.
|
||||||
* @@return the semantic value of the last scanned token.
|
* @@return the semantic value of the last scanned token. */
|
||||||
*/
|
|
||||||
]b4_yystype[ getLVal ();
|
]b4_yystype[ getLVal ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for the scanner. Returns the token identifier corresponding
|
* Entry point for the scanner. Returns the token identifier corresponding
|
||||||
* to the next token and prepares to return the semantic value
|
* to the next token and prepares to return the semantic value
|
||||||
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
||||||
* @@return the token identifier corresponding to the next token.
|
* @@return the token identifier corresponding to the next token. */
|
||||||
*/
|
|
||||||
int yylex () ]b4_maybe_throws([b4_lex_throws])[;
|
int yylex () ]b4_maybe_throws([b4_lex_throws])[;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -228,8 +162,7 @@ b4_locations_if([[
|
|||||||
*
|
*
|
||||||
* ]b4_locations_if([[@@param loc The location of the element to which the
|
* ]b4_locations_if([[@@param loc The location of the element to which the
|
||||||
* error message is related]])[
|
* error message is related]])[
|
||||||
* @@param msg The string for the error message.
|
* @@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);]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,9 +170,7 @@ b4_locations_if([[
|
|||||||
]b4_percent_code_get([[lexer]])[
|
]b4_percent_code_get([[lexer]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
]])[/**
|
]])[/** The object doing lexical analysis for us. */
|
||||||
* The object doing lexical analysis for us.
|
|
||||||
*/
|
|
||||||
private Lexer yylexer;
|
private Lexer yylexer;
|
||||||
]
|
]
|
||||||
b4_parse_param_vars
|
b4_parse_param_vars
|
||||||
@@ -405,74 +336,46 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returned by a Bison action in order to stop the parsing process and
|
* Returned by a Bison action in order to stop the parsing process and
|
||||||
* return success (<tt>true</tt>).
|
* return success (<tt>true</tt>). */
|
||||||
*/
|
|
||||||
public static final int YYACCEPT = 0;
|
public static final int YYACCEPT = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returned by a Bison action in order to stop the parsing process and
|
* Returned by a Bison action in order to stop the parsing process and
|
||||||
* return failure (<tt>false</tt>).
|
* return failure (<tt>false</tt>). */
|
||||||
*/
|
|
||||||
public static final int YYABORT = 1;
|
public static final int YYABORT = 1;
|
||||||
|
|
||||||
]b4_push_if([
|
|
||||||
/**
|
|
||||||
* Returned by a Bison action in order to request a new token.
|
|
||||||
*/
|
|
||||||
public static final int YYPUSH_MORE = 4;])[
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returned by a Bison action in order to start error recovery without
|
* Returned by a Bison action in order to start error recovery without
|
||||||
* printing an error message.
|
* printing an error message. */
|
||||||
*/
|
|
||||||
public static final int YYERROR = 2;
|
public static final int YYERROR = 2;
|
||||||
|
|
||||||
/**
|
// Internal return codes that are not supported for user semantic
|
||||||
* Internal return codes that are not supported for user semantic
|
// actions.
|
||||||
* actions.
|
|
||||||
*/
|
|
||||||
private static final int YYERRLAB = 3;
|
private static final int YYERRLAB = 3;
|
||||||
private static final int YYNEWSTATE = 4;
|
private static final int YYNEWSTATE = 4;
|
||||||
private static final int YYDEFAULT = 5;
|
private static final int YYDEFAULT = 5;
|
||||||
private static final int YYREDUCE = 6;
|
private static final int YYREDUCE = 6;
|
||||||
private static final int YYERRLAB1 = 7;
|
private static final int YYERRLAB1 = 7;
|
||||||
private static final int YYRETURN = 8;
|
private static final int YYRETURN = 8;
|
||||||
]b4_push_if([[ private static final int YYGETTOKEN = 9; /* Signify that a new token is expected when doing push-parsing. */]])[
|
|
||||||
|
|
||||||
private int yyerrstatus_ = 0;
|
private int yyerrstatus_ = 0;
|
||||||
|
|
||||||
]b4_push_if([dnl
|
|
||||||
b4_define_state])[
|
|
||||||
/**
|
/**
|
||||||
* Return whether error recovery is being done. In this state, the parser
|
* Return whether error recovery is being done. In this state, the parser
|
||||||
* reads token until it reaches a known state, and then restarts normal
|
* reads token until it reaches a known state, and then restarts normal
|
||||||
* operation.
|
* operation. */
|
||||||
*/
|
|
||||||
public final boolean recovering ()
|
public final boolean recovering ()
|
||||||
{
|
{
|
||||||
return yyerrstatus_ == 0;
|
return yyerrstatus_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compute post-reduction 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)
|
|
||||||
{
|
|
||||||
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
|
||||||
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
|
||||||
return yytable_[yyr];
|
|
||||||
else
|
|
||||||
return yydefgoto_[yysym - yyntokens_];
|
|
||||||
}
|
|
||||||
|
|
||||||
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
||||||
{
|
{
|
||||||
]b4_yystype[ yyval;
|
]b4_yystype[ yyval;
|
||||||
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
]b4_locations_if([b4_location_type[ yyloc = yylloc (yystack, yylen);]])[
|
||||||
|
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
'$$ = $1'. Otherwise, use the top of the stack.
|
`$$ = $1'. Otherwise, use the top of the stack.
|
||||||
|
|
||||||
Otherwise, the following line sets YYVAL to garbage.
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison
|
||||||
@@ -496,7 +399,14 @@ b4_define_state])[
|
|||||||
yylen = 0;
|
yylen = 0;
|
||||||
|
|
||||||
/* Shift the result of the reduction. */
|
/* Shift the result of the reduction. */
|
||||||
int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]);
|
yyn = yyr1_[yyn];
|
||||||
|
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
||||||
|
if (0 <= yystate && yystate <= yylast_
|
||||||
|
&& yycheck_[yystate] == yystack.stateAt (0))
|
||||||
|
yystate = yytable_[yystate];
|
||||||
|
else
|
||||||
|
yystate = yydefgoto_[yyn - yyntokens_];
|
||||||
|
|
||||||
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
||||||
return YYNEWSTATE;
|
return YYNEWSTATE;
|
||||||
}
|
}
|
||||||
@@ -553,7 +463,6 @@ b4_define_state])[
|
|||||||
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_push_if([],[[
|
|
||||||
/**
|
/**
|
||||||
* Parse input from the scanner that was specified at object construction
|
* Parse input from the scanner that was specified at object construction
|
||||||
* time. Return whether the end of the input was reached successfully.
|
* time. Return whether the end of the input was reached successfully.
|
||||||
@@ -561,53 +470,46 @@ b4_define_state])[
|
|||||||
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||||
* imply that there were no syntax errors.
|
* 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
|
|
||||||
*
|
|
||||||
* @@param yylextoken current token
|
|
||||||
* @@param yylexval current lval
|
|
||||||
]b4_locations_if([ * @@param yylexloc current position])[
|
|
||||||
*
|
|
||||||
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
|
|
||||||
*/
|
|
||||||
public int push_parse (int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))
|
|
||||||
b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
|
|
||||||
{
|
{
|
||||||
]b4_locations_if([/* @@$. */
|
/// Lookahead and lookahead in internal form.
|
||||||
b4_location_type yyloc;])[
|
int yychar = yyempty_;
|
||||||
]b4_push_if([],[[
|
int yytoken = 0;
|
||||||
]b4_define_state[
|
|
||||||
|
/* State. */
|
||||||
|
int yyn = 0;
|
||||||
|
int yylen = 0;
|
||||||
|
int yystate = 0;
|
||||||
|
|
||||||
|
YYStack yystack = new YYStack ();
|
||||||
|
|
||||||
|
/* Error handling. */
|
||||||
|
int yynerrs_ = 0;
|
||||||
|
]b4_locations_if([/// The location where the error started.
|
||||||
|
]b4_location_type[ yyerrloc = null;
|
||||||
|
|
||||||
|
/// ]b4_location_type[ of the lookahead.
|
||||||
|
]b4_location_type[ yylloc = new ]b4_location_type[ (null, null);
|
||||||
|
|
||||||
|
/// @@$.
|
||||||
|
]b4_location_type[ yyloc;])
|
||||||
|
|
||||||
|
/// Semantic value of the lookahead.
|
||||||
|
b4_yystype[ yylval = null;
|
||||||
|
|
||||||
yycdebug ("Starting parse\n");
|
yycdebug ("Starting parse\n");
|
||||||
yyerrstatus_ = 0;
|
yyerrstatus_ = 0;
|
||||||
|
|
||||||
/* Initialize the stack. */
|
|
||||||
yystack.push (yystate, yylval ]b4_locations_if([, yylloc])[);
|
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef[]dnl
|
b4_dollar_popdef])[]dnl
|
||||||
])[
|
|
||||||
]])[
|
|
||||||
]b4_push_if([[
|
|
||||||
if (!this.push_parse_initialized)
|
|
||||||
{
|
|
||||||
push_parse_initialize ();
|
|
||||||
]m4_ifdef([b4_initial_action], [
|
|
||||||
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
|
||||||
/* User initialization code. */
|
|
||||||
b4_user_initial_action
|
|
||||||
b4_dollar_popdef[]dnl
|
|
||||||
])[
|
|
||||||
yycdebug ("Starting parse\n");
|
|
||||||
yyerrstatus_ = 0;
|
|
||||||
} else
|
|
||||||
label = YYGETTOKEN;
|
|
||||||
|
|
||||||
boolean push_token_consumed = true;
|
[ /* Initialize the stack. */
|
||||||
]])[
|
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||||
|
|
||||||
|
int label = YYNEWSTATE;
|
||||||
for (;;)
|
for (;;)
|
||||||
switch (label)
|
switch (label)
|
||||||
{
|
{
|
||||||
@@ -620,8 +522,7 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* Accept? */
|
/* Accept? */
|
||||||
if (yystate == yyfinal_)
|
if (yystate == yyfinal_)
|
||||||
]b4_push_if([{label = YYACCEPT; break;}],
|
return true;
|
||||||
[return true;])[
|
|
||||||
|
|
||||||
/* Take a decision. First try without lookahead. */
|
/* Take a decision. First try without lookahead. */
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
@@ -630,27 +531,16 @@ b4_dollar_popdef[]dnl
|
|||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
]b4_push_if([ /* Fall Through */
|
|
||||||
|
|
||||||
case YYGETTOKEN:])[
|
|
||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
if (yychar == yyempty_)
|
if (yychar == yyempty_)
|
||||||
{
|
{
|
||||||
]b4_push_if([[
|
|
||||||
if (!push_token_consumed)
|
|
||||||
return YYPUSH_MORE;
|
|
||||||
yycdebug ("Reading a token: ");
|
yycdebug ("Reading a token: ");
|
||||||
yychar = yylextoken;
|
yychar = yylexer.yylex ();]
|
||||||
yylval = yylexval;]b4_locations_if([
|
b4_locations_if([[
|
||||||
yylloc = yylexloc;])[
|
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
||||||
push_token_consumed = false;]])[
|
yylexer.getEndPos ());]])
|
||||||
]b4_push_if([],[[
|
yylval = yylexer.getLVal ();[
|
||||||
yycdebug ("Reading a token: ");
|
|
||||||
yychar = yylexer.yylex ();
|
|
||||||
yylval = yylexer.getLVal ();]b4_locations_if([
|
|
||||||
yylloc = new b4_location_type (yylexer.getStartPos (),
|
|
||||||
yylexer.getEndPos ());])[
|
|
||||||
]])[
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
@@ -747,10 +637,10 @@ b4_dollar_popdef[]dnl
|
|||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
if (yychar == Lexer.EOF)
|
if (yychar == Lexer.EOF)
|
||||||
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token after shifting the error
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
@@ -758,9 +648,9 @@ b4_dollar_popdef[]dnl
|
|||||||
label = YYERRLAB1;
|
label = YYERRLAB1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*-------------------------------------------------.
|
/*---------------------------------------------------.
|
||||||
| errorlab -- error raised explicitly by YYERROR. |
|
| errorlab -- error raised explicitly by YYERROR. |
|
||||||
`-------------------------------------------------*/
|
`---------------------------------------------------*/
|
||||||
case YYERROR:
|
case YYERROR:
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
||||||
@@ -792,10 +682,9 @@ b4_dollar_popdef[]dnl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop the current state because it cannot handle the
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
* error token. */
|
|
||||||
if (yystack.height == 0)
|
if (yystack.height == 0)
|
||||||
]b4_push_if([{label = YYABORT; break;}],[return false;])[
|
return false;
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||||
yystack.pop ();
|
yystack.pop ();
|
||||||
@@ -804,11 +693,7 @@ b4_dollar_popdef[]dnl
|
|||||||
yystack.print (yyDebugStream);
|
yystack.print (yyDebugStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (label == YYABORT)
|
]b4_locations_if([
|
||||||
/* Leave the switch. */
|
|
||||||
break;
|
|
||||||
|
|
||||||
]b4_locations_if([
|
|
||||||
/* Muck with the stack to setup for yylloc. */
|
/* Muck with the stack to setup for yylloc. */
|
||||||
yystack.push (0, null, yylloc);
|
yystack.push (0, null, yylloc);
|
||||||
yystack.push (0, null, yyerrloc);
|
yystack.push (0, null, yyerrloc);
|
||||||
@@ -826,91 +711,13 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* Accept. */
|
/* Accept. */
|
||||||
case YYACCEPT:
|
case YYACCEPT:
|
||||||
]b4_push_if([this.push_parse_initialized = false; return YYACCEPT;],
|
return true;
|
||||||
[return true;])[
|
|
||||||
|
|
||||||
/* Abort. */
|
/* Abort. */
|
||||||
case YYABORT:
|
case YYABORT:
|
||||||
]b4_push_if([this.push_parse_initialized = false; return YYABORT;],
|
return false;
|
||||||
[return false;])[
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]b4_push_if([[
|
|
||||||
boolean push_parse_initialized = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (Re-)Initialize the state of the push parser.
|
|
||||||
*/
|
|
||||||
public void push_parse_initialize()
|
|
||||||
{
|
|
||||||
/* Lookahead and lookahead in internal form. */
|
|
||||||
this.yychar = yyempty_;
|
|
||||||
this.yytoken = 0;
|
|
||||||
|
|
||||||
/* State. */
|
|
||||||
this.yyn = 0;
|
|
||||||
this.yylen = 0;
|
|
||||||
this.yystate = 0;
|
|
||||||
this.yystack = new YYStack ();
|
|
||||||
this.label = YYNEWSTATE;
|
|
||||||
|
|
||||||
/* Error handling. */
|
|
||||||
this.yynerrs_ = 0;
|
|
||||||
]b4_locations_if([/* The location where the error started. */
|
|
||||||
this.yyerrloc = null;
|
|
||||||
this.yylloc = new b4_location_type (null, null);])[
|
|
||||||
|
|
||||||
/* Semantic value of the lookahead. */
|
|
||||||
this.yylval = null;
|
|
||||||
|
|
||||||
yystack.push (this.yystate, this.yylval]b4_locations_if([, this.yylloc])[);
|
|
||||||
|
|
||||||
this.push_parse_initialized = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
]b4_locations_if([
|
|
||||||
/**
|
|
||||||
* Push parse given input from an external lexer.
|
|
||||||
*
|
|
||||||
* @@param yylextoken current token
|
|
||||||
* @@param yylexval current lval
|
|
||||||
* @@param yyylexpos current position
|
|
||||||
*
|
|
||||||
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
|
|
||||||
*/
|
|
||||||
public int push_parse (int yylextoken, b4_yystype yylexval, b4_position_type yylexpos)
|
|
||||||
b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])
|
|
||||||
{
|
|
||||||
return push_parse (yylextoken, yylexval, new b4_location_type (yylexpos));
|
|
||||||
}
|
|
||||||
])[]])
|
|
||||||
|
|
||||||
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.
|
|
||||||
* This version of parse () is defined only when api.push-push=both.
|
|
||||||
*
|
|
||||||
* @@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();
|
|
||||||
]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);
|
|
||||||
}
|
|
||||||
]])[
|
|
||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
private String yysyntax_error (int yystate, int tok)
|
private String yysyntax_error (int yystate, int tok)
|
||||||
@@ -945,8 +752,8 @@ b4_both_if([[
|
|||||||
*/
|
*/
|
||||||
if (tok != yyempty_)
|
if (tok != yyempty_)
|
||||||
{
|
{
|
||||||
/* FIXME: This method of building the message is not compatible
|
// FIXME: This method of building the message is not compatible
|
||||||
with internationalization. */
|
// with internationalization.
|
||||||
StringBuffer res =
|
StringBuffer res =
|
||||||
new StringBuffer ("syntax error, unexpected ");
|
new StringBuffer ("syntax error, unexpected ");
|
||||||
res.append (yytnamerr_ (yytname_[tok]));
|
res.append (yytnamerr_ (yytname_[tok]));
|
||||||
@@ -995,9 +802,8 @@ b4_both_if([[
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the given <code>yytable_</code>
|
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
||||||
* value indicates a syntax error.
|
* @@param yyvalue the value to check
|
||||||
* @@param yyvalue the value to check
|
|
||||||
*/
|
*/
|
||||||
private static boolean yy_table_value_is_error_ (int yyvalue)
|
private static boolean yy_table_value_is_error_ (int yyvalue)
|
||||||
{
|
{
|
||||||
@@ -1019,7 +825,6 @@ b4_both_if([[
|
|||||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
]b4_integral_parser_table_define([rline], [b4_rline],
|
||||||
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
|
[[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
|
||||||
|
|
||||||
|
|
||||||
// Report on the debug stream that the rule yyrule is going to be reduced.
|
// 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 yy_reduce_print (int yyrule, YYStack yystack)
|
||||||
{
|
{
|
||||||
@@ -1068,4 +873,4 @@ b4_percent_code_get[]dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
b4_epilogue[]dnl
|
b4_epilogue[]dnl
|
||||||
b4_output_end
|
b4_output_end()
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2002, 2005-2015, 2018 Free Software Foundation, Inc.
|
## Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+94
-141
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,67 +16,32 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2015, 2018])
|
[2002-2013])
|
||||||
|
|
||||||
|
# b4_position_define
|
||||||
# b4_position_file
|
|
||||||
# ----------------
|
|
||||||
# Name of the file containing the position class, if we want this file.
|
|
||||||
b4_defines_if([b4_required_version_if([302], [],
|
|
||||||
[m4_define([b4_position_file], [position.hh])])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_location_file
|
|
||||||
# ----------------
|
|
||||||
# Name of the file containing the position/location class,
|
|
||||||
# if we want this file.
|
|
||||||
b4_percent_define_check_file([b4_location_file],
|
|
||||||
[[api.location.file]],
|
|
||||||
b4_defines_if([[location.hh]]))
|
|
||||||
|
|
||||||
# b4_location_include
|
|
||||||
# -------------------
|
|
||||||
# If location.hh is to be generated, the name under which should it be
|
|
||||||
# included.
|
|
||||||
#
|
|
||||||
# b4_location_path
|
|
||||||
# ----------------
|
|
||||||
# The path to use for the CPP guard.
|
|
||||||
m4_ifdef([b4_location_file],
|
|
||||||
[m4_define([b4_location_include],
|
|
||||||
[b4_percent_define_get([[api.location.include]],
|
|
||||||
["b4_location_file"])])
|
|
||||||
m4_define([b4_location_path],
|
|
||||||
b4_percent_define_get([[api.location.include]],
|
|
||||||
["b4_dir_prefix[]b4_location_file"]))
|
|
||||||
m4_define([b4_location_path],
|
|
||||||
m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2)))
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_location_define
|
|
||||||
# ------------------
|
# ------------------
|
||||||
# Define the position and location classes.
|
# Define class position.
|
||||||
m4_define([b4_location_define],
|
m4_define([b4_position_define],
|
||||||
[[ /// Abstract a position.
|
[[ /// Abstract a position.
|
||||||
class position
|
class position
|
||||||
{
|
{
|
||||||
public:]m4_ifdef([b4_location_constructors], [[
|
public:
|
||||||
|
]m4_ifdef([b4_location_constructors], [[
|
||||||
/// Construct a position.
|
/// Construct a position.
|
||||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
||||||
unsigned l = ]b4_location_initial_line[u,
|
unsigned int l = ]b4_location_initial_line[u,
|
||||||
unsigned c = ]b4_location_initial_column[u)
|
unsigned int c = ]b4_location_initial_column[u)
|
||||||
: filename (f)
|
: filename (f)
|
||||||
, line (l)
|
, line (l)
|
||||||
, column (c)
|
, column (c)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
]])[
|
]])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL,
|
||||||
unsigned l = ]b4_location_initial_line[u,
|
unsigned int l = ]b4_location_initial_line[u,
|
||||||
unsigned c = ]b4_location_initial_column[u)
|
unsigned int c = ]b4_location_initial_column[u)
|
||||||
{
|
{
|
||||||
filename = fn;
|
filename = fn;
|
||||||
line = l;
|
line = l;
|
||||||
@@ -88,63 +53,53 @@ m4_define([b4_location_define],
|
|||||||
/// (line related) Advance to the COUNT next lines.
|
/// (line related) Advance to the COUNT next lines.
|
||||||
void lines (int count = 1)
|
void lines (int count = 1)
|
||||||
{
|
{
|
||||||
if (count)
|
column = ]b4_location_initial_column[u;
|
||||||
{
|
line += count;
|
||||||
column = ]b4_location_initial_column[u;
|
|
||||||
line = add_ (line, count, ]b4_location_initial_line[);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// (column related) Advance to the COUNT next columns.
|
/// (column related) Advance to the COUNT next columns.
|
||||||
void columns (int count = 1)
|
void columns (int count = 1)
|
||||||
{
|
{
|
||||||
column = add_ (column, count, ]b4_location_initial_column[);
|
column = std::max (]b4_location_initial_column[u, column + count);
|
||||||
}
|
}
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
/// File name to which this position refers.
|
/// File name to which this position refers.
|
||||||
]b4_percent_define_get([[filename_type]])[* filename;
|
]b4_percent_define_get([[filename_type]])[* filename;
|
||||||
/// Current line number.
|
/// Current line number.
|
||||||
unsigned line;
|
unsigned int line;
|
||||||
/// Current column number.
|
/// Current column number.
|
||||||
unsigned column;
|
unsigned int column;
|
||||||
|
|
||||||
private:
|
|
||||||
/// Compute max (min, lhs+rhs).
|
|
||||||
static unsigned add_ (unsigned lhs, int rhs, int min)
|
|
||||||
{
|
|
||||||
return static_cast<unsigned> (std::max (min,
|
|
||||||
static_cast<int> (lhs) + rhs));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Add \a width columns, in place.
|
/// Add and assign a position.
|
||||||
inline position&
|
inline position&
|
||||||
operator+= (position& res, int width)
|
operator+= (position& res, const int width)
|
||||||
{
|
{
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add \a width columns.
|
/// Add two position objects.
|
||||||
inline position
|
inline const position
|
||||||
operator+ (position res, int width)
|
operator+ (const position& begin, const int width)
|
||||||
{
|
{
|
||||||
|
position res = begin;
|
||||||
return res += width;
|
return res += width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subtract \a width columns, in place.
|
/// Add and assign a position.
|
||||||
inline position&
|
inline position&
|
||||||
operator-= (position& res, int width)
|
operator-= (position& res, const int width)
|
||||||
{
|
{
|
||||||
return res += -width;
|
return res += -width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subtract \a width columns.
|
/// Add two position objects.
|
||||||
inline position
|
inline const position
|
||||||
operator- (position res, int width)
|
operator- (const position& begin, const int width)
|
||||||
{
|
{
|
||||||
return res -= width;
|
return begin + -width;
|
||||||
}
|
}
|
||||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||||
/// Compare two position objects.
|
/// Compare two position objects.
|
||||||
@@ -170,15 +125,20 @@ m4_define([b4_location_define],
|
|||||||
** \param pos a reference to the position to redirect
|
** \param pos a reference to the position to redirect
|
||||||
*/
|
*/
|
||||||
template <typename YYChar>
|
template <typename YYChar>
|
||||||
std::basic_ostream<YYChar>&
|
inline std::basic_ostream<YYChar>&
|
||||||
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
||||||
{
|
{
|
||||||
if (pos.filename)
|
if (pos.filename)
|
||||||
ostr << *pos.filename << ':';
|
ostr << *pos.filename << ':';
|
||||||
return ostr << pos.line << '.' << pos.column;
|
return ostr << pos.line << '.' << pos.column;
|
||||||
}
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
/// Abstract a location.
|
|
||||||
|
# b4_location_define
|
||||||
|
# ------------------
|
||||||
|
m4_define([b4_location_define],
|
||||||
|
[[ /// Abstract a location.
|
||||||
class location
|
class location
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -187,27 +147,30 @@ m4_define([b4_location_define],
|
|||||||
location (const position& b, const position& e)
|
location (const position& b, const position& e)
|
||||||
: begin (b)
|
: begin (b)
|
||||||
, end (e)
|
, end (e)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// Construct a 0-width location in \a p.
|
/// Construct a 0-width location in \a p.
|
||||||
explicit location (const position& p = position ())
|
explicit location (const position& p = position ())
|
||||||
: begin (p)
|
: begin (p)
|
||||||
, end (p)
|
, end (p)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||||
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
||||||
unsigned l = ]b4_location_initial_line[u,
|
unsigned int l = ]b4_location_initial_line[u,
|
||||||
unsigned c = ]b4_location_initial_column[u)
|
unsigned int c = ]b4_location_initial_column[u)
|
||||||
: begin (f, l, c)
|
: begin (f, l, c)
|
||||||
, end (f, l, c)
|
, end (f, l, c)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
])[
|
])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
||||||
unsigned l = ]b4_location_initial_line[u,
|
unsigned int l = ]b4_location_initial_line[u,
|
||||||
unsigned c = ]b4_location_initial_column[u)
|
unsigned int c = ]b4_location_initial_column[u)
|
||||||
{
|
{
|
||||||
begin.initialize (f, l, c);
|
begin.initialize (f, l, c);
|
||||||
end = begin;
|
end = begin;
|
||||||
@@ -223,13 +186,13 @@ m4_define([b4_location_define],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next columns.
|
/// Extend the current location to the COUNT next columns.
|
||||||
void columns (int count = 1)
|
void columns (unsigned int count = 1)
|
||||||
{
|
{
|
||||||
end += count;
|
end += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extend the current location to the COUNT next lines.
|
/// Extend the current location to the COUNT next lines.
|
||||||
void lines (int count = 1)
|
void lines (unsigned int count = 1)
|
||||||
{
|
{
|
||||||
end.lines (count);
|
end.lines (count);
|
||||||
}
|
}
|
||||||
@@ -243,42 +206,27 @@ m4_define([b4_location_define],
|
|||||||
position end;
|
position end;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Join two locations, in place.
|
/// Join two location objects to create a location.
|
||||||
inline location& operator+= (location& res, const location& end)
|
inline const location operator+ (const location& begin, const location& end)
|
||||||
{
|
{
|
||||||
|
location res = begin;
|
||||||
res.end = end.end;
|
res.end = end.end;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Join two locations.
|
/// Add two location objects.
|
||||||
inline location operator+ (location res, const location& end)
|
inline const location operator+ (const location& begin, unsigned int width)
|
||||||
{
|
|
||||||
return res += end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Add \a width columns to the end position, in place.
|
|
||||||
inline location& operator+= (location& res, int width)
|
|
||||||
{
|
{
|
||||||
|
location res = begin;
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add \a width columns to the end position.
|
/// Add and assign a location.
|
||||||
inline location operator+ (location res, int width)
|
inline location& operator+= (location& res, unsigned int width)
|
||||||
{
|
{
|
||||||
return res += width;
|
res.columns (width);
|
||||||
}
|
return res;
|
||||||
|
|
||||||
/// Subtract \a width columns to the end position, in place.
|
|
||||||
inline location& operator-= (location& res, int width)
|
|
||||||
{
|
|
||||||
return res += -width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Subtract \a width columns to the end position.
|
|
||||||
inline location operator- (location res, int width)
|
|
||||||
{
|
|
||||||
return res -= width;
|
|
||||||
}
|
}
|
||||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||||
/// Compare two location objects.
|
/// Compare two location objects.
|
||||||
@@ -302,11 +250,12 @@ m4_define([b4_location_define],
|
|||||||
** Avoid duplicate information.
|
** Avoid duplicate information.
|
||||||
*/
|
*/
|
||||||
template <typename YYChar>
|
template <typename YYChar>
|
||||||
std::basic_ostream<YYChar>&
|
inline std::basic_ostream<YYChar>&
|
||||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
||||||
{
|
{
|
||||||
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||||
ostr << loc.begin;
|
ostr << loc.begin// << "(" << loc.end << ") "
|
||||||
|
;
|
||||||
if (loc.end.filename
|
if (loc.end.filename
|
||||||
&& (!loc.begin.filename
|
&& (!loc.begin.filename
|
||||||
|| *loc.begin.filename != *loc.end.filename))
|
|| *loc.begin.filename != *loc.end.filename))
|
||||||
@@ -320,31 +269,16 @@ m4_define([b4_location_define],
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
m4_ifdef([b4_position_file], [[
|
b4_defines_if([
|
||||||
]b4_output_begin([b4_dir_prefix], [b4_position_file])[
|
b4_output_begin([b4_dir_prefix[]position.hh])
|
||||||
// Starting with Bison 3.2, this file is useless: the structure it
|
b4_copyright([Positions for Bison parsers in C++])[
|
||||||
// used to define is now defined in "]b4_location_file[".
|
|
||||||
//
|
|
||||||
// To get rid of this file:
|
|
||||||
// 1. add 'require "3.2"' (or newer) to your grammar file
|
|
||||||
// 2. remove references to this file from your build system
|
|
||||||
// 3. if you used to include it, include "]b4_location_file[" instead.
|
|
||||||
|
|
||||||
#include ]b4_location_include[
|
|
||||||
]b4_output_end[
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
m4_ifdef([b4_location_file], [[
|
|
||||||
]b4_output_begin([b4_dir_prefix], [b4_location_file])[
|
|
||||||
]b4_copyright([Locations for Bison parsers in C++])[
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file ]b4_location_path[
|
** \file ]b4_dir_prefix[position.hh
|
||||||
** Define the ]b4_namespace_ref[::location class.
|
** Define the ]b4_namespace_ref[::position class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
]b4_cpp_guard_open([b4_location_path])[
|
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
||||||
|
|
||||||
# include <algorithm> // std::max
|
# include <algorithm> // std::max
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
@@ -352,12 +286,31 @@ m4_ifdef([b4_location_file], [[
|
|||||||
|
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
]b4_position_define[
|
||||||
|
]b4_namespace_close[
|
||||||
|
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
|
||||||
|
b4_output_end()
|
||||||
|
|
||||||
|
|
||||||
|
b4_output_begin([b4_dir_prefix[]location.hh])
|
||||||
|
b4_copyright([Locations for Bison parsers in C++])[
|
||||||
|
|
||||||
|
/**
|
||||||
|
** \file ]b4_dir_prefix[location.hh
|
||||||
|
** Define the ]b4_namespace_ref[::location class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
||||||
|
|
||||||
|
# include "position.hh"
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
]b4_location_define[
|
]b4_location_define[
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_cpp_guard_close([b4_location_path])[
|
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
|
||||||
]b4_output_end[
|
b4_output_end()
|
||||||
]])
|
])
|
||||||
|
|
||||||
|
|
||||||
m4_popdef([b4_copyright_years])
|
m4_popdef([b4_copyright_years])
|
||||||
|
|||||||
+49
-49
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,50 +15,40 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
m4_pushdef([b4_copyright_years],
|
||||||
# b4_stack_file
|
[2002-2013])
|
||||||
# -------------
|
|
||||||
# Name of the file containing the stack class, if we want this file.
|
|
||||||
b4_defines_if([b4_required_version_if([302], [],
|
|
||||||
[m4_define([b4_stack_file], [stack.hh])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_stack_define
|
# b4_stack_define
|
||||||
# ---------------
|
# ---------------
|
||||||
m4_define([b4_stack_define],
|
m4_define([b4_stack_define],
|
||||||
[[ /// A stack with random access from its top.
|
[[ template <class T, class S = std::vector<T> >
|
||||||
template <class T, class S = std::vector<T> >
|
|
||||||
class stack
|
class stack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Hide our reversed order.
|
// Hide our reversed order.
|
||||||
typedef typename S::reverse_iterator iterator;
|
typedef typename S::reverse_iterator iterator;
|
||||||
typedef typename S::const_reverse_iterator const_iterator;
|
typedef typename S::const_reverse_iterator const_iterator;
|
||||||
typedef typename S::size_type size_type;
|
|
||||||
|
|
||||||
stack ()
|
stack ()
|
||||||
|
: seq_ ()
|
||||||
{
|
{
|
||||||
seq_.reserve (200);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stack (size_type n)
|
stack (unsigned int n)
|
||||||
: seq_ (n)
|
: seq_ (n)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// Random access.
|
inline
|
||||||
///
|
|
||||||
/// Index 0 returns the topmost element.
|
|
||||||
T&
|
T&
|
||||||
operator[] (size_type i)
|
operator[] (unsigned int i)
|
||||||
{
|
{
|
||||||
return seq_[seq_.size () - 1 - i];
|
return seq_[seq_.size () - 1 - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Random access.
|
inline
|
||||||
///
|
|
||||||
/// Index 0 returns the topmost element.
|
|
||||||
const T&
|
const T&
|
||||||
operator[] (size_type i) const
|
operator[] (unsigned int i) const
|
||||||
{
|
{
|
||||||
return seq_[seq_.size () - 1 - i];
|
return seq_[seq_.size () - 1 - i];
|
||||||
}
|
}
|
||||||
@@ -66,38 +56,37 @@ m4_define([b4_stack_define],
|
|||||||
/// Steal the contents of \a t.
|
/// Steal the contents of \a t.
|
||||||
///
|
///
|
||||||
/// Close to move-semantics.
|
/// Close to move-semantics.
|
||||||
|
inline
|
||||||
void
|
void
|
||||||
push (YY_MOVE_REF (T) t)
|
push (T& t)
|
||||||
{
|
{
|
||||||
seq_.push_back (T ());
|
seq_.push_back (T());
|
||||||
operator[](0).move (t);
|
operator[](0).move (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
void
|
void
|
||||||
pop (size_type n = 1)
|
pop (unsigned int n = 1)
|
||||||
{
|
{
|
||||||
for (; n; --n)
|
for (; n; --n)
|
||||||
seq_.pop_back ();
|
seq_.pop_back ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
inline
|
||||||
clear ()
|
typename S::size_type
|
||||||
{
|
|
||||||
seq_.clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type
|
|
||||||
size () const
|
size () const
|
||||||
{
|
{
|
||||||
return seq_.size ();
|
return seq_.size ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
const_iterator
|
const_iterator
|
||||||
begin () const
|
begin () const
|
||||||
{
|
{
|
||||||
return seq_.rbegin ();
|
return seq_.rbegin ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
const_iterator
|
const_iterator
|
||||||
end () const
|
end () const
|
||||||
{
|
{
|
||||||
@@ -105,8 +94,6 @@ m4_define([b4_stack_define],
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
stack (const stack&);
|
|
||||||
stack& operator= (const stack&);
|
|
||||||
/// The wrapped container.
|
/// The wrapped container.
|
||||||
S seq_;
|
S seq_;
|
||||||
};
|
};
|
||||||
@@ -116,31 +103,44 @@ m4_define([b4_stack_define],
|
|||||||
class slice
|
class slice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename S::size_type size_type;
|
slice (const S& stack, unsigned int range)
|
||||||
slice (const S& stack, size_type range)
|
|
||||||
: stack_ (stack)
|
: stack_ (stack)
|
||||||
, range_ (range)
|
, range_ (range)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
const T&
|
const T&
|
||||||
operator[] (size_type i) const
|
operator [] (unsigned int i) const
|
||||||
{
|
{
|
||||||
return stack_[range_ - i];
|
return stack_[range_ - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const S& stack_;
|
const S& stack_;
|
||||||
size_type range_;
|
unsigned int range_;
|
||||||
};
|
};
|
||||||
]])
|
]])
|
||||||
|
|
||||||
m4_ifdef([b4_stack_file],
|
b4_defines_if(
|
||||||
[b4_output_begin([b4_dir_prefix], [b4_stack_file])[
|
[b4_output_begin([b4_dir_prefix[]stack.hh])
|
||||||
// Starting with Bison 3.2, this file is useless: the structure it
|
b4_copyright([Stack handling for Bison parsers in C++])[
|
||||||
// used to define is now defined with the parser itself.
|
|
||||||
//
|
/**
|
||||||
// To get rid of this file:
|
** \file ]b4_dir_prefix[stack.hh
|
||||||
// 1. add 'require "3.2"' (or newer) to your grammar file
|
** Define the ]b4_namespace_ref[::stack class.
|
||||||
// 2. remove references to this file from your build system.
|
*/
|
||||||
]b4_output_end[
|
|
||||||
]])
|
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
|
||||||
|
|
||||||
|
# include <vector>
|
||||||
|
|
||||||
|
]b4_namespace_open[
|
||||||
|
]b4_stack_define[
|
||||||
|
]b4_namespace_close[
|
||||||
|
|
||||||
|
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
||||||
|
b4_output_end()
|
||||||
|
])
|
||||||
|
|
||||||
|
m4_popdef([b4_copyright_years])
|
||||||
|
|||||||
+77
-111
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,10 +26,10 @@
|
|||||||
# YYTYPE.
|
# YYTYPE.
|
||||||
m4_define([b4_symbol_variant],
|
m4_define([b4_symbol_variant],
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
[$2.$3< $][3 >(m4_shift3($@))])dnl
|
||||||
switch ($1)
|
switch ($1)
|
||||||
{
|
{
|
||||||
b4_type_foreach([_b4_type_action])[]dnl
|
b4_type_foreach([b4_type_action_])[]dnl
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -55,15 +55,15 @@ dummy[]_b4_char_sizeof_counter])
|
|||||||
# ---------------------------
|
# ---------------------------
|
||||||
# To be mapped on the list of type names to produce:
|
# To be mapped on the list of type names to produce:
|
||||||
#
|
#
|
||||||
# char dummy1[sizeof (type_name_1)];
|
# char dummy1[sizeof(type_name_1)];
|
||||||
# char dummy2[sizeof (type_name_2)];
|
# char dummy2[sizeof(type_name_2)];
|
||||||
#
|
#
|
||||||
# for defined type names.
|
# for defined type names.
|
||||||
m4_define([b4_char_sizeof],
|
m4_define([b4_char_sizeof],
|
||||||
[b4_symbol_if([$1], [has_type],
|
[b4_symbol_if([$1], [has_type],
|
||||||
[
|
[
|
||||||
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
||||||
char _b4_char_sizeof_dummy@{sizeof (b4_symbol([$1], [type]))@};
|
char _b4_char_sizeof_dummy@{sizeof([b4_symbol([$1], [type])])@};
|
||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
@@ -94,24 +94,23 @@ m4_define([b4_variant_define],
|
|||||||
typedef variant<S> self_type;
|
typedef variant<S> self_type;
|
||||||
|
|
||||||
/// Empty construction.
|
/// Empty construction.
|
||||||
variant ()
|
variant ()]b4_parse_assert_if([
|
||||||
: yybuffer_ ()]b4_parse_assert_if([
|
: tname (YY_NULL)])[
|
||||||
, yytypeid_ (YY_NULLPTR)])[
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Construct and fill.
|
/// Construct and fill.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
variant (YY_RVREF (T) t)]b4_parse_assert_if([
|
variant (const T& t)]b4_parse_assert_if([
|
||||||
: yytypeid_ (&typeid (T))])[
|
: tname (typeid (T).name ())])[
|
||||||
{
|
{
|
||||||
YYASSERT (sizeof (T) <= S);
|
YYASSERT (sizeof (T) <= S);
|
||||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
new (buffer.raw) T (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destruction, allowed only if empty.
|
/// Destruction, allowed only if empty.
|
||||||
~variant ()
|
~variant ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YYASSERT (!tname);
|
||||||
])[}
|
])[}
|
||||||
|
|
||||||
/// Instantiate an empty \a T in here.
|
/// Instantiate an empty \a T in here.
|
||||||
@@ -119,10 +118,10 @@ m4_define([b4_variant_define],
|
|||||||
T&
|
T&
|
||||||
build ()
|
build ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YYASSERT (!tname);
|
||||||
YYASSERT (sizeof (T) <= S);
|
YYASSERT (sizeof (T) <= S);
|
||||||
yytypeid_ = & typeid (T);])[
|
tname = typeid (T).name ();])[
|
||||||
return *new (yyas_<T> ()) T ();
|
return *new (buffer.raw) T;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
/// Instantiate a \a T in here from \a t.
|
||||||
@@ -130,10 +129,10 @@ m4_define([b4_variant_define],
|
|||||||
T&
|
T&
|
||||||
build (const T& t)
|
build (const T& t)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YYASSERT (!tname);
|
||||||
YYASSERT (sizeof (T) <= S);
|
YYASSERT (sizeof (T) <= S);
|
||||||
yytypeid_ = & typeid (T);])[
|
tname = typeid (T).name ();])[
|
||||||
return *new (yyas_<T> ()) T (t);
|
return *new (buffer.raw) T (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Accessor to a built \a T.
|
/// Accessor to a built \a T.
|
||||||
@@ -141,10 +140,9 @@ m4_define([b4_variant_define],
|
|||||||
T&
|
T&
|
||||||
as ()
|
as ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YYASSERT (tname == typeid (T).name ());
|
||||||
YYASSERT (*yytypeid_ == typeid (T));
|
|
||||||
YYASSERT (sizeof (T) <= S);])[
|
YYASSERT (sizeof (T) <= S);])[
|
||||||
return *yyas_<T> ();
|
return reinterpret_cast<T&> (buffer.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Const accessor to a built \a T (for %printer).
|
/// Const accessor to a built \a T (for %printer).
|
||||||
@@ -152,10 +150,9 @@ m4_define([b4_variant_define],
|
|||||||
const T&
|
const T&
|
||||||
as () const
|
as () const
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YYASSERT (tname == typeid (T).name ());
|
||||||
YYASSERT (*yytypeid_ == typeid (T));
|
|
||||||
YYASSERT (sizeof (T) <= S);])[
|
YYASSERT (sizeof (T) <= S);])[
|
||||||
return *yyas_<T> ();
|
return reinterpret_cast<const T&> (buffer.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Swap the content with \a other, of same type.
|
/// Swap the content with \a other, of same type.
|
||||||
@@ -163,16 +160,16 @@ m4_define([b4_variant_define],
|
|||||||
/// Both variants must be built beforehand, because swapping the actual
|
/// Both variants must be built beforehand, because swapping the actual
|
||||||
/// data requires reading it (with as()), and this is not possible on
|
/// data requires reading it (with as()), and this is not possible on
|
||||||
/// unconstructed variants: it would require some dynamic testing, which
|
/// unconstructed variants: it would require some dynamic testing, which
|
||||||
/// should not be the variant's responsibility.
|
/// should not be the variant's responsability.
|
||||||
/// Swapping between built and (possibly) non-built is done with
|
/// Swapping between built and (possibly) non-built is done with
|
||||||
/// variant::move ().
|
/// variant::move ().
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
swap (self_type& other)
|
swap (self_type& other)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YYASSERT (tname);
|
||||||
YYASSERT (*yytypeid_ == *other.yytypeid_);])[
|
YYASSERT (tname == other.tname);])[
|
||||||
std::swap (as<T> (), other.as<T> ());
|
std::swap (as<T>(), other.as<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Move the content of \a other to this.
|
/// Move the content of \a other to this.
|
||||||
@@ -181,28 +178,13 @@ m4_define([b4_variant_define],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
move (self_type& other)
|
move (self_type& other)
|
||||||
{
|
{]b4_parse_assert_if([
|
||||||
build<T> ();
|
YYASSERT (!tname);])[
|
||||||
# if defined __cplusplus && 201103L <= __cplusplus
|
build<T>();
|
||||||
as<T> () = YY_MOVE (other.as<T> ());
|
swap<T>(other);
|
||||||
# else
|
other.destroy<T>();
|
||||||
swap<T> (other);
|
|
||||||
# endif
|
|
||||||
other.destroy<T> ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined __cplusplus && 201103L <= __cplusplus
|
|
||||||
/// Move the content of \a other to this.
|
|
||||||
template <typename T>
|
|
||||||
void
|
|
||||||
move (self_type&& other)
|
|
||||||
{
|
|
||||||
build<T> ();
|
|
||||||
as<T> () = YY_MOVE (other.as<T> ());
|
|
||||||
other.destroy<T> ();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Copy the content of \a other to this.
|
/// Copy the content of \a other to this.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
@@ -217,42 +199,25 @@ m4_define([b4_variant_define],
|
|||||||
destroy ()
|
destroy ()
|
||||||
{
|
{
|
||||||
as<T> ().~T ();]b4_parse_assert_if([
|
as<T> ().~T ();]b4_parse_assert_if([
|
||||||
yytypeid_ = YY_NULLPTR;])[
|
tname = YY_NULL;])[
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Prohibit blind copies.
|
/// Prohibit blind copies.
|
||||||
self_type& operator= (const self_type&);
|
self_type& operator=(const self_type&);
|
||||||
variant (const self_type&);
|
variant (const self_type&);
|
||||||
|
|
||||||
/// Accessor to raw memory as \a T.
|
/// A buffer large enough to store any of the semantic values.
|
||||||
template <typename T>
|
/// Long double is chosen as it has the strongest alignment
|
||||||
T*
|
/// constraints.
|
||||||
yyas_ ()
|
|
||||||
{
|
|
||||||
void *yyp = yybuffer_.yyraw;
|
|
||||||
return static_cast<T*> (yyp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Const accessor to raw memory as \a T.
|
|
||||||
template <typename T>
|
|
||||||
const T*
|
|
||||||
yyas_ () const
|
|
||||||
{
|
|
||||||
const void *yyp = yybuffer_.yyraw;
|
|
||||||
return static_cast<const T*> (yyp);
|
|
||||||
}
|
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
/// Strongest alignment constraints.
|
long double align_me;
|
||||||
long double yyalign_me;
|
char raw[S];
|
||||||
/// A buffer large enough to store any of the semantic values.
|
} buffer;]b4_parse_assert_if([
|
||||||
char yyraw[S];
|
|
||||||
} yybuffer_;]b4_parse_assert_if([
|
|
||||||
|
|
||||||
/// Whether the content is built: if defined, the name of the stored type.
|
/// Whether the content is built: if defined, the name of the stored type.
|
||||||
const std::type_info *yytypeid_;])[
|
const char* tname;])[
|
||||||
};
|
};
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -262,16 +227,16 @@ m4_define([b4_variant_define],
|
|||||||
## -------------------------- ##
|
## -------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_declare
|
# b4_semantic_type_declare
|
||||||
# ---------------------
|
# ------------------------
|
||||||
# Declare semantic_type.
|
# Declare semantic_type.
|
||||||
m4_define([b4_value_type_declare],
|
m4_define([b4_semantic_type_declare],
|
||||||
[[ /// An auxiliary type to compute the largest semantic type.
|
[ /// An auxiliary type to compute the largest semantic type.
|
||||||
union union_type
|
union union_type
|
||||||
{]b4_type_foreach([b4_char_sizeof])[};
|
{]b4_type_foreach([b4_char_sizeof])[};
|
||||||
|
|
||||||
/// Symbol semantic values.
|
/// Symbol semantic values.
|
||||||
typedef variant<sizeof (union_type)> semantic_type;][]dnl
|
typedef variant<sizeof(union_type)> semantic_type;dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -281,7 +246,7 @@ m4_define([b4_value_type_declare],
|
|||||||
# ----------------------------
|
# ----------------------------
|
||||||
m4_define([b4_symbol_value],
|
m4_define([b4_symbol_value],
|
||||||
[m4_ifval([$2],
|
[m4_ifval([$2],
|
||||||
[$1.as< $2 > ()],
|
[$1.as< $2 >()],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, [TYPE])
|
# b4_symbol_value_template(VAL, [TYPE])
|
||||||
@@ -289,7 +254,7 @@ m4_define([b4_symbol_value],
|
|||||||
# Same as b4_symbol_value, but used in a template method.
|
# Same as b4_symbol_value, but used in a template method.
|
||||||
m4_define([b4_symbol_value_template],
|
m4_define([b4_symbol_value_template],
|
||||||
[m4_ifval([$2],
|
[m4_ifval([$2],
|
||||||
[$1.template as< $2 > ()],
|
[$1.template as< $2 >()],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
|
|
||||||
@@ -299,18 +264,18 @@ m4_define([b4_symbol_value_template],
|
|||||||
## ------------- ##
|
## ------------- ##
|
||||||
|
|
||||||
|
|
||||||
# _b4_symbol_constructor_declare(SYMBOL-NUMBER)
|
# b4_symbol_constructor_declare_(SYMBOL-NUMBER)
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
# Declare the overloaded version of make_symbol for the (common) type of
|
# Declare the overloaded version of make_symbol for the (common) type of
|
||||||
# these SYMBOL-NUMBERS. Use at class-level.
|
# these SYMBOL-NUMBERS. Use at class-level.
|
||||||
m4_define([_b4_symbol_constructor_declare],
|
m4_define([b4_symbol_constructor_declare_],
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||||
[ static
|
[ static inline
|
||||||
symbol_type
|
symbol_type
|
||||||
make_[]_b4_symbol([$1], [id]) (dnl
|
make_[]b4_symbol_([$1], [id]) (dnl
|
||||||
b4_join(b4_symbol_if([$1], [has_type],
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
[YY_COPY (b4_symbol([$1], [type])) v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([YY_COPY (location_type) l])));
|
b4_locations_if([const location_type& l])));
|
||||||
|
|
||||||
])])])
|
])])])
|
||||||
|
|
||||||
@@ -321,54 +286,55 @@ b4_join(b4_symbol_if([$1], [has_type],
|
|||||||
# Use at class-level.
|
# Use at class-level.
|
||||||
m4_define([b4_symbol_constructor_declare],
|
m4_define([b4_symbol_constructor_declare],
|
||||||
[ // Symbol constructors declarations.
|
[ // Symbol constructors declarations.
|
||||||
b4_symbol_foreach([_b4_symbol_constructor_declare])])
|
b4_symbol_foreach([b4_symbol_constructor_declare_])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_symbol_constructor_define(SYMBOL-NUMBER)
|
# b4_symbol_constructor_define_(SYMBOL-NUMBER)
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Define symbol constructor for this SYMBOL-NUMBER.
|
# Define symbol constructor for this SYMBOL-NUMBER.
|
||||||
m4_define([_b4_symbol_constructor_define],
|
m4_define([b4_symbol_constructor_define_],
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||||
[ inline
|
[ b4_parser_class_name::symbol_type
|
||||||
b4_parser_class_name::symbol_type
|
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
||||||
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
|
||||||
b4_join(b4_symbol_if([$1], [has_type],
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
[YY_COPY (b4_symbol([$1], [type])) v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([YY_COPY (location_type) l])))
|
b4_locations_if([const location_type& l])))
|
||||||
{
|
{
|
||||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||||
b4_symbol_if([$1], [has_type], [YY_MOVE (v)]),
|
b4_symbol_if([$1], [has_type], [v]),
|
||||||
b4_locations_if([YY_MOVE (l)])));
|
b4_locations_if([l])));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
])])])
|
])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_declare
|
# b4_basic_symbol_constructor_declare
|
||||||
# -----------------------------------
|
# ----------------------------------
|
||||||
# Generate a constructor declaration for basic_symbol from given type.
|
# Generate a constructor declaration for basic_symbol from given type.
|
||||||
m4_define([b4_basic_symbol_constructor_declare],
|
m4_define([b4_basic_symbol_constructor_declare],
|
||||||
[[ basic_symbol (]b4_join(
|
[[
|
||||||
|
basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
b4_symbol_if([$1], [has_type], [YY_RVREF (b4_symbol([$1], [type])) v]),
|
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]),
|
||||||
b4_locations_if([YY_RVREF (location_type) l]))[);
|
b4_locations_if([const location_type& l]))[);
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_define
|
# b4_basic_symbol_constructor_define
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
# Generate a constructor implementation for basic_symbol from given type.
|
# Generate a constructor implementation for basic_symbol from given type.
|
||||||
m4_define([b4_basic_symbol_constructor_define],
|
m4_define([b4_basic_symbol_constructor_define],
|
||||||
[[ template <typename Base>
|
[[
|
||||||
|
template <typename Base>
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
b4_symbol_if([$1], [has_type], [YY_RVREF (b4_symbol([$1], [type])) v]),
|
b4_symbol_if([$1], [has_type], const b4_symbol([$1], [type])[ v]),
|
||||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
b4_locations_if([const location_type& l]))[)
|
||||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
: Base (t)
|
||||||
, value (YY_MOVE (v))])[]b4_locations_if([
|
, value (]b4_symbol_if([$1], [has_type], [v])[)]b4_locations_if([
|
||||||
, location (YY_MOVE (l))])[
|
, location (l)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# b4_symbol_constructor_define
|
# b4_symbol_constructor_define
|
||||||
@@ -376,4 +342,4 @@ m4_define([b4_basic_symbol_constructor_define],
|
|||||||
# Define the overloaded versions of make_symbol for all the value types.
|
# Define the overloaded versions of make_symbol for all the value types.
|
||||||
m4_define([b4_symbol_constructor_define],
|
m4_define([b4_symbol_constructor_define],
|
||||||
[ // Implementation of make_symbol for each symbol type.
|
[ // Implementation of make_symbol for each symbol type.
|
||||||
b4_symbol_foreach([_b4_symbol_constructor_define])])
|
b4_symbol_foreach([b4_symbol_constructor_define_])])
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
bison.xsl - common templates for Bison XSLT.
|
bison.xsl - common templates for Bison XSLT.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -201,8 +201,6 @@
|
|||||||
<xsl:if test="$point = 0">
|
<xsl:if test="$point = 0">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<!-- RHS -->
|
|
||||||
<xsl:for-each select="rhs/symbol|rhs/empty">
|
<xsl:for-each select="rhs/symbol|rhs/empty">
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:if test="$point = position()">
|
<xsl:if test="$point = position()">
|
||||||
@@ -216,9 +214,7 @@
|
|||||||
<xsl:value-of select="."/>
|
<xsl:value-of select="."/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty"/>
|
||||||
<xsl:text> %empty</xsl:text>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
<xsl:text> [</xsl:text>
|
<xsl:text> [</xsl:text>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2text.xsl - transform Bison XML Report into plain text.
|
xml2text.xsl - transform Bison XML Report into plain text.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -350,7 +350,12 @@
|
|||||||
<xsl:if test="position() = $point + 1">
|
<xsl:if test="position() = $point + 1">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$itemset != 'true'">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:if>
|
||||||
<xsl:if test="position() = last() and position() = $point">
|
<xsl:if test="position() = last() and position() = $point">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -368,7 +373,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty">
|
||||||
<xsl:text> %empty</xsl:text>
|
<xsl:text> /* empty */</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -38,7 +38,6 @@
|
|||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
|
||||||
<title>
|
<title>
|
||||||
<xsl:value-of select="bison-xml-report/filename"/>
|
<xsl:value-of select="bison-xml-report/filename"/>
|
||||||
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
|
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
|
||||||
@@ -533,7 +532,12 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="point">.</span>
|
<span class="point">.</span>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$itemset != 'true'">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:if>
|
||||||
<xsl:if test="position() = last() and position() = $point">
|
<xsl:if test="position() = last() and position() = $point">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="point">.</span>
|
<span class="point">.</span>
|
||||||
@@ -559,7 +563,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty">
|
||||||
<xsl:text> %empty</xsl:text>
|
<xsl:text> ε</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
|
|||||||
+76
-57
@@ -1,11 +1,11 @@
|
|||||||
-*- C -*-
|
-*- C -*-
|
||||||
# Yacc compatible skeleton for Bison
|
# Yacc compatible skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software
|
# Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation,
|
||||||
# Foundation, Inc.
|
# Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[1984, 1989-1990, 2000-2015, 2018])
|
[1984, 1989-1990, 2000-2013])
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -118,7 +118,7 @@ m4_define([b4_int_type],
|
|||||||
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
|
b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
|
||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned],
|
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
@@ -143,6 +143,7 @@ m4_define([b4_rhs_value],
|
|||||||
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
## Locations. ##
|
## Locations. ##
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
@@ -175,19 +176,36 @@ m4_define([b4_declare_scanner_communication_variables], [[
|
|||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
]b4_pure_if([[
|
]b4_pure_if([[
|
||||||
/* The semantic value of the lookahead symbol. */
|
#if defined __GNUC__ && 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\"")\
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||||
|
_Pragma ("GCC diagnostic pop")
|
||||||
|
#else
|
||||||
/* Default value used for initialization, for pacifying older GCCs
|
/* Default value used for initialization, for pacifying older GCCs
|
||||||
or non-GCC compilers. */
|
or non-GCC compilers. */
|
||||||
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
|
static YYSTYPE yyval_default;
|
||||||
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[
|
# define YY_INITIAL_VALUE(Value) = Value
|
||||||
|
#endif]b4_locations_if([[
|
||||||
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;]])])[
|
||||||
|
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
|
#endif
|
||||||
|
#ifndef YY_INITIAL_VALUE
|
||||||
|
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The semantic value of the lookahead symbol. */
|
||||||
|
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);]b4_locations_if([[
|
||||||
|
|
||||||
/* Location data for the lookahead symbol. */
|
/* Location data for the lookahead symbol. */
|
||||||
static YYLTYPE yyloc_default]b4_yyloc_default[;
|
YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[;
|
||||||
YYLTYPE yylloc = yyloc_default;]])],
|
]])b4_pure_if([], [[
|
||||||
[[/* The semantic value of the lookahead symbol. */
|
|
||||||
YYSTYPE yylval;]b4_locations_if([[
|
|
||||||
/* Location data for the lookahead symbol. */
|
|
||||||
YYLTYPE yylloc]b4_yyloc_default[;]])[
|
|
||||||
/* Number of syntax errors so far. */
|
/* Number of syntax errors so far. */
|
||||||
int yynerrs;]])])
|
int yynerrs;]])])
|
||||||
|
|
||||||
@@ -205,9 +223,9 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
|||||||
int yyerrstatus;
|
int yyerrstatus;
|
||||||
|
|
||||||
/* The stacks and their tools:
|
/* The stacks and their tools:
|
||||||
'yyss': related to states.
|
`yyss': related to states.
|
||||||
'yyvs': related to semantic values.]b4_locations_if([[
|
`yyvs': related to semantic values.]b4_locations_if([[
|
||||||
'yyls': related to locations.]])[
|
`yyls': related to locations.]])[
|
||||||
|
|
||||||
Refer to the stacks through separate pointers, to allow yyoverflow
|
Refer to the stacks through separate pointers, to allow yyoverflow
|
||||||
to reallocate them elsewhere. */
|
to reallocate them elsewhere. */
|
||||||
@@ -237,11 +255,11 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
|||||||
YYSIZE_T yyes_capacity;]])])
|
YYSIZE_T yyes_capacity;]])])
|
||||||
|
|
||||||
|
|
||||||
# _b4_declare_yyparse_push
|
# b4_declare_yyparse_push_
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Declaration of yyparse (and dependencies) when using the push parser
|
# Declaration of yyparse (and dependencies) when using the push parser
|
||||||
# (including in pull mode).
|
# (including in pull mode).
|
||||||
m4_define([_b4_declare_yyparse_push],
|
m4_define([b4_declare_yyparse_push_],
|
||||||
[[#ifndef YYPUSH_MORE_DEFINED
|
[[#ifndef YYPUSH_MORE_DEFINED
|
||||||
# define YYPUSH_MORE_DEFINED
|
# define YYPUSH_MORE_DEFINED
|
||||||
enum { YYPUSH_MORE = 4 };
|
enum { YYPUSH_MORE = 4 };
|
||||||
@@ -265,18 +283,18 @@ b4_function_declare([b4_prefix[pstate_delete]], [[void]],
|
|||||||
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
# _b4_declare_yyparse
|
# b4_declare_yyparse_
|
||||||
# -------------------
|
# -------------------
|
||||||
# When not the push parser.
|
# When not the push parser.
|
||||||
m4_define([_b4_declare_yyparse],
|
m4_define([b4_declare_yyparse_],
|
||||||
[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)])
|
[b4_function_declare(b4_prefix[parse], [int], b4_parse_param)])
|
||||||
|
|
||||||
|
|
||||||
# b4_declare_yyparse
|
# b4_declare_yyparse
|
||||||
# ------------------
|
# ------------------
|
||||||
m4_define([b4_declare_yyparse],
|
m4_define([b4_declare_yyparse],
|
||||||
[b4_push_if([_b4_declare_yyparse_push],
|
[b4_push_if([b4_declare_yyparse_push_],
|
||||||
[_b4_declare_yyparse])[]dnl
|
[b4_declare_yyparse_])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -377,13 +395,13 @@ typedef signed char yytype_int8;
|
|||||||
#ifdef YYTYPE_UINT16
|
#ifdef YYTYPE_UINT16
|
||||||
typedef YYTYPE_UINT16 yytype_uint16;
|
typedef YYTYPE_UINT16 yytype_uint16;
|
||||||
#else
|
#else
|
||||||
typedef unsigned short yytype_uint16;
|
typedef unsigned short int yytype_uint16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef YYTYPE_INT16
|
#ifdef YYTYPE_INT16
|
||||||
typedef YYTYPE_INT16 yytype_int16;
|
typedef YYTYPE_INT16 yytype_int16;
|
||||||
#else
|
#else
|
||||||
typedef short yytype_int16;
|
typedef short int yytype_int16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef YYSIZE_T
|
#ifndef YYSIZE_T
|
||||||
@@ -395,7 +413,7 @@ typedef short yytype_int16;
|
|||||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YYSIZE_T size_t
|
# define YYSIZE_T size_t
|
||||||
# else
|
# else
|
||||||
# define YYSIZE_T unsigned
|
# define YYSIZE_T unsigned int
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -413,7 +431,12 @@ typedef short yytype_int16;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_attribute_define[
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# define YYUSE(E) ((void) (E))
|
||||||
|
#else
|
||||||
|
# define YYUSE(E) /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[
|
#if ]b4_lac_if([[1]], [[! defined yyoverflow || YYERROR_VERBOSE]])[
|
||||||
|
|
||||||
@@ -445,7 +468,7 @@ b4_push_if([], [b4_lac_if([], [[
|
|||||||
# endif]])])[
|
# endif]])])[
|
||||||
|
|
||||||
# ifdef YYSTACK_ALLOC
|
# ifdef YYSTACK_ALLOC
|
||||||
/* Pacify GCC's 'empty if-body' warning. */
|
/* Pacify GCC's `empty if-body' warning. */
|
||||||
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
|
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
|
||||||
# ifndef YYSTACK_ALLOC_MAXIMUM
|
# ifndef YYSTACK_ALLOC_MAXIMUM
|
||||||
/* The OS might guarantee only one guard page at the bottom of the stack,
|
/* The OS might guarantee only one guard page at the bottom of the stack,
|
||||||
@@ -571,7 +594,7 @@ union yyalloc
|
|||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||||
|
|
||||||
#define YYTRANSLATE(YYX) \
|
#define YYTRANSLATE(YYX) \
|
||||||
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||||
|
|
||||||
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
||||||
as returned by yylex, without out-of-bounds checking. */
|
as returned by yylex, without out-of-bounds checking. */
|
||||||
@@ -719,7 +742,7 @@ do { \
|
|||||||
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))[
|
b4_parse_param]))[
|
||||||
{
|
{
|
||||||
unsigned long yylno = yyrline[yyrule];
|
unsigned long int yylno = yyrline[yyrule];
|
||||||
int yynrhs = yyr2[yyrule];
|
int yynrhs = yyr2[yyrule];
|
||||||
int yyi;
|
int yyi;
|
||||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
||||||
@@ -827,7 +850,7 @@ yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
|||||||
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
||||||
[full], [[
|
[full], [[
|
||||||
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
|
YYDPRINTF ((stderr, "%srealloc to %lu%s", yydebug_prefix,
|
||||||
(unsigned long) yyalloc, yydebug_suffix));]])[
|
(unsigned long int) yyalloc, yydebug_suffix));]])[
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1108,11 +1131,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||||
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
|
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULLPTR;
|
const char *yyformat = YY_NULL;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat. */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* Number of reported tokens (one for the "unexpected", one per
|
||||||
@@ -1187,7 +1210,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
||||||
if (! (yysize <= yysize1
|
if (! (yysize <= yysize1
|
||||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
return 2;
|
return 2;
|
||||||
@@ -1207,7 +1230,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
case N: \
|
case N: \
|
||||||
yyformat = S; \
|
yyformat = S; \
|
||||||
break
|
break
|
||||||
default: /* Avoid compiler warnings. */
|
|
||||||
YYCASE_(0, YY_("syntax error"));
|
YYCASE_(0, YY_("syntax error"));
|
||||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||||
@@ -1272,7 +1294,7 @@ static char yypstate_allocated = 0;]])b4_pull_if([
|
|||||||
|
|
||||||
b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||||
{
|
{
|
||||||
return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param],
|
return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
|
||||||
[[, ]b4_args(b4_parse_param)])[);
|
[[, ]b4_args(b4_parse_param)])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1314,10 +1336,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
{
|
{
|
||||||
yypstate *yyps;]b4_pure_if([], [[
|
yypstate *yyps;]b4_pure_if([], [[
|
||||||
if (yypstate_allocated)
|
if (yypstate_allocated)
|
||||||
return YY_NULLPTR;]])[
|
return YY_NULL;]])[
|
||||||
yyps = (yypstate *) malloc (sizeof *yyps);
|
yyps = (yypstate *) malloc (sizeof *yyps);
|
||||||
if (!yyps)
|
if (!yyps)
|
||||||
return YY_NULLPTR;
|
return YY_NULL;
|
||||||
yyps->yynew = 1;]b4_pure_if([], [[
|
yyps->yynew = 1;]b4_pure_if([], [[
|
||||||
yypstate_allocated = 1;]])[
|
yypstate_allocated = 1;]])[
|
||||||
return yyps;
|
return yyps;
|
||||||
@@ -1326,19 +1348,16 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
]b4_function_define([[yypstate_delete]], [[void]],
|
]b4_function_define([[yypstate_delete]], [[void]],
|
||||||
[[[yypstate *yyps]], [[yyps]]])[
|
[[[yypstate *yyps]], [[yyps]]])[
|
||||||
{
|
{
|
||||||
if (yyps)
|
|
||||||
{
|
|
||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
/* If the stack was reallocated but the parse did not complete, then the
|
/* If the stack was reallocated but the parse did not complete, then the
|
||||||
stack still needs to be freed. */
|
stack still needs to be freed. */
|
||||||
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
||||||
YYSTACK_FREE (yyps->yyss);
|
YYSTACK_FREE (yyps->yyss);
|
||||||
#endif]b4_lac_if([[
|
#endif]b4_lac_if([[
|
||||||
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
if (!yyps->yynew && yyps->yyes != yyps->yyesa)
|
||||||
YYSTACK_FREE (yyps->yyes);]])[
|
YYSTACK_FREE (yyps->yyes);]])[
|
||||||
free (yyps);]b4_pure_if([], [[
|
free (yyps);]b4_pure_if([], [[
|
||||||
yypstate_allocated = 0;]])[
|
yypstate_allocated = 0;]])[
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]b4_pure_if([[
|
]b4_pure_if([[
|
||||||
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
|
#define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
|
||||||
@@ -1513,7 +1532,7 @@ b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yyllo
|
|||||||
yylsp = yyls + yysize - 1;])[
|
yylsp = yyls + yysize - 1;])[
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
||||||
(unsigned long) yystacksize));
|
(unsigned long int) yystacksize));
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
@@ -1635,7 +1654,7 @@ yyreduce:
|
|||||||
yylen = yyr2[yyn];
|
yylen = yyr2[yyn];
|
||||||
|
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
'$$ = $1'.
|
`$$ = $1'.
|
||||||
|
|
||||||
Otherwise, the following line sets YYVAL to garbage.
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison
|
||||||
@@ -1645,9 +1664,8 @@ yyreduce:
|
|||||||
yyval = yyvsp[1-yylen];
|
yyval = yyvsp[1-yylen];
|
||||||
|
|
||||||
]b4_locations_if(
|
]b4_locations_if(
|
||||||
[[ /* Default location. */
|
[[ /* Default location. */
|
||||||
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
|
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
|
||||||
yyerror_range[1] = yyloc;]])[
|
|
||||||
YY_REDUCE_PRINT (yyn);]b4_lac_if([[
|
YY_REDUCE_PRINT (yyn);]b4_lac_if([[
|
||||||
{
|
{
|
||||||
int yychar_backup = yychar;
|
int yychar_backup = yychar;
|
||||||
@@ -1684,7 +1702,7 @@ yyreduce:
|
|||||||
*++yyvsp = yyval;]b4_locations_if([
|
*++yyvsp = yyval;]b4_locations_if([
|
||||||
*++yylsp = yyloc;])[
|
*++yylsp = yyloc;])[
|
||||||
|
|
||||||
/* Now 'shift' the result of the reduction. Determine what state
|
/* Now `shift' the result of the reduction. Determine what state
|
||||||
that goes to, based on the state we popped back to and the rule
|
that goes to, based on the state we popped back to and the rule
|
||||||
number reduced by. */
|
number reduced by. */
|
||||||
|
|
||||||
@@ -1787,7 +1805,8 @@ yyerrorlab:
|
|||||||
if (/*CONSTCOND*/ 0)
|
if (/*CONSTCOND*/ 0)
|
||||||
goto yyerrorlab;
|
goto yyerrorlab;
|
||||||
|
|
||||||
/* Do not reclaim the symbols of the rule whose action triggered
|
]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
|
||||||
|
]])[ /* Do not reclaim the symbols of the rule whose action triggered
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
YYPOPSTACK (yylen);
|
YYPOPSTACK (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
@@ -1908,12 +1927,12 @@ yypushreturn:]])[
|
|||||||
return yyresult;
|
return yyresult;
|
||||||
}
|
}
|
||||||
]b4_epilogue[]dnl
|
]b4_epilogue[]dnl
|
||||||
b4_output_end
|
b4_output_end()
|
||||||
|
|
||||||
b4_defines_if(
|
b4_defines_if(
|
||||||
[b4_output_begin([b4_spec_defines_file])[
|
[b4_output_begin([b4_spec_defines_file])[
|
||||||
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
]b4_copyright([Bison interface for Yacc-like parsers in C])[
|
||||||
|
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]b4_output_end
|
]b4_output_end()
|
||||||
])# b4_defines_if
|
])# b4_defines_if
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||||
# Requires GNU sed
|
# Requires GNU sed
|
||||||
|
|
||||||
## Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
## Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||||
|
|
||||||
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
=======================
|
=======================
|
||||||
|
|
||||||
The DJGPP port of Bison offers LFN and SFN support depending on which
|
The DJGPP port of Bison offers LFN and SFN support depending on which
|
||||||
OS it is running. If LFN support is available or not is determined at
|
OS it is running. If LFN support is available or not is determinated at
|
||||||
run time. If LFN support is available (DOS session under Win9X, Win2K,
|
run time. If LFN support is available (DOS session under Win9X, Win2K,
|
||||||
WinXP, etc.) the standard posix file name extensions will be used.
|
WinXP, etc.) the standard posix file name extensions will be used.
|
||||||
These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN
|
These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN
|
||||||
|
|||||||
+6
-6
@@ -4,7 +4,7 @@ Rem Configure Bison for DJGPP.
|
|||||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
|
||||||
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
Rem Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
Rem it under the terms of the GNU General Public License as published by
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
@@ -80,10 +80,10 @@ goto NextArgument
|
|||||||
if "%1" == "no-dep" goto NextArgument
|
if "%1" == "no-dep" goto NextArgument
|
||||||
if "%1" == "no-DEP" goto NextArgument
|
if "%1" == "no-DEP" goto NextArgument
|
||||||
if "%1" == "NO-DEP" goto NextArgument
|
if "%1" == "NO-DEP" goto NextArgument
|
||||||
if "%1" == "dep" goto DependecyTracking
|
if "%1" == "dep" goto DependecyTraking
|
||||||
if "%1" == "DEP" goto DependecyTracking
|
if "%1" == "DEP" goto DependecyTraking
|
||||||
goto LibiconvPrefixOption
|
goto LibiconvPrefixOption
|
||||||
:DependecyTracking
|
:DependecyTraking
|
||||||
if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
|
if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
|
||||||
if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
|
if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
|
||||||
if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
|
if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
|
||||||
@@ -290,7 +290,7 @@ if errorlevel 1 goto SedError2
|
|||||||
mv -f config.hin %XSRC%/lib/config.hin
|
mv -f config.hin %XSRC%/lib/config.hin
|
||||||
|
|
||||||
|
|
||||||
Rem Fixing illicit testsuite file name.
|
Rem Fixing ilicit testsuite file name.
|
||||||
test -f %XSRC%/tests/c++.at
|
test -f %XSRC%/tests/c++.at
|
||||||
if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
|
if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ sed -f %XSRC%/djgpp/testsuite.sed %XSRC%/tests/testsuite.org > testsuite.tmp
|
|||||||
if errorlevel 1 goto SedError3
|
if errorlevel 1 goto SedError3
|
||||||
mv -f ./testsuite.tmp %XSRC%/tests/testsuite
|
mv -f ./testsuite.tmp %XSRC%/tests/testsuite
|
||||||
|
|
||||||
Rem Fixing illicit calc++ file names in the calc++ directory.
|
Rem Fixing ilicit calc++ file names in the calc++ directory.
|
||||||
test -d %XSRC%/examples/calc++
|
test -d %XSRC%/examples/calc++
|
||||||
if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
|
if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
|
||||||
test -d %XSRC%/examples/calcxx
|
test -d %XSRC%/examples/calcxx
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Sed script for additional DJGPP specific editing
|
# Sed script for additional DJGPP specific editing
|
||||||
# of the configure script generated by autoconf 2.62.
|
# of the configure script generated by autoconf 2.62.
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
# This is the config.site file for configuring GNU packages
|
# This is the config.site file for configuring GNU packages
|
||||||
# which are to be built with DJGPP tools.
|
# which are to be built with DJGPP tools.
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# sed script for DJGPP specific editing of config.hin
|
# sed script for DJGPP specific editing of config.hin
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ Rem This batch file unpacks the Bison distribution while simultaneously
|
|||||||
Rem renaming some of the files whose names are invalid on DOS or conflict
|
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||||
Rem with other file names after truncation to DOS 8+3 namespace.
|
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||||
Rem
|
Rem
|
||||||
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
Rem Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
Rem
|
Rem
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
Rem it under the terms of the GNU General Public License as published by
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
## Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Sed script for additional DJGPP specific editing
|
# Sed script for additional DJGPP specific editing
|
||||||
# of the testsuite script generated by autoconf 2.61.
|
# of the testsuite script generated by autoconf 2.61.
|
||||||
|
|
||||||
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -27,4 +27,3 @@
|
|||||||
/stamp-vti
|
/stamp-vti
|
||||||
/version.texi
|
/version.texi
|
||||||
/yacc.1
|
/yacc.1
|
||||||
/gendocs_template_min
|
|
||||||
|
|||||||
+961
-1406
File diff suppressed because it is too large
Load Diff
+855
-1534
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
|||||||
This file is a stub, not used by the documentation. If you feel like
|
|
||||||
contributing ASCII art for example.gv, please step forward!
|
|
||||||
+20
-28
@@ -1,5 +1,4 @@
|
|||||||
## Copyright (C) 2001-2003, 2005-2015, 2018 Free Software Foundation,
|
## Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
|
||||||
## Inc.
|
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,20 +23,21 @@ doc_bison_TEXINFOS = \
|
|||||||
# Cannot express dependencies directly on file names because of Automake.
|
# Cannot express dependencies directly on file names because of Automake.
|
||||||
# Obfuscate with a variable.
|
# Obfuscate with a variable.
|
||||||
doc_bison = doc/bison
|
doc_bison = doc/bison
|
||||||
$(doc_bison).dvi: $(FIGS_GV:.gv=.eps)
|
$(doc_bison).dvi: $(FIGS_DOT:.dot=.eps)
|
||||||
$(doc_bison).info: $(FIGS_GV:.gv=.txt)
|
$(doc_bison).pdf: $(FIGS_DOT:.dot=.pdf)
|
||||||
$(doc_bison).pdf: $(FIGS_GV:.gv=.pdf)
|
$(doc_bison).html: $(FIGS_DOT:.dot=.png)
|
||||||
$(doc_bison).html: $(FIGS_GV:.gv=.png)
|
|
||||||
|
|
||||||
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
|
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d -I doc
|
||||||
CLEANDIRS += doc/bison.t2d
|
CLEANDIRS = doc/bison.t2d
|
||||||
|
clean-local:
|
||||||
|
rm -rf $(CLEANDIRS)
|
||||||
|
|
||||||
MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
|
MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
|
||||||
|
|
||||||
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
||||||
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
||||||
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
||||||
# Create $@~ which is the previous contents. Don't use 'mv' here so
|
# Create $@~ which is the previous contents. Don't use `mv' here so
|
||||||
# that even if we are interrupted, the file is still available for
|
# that even if we are interrupted, the file is still available for
|
||||||
# diff in the next run. Note that $@ might not exist yet.
|
# diff in the next run. Note that $@ might not exist yet.
|
||||||
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
||||||
@@ -84,13 +84,11 @@ doc/refcard.pdf: doc/refcard.tex
|
|||||||
# repeated builds of bison.help.
|
# repeated builds of bison.help.
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/doc/bison.help
|
EXTRA_DIST += $(top_srcdir)/doc/bison.help
|
||||||
if ! CROSS_COMPILING
|
|
||||||
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
|
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
|
||||||
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
|
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
|
||||||
$(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
|
$(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
|
||||||
$(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
|
$(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
|
||||||
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
|
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
|
||||||
endif ! CROSS_COMPILING
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
@@ -107,11 +105,7 @@ remove_time_stamp = \
|
|||||||
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
||||||
|
|
||||||
# Depend on configure to get version number changes.
|
# Depend on configure to get version number changes.
|
||||||
if ! CROSS_COMPILING
|
$(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
|
||||||
MAN_DEPS = doc/bison.help doc/bison.x $(top_srcdir)/configure
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(top_srcdir)/doc/bison.1: $(MAN_DEPS)
|
|
||||||
$(AM_V_GEN)$(HELP2MAN) \
|
$(AM_V_GEN)$(HELP2MAN) \
|
||||||
--include=$(top_srcdir)/doc/bison.x \
|
--include=$(top_srcdir)/doc/bison.x \
|
||||||
--output=$@.t src/bison$(EXEEXT)
|
--output=$@.t src/bison$(EXEEXT)
|
||||||
@@ -123,34 +117,32 @@ $(top_srcdir)/doc/bison.1: $(MAN_DEPS)
|
|||||||
fi
|
fi
|
||||||
$(AM_V_at)rm -f $@*.t
|
$(AM_V_at)rm -f $@*.t
|
||||||
|
|
||||||
if ENABLE_YACC
|
|
||||||
nodist_man_MANS = doc/yacc.1
|
nodist_man_MANS = doc/yacc.1
|
||||||
endif
|
|
||||||
|
|
||||||
## ----------------------------- ##
|
## ----------------------------- ##
|
||||||
## Graphviz examples generation. ##
|
## Graphviz examples generation. ##
|
||||||
## ----------------------------- ##
|
## ----------------------------- ##
|
||||||
|
|
||||||
CLEANFILES += $(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
|
CLEANDIRS += doc/figs
|
||||||
FIGS_GV = \
|
FIGS_DOT = \
|
||||||
doc/figs/example.gv \
|
doc/figs/example.dot \
|
||||||
doc/figs/example-reduce.gv doc/figs/example-shift.gv
|
doc/figs/example-reduce.dot doc/figs/example-shift.dot
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
$(FIGS_GV) $(FIGS_GV:.gv=.txt) \
|
$(FIGS_DOT) \
|
||||||
$(FIGS_GV:.gv=.eps) $(FIGS_GV:.gv=.pdf) $(FIGS_GV:.gv=.png)
|
$(FIGS_DOT:.dot=.eps) $(FIGS_DOT:.dot=.pdf) $(FIGS_DOT:.dot=.png)
|
||||||
SUFFIXES += .gv .eps .pdf .png
|
SUFFIXES += .dot .eps .pdf .png
|
||||||
|
|
||||||
.gv.eps:
|
.dot.eps:
|
||||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
|
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
|
||||||
$(AM_V_at) mv $@.tmp $@
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|
||||||
.gv.pdf:
|
.dot.pdf:
|
||||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
|
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
|
||||||
$(AM_V_at) mv $@.tmp $@
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|
||||||
.gv.png:
|
.dot.png:
|
||||||
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
|
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
|
||||||
$(AM_V_at) mv $@.tmp $@
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|||||||
+1
-2
@@ -19,8 +19,7 @@
|
|||||||
\def\finalout{\overfullrule=0pt}
|
\def\finalout{\overfullrule=0pt}
|
||||||
%\finalout
|
%\finalout
|
||||||
|
|
||||||
% Copyright (c) 1998, 2001, 2009-2015, 2018 Free Software Foundation,
|
% Copyright (c) 1998, 2001, 2009-2013 Free Software Foundation, Inc.
|
||||||
% Inc.
|
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% 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 Free Software Foundation, Inc.
|
Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
# Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
# This file is part of Bison, the GNU Compiler Compiler.
|
||||||
#
|
#
|
||||||
@@ -53,7 +53,7 @@ will generate eight different cases.
|
|||||||
|
|
||||||
=item B<-b>, B<--bench>
|
=item B<-b>, B<--bench>
|
||||||
|
|
||||||
Predefined benches, that is, combination between a grammar and a I<directives>
|
Predefined benches, that is, combimation between a grammar and a I<directives>
|
||||||
request.
|
request.
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
@@ -204,9 +204,9 @@ Format the list of directives for Bison for bench named C<$bench>.
|
|||||||
sub directives($@)
|
sub directives($@)
|
||||||
{
|
{
|
||||||
my ($bench, @directive) = @_;
|
my ($bench, @directive) = @_;
|
||||||
my $res = "/* Directives for bench '$bench'. */\n";
|
my $res = "/* Directives for bench `$bench'. */\n";
|
||||||
$res .= join ("\n", @directive) . "\n";
|
$res .= join ("\n", @directive) . "\n";
|
||||||
$res .= "/* End of directives for bench '$bench'. */\n";
|
$res .= "/* End of directives for bench `$bench'. */\n";
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,7 +738,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylvalp,
|
|||||||
void
|
void
|
||||||
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
|
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
|
||||||
{
|
{
|
||||||
std::cerr << loc << ": " << msg << '\n';
|
std::cerr << loc << ": " << msg << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2006, 2008-2015, 2018 Free Software Foundation, Inc.
|
## Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
This directory contains examples of Bison grammar files.
|
|
||||||
|
|
||||||
* mfcalc
|
|
||||||
A C example of a multi-function calculator. Extracted from the
|
|
||||||
documentation.
|
|
||||||
|
|
||||||
* calc++
|
|
||||||
A C++ version of the canonical example for parsers: a calculator. Also uses
|
|
||||||
Flex for the scanner. Extracted from the documentation.
|
|
||||||
|
|
||||||
* variant.yy
|
|
||||||
A C++ example that uses variants (they allow to use any C++ type as semantic
|
|
||||||
value type) and symbol constructors (they ensure consistency between
|
|
||||||
declared token type and effective semantic value).
|
|
||||||
|
|
||||||
* variant-11.yy
|
|
||||||
Another C++ example, closely related to the previous one, but exhibiting
|
|
||||||
support for C++11's move semantics.
|
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: outline
|
|
||||||
fill-column: 76
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2018 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
|
|
||||||
any later version published by the Free Software Foundation; with no
|
|
||||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
|
||||||
Texts. A copy of the license is included in the "GNU Free
|
|
||||||
Documentation License" file as part of this distribution.
|
|
||||||
|
|
||||||
# LocalWords: mfcalc calc parsers yy
|
|
||||||
@@ -2,18 +2,18 @@
|
|||||||
/*.tmp
|
/*.tmp
|
||||||
/.deps
|
/.deps
|
||||||
/calc++
|
/calc++
|
||||||
|
/calc++-driver.cc
|
||||||
|
/calc++-driver.hh
|
||||||
|
/calc++-parser.cc
|
||||||
|
/calc++-parser.hh
|
||||||
|
/calc++-parser.output
|
||||||
|
/calc++-parser.stamp
|
||||||
|
/calc++-parser.yy
|
||||||
|
/calc++-scanner.cc
|
||||||
|
/calc++-scanner.ll
|
||||||
/calc++.cc
|
/calc++.cc
|
||||||
/calc++.exe
|
/calc++.exe
|
||||||
/calc.stamp
|
/calc.stamp
|
||||||
/driver.cc
|
|
||||||
/driver.hh
|
|
||||||
/location.hh
|
/location.hh
|
||||||
/parser.cc
|
|
||||||
/parser.hh
|
|
||||||
/parser.output
|
|
||||||
/parser.stamp
|
|
||||||
/parser.yy
|
|
||||||
/position.hh
|
/position.hh
|
||||||
/scanner.cc
|
|
||||||
/scanner.ll
|
|
||||||
/stack.hh
|
/stack.hh
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
# This Makefile is designed to be simple and readable. It does not
|
|
||||||
# aim at portability. It requires GNU Make.
|
|
||||||
|
|
||||||
BISON = bison
|
|
||||||
CXX = g++
|
|
||||||
FLEX = flex
|
|
||||||
|
|
||||||
all: calc++
|
|
||||||
|
|
||||||
%.cc %.hh: %.yy
|
|
||||||
$(BISON) $(BISONFLAGS) -o $*.cc $<
|
|
||||||
|
|
||||||
%.cc: %.ll
|
|
||||||
$(FLEX) $(FLEXFLAGS) -o$@ $<
|
|
||||||
|
|
||||||
%.o: %.cc
|
|
||||||
$(CXX) $(CXXFLAGS) -c -o$@ $<
|
|
||||||
|
|
||||||
calc++: calc++.o driver.o parser.o scanner.o
|
|
||||||
$(CXX) -o $@ $^
|
|
||||||
|
|
||||||
calc++.o: parser.hh
|
|
||||||
parser.o: parser.hh
|
|
||||||
scanner.o: parser.hh
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f calc++ *.o parser.hh parser.cc scanner.cc
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
This directory contains calc++, a simple Bison grammar file in C++.
|
|
||||||
|
|
||||||
Please, read the corresponding chapter in the documentation: "A Complete C++
|
|
||||||
Example". It is also available on line (maybe with a different version of
|
|
||||||
Bison):
|
|
||||||
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
|
||||||
|
|
||||||
To use it, copy this directory into some work directory, and run `make` to
|
|
||||||
compile the executable, and try it. It is a simple calculator which accepts
|
|
||||||
several variable definitions, one per line, and then a single expression to
|
|
||||||
evaluate.
|
|
||||||
|
|
||||||
The program calc++ expects the file to parse as argument; pass `-` to read
|
|
||||||
the standard input (and then hit <Ctrl-d>, control-d, to end your input).
|
|
||||||
|
|
||||||
$ ./calc++ -
|
|
||||||
one := 1
|
|
||||||
two := 2
|
|
||||||
three := 3
|
|
||||||
(one + two * three) * two * three
|
|
||||||
<Ctrl-d>
|
|
||||||
42
|
|
||||||
|
|
||||||
You may pass `-p` to activate the parser debug traces, and `-s` to activate
|
|
||||||
the scanner's.
|
|
||||||
|
|
||||||
-----
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: outline
|
|
||||||
fill-column: 76
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2018 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# LocalWords: mfcalc calc parsers yy MERCHANTABILITY
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+38
-49
@@ -1,5 +1,4 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
|
||||||
# Inc.
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,7 +19,7 @@
|
|||||||
|
|
||||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||||
# in srcdir, including during distcheck, which is forbidden.
|
# in srcdir, including during distcheck, which is forbidden.
|
||||||
%D%/parser.stamp: $(BISON_IN)
|
examples/calc++/calc++-parser.stamp: $(BISON_IN)
|
||||||
SUFFIXES += .yy .stamp
|
SUFFIXES += .yy .stamp
|
||||||
.yy.stamp:
|
.yy.stamp:
|
||||||
$(AM_V_YACC)rm -f $@
|
$(AM_V_YACC)rm -f $@
|
||||||
@@ -28,59 +27,49 @@ SUFFIXES += .yy .stamp
|
|||||||
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
||||||
$(AM_V_at)mv -f $@.tmp $@
|
$(AM_V_at)mv -f $@.tmp $@
|
||||||
|
|
||||||
$(calcxx_sources_generated): %D%/parser.stamp
|
$(calc_sources_generated): examples/calc++/calc++-parser.stamp
|
||||||
@test -f $@ || rm -f %D%/parser.stamp
|
@test -f $@ || rm -f examples/calc++/calc++-parser.stamp
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/parser.stamp
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
$(calcxx_sources_generated) \
|
$(calc_sources_generated) \
|
||||||
%D%/parser.output \
|
examples/calc++/calc++-parser.output \
|
||||||
%D%/parser.stamp \
|
examples/calc++/calc++-parser.stamp \
|
||||||
%D%/scanner.cc
|
examples/calc++/calc++-scanner.cc
|
||||||
CLEANDIRS += %D%/*.dSYM
|
|
||||||
|
|
||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
## Building & testing. ##
|
## Building & testing. ##
|
||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
# Avoid using BUILT_SOURCES which is too global.
|
# Avoid using BUILT_SOURCES which is too global.
|
||||||
$(%C%_calc___OBJECTS): $(calcxx_sources_generated)
|
$(examples_calc___calc___OBJECTS): $(calc_sources_generated)
|
||||||
|
|
||||||
calcxx_sources_extracted = \
|
calc_sources_extracted = \
|
||||||
%D%/driver.cc \
|
examples/calc++/calc++-driver.cc \
|
||||||
%D%/driver.hh \
|
examples/calc++/calc++-driver.hh \
|
||||||
%D%/scanner.ll \
|
examples/calc++/calc++-scanner.ll \
|
||||||
%D%/calc++.cc
|
examples/calc++/calc++.cc
|
||||||
calcxx_extracted = \
|
calc_extracted = \
|
||||||
$(calcxx_sources_extracted) \
|
$(calc_sources_extracted) \
|
||||||
%D%/parser.yy
|
examples/calc++/calc++-parser.yy
|
||||||
extracted += $(calcxx_extracted)
|
extracted += $(calc_extracted)
|
||||||
calcxx_sources_generated = \
|
calc_sources_generated = \
|
||||||
%D%/parser.cc \
|
examples/calc++/calc++-parser.cc \
|
||||||
%D%/parser.hh \
|
examples/calc++/calc++-parser.hh \
|
||||||
%D%/location.hh \
|
examples/calc++/location.hh \
|
||||||
%D%/position.hh \
|
examples/calc++/position.hh \
|
||||||
%D%/stack.hh
|
examples/calc++/stack.hh
|
||||||
calcxx_sources = \
|
calc_sources = \
|
||||||
$(calcxx_sources_extracted) \
|
$(calc_sources_extracted) \
|
||||||
$(calcxx_sources_generated)
|
$(calc_sources_generated)
|
||||||
|
|
||||||
if FLEX_CXX_WORKS
|
if BISON_CXX_WORKS
|
||||||
check_PROGRAMS += %D%/calc++
|
check_PROGRAMS += examples/calc++/calc++
|
||||||
nodist_%C%_calc___SOURCES = \
|
nodist_examples_calc___calc___SOURCES = \
|
||||||
$(calcxx_sources)
|
$(calc_sources)
|
||||||
|
|
||||||
%C%_calc___CPPFLAGS = -I$(top_builddir)/%D%
|
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
|
||||||
%C%_calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
|
examples_calc___calc___CXXFLAGS = \
|
||||||
dist_TESTS += %D%/calc++.test
|
$(AM_CXXFLAGS) $(WARN_NO_NULL_CONVERSION_CXXFLAGS)
|
||||||
else
|
dist_TESTS += examples/calc++/calc++.test
|
||||||
EXTRA_DIST += %D%/calc++.test
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
|
||||||
## Installing. ##
|
|
||||||
## ------------ ##
|
|
||||||
|
|
||||||
calcxxdir = $(docdir)/examples/calc++
|
|
||||||
calcxx_DATA = $(calcxx_extracted)
|
|
||||||
dist_calcxx_DATA = %D%/README %D%/Makefile
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Work around an Automake 1.11.2 bug: it asks for the creation of
|
||||||
|
// y.tab.c and y.tab.h and then renames them as calc++-parser.cc and
|
||||||
|
// calc++-parser.h, but in the former it does not convert the
|
||||||
|
// #include "y.tab.h". We don't want this to show in the
|
||||||
|
// documentation.
|
||||||
|
#include "calc++-parser.hh"
|
||||||
+15
-51
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
# This file is part of GNU Bison
|
# This file is part of GNU Bison
|
||||||
|
|
||||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018 Free
|
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2013 Free Software
|
||||||
# Software Foundation, Inc.
|
# Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Usage: extexi [OPTION...] input-file.texi ... -- [FILES to extract]
|
# Usage: extexi input-file.texi ... -- [FILES to extract]
|
||||||
|
|
||||||
# Look for @example environments preceded with lines such as:
|
# Look for @example environments preceded with lines such as:
|
||||||
#
|
#
|
||||||
@@ -32,27 +32,9 @@
|
|||||||
# output before block 2, even if the latter appears before). The same
|
# output before block 2, even if the latter appears before). The same
|
||||||
# number may be used several time, in which case the order of
|
# number may be used several time, in which case the order of
|
||||||
# appearance is used.
|
# appearance is used.
|
||||||
#
|
|
||||||
# Use @ignore for code to extract that must not be part of the
|
|
||||||
# documentation. For instance:
|
|
||||||
#
|
|
||||||
# @ignore
|
|
||||||
# @comment file: calc++/scanner.ll
|
|
||||||
# @example
|
|
||||||
# // Work around an incompatibility in Flex.
|
|
||||||
# # undef yywrap
|
|
||||||
# # define yywrap() 1
|
|
||||||
# @end example
|
|
||||||
# @end ignore
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use File::Basename qw(dirname);
|
|
||||||
use File::Path qw(make_path);
|
|
||||||
|
|
||||||
# Whether we generate synclines.
|
|
||||||
my $synclines = 0;
|
|
||||||
|
|
||||||
# normalize($block)
|
# normalize($block)
|
||||||
# -----------------
|
# -----------------
|
||||||
# Remove Texinfo mark up.
|
# Remove Texinfo mark up.
|
||||||
@@ -60,7 +42,7 @@ sub normalize($)
|
|||||||
{
|
{
|
||||||
local ($_) = @_;
|
local ($_) = @_;
|
||||||
|
|
||||||
s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*\n//mg;
|
s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*//mg;
|
||||||
s/\@value\{VERSION\}/$ENV{VERSION}/g;
|
s/\@value\{VERSION\}/$ENV{VERSION}/g;
|
||||||
s/^\@(error|result)\{\}//mg;
|
s/^\@(error|result)\{\}//mg;
|
||||||
s/\@([{}@])/$1/g;
|
s/\@([{}@])/$1/g;
|
||||||
@@ -80,24 +62,9 @@ sub message($)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# The list of files we should extract.
|
# basename => full file name for files we should extract.
|
||||||
my @file_wanted;
|
my %file_wanted;
|
||||||
|
|
||||||
# Whether we should extract that file, and then under which path.
|
|
||||||
sub file_wanted ($)
|
|
||||||
{
|
|
||||||
my ($f) = @_;
|
|
||||||
for my $file (@file_wanted)
|
|
||||||
{
|
|
||||||
# No endswith in Perl 5...
|
|
||||||
return $file if $f eq substr($file, -length($f));
|
|
||||||
}
|
|
||||||
undef
|
|
||||||
}
|
|
||||||
|
|
||||||
# process ($in)
|
|
||||||
# -------------
|
|
||||||
# Read input file $in, and generate the outputs.
|
|
||||||
sub process ($)
|
sub process ($)
|
||||||
{
|
{
|
||||||
my ($in) = @_;
|
my ($in) = @_;
|
||||||
@@ -119,9 +86,9 @@ sub process ($)
|
|||||||
{
|
{
|
||||||
my $f = $1;
|
my $f = $1;
|
||||||
$block = $2 || 1;
|
$block = $2 || 1;
|
||||||
if (file_wanted($f))
|
if ($file_wanted{$f})
|
||||||
{
|
{
|
||||||
$file = file_wanted($f);
|
$file = $file_wanted{$f};
|
||||||
message(" GEN $file");
|
message(" GEN $file");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -135,14 +102,14 @@ sub process ($)
|
|||||||
{
|
{
|
||||||
# Bison supports synclines, but not Flex.
|
# Bison supports synclines, but not Flex.
|
||||||
$input .= sprintf ("#line %s \"$in\"\n", $. + 1)
|
$input .= sprintf ("#line %s \"$in\"\n", $. + 1)
|
||||||
if $synclines && $file =~ /\.[chy]*$/;
|
if $file =~ /\.[chy]*$/;
|
||||||
|
next;
|
||||||
}
|
}
|
||||||
elsif (/^\@end (small)?example$/)
|
elsif (/^\@end (small)?example$/)
|
||||||
{
|
{
|
||||||
die "no contents: $file"
|
die "no contents: $file"
|
||||||
if $input eq "";
|
if $input eq "";
|
||||||
|
|
||||||
$file{$file}{$block} .= "\n" if defined $file{$file}{$block};
|
|
||||||
$file{$file}{$block} .= normalize($input);
|
$file{$file}{$block} .= normalize($input);
|
||||||
$file = $input = undef;
|
$file = $input = undef;
|
||||||
++$block;
|
++$block;
|
||||||
@@ -157,7 +124,7 @@ sub process ($)
|
|||||||
# Output the files.
|
# Output the files.
|
||||||
for my $file (keys %file)
|
for my $file (keys %file)
|
||||||
{
|
{
|
||||||
make_path (dirname ($file));
|
# No spurious end of line: use printf.
|
||||||
my $o = new IO::File(">$file")
|
my $o = new IO::File(">$file")
|
||||||
or die "$file: cannot create: $?";
|
or die "$file: cannot create: $?";
|
||||||
print $o $file{$file}{$_}
|
print $o $file{$file}{$_}
|
||||||
@@ -169,17 +136,14 @@ my @input;
|
|||||||
my $seen_dash = 0;
|
my $seen_dash = 0;
|
||||||
for my $arg (@ARGV)
|
for my $arg (@ARGV)
|
||||||
{
|
{
|
||||||
if ($seen_dash)
|
if ($arg eq '--')
|
||||||
{
|
|
||||||
push @file_wanted, $arg;
|
|
||||||
}
|
|
||||||
elsif ($arg eq '--')
|
|
||||||
{
|
{
|
||||||
$seen_dash = 1;
|
$seen_dash = 1;
|
||||||
}
|
}
|
||||||
elsif ($arg eq '--synclines')
|
elsif ($seen_dash)
|
||||||
{
|
{
|
||||||
$synclines = 1;
|
use File::Basename;
|
||||||
|
$file_wanted{basename($arg)} = $arg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+14
-43
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2005, 2008-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2005, 2008-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -13,10 +13,11 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
dist_noinst_SCRIPTS = %D%/extexi %D%/test
|
dist_noinst_SCRIPTS = examples/extexi examples/test
|
||||||
TEST_LOG_COMPILER = $(top_srcdir)/%D%/test
|
TEST_LOG_COMPILER = $(top_srcdir)/examples/test
|
||||||
|
|
||||||
AM_CXXFLAGS = \
|
AM_CXXFLAGS = \
|
||||||
|
$(NO_STRICT_ALIAS_CXXFLAGS) \
|
||||||
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -24,50 +25,20 @@ AM_CXXFLAGS = \
|
|||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|
||||||
doc = $(top_srcdir)/doc/bison.texi
|
doc = $(top_srcdir)/doc/bison.texi
|
||||||
extexi = $(top_srcdir)/%D%/extexi
|
extexi = $(top_srcdir)/examples/extexi
|
||||||
if ENABLE_GCC_WARNINGS
|
extract = VERSION="$(VERSION)" $(PERL) -f $(extexi) $(doc) --
|
||||||
EXTEXIFLAGS = --synclines
|
|
||||||
endif
|
|
||||||
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(EXTEXIFLAGS) $(doc) --
|
|
||||||
extracted =
|
extracted =
|
||||||
CLEANFILES += $(extracted) %D%/extracted.stamp
|
CLEANFILES += $(extracted) examples/extracted.stamp
|
||||||
%D%/extracted.stamp: $(doc) $(extexi)
|
examples/extracted.stamp: $(doc) $(extexi)
|
||||||
$(AM_V_GEN)rm -f $@ $@.tmp
|
$(AM_V_GEN)rm -f $@ $@.tmp
|
||||||
$(AM_V_at)$(MKDIR_P) %D%
|
|
||||||
$(AM_V_at)touch $@.tmp
|
$(AM_V_at)touch $@.tmp
|
||||||
$(AM_V_at)$(extract) $(extracted)
|
$(AM_V_at)$(extract) $(extracted)
|
||||||
$(AM_V_at)mv $@.tmp $@
|
$(AM_V_at)mv $@.tmp $@
|
||||||
|
|
||||||
$(extracted): %D%/extracted.stamp
|
$(extracted): examples/extracted.stamp
|
||||||
@test -f $@ || rm -f %D%/extracted.stamp
|
@test -f $@ || rm -f examples/extracted.stamp
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
|
||||||
|
|
||||||
## ---------- ##
|
include examples/calc++/local.mk
|
||||||
## Examples. ##
|
include examples/mfcalc/local.mk
|
||||||
## ---------- ##
|
include examples/rpcalc/local.mk
|
||||||
|
|
||||||
|
|
||||||
examplesdir = $(docdir)/examples
|
|
||||||
dist_examples_DATA = %D%/README %D%/variant.yy %D%/variant-11.yy
|
|
||||||
|
|
||||||
check_PROGRAMS += %D%/variant
|
|
||||||
nodist_%C%_variant_SOURCES = %D%/variant.yy
|
|
||||||
%C%_variant_CPPFLAGS = -I$(top_builddir)
|
|
||||||
dist_TESTS += %D%/variant.test
|
|
||||||
%D%/variant.cc: $(BISON_IN) $(dist_pkgdata_DATA)
|
|
||||||
|
|
||||||
if ENABLE_CXX11
|
|
||||||
check_PROGRAMS += %D%/variant-11
|
|
||||||
nodist_%C%_variant_11_SOURCES = %D%/variant-11.yy
|
|
||||||
%C%_variant_11_CXXFLAGS = $(CXX11_CXXFLAGS)
|
|
||||||
%C%_variant_11_CPPFLAGS = -I$(top_builddir)
|
|
||||||
dist_TESTS += %D%/variant-11.test
|
|
||||||
%D%/variant-11.cc: $(BISON_IN) $(dist_pkgdata_DATA)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CLEANFILES += %D%/variant.output %D%/variant-11.output
|
|
||||||
CLEANDIRS += %D%/*.dSYM
|
|
||||||
|
|
||||||
include %D%/calc++/local.mk
|
|
||||||
include %D%/mfcalc/local.mk
|
|
||||||
include %D%/rpcalc/local.mk
|
|
||||||
|
|||||||
+13
-18
@@ -1,5 +1,4 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
|
||||||
# Inc.
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,23 +18,19 @@
|
|||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
BUILT_SOURCES += $(mfcalc_sources)
|
BUILT_SOURCES += $(mfcalc_sources)
|
||||||
CLEANFILES += %D%/mfcalc.[ch] %D%/mfcalc.output
|
CLEANFILES += examples/mfcalc/mfcalc.[ch] examples/mfcalc/mfcalc.output
|
||||||
CLEANDIRS += %D%/*.dSYM
|
|
||||||
|
|
||||||
mfcalc_extracted = %D%/calc.h %D%/mfcalc.y
|
mfcalc_extracted = \
|
||||||
mfcalc_sources = $(mfcalc_extracted)
|
examples/mfcalc/calc.h \
|
||||||
|
examples/mfcalc/mfcalc.y
|
||||||
|
mfcalc_sources = \
|
||||||
|
$(mfcalc_extracted)
|
||||||
extracted += $(mfcalc_extracted)
|
extracted += $(mfcalc_extracted)
|
||||||
|
|
||||||
check_PROGRAMS += %D%/mfcalc
|
check_PROGRAMS += examples/mfcalc/mfcalc
|
||||||
nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
|
examples_mfcalc_mfcalc_LDADD = -lm
|
||||||
%C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
nodist_examples_mfcalc_mfcalc_SOURCES = \
|
||||||
%C%_mfcalc_LDADD = -lm
|
$(mfcalc_sources)
|
||||||
|
|
||||||
dist_TESTS += %D%/mfcalc.test
|
examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc
|
||||||
|
dist_TESTS += examples/mfcalc/mfcalc.test
|
||||||
## ------------ ##
|
|
||||||
## Installing. ##
|
|
||||||
## ------------ ##
|
|
||||||
|
|
||||||
mfcalcdir = $(docdir)/examples/mfcalc
|
|
||||||
mfcalc_DATA = $(mfcalc_extracted)
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/calc.h
|
/calc.h
|
||||||
/rpcalc
|
|
||||||
/rpcalc.c
|
/rpcalc.c
|
||||||
/rpcalc.h
|
/rpcalc.h
|
||||||
/rpcalc.output
|
/rpcalc.output
|
||||||
|
|||||||
+12
-18
@@ -1,5 +1,4 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
# Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
|
||||||
# Inc.
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,23 +18,18 @@
|
|||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
BUILT_SOURCES += $(rpcalc_sources)
|
BUILT_SOURCES += $(rpcalc_sources)
|
||||||
CLEANFILES += %D%/rpcalc.[ch] %D%/rpcalc.output
|
CLEANFILES += examples/rpcalc/rpcalc.[ch] examples/rpcalc/rpcalc.output
|
||||||
CLEANDIRS += %D%/*.dSYM
|
|
||||||
|
|
||||||
rpcalc_extracted = %D%/rpcalc.y
|
rpcalc_extracted = \
|
||||||
rpcalc_sources = $(rpcalc_extracted)
|
examples/rpcalc/rpcalc.y
|
||||||
|
rpcalc_sources = \
|
||||||
|
$(rpcalc_extracted)
|
||||||
extracted += $(rpcalc_extracted)
|
extracted += $(rpcalc_extracted)
|
||||||
|
|
||||||
check_PROGRAMS += %D%/rpcalc
|
check_PROGRAMS += examples/rpcalc/rpcalc
|
||||||
nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
|
examples_rpcalc_rpcalc_LDADD = -lm
|
||||||
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
nodist_examples_rpcalc_rpcalc_SOURCES = \
|
||||||
%C%_rpcalc_LDADD = -lm
|
$(rpcalc_sources)
|
||||||
|
|
||||||
dist_TESTS += %D%/rpcalc.test
|
examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc
|
||||||
|
dist_TESTS += examples/rpcalc/rpcalc.test
|
||||||
## ------------ ##
|
|
||||||
## Installing. ##
|
|
||||||
## ------------ ##
|
|
||||||
|
|
||||||
rpcalcdir = $(docdir)/examples/rpcalc
|
|
||||||
rpcalc_DATA = $(rpcalc_extracted)
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+6
-17
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,22 +23,11 @@ number=1
|
|||||||
# Exit status of this script.
|
# Exit status of this script.
|
||||||
exit=true
|
exit=true
|
||||||
|
|
||||||
# top_builddir.
|
# top_buiddir.
|
||||||
cwd=`pwd`
|
cwd=`pwd`
|
||||||
|
|
||||||
# The exercised program.
|
# The exercised program.
|
||||||
for p in $cwd/examples/$me/$me $cwd/examples/$me
|
prog=$cwd/examples/$me/$me
|
||||||
do
|
|
||||||
if test -x "$p"; then
|
|
||||||
prog=$p
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if test x"$prog" = x; then
|
|
||||||
echo "$me: ERROR: cannot find program to exercise"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
# -------
|
# -------
|
||||||
@@ -60,16 +49,16 @@ cd $$.dir
|
|||||||
run ()
|
run ()
|
||||||
{
|
{
|
||||||
# Expected exit status.
|
# Expected exit status.
|
||||||
local sta_exp="$1"
|
local sta_exp=$1
|
||||||
shift
|
shift
|
||||||
# Expected output.
|
# Expected output.
|
||||||
local out_exp="$1"
|
local out_exp=$1
|
||||||
shift
|
shift
|
||||||
# Effective exit status.
|
# Effective exit status.
|
||||||
local sta_eff=0
|
local sta_eff=0
|
||||||
$prog "$@" - <input >out_eff || sta_eff=$?
|
$prog "$@" - <input >out_eff || sta_eff=$?
|
||||||
# Effective output.
|
# Effective output.
|
||||||
local out_eff="`cat out_eff`"
|
local out_eff=`cat out_eff`
|
||||||
if test $sta_eff -eq $sta_exp; then
|
if test $sta_eff -eq $sta_exp; then
|
||||||
if test "$out_eff" = "$out_exp"; then
|
if test "$out_eff" = "$out_exp"; then
|
||||||
echo "$me: PASS: $number"
|
echo "$me: PASS: $number"
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# Copyright (C) 2018 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
: >input
|
|
||||||
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
%require "3.2"
|
|
||||||
%debug
|
|
||||||
%language "c++"
|
|
||||||
%define api.token.constructor
|
|
||||||
%define api.value.type variant
|
|
||||||
%define api.value.automove
|
|
||||||
%define api.location.file none
|
|
||||||
%define parse.assert
|
|
||||||
%locations
|
|
||||||
|
|
||||||
%code requires // *.hh
|
|
||||||
{
|
|
||||||
#include <memory> // std::unique_ptr
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using string_uptr = std::unique_ptr<std::string>;
|
|
||||||
using string_uptrs = std::vector<string_uptr>;
|
|
||||||
}
|
|
||||||
|
|
||||||
%code // *.cc
|
|
||||||
{
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
namespace yy
|
|
||||||
{
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
|
||||||
static parser::symbol_type yylex ();
|
|
||||||
|
|
||||||
// Print a vector of strings.
|
|
||||||
std::ostream&
|
|
||||||
operator<< (std::ostream& o, const string_uptrs& ss)
|
|
||||||
{
|
|
||||||
o << '{';
|
|
||||||
const char *sep = "";
|
|
||||||
for (const auto& s: ss)
|
|
||||||
{
|
|
||||||
o << sep << *s;
|
|
||||||
sep = ", ";
|
|
||||||
}
|
|
||||||
return o << '}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
string_uptr
|
|
||||||
make_string_uptr (Args&&... args)
|
|
||||||
{
|
|
||||||
// std::make_unique is C++14.
|
|
||||||
return string_uptr (new std::string{std::forward<Args> (args)...});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert to string.
|
|
||||||
template <typename T>
|
|
||||||
std::string
|
|
||||||
to_string (const T& t)
|
|
||||||
{
|
|
||||||
auto&& o = std::ostringstream{};
|
|
||||||
o << t;
|
|
||||||
return o.str ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%token <string_uptr> TEXT;
|
|
||||||
%token <int> NUMBER;
|
|
||||||
%printer { yyo << '(' << &$$ << ") " << $$; } <*>;
|
|
||||||
%printer { yyo << *$$; } <string_uptr>;
|
|
||||||
%token END_OF_FILE 0;
|
|
||||||
|
|
||||||
%type <string_uptr> item;
|
|
||||||
%type <string_uptrs> list;
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
result:
|
|
||||||
list { std::cout << $1 << '\n'; }
|
|
||||||
;
|
|
||||||
|
|
||||||
list:
|
|
||||||
%empty { /* Generates an empty string list */ }
|
|
||||||
| list item { $$ = $1; $$.emplace_back ($2); }
|
|
||||||
;
|
|
||||||
|
|
||||||
item:
|
|
||||||
TEXT
|
|
||||||
| NUMBER { $$ = make_string_uptr (to_string ($1)); }
|
|
||||||
;
|
|
||||||
%%
|
|
||||||
|
|
||||||
namespace yy
|
|
||||||
{
|
|
||||||
// The yylex function providing subsequent tokens:
|
|
||||||
// TEXT "I have three numbers for you."
|
|
||||||
// NUMBER 1
|
|
||||||
// NUMBER 2
|
|
||||||
// NUMBER 3
|
|
||||||
// TEXT "And that's all!"
|
|
||||||
// END_OF_FILE
|
|
||||||
|
|
||||||
static
|
|
||||||
parser::symbol_type
|
|
||||||
yylex ()
|
|
||||||
{
|
|
||||||
static auto count = 0u;
|
|
||||||
auto stage = count;
|
|
||||||
++count;
|
|
||||||
auto loc = parser::location_type{nullptr, stage + 1, stage + 1};
|
|
||||||
switch (stage)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return parser::make_TEXT (make_string_uptr ("I have three numbers for you."), std::move (loc));
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
return parser::make_NUMBER (stage, std::move (loc));
|
|
||||||
case 4:
|
|
||||||
return parser::make_TEXT (make_string_uptr ("And that's all!"), std::move (loc));
|
|
||||||
default:
|
|
||||||
return parser::make_END_OF_FILE (std::move (loc));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mandatory error function
|
|
||||||
void
|
|
||||||
parser::error (const parser::location_type& loc, const std::string& msg)
|
|
||||||
{
|
|
||||||
std::cerr << loc << ": " << msg << '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
auto&& p = yy::parser{};
|
|
||||||
p.set_debug_level (!!getenv ("YYDEBUG"));
|
|
||||||
return p.parse ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Local Variables:
|
|
||||||
// mode: C++
|
|
||||||
// End:
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# Copyright (C) 2018 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
: >input
|
|
||||||
run 0 "{I have three numbers for you., 1, 2, 3, And that's all!}"
|
|
||||||
+27
-29
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,20 +15,19 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
%require "3.2"
|
|
||||||
%debug
|
%debug
|
||||||
%language "c++"
|
%skeleton "lalr1.cc"
|
||||||
|
%defines
|
||||||
%define api.token.constructor
|
%define api.token.constructor
|
||||||
%define api.value.type variant
|
%define api.value.type variant
|
||||||
%define api.location.file none
|
|
||||||
%define parse.assert
|
%define parse.assert
|
||||||
%locations
|
%locations
|
||||||
|
|
||||||
%code requires // *.hh
|
%code requires // *.hh
|
||||||
{
|
{
|
||||||
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
typedef std::list<std::string> strings_type;
|
||||||
typedef std::vector<std::string> strings_type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
%code // *.cc
|
%code // *.cc
|
||||||
@@ -38,31 +37,30 @@ typedef std::vector<std::string> strings_type;
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
// Prototype of the yylex function providing subsequent tokens.
|
||||||
namespace yy
|
namespace yy
|
||||||
{
|
{
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
|
||||||
static parser::symbol_type yylex ();
|
static parser::symbol_type yylex ();
|
||||||
|
}
|
||||||
|
|
||||||
// Print a vector of strings.
|
// Printing a list of strings.
|
||||||
|
// Koening look up will look into std, since that's an std::list.
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream& o, const strings_type& ss)
|
operator<< (std::ostream& o, const strings_type& s)
|
||||||
{
|
{
|
||||||
o << '{';
|
std::copy (s.begin (), s.end (),
|
||||||
const char *sep = "";
|
std::ostream_iterator<strings_type::value_type> (o, "\n"));
|
||||||
for (strings_type::const_iterator i = ss.begin (), end = ss.end ();
|
return o;
|
||||||
i != end; ++i)
|
|
||||||
{
|
|
||||||
o << sep << *i;
|
|
||||||
sep = ", ";
|
|
||||||
}
|
|
||||||
return o << '}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to string.
|
// Conversion to string.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
inline
|
||||||
std::string
|
std::string
|
||||||
to_string (const T& t)
|
string_cast (const T& t)
|
||||||
{
|
{
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << t;
|
o << t;
|
||||||
@@ -72,26 +70,26 @@ typedef std::vector<std::string> strings_type;
|
|||||||
|
|
||||||
%token <::std::string> TEXT;
|
%token <::std::string> TEXT;
|
||||||
%token <int> NUMBER;
|
%token <int> NUMBER;
|
||||||
%printer { yyo << '(' << &$$ << ") " << $$; } <*>;
|
%printer { yyoutput << $$; } <*>;
|
||||||
%token END_OF_FILE 0;
|
%token END_OF_FILE 0;
|
||||||
|
|
||||||
%type <::std::string> item;
|
%type <::std::string> item;
|
||||||
%type <::std::vector<std::string>> list;
|
%type <::std::list<std::string>> list;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
result:
|
result:
|
||||||
list { std::cout << $1 << '\n'; }
|
list { std::cout << $1 << std::endl; }
|
||||||
;
|
;
|
||||||
|
|
||||||
list:
|
list:
|
||||||
%empty { /* Generates an empty string list */ }
|
/* nothing */ { /* Generates an empty string list */ }
|
||||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
item:
|
item:
|
||||||
TEXT
|
TEXT { std::swap ($$, $1); }
|
||||||
| NUMBER { $$ = to_string ($1); }
|
| NUMBER { $$ = string_cast ($1); }
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -111,7 +109,7 @@ namespace yy
|
|||||||
{
|
{
|
||||||
static int stage = -1;
|
static int stage = -1;
|
||||||
++stage;
|
++stage;
|
||||||
parser::location_type loc (YY_NULLPTR, stage + 1, stage + 1);
|
parser::location_type loc(0, stage + 1, stage + 1);
|
||||||
switch (stage)
|
switch (stage)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -131,7 +129,7 @@ namespace yy
|
|||||||
void
|
void
|
||||||
parser::error (const parser::location_type& loc, const std::string& msg)
|
parser::error (const parser::location_type& loc, const std::string& msg)
|
||||||
{
|
{
|
||||||
std::cerr << loc << ": " << msg << '\n';
|
std::cerr << loc << ": " << msg << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule gnulib updated: a79f2a2871...c67e3c0414
+27
-44
@@ -4,7 +4,8 @@
|
|||||||
/*~
|
/*~
|
||||||
/.deps
|
/.deps
|
||||||
/.dirstamp
|
/.dirstamp
|
||||||
/_Noreturn.h
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
/alignof.h
|
/alignof.h
|
||||||
/alloca.h
|
/alloca.h
|
||||||
/alloca.in.h
|
/alloca.in.h
|
||||||
@@ -14,9 +15,7 @@
|
|||||||
/asnprintf.c
|
/asnprintf.c
|
||||||
/basename-lgpl.c
|
/basename-lgpl.c
|
||||||
/basename.c
|
/basename.c
|
||||||
/binary-io.c
|
|
||||||
/binary-io.h
|
/binary-io.h
|
||||||
/bitrotate.c
|
|
||||||
/bitrotate.h
|
/bitrotate.h
|
||||||
/c++defs.h
|
/c++defs.h
|
||||||
/c-ctype.c
|
/c-ctype.c
|
||||||
@@ -29,6 +28,8 @@
|
|||||||
/charset.alias
|
/charset.alias
|
||||||
/cloexec.c
|
/cloexec.c
|
||||||
/cloexec.h
|
/cloexec.h
|
||||||
|
/close-hook.c
|
||||||
|
/close-hook.h
|
||||||
/close-stream.c
|
/close-stream.c
|
||||||
/close-stream.h
|
/close-stream.h
|
||||||
/close.c
|
/close.c
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
/closeout.h
|
/closeout.h
|
||||||
/concat-filename.c
|
/concat-filename.c
|
||||||
/concat-filename.h
|
/concat-filename.h
|
||||||
|
/config.charset
|
||||||
/config.h
|
/config.h
|
||||||
/config.in.h
|
/config.in.h
|
||||||
/configmake.h
|
/configmake.h
|
||||||
@@ -54,6 +56,7 @@
|
|||||||
/exitfail.h
|
/exitfail.h
|
||||||
/fatal-signal.c
|
/fatal-signal.c
|
||||||
/fatal-signal.h
|
/fatal-signal.h
|
||||||
|
/fclose.c
|
||||||
/fcntl.c
|
/fcntl.c
|
||||||
/fcntl.h
|
/fcntl.h
|
||||||
/fcntl.in.h
|
/fcntl.in.h
|
||||||
@@ -78,27 +81,19 @@
|
|||||||
/fseterr.h
|
/fseterr.h
|
||||||
/fstat.c
|
/fstat.c
|
||||||
/getdtablesize.c
|
/getdtablesize.c
|
||||||
/getopt-cdefs.in.h
|
|
||||||
/getopt-core.h
|
|
||||||
/getopt-ext.h
|
|
||||||
/getopt-pfx-core.h
|
|
||||||
/getopt-pfx-ext.h
|
|
||||||
/getopt.c
|
/getopt.c
|
||||||
/getopt.h
|
/getopt.h
|
||||||
/getopt.in.h
|
/getopt.in.h
|
||||||
/getopt1.c
|
/getopt1.c
|
||||||
/getopt_int.h
|
/getopt_int.h
|
||||||
/getprogname.c
|
|
||||||
/getprogname.h
|
|
||||||
/gettext.h
|
/gettext.h
|
||||||
/gnulib.mk
|
/gnulib.mk
|
||||||
/hard-locale.c
|
|
||||||
/hard-locale.h
|
|
||||||
/hash.c
|
/hash.c
|
||||||
/hash.h
|
/hash.h
|
||||||
/intprops.h
|
/intprops.h
|
||||||
/inttypes.h
|
/inttypes.h
|
||||||
/inttypes.in.h
|
/inttypes.in.h
|
||||||
|
/ioctl.c
|
||||||
/isnan.c
|
/isnan.c
|
||||||
/isnand-nolibm.h
|
/isnand-nolibm.h
|
||||||
/isnand.c
|
/isnand.c
|
||||||
@@ -108,15 +103,9 @@
|
|||||||
/isnanl.c
|
/isnanl.c
|
||||||
/itold.c
|
/itold.c
|
||||||
/ldexpl.c
|
/ldexpl.c
|
||||||
/limits.h
|
|
||||||
/limits.in.h
|
|
||||||
/localcharset.c
|
/localcharset.c
|
||||||
/localcharset.h
|
/localcharset.h
|
||||||
/lstat.c
|
|
||||||
/malloc.c
|
/malloc.c
|
||||||
/malloca.c
|
|
||||||
/malloca.h
|
|
||||||
/math.c
|
|
||||||
/math.h
|
/math.h
|
||||||
/math.in.h
|
/math.in.h
|
||||||
/mbrtowc.c
|
/mbrtowc.c
|
||||||
@@ -125,11 +114,12 @@
|
|||||||
/mbswidth.h
|
/mbswidth.h
|
||||||
/memchr.c
|
/memchr.c
|
||||||
/memchr.valgrind
|
/memchr.valgrind
|
||||||
/minmax.h
|
|
||||||
/msvc-inval.c
|
/msvc-inval.c
|
||||||
/msvc-inval.h
|
/msvc-inval.h
|
||||||
/msvc-nothrow.c
|
/msvc-nothrow.c
|
||||||
/msvc-nothrow.h
|
/msvc-nothrow.h
|
||||||
|
/nonblocking.c
|
||||||
|
/nonblocking.h
|
||||||
/obstack.c
|
/obstack.c
|
||||||
/obstack.h
|
/obstack.h
|
||||||
/obstack_printf.c
|
/obstack_printf.c
|
||||||
@@ -150,6 +140,7 @@
|
|||||||
/printf.c
|
/printf.c
|
||||||
/progname.c
|
/progname.c
|
||||||
/progname.h
|
/progname.h
|
||||||
|
/quote.c
|
||||||
/quote.h
|
/quote.h
|
||||||
/quotearg.c
|
/quotearg.c
|
||||||
/quotearg.h
|
/quotearg.h
|
||||||
@@ -158,10 +149,11 @@
|
|||||||
/rawmemchr.valgrind
|
/rawmemchr.valgrind
|
||||||
/realloc.c
|
/realloc.c
|
||||||
/ref-add.sed
|
/ref-add.sed
|
||||||
|
/ref-add.sin
|
||||||
/ref-del.sed
|
/ref-del.sed
|
||||||
|
/ref-del.sin
|
||||||
/sched.h
|
/sched.h
|
||||||
/sched.in.h
|
/sched.in.h
|
||||||
/sig-handler.c
|
|
||||||
/sig-handler.h
|
/sig-handler.h
|
||||||
/sigaction.c
|
/sigaction.c
|
||||||
/signal.h
|
/signal.h
|
||||||
@@ -190,8 +182,6 @@
|
|||||||
/spawnp.c
|
/spawnp.c
|
||||||
/sprintf.c
|
/sprintf.c
|
||||||
/stamp-h1
|
/stamp-h1
|
||||||
/stat-w32.c
|
|
||||||
/stat-w32.h
|
|
||||||
/stat.c
|
/stat.c
|
||||||
/stdbool.h
|
/stdbool.h
|
||||||
/stdbool.in.h
|
/stdbool.in.h
|
||||||
@@ -202,6 +192,7 @@
|
|||||||
/stdio--.h
|
/stdio--.h
|
||||||
/stdio-impl.h
|
/stdio-impl.h
|
||||||
/stdio-safer.h
|
/stdio-safer.h
|
||||||
|
/stdio-write.c
|
||||||
/stdio.h
|
/stdio.h
|
||||||
/stdio.in.h
|
/stdio.in.h
|
||||||
/stdlib.h
|
/stdlib.h
|
||||||
@@ -220,19 +211,24 @@
|
|||||||
/stripslash.c
|
/stripslash.c
|
||||||
/strndup.c
|
/strndup.c
|
||||||
/strnlen.c
|
/strnlen.c
|
||||||
|
/strtol.c
|
||||||
|
/strtoul.c
|
||||||
/strverscmp.c
|
/strverscmp.c
|
||||||
/sys
|
/sys
|
||||||
|
/sys_ioctl.h
|
||||||
/sys_ioctl.in.h
|
/sys_ioctl.in.h
|
||||||
|
/sys_socket.h
|
||||||
/sys_socket.in.h
|
/sys_socket.in.h
|
||||||
|
/sys_stat.h
|
||||||
/sys_stat.in.h
|
/sys_stat.in.h
|
||||||
/sys_types.in.h
|
/sys_types.in.h
|
||||||
|
/sys_wait.h
|
||||||
/sys_wait.in.h
|
/sys_wait.in.h
|
||||||
/sysexits.in.h
|
/sysexits.in.h
|
||||||
/time.h
|
/time.h
|
||||||
/time.in.h
|
/time.in.h
|
||||||
/unistd--.h
|
/unistd--.h
|
||||||
/unistd-safer.h
|
/unistd-safer.h
|
||||||
/unistd.c
|
|
||||||
/unistd.h
|
/unistd.h
|
||||||
/unistd.in.h
|
/unistd.in.h
|
||||||
/unitypes.h
|
/unitypes.h
|
||||||
@@ -240,7 +236,6 @@
|
|||||||
/uniwidth
|
/uniwidth
|
||||||
/uniwidth.h
|
/uniwidth.h
|
||||||
/uniwidth.in.h
|
/uniwidth.in.h
|
||||||
/unlink.c
|
|
||||||
/unlocked-io.h
|
/unlocked-io.h
|
||||||
/unsetenv.c
|
/unsetenv.c
|
||||||
/vasnprintf.c
|
/vasnprintf.c
|
||||||
@@ -249,6 +244,7 @@
|
|||||||
/vfprintf.c
|
/vfprintf.c
|
||||||
/vsnprintf.c
|
/vsnprintf.c
|
||||||
/vsprintf.c
|
/vsprintf.c
|
||||||
|
/w32sock.h
|
||||||
/w32spawn.h
|
/w32spawn.h
|
||||||
/wait-process.c
|
/wait-process.c
|
||||||
/wait-process.h
|
/wait-process.h
|
||||||
@@ -256,7 +252,6 @@
|
|||||||
/warn-on-use.h
|
/warn-on-use.h
|
||||||
/wchar.h
|
/wchar.h
|
||||||
/wchar.in.h
|
/wchar.in.h
|
||||||
/wctype-h.c
|
|
||||||
/wctype.h
|
/wctype.h
|
||||||
/wctype.in.h
|
/wctype.in.h
|
||||||
/wcwidth.c
|
/wcwidth.c
|
||||||
@@ -267,25 +262,13 @@
|
|||||||
/xmalloc.c
|
/xmalloc.c
|
||||||
/xmemdup0.c
|
/xmemdup0.c
|
||||||
/xmemdup0.h
|
/xmemdup0.h
|
||||||
/xsize.c
|
|
||||||
/xsize.h
|
/xsize.h
|
||||||
/xstrndup.c
|
/xstrndup.c
|
||||||
/xstrndup.h
|
/xstrndup.h
|
||||||
/stat-time.c
|
/binary-io.c
|
||||||
/stat-time.h
|
/xsize.c
|
||||||
/timevar.c
|
/bitrotate.c
|
||||||
/timevar.h
|
/math.c
|
||||||
/sys_time.in.h
|
/sig-handler.c
|
||||||
/sys_times.in.h
|
/unistd.c
|
||||||
/gethrxtime.c
|
/wctype-h.c
|
||||||
/gethrxtime.h
|
|
||||||
/getrusage.c
|
|
||||||
/gettime.c
|
|
||||||
/gettimeofday.c
|
|
||||||
/localtime-buffer.c
|
|
||||||
/localtime-buffer.h
|
|
||||||
/sys_resource.in.h
|
|
||||||
/timespec.c
|
|
||||||
/timespec.h
|
|
||||||
/xtime.c
|
|
||||||
/xtime.h
|
|
||||||
|
|||||||
+103
-60
@@ -1,7 +1,7 @@
|
|||||||
/* Array bitsets.
|
/* Array bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2003, 2006, 2009-2015, 2018 Free Software
|
Copyright (C) 2002-2003, 2006, 2009-2013 Free Software Foundation,
|
||||||
Foundation, Inc.
|
Inc.
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -36,10 +36,10 @@ static bitset_bindex
|
|||||||
abitset_resize (bitset src, bitset_bindex size)
|
abitset_resize (bitset src, bitset_bindex size)
|
||||||
{
|
{
|
||||||
/* These bitsets have a fixed size. */
|
/* These bitsets have a fixed size. */
|
||||||
if (BITSET_SIZE_ (src) != size)
|
if (BITSET_SIZE_ (src) != size)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find list of up to NUM bits set in BSET starting from and including
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
@@ -49,14 +49,19 @@ static bitset_bindex
|
|||||||
abitset_small_list (bitset src, bitset_bindex *list,
|
abitset_small_list (bitset src, bitset_bindex *list,
|
||||||
bitset_bindex num, bitset_bindex *next)
|
bitset_bindex num, bitset_bindex *next)
|
||||||
{
|
{
|
||||||
bitset_word word = ABITSET_WORDS (src)[0];
|
bitset_bindex bitno;
|
||||||
|
bitset_bindex count;
|
||||||
|
bitset_windex size;
|
||||||
|
bitset_word word;
|
||||||
|
|
||||||
|
word = ABITSET_WORDS (src)[0];
|
||||||
|
|
||||||
/* Short circuit common case. */
|
/* Short circuit common case. */
|
||||||
if (!word)
|
if (!word)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bitset_windex size = BITSET_SIZE_ (src);
|
size = BITSET_SIZE_ (src);
|
||||||
bitset_bindex bitno = *next;
|
bitno = *next;
|
||||||
if (bitno >= size)
|
if (bitno >= size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -65,7 +70,6 @@ abitset_small_list (bitset src, bitset_bindex *list,
|
|||||||
/* If num is 1, we could speed things up with a binary search
|
/* If num is 1, we could speed things up with a binary search
|
||||||
of the word of interest. */
|
of the word of interest. */
|
||||||
|
|
||||||
bitset_bindex count;
|
|
||||||
if (num >= BITSET_WORD_BITS)
|
if (num >= BITSET_WORD_BITS)
|
||||||
{
|
{
|
||||||
for (count = 0; word; bitno++)
|
for (count = 0; word; bitno++)
|
||||||
@@ -138,10 +142,16 @@ static bitset_bindex
|
|||||||
abitset_list_reverse (bitset src, bitset_bindex *list,
|
abitset_list_reverse (bitset src, bitset_bindex *list,
|
||||||
bitset_bindex num, bitset_bindex *next)
|
bitset_bindex num, bitset_bindex *next)
|
||||||
{
|
{
|
||||||
|
bitset_bindex bitno;
|
||||||
|
bitset_bindex rbitno;
|
||||||
|
bitset_bindex count;
|
||||||
|
bitset_windex windex;
|
||||||
|
unsigned int bitcnt;
|
||||||
|
bitset_bindex bitoff;
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_bindex n_bits = BITSET_SIZE_ (src);
|
bitset_bindex n_bits = BITSET_SIZE_ (src);
|
||||||
|
|
||||||
bitset_bindex rbitno = *next;
|
rbitno = *next;
|
||||||
|
|
||||||
/* If num is 1, we could speed things up with a binary search
|
/* If num is 1, we could speed things up with a binary search
|
||||||
of the word of interest. */
|
of the word of interest. */
|
||||||
@@ -149,17 +159,19 @@ abitset_list_reverse (bitset src, bitset_bindex *list,
|
|||||||
if (rbitno >= n_bits)
|
if (rbitno >= n_bits)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bitset_bindex count = 0;
|
count = 0;
|
||||||
|
|
||||||
bitset_bindex bitno = n_bits - (rbitno + 1);
|
bitno = n_bits - (rbitno + 1);
|
||||||
|
|
||||||
bitset_windex windex = bitno / BITSET_WORD_BITS;
|
windex = bitno / BITSET_WORD_BITS;
|
||||||
unsigned bitcnt = bitno % BITSET_WORD_BITS;
|
bitcnt = bitno % BITSET_WORD_BITS;
|
||||||
bitset_bindex bitoff = windex * BITSET_WORD_BITS;
|
bitoff = windex * BITSET_WORD_BITS;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
bitset_word word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
bitset_word word;
|
||||||
|
|
||||||
|
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
||||||
for (; word; bitcnt--)
|
for (; word; bitcnt--)
|
||||||
{
|
{
|
||||||
if (word & BITSET_MSB)
|
if (word & BITSET_MSB)
|
||||||
@@ -184,21 +196,23 @@ abitset_list_reverse (bitset src, bitset_bindex *list,
|
|||||||
|
|
||||||
|
|
||||||
/* Find list of up to NUM bits set in BSET starting from and including
|
/* Find list of up to NUM bits set in BSET starting from and including
|
||||||
*NEXT and store in array LIST. Return with actual number of bits
|
*NEXT and store in array LIST. Return with actual number of bits
|
||||||
found and with *NEXT indicating where search stopped. */
|
found and with *NEXT indicating where search stopped. */
|
||||||
static bitset_bindex
|
static bitset_bindex
|
||||||
abitset_list (bitset src, bitset_bindex *list,
|
abitset_list (bitset src, bitset_bindex *list,
|
||||||
bitset_bindex num, bitset_bindex *next)
|
bitset_bindex num, bitset_bindex *next)
|
||||||
{
|
{
|
||||||
|
bitset_bindex bitno;
|
||||||
|
bitset_bindex count;
|
||||||
bitset_windex windex;
|
bitset_windex windex;
|
||||||
bitset_bindex bitoff;
|
bitset_bindex bitoff;
|
||||||
bitset_windex size = src->b.csize;
|
bitset_windex size = src->b.csize;
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_word word;
|
bitset_word word;
|
||||||
|
|
||||||
bitset_bindex bitno = *next;
|
bitno = *next;
|
||||||
|
|
||||||
bitset_bindex count = 0;
|
count = 0;
|
||||||
if (!bitno)
|
if (!bitno)
|
||||||
{
|
{
|
||||||
/* Many bitsets are zero, so make this common case fast. */
|
/* Many bitsets are zero, so make this common case fast. */
|
||||||
@@ -288,7 +302,9 @@ abitset_list (bitset src, bitset_bindex *list,
|
|||||||
static inline void
|
static inline void
|
||||||
abitset_unused_clear (bitset dst)
|
abitset_unused_clear (bitset dst)
|
||||||
{
|
{
|
||||||
unsigned last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS;
|
unsigned int last_bit;
|
||||||
|
|
||||||
|
last_bit = BITSET_SIZE_ (dst) % BITSET_WORD_BITS;
|
||||||
if (last_bit)
|
if (last_bit)
|
||||||
ABITSET_WORDS (dst)[dst->b.csize - 1] &=
|
ABITSET_WORDS (dst)[dst->b.csize - 1] &=
|
||||||
((bitset_word) 1 << last_bit) - 1;
|
((bitset_word) 1 << last_bit) - 1;
|
||||||
@@ -299,7 +315,9 @@ static void
|
|||||||
abitset_ones (bitset dst)
|
abitset_ones (bitset dst)
|
||||||
{
|
{
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
size_t bytes = sizeof (bitset_word) * dst->b.csize;
|
size_t bytes;
|
||||||
|
|
||||||
|
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||||
|
|
||||||
memset (dstp, -1, bytes);
|
memset (dstp, -1, bytes);
|
||||||
abitset_unused_clear (dst);
|
abitset_unused_clear (dst);
|
||||||
@@ -310,7 +328,9 @@ static void
|
|||||||
abitset_zero (bitset dst)
|
abitset_zero (bitset dst)
|
||||||
{
|
{
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
size_t bytes = sizeof (bitset_word) * dst->b.csize;
|
size_t bytes;
|
||||||
|
|
||||||
|
bytes = sizeof (bitset_word) * dst->b.csize;
|
||||||
|
|
||||||
memset (dstp, 0, bytes);
|
memset (dstp, 0, bytes);
|
||||||
}
|
}
|
||||||
@@ -319,9 +339,10 @@ abitset_zero (bitset dst)
|
|||||||
static bool
|
static bool
|
||||||
abitset_empty_p (bitset dst)
|
abitset_empty_p (bitset dst)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < dst->b.csize; i++)
|
for (i = 0; i < dst->b.csize; i++)
|
||||||
if (dstp[i])
|
if (dstp[i])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -345,12 +366,13 @@ abitset_copy1 (bitset dst, bitset src)
|
|||||||
static void
|
static void
|
||||||
abitset_not (bitset dst, bitset src)
|
abitset_not (bitset dst, bitset src)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
*dstp++ = ~(*srcp++);
|
*dstp++ = ~(*srcp++);
|
||||||
abitset_unused_clear (dst);
|
abitset_unused_clear (dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,13 +380,14 @@ abitset_not (bitset dst, bitset src)
|
|||||||
static bool
|
static bool
|
||||||
abitset_equal_p (bitset dst, bitset src)
|
abitset_equal_p (bitset dst, bitset src)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
if (*srcp++ != *dstp++)
|
if (*srcp++ != *dstp++)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,13 +395,14 @@ abitset_equal_p (bitset dst, bitset src)
|
|||||||
static bool
|
static bool
|
||||||
abitset_subset_p (bitset dst, bitset src)
|
abitset_subset_p (bitset dst, bitset src)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++, dstp++, srcp++)
|
for (i = 0; i < size; i++, dstp++, srcp++)
|
||||||
if (*dstp != (*srcp | *dstp))
|
if (*dstp != (*srcp | *dstp))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,13 +410,14 @@ abitset_subset_p (bitset dst, bitset src)
|
|||||||
static bool
|
static bool
|
||||||
abitset_disjoint_p (bitset dst, bitset src)
|
abitset_disjoint_p (bitset dst, bitset src)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *srcp = ABITSET_WORDS (src);
|
bitset_word *srcp = ABITSET_WORDS (src);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
if (*srcp++ & *dstp++)
|
if (*srcp++ & *dstp++)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -401,26 +426,28 @@ abitset_disjoint_p (bitset dst, bitset src)
|
|||||||
static void
|
static void
|
||||||
abitset_and (bitset dst, bitset src1, bitset src2)
|
abitset_and (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
*dstp++ = *src1p++ & *src2p++;
|
*dstp++ = *src1p++ & *src2p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
abitset_and_cmp (bitset dst, bitset src1, bitset src2)
|
abitset_and_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
bitset_word tmp = *src1p++ & *src2p++;
|
bitset_word tmp = *src1p++ & *src2p++;
|
||||||
|
|
||||||
@@ -437,26 +464,28 @@ abitset_and_cmp (bitset dst, bitset src1, bitset src2)
|
|||||||
static void
|
static void
|
||||||
abitset_andn (bitset dst, bitset src1, bitset src2)
|
abitset_andn (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
*dstp++ = *src1p++ & ~(*src2p++);
|
*dstp++ = *src1p++ & ~(*src2p++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
|
abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
bitset_word tmp = *src1p++ & ~(*src2p++);
|
bitset_word tmp = *src1p++ & ~(*src2p++);
|
||||||
|
|
||||||
@@ -473,26 +502,28 @@ abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
|
|||||||
static void
|
static void
|
||||||
abitset_or (bitset dst, bitset src1, bitset src2)
|
abitset_or (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
*dstp++ = *src1p++ | *src2p++;
|
*dstp++ = *src1p++ | *src2p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
abitset_or_cmp (bitset dst, bitset src1, bitset src2)
|
abitset_or_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
bitset_word tmp = *src1p++ | *src2p++;
|
bitset_word tmp = *src1p++ | *src2p++;
|
||||||
|
|
||||||
@@ -509,12 +540,13 @@ abitset_or_cmp (bitset dst, bitset src1, bitset src2)
|
|||||||
static void
|
static void
|
||||||
abitset_xor (bitset dst, bitset src1, bitset src2)
|
abitset_xor (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
*dstp++ = *src1p++ ^ *src2p++;
|
*dstp++ = *src1p++ ^ *src2p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,13 +554,14 @@ abitset_xor (bitset dst, bitset src1, bitset src2)
|
|||||||
static bool
|
static bool
|
||||||
abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
|
abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
bitset_word tmp = *src1p++ ^ *src2p++;
|
bitset_word tmp = *src1p++ ^ *src2p++;
|
||||||
|
|
||||||
@@ -545,20 +578,22 @@ abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
|
|||||||
static void
|
static void
|
||||||
abitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
abitset_and_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *src3p = ABITSET_WORDS (src3);
|
bitset_word *src3p = ABITSET_WORDS (src3);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
*dstp++ = (*src1p++ & *src2p++) | *src3p++;
|
*dstp++ = (*src1p++ & *src2p++) | *src3p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
@@ -566,7 +601,7 @@ abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
|||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
|
bitset_word tmp = (*src1p++ & *src2p++) | *src3p++;
|
||||||
|
|
||||||
@@ -583,20 +618,22 @@ abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
|||||||
static void
|
static void
|
||||||
abitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
abitset_andn_or (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *src3p = ABITSET_WORDS (src3);
|
bitset_word *src3p = ABITSET_WORDS (src3);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
*dstp++ = (*src1p++ & ~(*src2p++)) | *src3p++;
|
*dstp++ = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
@@ -604,7 +641,7 @@ abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
|||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
|
bitset_word tmp = (*src1p++ & ~(*src2p++)) | *src3p++;
|
||||||
|
|
||||||
@@ -621,20 +658,22 @@ abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
|||||||
static void
|
static void
|
||||||
abitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
|
abitset_or_and (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
bitset_word *src3p = ABITSET_WORDS (src3);
|
bitset_word *src3p = ABITSET_WORDS (src3);
|
||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
|
*dstp++ = (*src1p++ | *src2p++) & *src3p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
||||||
{
|
{
|
||||||
|
bitset_windex i;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
bitset_word *src1p = ABITSET_WORDS (src1);
|
bitset_word *src1p = ABITSET_WORDS (src1);
|
||||||
bitset_word *src2p = ABITSET_WORDS (src2);
|
bitset_word *src2p = ABITSET_WORDS (src2);
|
||||||
@@ -642,7 +681,7 @@ abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
|
|||||||
bitset_word *dstp = ABITSET_WORDS (dst);
|
bitset_word *dstp = ABITSET_WORDS (dst);
|
||||||
bitset_windex size = dst->b.csize;
|
bitset_windex size = dst->b.csize;
|
||||||
|
|
||||||
for (bitset_windex i = 0; i < size; i++, dstp++)
|
for (i = 0; i < size; i++, dstp++)
|
||||||
{
|
{
|
||||||
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
|
bitset_word tmp = (*src1p++ | *src2p++) & *src3p++;
|
||||||
|
|
||||||
@@ -660,9 +699,9 @@ static void
|
|||||||
abitset_copy (bitset dst, bitset src)
|
abitset_copy (bitset dst, bitset src)
|
||||||
{
|
{
|
||||||
if (BITSET_COMPATIBLE_ (dst, src))
|
if (BITSET_COMPATIBLE_ (dst, src))
|
||||||
abitset_copy1 (dst, src);
|
abitset_copy1 (dst, src);
|
||||||
else
|
else
|
||||||
bitset_copy_ (dst, src);
|
bitset_copy_ (dst, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -745,12 +784,14 @@ struct bitset_vtable abitset_vtable = {
|
|||||||
size_t
|
size_t
|
||||||
abitset_bytes (bitset_bindex n_bits)
|
abitset_bytes (bitset_bindex n_bits)
|
||||||
{
|
{
|
||||||
|
bitset_windex size;
|
||||||
|
size_t bytes;
|
||||||
size_t header_size = offsetof (union bitset_union, a.words);
|
size_t header_size = offsetof (union bitset_union, a.words);
|
||||||
struct bitset_align_struct { char a; union bitset_union b; };
|
struct bitset_align_struct { char a; union bitset_union b; };
|
||||||
size_t bitset_alignment = offsetof (struct bitset_align_struct, b);
|
size_t bitset_alignment = offsetof (struct bitset_align_struct, b);
|
||||||
|
|
||||||
bitset_windex size = ABITSET_N_WORDS (n_bits);
|
size = ABITSET_N_WORDS (n_bits);
|
||||||
size_t bytes = header_size + size * sizeof (bitset_word);
|
bytes = header_size + size * sizeof (bitset_word);
|
||||||
|
|
||||||
/* Align the size properly for a vector of abitset objects. */
|
/* Align the size properly for a vector of abitset objects. */
|
||||||
if (header_size % bitset_alignment != 0
|
if (header_size % bitset_alignment != 0
|
||||||
@@ -767,7 +808,9 @@ abitset_bytes (bitset_bindex n_bits)
|
|||||||
bitset
|
bitset
|
||||||
abitset_init (bitset bset, bitset_bindex n_bits)
|
abitset_init (bitset bset, bitset_bindex n_bits)
|
||||||
{
|
{
|
||||||
bitset_windex size = ABITSET_N_WORDS (n_bits);
|
bitset_windex size;
|
||||||
|
|
||||||
|
size = ABITSET_N_WORDS (n_bits);
|
||||||
BITSET_NBITS_ (bset) = n_bits;
|
BITSET_NBITS_ (bset) = n_bits;
|
||||||
|
|
||||||
/* Use optimized routines if bitset fits within a single word.
|
/* Use optimized routines if bitset fits within a single word.
|
||||||
|
|||||||
+3
-4
@@ -1,7 +1,6 @@
|
|||||||
/* Functions to support abitsets.
|
/* Functions to support abitsets.
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation,
|
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
|
||||||
Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -23,8 +22,8 @@
|
|||||||
|
|
||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
|
|
||||||
size_t abitset_bytes (bitset_bindex);
|
extern size_t abitset_bytes (bitset_bindex);
|
||||||
|
|
||||||
bitset abitset_init (bitset, bitset_bindex);
|
extern bitset abitset_init (bitset, bitset_bindex);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+14
-14
@@ -1,7 +1,7 @@
|
|||||||
/* Base bitset stuff.
|
/* Base bitset stuff.
|
||||||
|
|
||||||
Copyright (C) 2002-2004, 2006, 2009-2015, 2018 Free Software
|
Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation,
|
||||||
Foundation, Inc.
|
Inc.
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ extern const char * const bitset_type_names[];
|
|||||||
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC};
|
||||||
|
|
||||||
/* Data type used to store a word of bits. */
|
/* Data type used to store a word of bits. */
|
||||||
typedef unsigned long bitset_word;
|
typedef unsigned long int bitset_word;
|
||||||
#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word)))
|
#define BITSET_WORD_BITS ((unsigned int) (CHAR_BIT * sizeof (bitset_word)))
|
||||||
|
|
||||||
/* Bit index. In theory we might need a type wider than size_t, but
|
/* Bit index. In theory we might need a type wider than size_t, but
|
||||||
in practice we lose at most a factor of CHAR_BIT by going with
|
in practice we lose at most a factor of CHAR_BIT by going with
|
||||||
@@ -281,24 +281,24 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !BITSET_COMPATIBLE_ (DST, SRC2) \
|
|||||||
|
|
||||||
/* Private functions for bitset implementations. */
|
/* Private functions for bitset implementations. */
|
||||||
|
|
||||||
bool bitset_toggle_ (bitset, bitset_bindex);
|
extern bool bitset_toggle_ (bitset, bitset_bindex);
|
||||||
|
|
||||||
bitset_bindex bitset_count_ (bitset);
|
extern bitset_bindex bitset_count_ (bitset);
|
||||||
|
|
||||||
bitset_bindex bitset_size_ (bitset);
|
extern bitset_bindex bitset_size_ (bitset);
|
||||||
|
|
||||||
bool bitset_copy_ (bitset, bitset);
|
extern bool bitset_copy_ (bitset, bitset);
|
||||||
|
|
||||||
void bitset_and_or_ (bitset, bitset, bitset, bitset);
|
extern void bitset_and_or_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_and_or_cmp_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
void bitset_andn_or_ (bitset, bitset, bitset, bitset);
|
extern void bitset_andn_or_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_andn_or_cmp_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
void bitset_or_and_ (bitset, bitset, bitset, bitset);
|
extern void bitset_or_and_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
|
extern bool bitset_or_and_cmp_ (bitset, bitset, bitset, bitset);
|
||||||
|
|
||||||
#endif /* _BBITSET_H */
|
#endif /* _BBITSET_H */
|
||||||
|
|||||||
+40
-23
@@ -1,7 +1,6 @@
|
|||||||
/* General bitsets.
|
/* General bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
|
Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
|
||||||
Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -39,10 +38,11 @@ const char * const bitset_type_names[] = BITSET_TYPE_NAMES;
|
|||||||
size_t
|
size_t
|
||||||
bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
||||||
{
|
{
|
||||||
|
size_t bytes;
|
||||||
|
|
||||||
if (bitset_stats_enabled)
|
if (bitset_stats_enabled)
|
||||||
return bitset_stats_bytes ();
|
return bitset_stats_bytes ();
|
||||||
|
|
||||||
size_t bytes;
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
@@ -100,7 +100,7 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
|||||||
specified by ATTR. For variable size bitsets, N_BITS is only a
|
specified by ATTR. For variable size bitsets, N_BITS is only a
|
||||||
hint and may be zero. */
|
hint and may be zero. */
|
||||||
enum bitset_type
|
enum bitset_type
|
||||||
bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned attr)
|
bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned int attr)
|
||||||
{
|
{
|
||||||
/* Check attributes. */
|
/* Check attributes. */
|
||||||
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
|
||||||
@@ -133,9 +133,12 @@ bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned attr)
|
|||||||
bitset
|
bitset
|
||||||
bitset_alloc (bitset_bindex n_bits, enum bitset_type type)
|
bitset_alloc (bitset_bindex n_bits, enum bitset_type type)
|
||||||
{
|
{
|
||||||
size_t bytes = bitset_bytes (type, n_bits);
|
size_t bytes;
|
||||||
|
bitset bset;
|
||||||
|
|
||||||
bitset bset = xcalloc (1, bytes);
|
bytes = bitset_bytes (type, n_bits);
|
||||||
|
|
||||||
|
bset = xcalloc (1, bytes);
|
||||||
|
|
||||||
/* The cache is disabled until some elements are allocated. If we
|
/* The cache is disabled until some elements are allocated. If we
|
||||||
have variable length arrays, then we may need to allocate a dummy
|
have variable length arrays, then we may need to allocate a dummy
|
||||||
@@ -150,9 +153,12 @@ bitset
|
|||||||
bitset_obstack_alloc (struct obstack *bobstack,
|
bitset_obstack_alloc (struct obstack *bobstack,
|
||||||
bitset_bindex n_bits, enum bitset_type type)
|
bitset_bindex n_bits, enum bitset_type type)
|
||||||
{
|
{
|
||||||
size_t bytes = bitset_bytes (type, n_bits);
|
size_t bytes;
|
||||||
|
bitset bset;
|
||||||
|
|
||||||
bitset bset = obstack_alloc (bobstack, bytes);
|
bytes = bitset_bytes (type, n_bits);
|
||||||
|
|
||||||
|
bset = obstack_alloc (bobstack, bytes);
|
||||||
memset (bset, 0, bytes);
|
memset (bset, 0, bytes);
|
||||||
|
|
||||||
return bitset_init (bset, n_bits, type);
|
return bitset_init (bset, n_bits, type);
|
||||||
@@ -162,9 +168,11 @@ bitset_obstack_alloc (struct obstack *bobstack,
|
|||||||
/* Create a bitset of N_BITS and with attribute hints specified by
|
/* Create a bitset of N_BITS and with attribute hints specified by
|
||||||
ATTR. */
|
ATTR. */
|
||||||
bitset
|
bitset
|
||||||
bitset_create (bitset_bindex n_bits, unsigned attr)
|
bitset_create (bitset_bindex n_bits, unsigned int attr)
|
||||||
{
|
{
|
||||||
enum bitset_type type = bitset_type_choose (n_bits, attr);
|
enum bitset_type type;
|
||||||
|
|
||||||
|
type = bitset_type_choose (n_bits, attr);
|
||||||
|
|
||||||
return bitset_alloc (n_bits, type);
|
return bitset_alloc (n_bits, type);
|
||||||
}
|
}
|
||||||
@@ -191,7 +199,9 @@ bitset_obstack_free (bitset bset)
|
|||||||
enum bitset_type
|
enum bitset_type
|
||||||
bitset_type_get (bitset bset)
|
bitset_type_get (bitset bset)
|
||||||
{
|
{
|
||||||
enum bitset_type type = BITSET_TYPE_ (bset);
|
enum bitset_type type;
|
||||||
|
|
||||||
|
type = BITSET_TYPE_ (bset);
|
||||||
if (type != BITSET_STATS)
|
if (type != BITSET_STATS)
|
||||||
return type;
|
return type;
|
||||||
|
|
||||||
@@ -203,7 +213,9 @@ bitset_type_get (bitset bset)
|
|||||||
const char *
|
const char *
|
||||||
bitset_type_name_get (bitset bset)
|
bitset_type_name_get (bitset bset)
|
||||||
{
|
{
|
||||||
enum bitset_type type = bitset_type_get (bset);
|
enum bitset_type type;
|
||||||
|
|
||||||
|
type = bitset_type_get (bset);
|
||||||
|
|
||||||
return bitset_type_names[type];
|
return bitset_type_names[type];
|
||||||
}
|
}
|
||||||
@@ -227,7 +239,7 @@ bitset_next (bitset src, bitset_bindex bitno)
|
|||||||
extern bool
|
extern bool
|
||||||
bitset_compatible_p (bitset bset1, bitset bset2)
|
bitset_compatible_p (bitset bset1, bitset bset2)
|
||||||
{
|
{
|
||||||
return BITSET_COMPATIBLE_ (bset1, bset2);
|
return BITSET_COMPATIBLE_ (bset1, bset2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -278,13 +290,15 @@ bitset_only_set_p (bitset src, bitset_bindex bitno)
|
|||||||
static void
|
static void
|
||||||
bitset_print (FILE *file, bitset bset, bool verbose)
|
bitset_print (FILE *file, bitset bset, bool verbose)
|
||||||
{
|
{
|
||||||
if (verbose)
|
unsigned int pos;
|
||||||
fprintf (file, "n_bits = %lu, set = {",
|
|
||||||
(unsigned long) bitset_size (bset));
|
|
||||||
|
|
||||||
unsigned pos = 30;
|
|
||||||
bitset_bindex i;
|
bitset_bindex i;
|
||||||
bitset_iterator iter;
|
bitset_iterator iter;
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
fprintf (file, "n_bits = %lu, set = {",
|
||||||
|
(unsigned long int) bitset_size (bset));
|
||||||
|
|
||||||
|
pos = 30;
|
||||||
BITSET_FOR_EACH (iter, bset, i, 0)
|
BITSET_FOR_EACH (iter, bset, i, 0)
|
||||||
{
|
{
|
||||||
if (pos > 70)
|
if (pos > 70)
|
||||||
@@ -293,7 +307,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
|
|||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (file, "%lu ", (unsigned long) i);
|
fprintf (file, "%lu ", (unsigned long int) i);
|
||||||
pos += 1 + (i >= 10) + (i >= 100);
|
pos += 1 + (i >= 10) + (i >= 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -342,7 +356,7 @@ bitset_toggle_ (bitset bset, bitset_bindex bitno)
|
|||||||
bitset_bindex
|
bitset_bindex
|
||||||
bitset_size_ (bitset src)
|
bitset_size_ (bitset src)
|
||||||
{
|
{
|
||||||
return BITSET_NBITS_ (src);
|
return BITSET_NBITS_ (src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -351,6 +365,7 @@ bitset_bindex
|
|||||||
bitset_count_ (bitset src)
|
bitset_count_ (bitset src)
|
||||||
{
|
{
|
||||||
bitset_bindex list[BITSET_LIST_SIZE];
|
bitset_bindex list[BITSET_LIST_SIZE];
|
||||||
|
bitset_bindex next;
|
||||||
bitset_bindex num;
|
bitset_bindex num;
|
||||||
bitset_bindex count;
|
bitset_bindex count;
|
||||||
|
|
||||||
@@ -358,7 +373,7 @@ bitset_count_ (bitset src)
|
|||||||
bitset implementation that uses a direct technique (based on
|
bitset implementation that uses a direct technique (based on
|
||||||
masks) for counting the number of bits set in a word. */
|
masks) for counting the number of bits set in a word. */
|
||||||
|
|
||||||
bitset_bindex next = 0;
|
next = 0;
|
||||||
for (count = 0; (num = bitset_list (src, list, BITSET_LIST_SIZE, &next));
|
for (count = 0; (num = bitset_list (src, list, BITSET_LIST_SIZE, &next));
|
||||||
count += num)
|
count += num)
|
||||||
continue;
|
continue;
|
||||||
@@ -395,11 +410,13 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
|||||||
enum bitset_ops op)
|
enum bitset_ops op)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
bool stats_enabled_save;
|
||||||
|
bitset tmp;
|
||||||
|
|
||||||
/* Create temporary bitset. */
|
/* Create temporary bitset. */
|
||||||
bool stats_enabled_save = bitset_stats_enabled;
|
stats_enabled_save = bitset_stats_enabled;
|
||||||
bitset_stats_enabled = false;
|
bitset_stats_enabled = false;
|
||||||
bitset tmp = bitset_alloc (0, bitset_type_get (dst));
|
tmp = bitset_alloc (0, bitset_type_get (dst));
|
||||||
bitset_stats_enabled = stats_enabled_save;
|
bitset_stats_enabled = stats_enabled_save;
|
||||||
|
|
||||||
switch (op)
|
switch (op)
|
||||||
|
|||||||
+29
-30
@@ -1,7 +1,6 @@
|
|||||||
/* Generic bitsets.
|
/* Generic bitsets.
|
||||||
|
|
||||||
Copyright (C) 2002-2004, 2009-2015, 2018 Free Software Foundation,
|
Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc.
|
||||||
Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ enum bitset_attr {BITSET_FIXED = 1, /* Bitset size fixed. */
|
|||||||
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
BITSET_FRUGAL = 16, /* Prefer most compact. */
|
||||||
BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */
|
BITSET_GREEDY = 32}; /* Prefer fastest at memory expense. */
|
||||||
|
|
||||||
typedef unsigned bitset_attrs;
|
typedef unsigned int bitset_attrs;
|
||||||
|
|
||||||
/* The contents of the union should be considered to be private.
|
/* The contents of the union should be considered to be private.
|
||||||
While I would like to make this union opaque, it needs to be
|
While I would like to make this union opaque, it needs to be
|
||||||
@@ -99,37 +98,37 @@ typedef struct
|
|||||||
|
|
||||||
|
|
||||||
/* Return bytes required for bitset of desired type and size. */
|
/* Return bytes required for bitset of desired type and size. */
|
||||||
size_t bitset_bytes (enum bitset_type, bitset_bindex);
|
extern size_t bitset_bytes (enum bitset_type, bitset_bindex);
|
||||||
|
|
||||||
/* Initialise a bitset with desired type and size. */
|
/* Initialise a bitset with desired type and size. */
|
||||||
bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
|
extern bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
|
||||||
|
|
||||||
/* Select an implementation type based on the desired bitset size
|
/* Select an implementation type based on the desired bitset size
|
||||||
and attributes. */
|
and attributes. */
|
||||||
enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
|
extern enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
|
||||||
|
|
||||||
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
/* Create a bitset of desired type and size. The bitset is zeroed. */
|
||||||
bitset bitset_alloc (bitset_bindex, enum bitset_type);
|
extern bitset bitset_alloc (bitset_bindex, enum bitset_type);
|
||||||
|
|
||||||
/* Free bitset. */
|
/* Free bitset. */
|
||||||
void bitset_free (bitset);
|
extern void bitset_free (bitset);
|
||||||
|
|
||||||
/* Create a bitset of desired type and size using an obstack. The
|
/* Create a bitset of desired type and size using an obstack. The
|
||||||
bitset is zeroed. */
|
bitset is zeroed. */
|
||||||
bitset bitset_obstack_alloc (struct obstack *bobstack,
|
extern bitset bitset_obstack_alloc (struct obstack *bobstack,
|
||||||
bitset_bindex, enum bitset_type);
|
bitset_bindex, enum bitset_type);
|
||||||
|
|
||||||
/* Free bitset allocated on obstack. */
|
/* Free bitset allocated on obstack. */
|
||||||
void bitset_obstack_free (bitset);
|
extern void bitset_obstack_free (bitset);
|
||||||
|
|
||||||
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
|
||||||
bitset bitset_create (bitset_bindex, bitset_attrs);
|
extern bitset bitset_create (bitset_bindex, bitset_attrs);
|
||||||
|
|
||||||
/* Return bitset type. */
|
/* Return bitset type. */
|
||||||
enum bitset_type bitset_type_get (bitset);
|
extern enum bitset_type bitset_type_get (bitset);
|
||||||
|
|
||||||
/* Return bitset type name. */
|
/* Return bitset type name. */
|
||||||
const char *bitset_type_name_get (bitset);
|
extern const char *bitset_type_name_get (bitset);
|
||||||
|
|
||||||
|
|
||||||
/* Set bit BITNO in bitset BSET. */
|
/* Set bit BITNO in bitset BSET. */
|
||||||
@@ -181,7 +180,7 @@ bitset_test (bitset bset, bitset_bindex bitno)
|
|||||||
#define bitset_size(SRC) BITSET_SIZE_ (SRC)
|
#define bitset_size(SRC) BITSET_SIZE_ (SRC)
|
||||||
|
|
||||||
/* Change size of bitset. */
|
/* Change size of bitset. */
|
||||||
void bitset_resize (bitset, bitset_bindex);
|
extern void bitset_resize (bitset, bitset_bindex);
|
||||||
|
|
||||||
/* Return number of bits set in bitset SRC. */
|
/* Return number of bits set in bitset SRC. */
|
||||||
#define bitset_count(SRC) BITSET_COUNT_ (SRC)
|
#define bitset_count(SRC) BITSET_COUNT_ (SRC)
|
||||||
@@ -281,25 +280,25 @@ void bitset_resize (bitset, bitset_bindex);
|
|||||||
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
|
BITSET_LIST_REVERSE_ (BSET, LIST, NUM, NEXT)
|
||||||
|
|
||||||
/* Return true if both bitsets are of the same type and size. */
|
/* Return true if both bitsets are of the same type and size. */
|
||||||
bool bitset_compatible_p (bitset bset1, bitset bset2);
|
extern bool bitset_compatible_p (bitset bset1, bitset bset2);
|
||||||
|
|
||||||
/* Find next set bit from the given bit index. */
|
/* Find next set bit from the given bit index. */
|
||||||
bitset_bindex bitset_next (bitset, bitset_bindex);
|
extern bitset_bindex bitset_next (bitset, bitset_bindex);
|
||||||
|
|
||||||
/* Find previous set bit from the given bit index. */
|
/* Find previous set bit from the given bit index. */
|
||||||
bitset_bindex bitset_prev (bitset, bitset_bindex);
|
extern bitset_bindex bitset_prev (bitset, bitset_bindex);
|
||||||
|
|
||||||
/* Find first set bit. */
|
/* Find first set bit. */
|
||||||
bitset_bindex bitset_first (bitset);
|
extern bitset_bindex bitset_first (bitset);
|
||||||
|
|
||||||
/* Find last set bit. */
|
/* Find last set bit. */
|
||||||
bitset_bindex bitset_last (bitset);
|
extern bitset_bindex bitset_last (bitset);
|
||||||
|
|
||||||
/* Return nonzero if this is the only set bit. */
|
/* Return nonzero if this is the only set bit. */
|
||||||
bool bitset_only_set_p (bitset, bitset_bindex);
|
extern bool bitset_only_set_p (bitset, bitset_bindex);
|
||||||
|
|
||||||
/* Dump bitset. */
|
/* Dump bitset. */
|
||||||
void bitset_dump (FILE *, bitset);
|
extern void bitset_dump (FILE *, bitset);
|
||||||
|
|
||||||
/* Loop over all elements of BSET, starting with MIN, setting INDEX
|
/* Loop over all elements of BSET, starting with MIN, setting INDEX
|
||||||
to the index of each set bit. For example, the following will print
|
to the index of each set bit. For example, the following will print
|
||||||
@@ -310,7 +309,7 @@ void bitset_dump (FILE *, bitset);
|
|||||||
|
|
||||||
BITSET_FOR_EACH (iter, src, i, 0)
|
BITSET_FOR_EACH (iter, src, i, 0)
|
||||||
{
|
{
|
||||||
printf ("%lu ", (unsigned long) i);
|
printf ("%lu ", (unsigned long int) i);
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
|
#define BITSET_FOR_EACH(ITER, BSET, INDEX, MIN) \
|
||||||
@@ -332,7 +331,7 @@ void bitset_dump (FILE *, bitset);
|
|||||||
|
|
||||||
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
|
BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
|
||||||
{
|
{
|
||||||
printf ("%lu ", (unsigned long) i);
|
printf ("%lu ", (unsigned long int) i);
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
|
#define BITSET_FOR_EACH_REVERSE(ITER, BSET, INDEX, MIN) \
|
||||||
@@ -368,13 +367,13 @@ void bitset_dump (FILE *, bitset);
|
|||||||
|
|
||||||
|
|
||||||
/* Release any memory tied up with bitsets. */
|
/* Release any memory tied up with bitsets. */
|
||||||
void bitset_release_memory (void);
|
extern void bitset_release_memory (void);
|
||||||
|
|
||||||
/* Enable bitset stats gathering. */
|
/* Enable bitset stats gathering. */
|
||||||
void bitset_stats_enable (void);
|
extern void bitset_stats_enable (void);
|
||||||
|
|
||||||
/* Disable bitset stats gathering. */
|
/* Disable bitset stats gathering. */
|
||||||
void bitset_stats_disable (void);
|
extern void bitset_stats_disable (void);
|
||||||
|
|
||||||
/* Read bitset stats file of accummulated stats. */
|
/* Read bitset stats file of accummulated stats. */
|
||||||
void bitset_stats_read (const char *file_name);
|
void bitset_stats_read (const char *file_name);
|
||||||
@@ -383,12 +382,12 @@ void bitset_stats_read (const char *file_name);
|
|||||||
void bitset_stats_write (const char *file_name);
|
void bitset_stats_write (const char *file_name);
|
||||||
|
|
||||||
/* Dump bitset stats. */
|
/* Dump bitset stats. */
|
||||||
void bitset_stats_dump (FILE *);
|
extern void bitset_stats_dump (FILE *);
|
||||||
|
|
||||||
/* Function to debug bitset from debugger. */
|
/* Function to debug bitset from debugger. */
|
||||||
void debug_bitset (bitset);
|
extern void debug_bitset (bitset);
|
||||||
|
|
||||||
/* Function to debug bitset stats from debugger. */
|
/* Function to debug bitset stats from debugger. */
|
||||||
void debug_bitset_stats (void);
|
extern void debug_bitset_stats (void);
|
||||||
|
|
||||||
#endif /* _BITSET_H */
|
#endif /* _BITSET_H */
|
||||||
|
|||||||
+61
-53
@@ -1,7 +1,6 @@
|
|||||||
/* Bitset statistics.
|
/* Bitset statistics.
|
||||||
|
|
||||||
Copyright (C) 2002-2006, 2009-2015, 2018 Free Software Foundation,
|
Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
|
||||||
Inc.
|
|
||||||
|
|
||||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
@@ -77,23 +76,23 @@
|
|||||||
|
|
||||||
struct bitset_type_info_struct
|
struct bitset_type_info_struct
|
||||||
{
|
{
|
||||||
unsigned allocs;
|
unsigned int allocs;
|
||||||
unsigned frees;
|
unsigned int frees;
|
||||||
unsigned lists;
|
unsigned int lists;
|
||||||
unsigned sets;
|
unsigned int sets;
|
||||||
unsigned cache_sets;
|
unsigned int cache_sets;
|
||||||
unsigned resets;
|
unsigned int resets;
|
||||||
unsigned cache_resets;
|
unsigned int cache_resets;
|
||||||
unsigned tests;
|
unsigned int tests;
|
||||||
unsigned cache_tests;
|
unsigned int cache_tests;
|
||||||
unsigned list_counts[BITSET_LOG_COUNT_BINS];
|
unsigned int list_counts[BITSET_LOG_COUNT_BINS];
|
||||||
unsigned list_sizes[BITSET_LOG_SIZE_BINS];
|
unsigned int list_sizes[BITSET_LOG_SIZE_BINS];
|
||||||
unsigned list_density[BITSET_DENSITY_BINS];
|
unsigned int list_density[BITSET_DENSITY_BINS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bitset_stats_info_struct
|
struct bitset_stats_info_struct
|
||||||
{
|
{
|
||||||
unsigned runs;
|
unsigned int runs;
|
||||||
struct bitset_type_info_struct types[BITSET_TYPE_NUM];
|
struct bitset_type_info_struct types[BITSET_TYPE_NUM];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -106,17 +105,20 @@ bool bitset_stats_enabled = false;
|
|||||||
/* Print a percentage histogram with message MSG to FILE. */
|
/* Print a percentage histogram with message MSG to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
||||||
unsigned n_bins, unsigned *bins)
|
unsigned int n_bins, unsigned int *bins)
|
||||||
{
|
{
|
||||||
unsigned total = 0;
|
unsigned int i;
|
||||||
for (unsigned i = 0; i < n_bins; i++)
|
unsigned int total;
|
||||||
|
|
||||||
|
total = 0;
|
||||||
|
for (i = 0; i < n_bins; i++)
|
||||||
total += bins[i];
|
total += bins[i];
|
||||||
|
|
||||||
if (!total)
|
if (!total)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf (file, "%s %s", name, msg);
|
fprintf (file, "%s %s", name, msg);
|
||||||
for (unsigned i = 0; i < n_bins; i++)
|
for (i = 0; i < n_bins; i++)
|
||||||
fprintf (file, "%.0f-%.0f%%\t%8u (%5.1f%%)\n",
|
fprintf (file, "%.0f-%.0f%%\t%8u (%5.1f%%)\n",
|
||||||
i * 100.0 / n_bins,
|
i * 100.0 / n_bins,
|
||||||
(i + 1) * 100.0 / n_bins, bins[i],
|
(i + 1) * 100.0 / n_bins, bins[i],
|
||||||
@@ -127,41 +129,39 @@ bitset_percent_histogram_print (FILE *file, const char *name, const char *msg,
|
|||||||
/* Print a log histogram with message MSG to FILE. */
|
/* Print a log histogram with message MSG to FILE. */
|
||||||
static void
|
static void
|
||||||
bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
bitset_log_histogram_print (FILE *file, const char *name, const char *msg,
|
||||||
unsigned n_bins, unsigned *bins)
|
unsigned int n_bins, unsigned int *bins)
|
||||||
{
|
{
|
||||||
unsigned total = 0;
|
unsigned int i;
|
||||||
for (unsigned i = 0; i < n_bins; i++)
|
unsigned int total;
|
||||||
|
unsigned int max_width;
|
||||||
|
|
||||||
|
total = 0;
|
||||||
|
for (i = 0; i < n_bins; i++)
|
||||||
total += bins[i];
|
total += bins[i];
|
||||||
|
|
||||||
if (!total)
|
if (!total)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Determine number of useful bins. */
|
/* Determine number of useful bins. */
|
||||||
{
|
for (i = n_bins; i > 3 && ! bins[i - 1]; i--)
|
||||||
unsigned i;
|
continue;
|
||||||
for (i = n_bins; i > 3 && ! bins[i - 1]; i--)
|
n_bins = i;
|
||||||
continue;
|
|
||||||
n_bins = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */
|
/* 2 * ceil (log10 (2) * (N - 1)) + 1. */
|
||||||
unsigned max_width = 2 * (unsigned) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
max_width = 2 * (unsigned int) (0.30103 * (n_bins - 1) + 0.9999) + 1;
|
||||||
|
|
||||||
fprintf (file, "%s %s", name, msg);
|
fprintf (file, "%s %s", name, msg);
|
||||||
{
|
for (i = 0; i < 2; i++)
|
||||||
unsigned i;
|
fprintf (file, "%*d\t%8u (%5.1f%%)\n",
|
||||||
for (i = 0; i < 2; i++)
|
max_width, i, bins[i], 100.0 * bins[i] / total);
|
||||||
fprintf (file, "%*d\t%8u (%5.1f%%)\n",
|
|
||||||
max_width, i, bins[i], 100.0 * bins[i] / total);
|
|
||||||
|
|
||||||
for (; i < n_bins; i++)
|
for (; i < n_bins; i++)
|
||||||
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
|
||||||
max_width - ((unsigned) (0.30103 * (i) + 0.9999) + 1),
|
max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1),
|
||||||
1UL << (i - 1),
|
1UL << (i - 1),
|
||||||
(1UL << i) - 1,
|
(1UL << i) - 1,
|
||||||
bins[i],
|
bins[i],
|
||||||
(100.0 * bins[i]) / total);
|
(100.0 * bins[i]) / total);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -204,6 +204,8 @@ bitset_stats_print_1 (FILE *file, const char *name,
|
|||||||
static void
|
static void
|
||||||
bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
|
bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -212,7 +214,7 @@ bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
|
|||||||
if (bitset_stats_info->runs > 1)
|
if (bitset_stats_info->runs > 1)
|
||||||
fprintf (file, _("Accumulated runs = %u\n"), bitset_stats_info->runs);
|
fprintf (file, _("Accumulated runs = %u\n"), bitset_stats_info->runs);
|
||||||
|
|
||||||
for (int i = 0; i < BITSET_TYPE_NUM; i++)
|
for (i = 0; i < BITSET_TYPE_NUM; i++)
|
||||||
bitset_stats_print_1 (file, bitset_type_names[i],
|
bitset_stats_print_1 (file, bitset_type_names[i],
|
||||||
&bitset_stats_info->types[i]);
|
&bitset_stats_info->types[i]);
|
||||||
}
|
}
|
||||||
@@ -239,13 +241,15 @@ bitset_stats_disable (void)
|
|||||||
void
|
void
|
||||||
bitset_stats_read (const char *file_name)
|
bitset_stats_read (const char *file_name)
|
||||||
{
|
{
|
||||||
|
FILE *file;
|
||||||
|
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!file_name)
|
if (!file_name)
|
||||||
file_name = BITSET_STATS_FILE;
|
file_name = BITSET_STATS_FILE;
|
||||||
|
|
||||||
FILE *file = fopen (file_name, "r");
|
file = fopen (file_name, "r");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||||
@@ -267,13 +271,15 @@ bitset_stats_read (const char *file_name)
|
|||||||
void
|
void
|
||||||
bitset_stats_write (const char *file_name)
|
bitset_stats_write (const char *file_name)
|
||||||
{
|
{
|
||||||
|
FILE *file;
|
||||||
|
|
||||||
if (!bitset_stats_info)
|
if (!bitset_stats_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!file_name)
|
if (!file_name)
|
||||||
file_name = BITSET_STATS_FILE;
|
file_name = BITSET_STATS_FILE;
|
||||||
|
|
||||||
FILE *file = fopen (file_name, "w");
|
file = fopen (file_name, "w");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
|
||||||
@@ -345,7 +351,7 @@ bitset_stats_reset (bitset dst, bitset_bindex bitno)
|
|||||||
static bool
|
static bool
|
||||||
bitset_stats_toggle (bitset src, bitset_bindex bitno)
|
bitset_stats_toggle (bitset src, bitset_bindex bitno)
|
||||||
{
|
{
|
||||||
return BITSET_TOGGLE_ (src->s.bset, bitno);
|
return BITSET_TOGGLE_ (src->s.bset, bitno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -566,14 +572,15 @@ static bitset_bindex
|
|||||||
bitset_stats_list (bitset bset, bitset_bindex *list,
|
bitset_stats_list (bitset bset, bitset_bindex *list,
|
||||||
bitset_bindex num, bitset_bindex *next)
|
bitset_bindex num, bitset_bindex *next)
|
||||||
{
|
{
|
||||||
bitset_bindex count = BITSET_LIST_ (bset->s.bset, list, num, next);
|
bitset_bindex count;
|
||||||
|
|
||||||
BITSET_STATS_LISTS_INC (bset->s.bset);
|
|
||||||
|
|
||||||
bitset_bindex tmp;
|
bitset_bindex tmp;
|
||||||
bitset_bindex size;
|
bitset_bindex size;
|
||||||
bitset_bindex i;
|
bitset_bindex i;
|
||||||
|
|
||||||
|
count = BITSET_LIST_ (bset->s.bset, list, num, next);
|
||||||
|
|
||||||
|
BITSET_STATS_LISTS_INC (bset->s.bset);
|
||||||
|
|
||||||
/* Log histogram of number of set bits. */
|
/* Log histogram of number of set bits. */
|
||||||
for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
|
for (i = 0, tmp = count; tmp; tmp >>= 1, i++)
|
||||||
continue;
|
continue;
|
||||||
@@ -655,7 +662,7 @@ struct bitset_vtable bitset_stats_vtable = {
|
|||||||
enum bitset_type
|
enum bitset_type
|
||||||
bitset_stats_type_get (bitset bset)
|
bitset_stats_type_get (bitset bset)
|
||||||
{
|
{
|
||||||
return BITSET_TYPE_ (bset->s.bset);
|
return BITSET_TYPE_ (bset->s.bset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -669,6 +676,9 @@ bitset_stats_bytes (void)
|
|||||||
bitset
|
bitset
|
||||||
bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||||
{
|
{
|
||||||
|
size_t bytes;
|
||||||
|
bitset sbset;
|
||||||
|
|
||||||
bset->b.vtable = &bitset_stats_vtable;
|
bset->b.vtable = &bitset_stats_vtable;
|
||||||
|
|
||||||
/* Disable cache. */
|
/* Disable cache. */
|
||||||
@@ -680,8 +690,6 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
|||||||
|
|
||||||
/* Set up the actual bitset implementation that
|
/* Set up the actual bitset implementation that
|
||||||
we are a wrapper over. */
|
we are a wrapper over. */
|
||||||
size_t bytes;
|
|
||||||
bitset sbset;
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user