mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-12 12:15:14 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb3c595f6c | ||
|
|
b741659d85 | ||
|
|
5e28cf53be | ||
|
|
5fb8b11152 | ||
|
|
2a1aefbf76 | ||
|
|
734b0ce45d | ||
|
|
59bcaebfae | ||
|
|
680b715518 | ||
|
|
2eb1ad9ef3 | ||
|
|
0360a35228 | ||
|
|
2e053317c8 | ||
|
|
33c788d37b | ||
|
|
c03d0d9625 | ||
|
|
bf7abf4849 | ||
|
|
2731332150 | ||
|
|
554a12102e |
+1
-1
@@ -1 +1 @@
|
|||||||
3.2.91
|
3.2.2
|
||||||
|
|||||||
+9
-43
@@ -21,7 +21,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "GCC 7 -O3"
|
- name: "GCC 7 -O3"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -35,11 +34,10 @@ matrix:
|
|||||||
# Travis if we run all the tests in on go. Run in two parts.
|
# Travis if we run all the tests in on go. Run in two parts.
|
||||||
- name: "Clang 7 libc++ and ASAN part 1"
|
- name: "Clang 7 libc++ and ASAN part 1"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- llvm-toolchain-xenial-7
|
- llvm-toolchain-trusty-7
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- clang-7
|
- clang-7
|
||||||
@@ -51,11 +49,10 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 7 libc++ and ASAN part 2"
|
- name: "Clang 7 libc++ and ASAN part 2"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- llvm-toolchain-xenial-7
|
- llvm-toolchain-trusty-7
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- clang-7
|
- clang-7
|
||||||
@@ -67,7 +64,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "ICC"
|
- name: "ICC"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
env:
|
env:
|
||||||
# ICC's warnings are often very wrong (e.g., it thinks foo ?
|
# ICC's warnings are often very wrong (e.g., it thinks foo ?
|
||||||
# "bar" : "baz" is char* instead of const char*), so don't try
|
# "bar" : "baz" is char* instead of const char*), so don't try
|
||||||
@@ -82,7 +78,6 @@ matrix:
|
|||||||
|
|
||||||
#- name: "GCC 8 with sanitizers"
|
#- name: "GCC 8 with sanitizers"
|
||||||
# os: linux
|
# os: linux
|
||||||
# dist: xenial
|
|
||||||
# addons:
|
# addons:
|
||||||
# apt:
|
# apt:
|
||||||
# sources:
|
# sources:
|
||||||
@@ -92,15 +87,11 @@ matrix:
|
|||||||
# env:
|
# env:
|
||||||
# # Can't use UBSAN: I get:
|
# # Can't use UBSAN: I get:
|
||||||
# # configure:4951: gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer conftest.c
|
# # configure:4951: gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer conftest.c
|
||||||
# # /usr/bin/ld: unrecognized option '--push-state' (on trusty)
|
# # /usr/bin/ld: unrecognized option '--push-state'
|
||||||
# # /usr/bin/ld: unrecognized option '--push-state--no-as-needed' (on xenial)
|
|
||||||
# #
|
|
||||||
# # https://stackoverflow.com/questions/50024731/ suggests using the gold linker.
|
|
||||||
# - MATRIX_EVAL="CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer' CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'"
|
# - MATRIX_EVAL="CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer' CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'"
|
||||||
|
|
||||||
- name: "GCC 6"
|
- name: "GCC 6"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -112,7 +103,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "GCC 5"
|
- name: "GCC 5"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -124,7 +114,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "GCC 4.9"
|
- name: "GCC 4.9"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -136,7 +125,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "GCC 4.8"
|
- name: "GCC 4.8"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -148,7 +136,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "GCC 4.7"
|
- name: "GCC 4.7"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -160,7 +147,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "GCC 4.6"
|
- name: "GCC 4.6"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -176,11 +162,10 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 6 -O3 and libc++"
|
- name: "Clang 6 -O3 and libc++"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- llvm-toolchain-xenial-6.0
|
- llvm-toolchain-trusty-6.0
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- clang-6.0
|
- clang-6.0
|
||||||
@@ -191,11 +176,10 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 5"
|
- name: "Clang 5"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- llvm-toolchain-xenial-5.0
|
- llvm-toolchain-trusty-5.0
|
||||||
packages:
|
packages:
|
||||||
- clang-5.0
|
- clang-5.0
|
||||||
- libc++-dev
|
- libc++-dev
|
||||||
@@ -204,11 +188,10 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 4"
|
- name: "Clang 4"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- llvm-toolchain-xenial-4.0
|
- llvm-toolchain-trusty-4.0
|
||||||
packages:
|
packages:
|
||||||
- clang-4.0
|
- clang-4.0
|
||||||
env:
|
env:
|
||||||
@@ -216,11 +199,10 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 3.9"
|
- name: "Clang 3.9"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- llvm-toolchain-xenial-3.9
|
- llvm-toolchain-trusty-3.9
|
||||||
packages:
|
packages:
|
||||||
- clang-3.9
|
- clang-3.9
|
||||||
env:
|
env:
|
||||||
@@ -228,7 +210,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 3.8"
|
- name: "Clang 3.8"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -241,7 +222,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "CLang 3.7"
|
- name: "CLang 3.7"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -254,7 +234,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 3.6"
|
- name: "Clang 3.6"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -267,7 +246,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 3.5"
|
- name: "Clang 3.5"
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@@ -280,8 +258,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 3.4"
|
- name: "Clang 3.4"
|
||||||
os: linux
|
os: linux
|
||||||
# Not available on Xenial.
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@@ -293,8 +269,6 @@ matrix:
|
|||||||
|
|
||||||
- name: "Clang 3.3"
|
- name: "Clang 3.3"
|
||||||
os: linux
|
os: linux
|
||||||
# Not available on Xenial.
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@@ -311,39 +285,31 @@ before_install:
|
|||||||
- sudo apt-get install -qq autoconf automake autopoint doxygen flex gettext graphviz help2man m4 texinfo
|
- 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 [[ $CC == "icc" ]]; then build-aux/install-icc.sh; fi
|
||||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
||||||
# Install and activate dmd
|
|
||||||
- mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
|
|
||||||
- source $(source ~/dlang/install.sh dmd -a)
|
|
||||||
- autoconf --version
|
- autoconf --version
|
||||||
- automake --version
|
- automake --version
|
||||||
- autopoint --version
|
- autopoint --version
|
||||||
- $CC --version
|
- $CC --version
|
||||||
- $CXX --version
|
- $CXX --version
|
||||||
- dmd --version
|
|
||||||
- doxygen --version
|
- doxygen --version
|
||||||
- flex --version
|
- flex --version
|
||||||
- gettext --version
|
- gettext --version
|
||||||
- dot -V
|
- dot -V
|
||||||
- help2man --version
|
- help2man --version
|
||||||
- ld --version
|
|
||||||
- m4 --version
|
- m4 --version
|
||||||
- makeinfo --version
|
- makeinfo --version
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- git show
|
||||||
- git tag -l
|
- git tag -l
|
||||||
# For some reasons, sometimes the checkout does not have any tags,
|
# For some reasons, sometimes the checkout does not have any tags,
|
||||||
# so `git describe` fails, so bootstrap fails.
|
# so `git describe` fails, so bootstrap fails.
|
||||||
- git describe || git tag v3.0 -m "Fake version 3.0."
|
- git describe || git tag v3.0 -m "Fake version 3.0."
|
||||||
- git describe
|
- git describe
|
||||||
# Unset this variable, otherwise, Java programs' stderr is cluttered
|
|
||||||
# with `Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m`, which makes
|
|
||||||
# the test suite fail.
|
|
||||||
- unset _JAVA_OPTIONS
|
|
||||||
- ./bootstrap
|
- ./bootstrap
|
||||||
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
- if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
|
||||||
- ./configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
|
- ./configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
|
||||||
- make -j2 $MAKE_ARGS
|
- make -j2 $MAKE_ARGS
|
||||||
- if test ${PART-1} = 1; then make check VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat test-suite.log && cat tests/testsuite.log && false; }; fi
|
- if test ${PART-1} = 1; then make check VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
||||||
- if test ${PART-1} = 1; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
- if test ${PART-1} = 1; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
||||||
- if test ${PART-2} = 2; then make maintainer-check-g++ VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
- if test ${PART-2} = 2; then make maintainer-check-g++ VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1998-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 1998-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26733,7 +26733,7 @@
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1987-1988, 1991-2015, 2018-2019 Free Software
|
Copyright (C) 1987-1988, 1991-2015, 2018 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without
|
Copying and distribution of this file, with or without
|
||||||
|
|||||||
+2
-9
@@ -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-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2015, 2018 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
|
||||||
@@ -29,13 +29,6 @@ EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \
|
|||||||
|
|
||||||
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
|
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
|
||||||
|
|
||||||
# Let generated files (e.g., from exampkles/) depend on this variable,
|
|
||||||
# to make sure they are regenerated when there are changes in Bison.
|
|
||||||
#
|
|
||||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
|
||||||
# in srcdir, including during distcheck, which is forbidden.
|
|
||||||
dependencies = $(BISON_IN) $(dist_skeletons_DATA)
|
|
||||||
|
|
||||||
## 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...
|
||||||
@@ -59,12 +52,12 @@ MOSTLYCLEANFILES =
|
|||||||
SUFFIXES =
|
SUFFIXES =
|
||||||
TESTS = $(dist_TESTS)
|
TESTS = $(dist_TESTS)
|
||||||
check_PROGRAMS =
|
check_PROGRAMS =
|
||||||
check_SCRIPTS =
|
|
||||||
dist_TESTS =
|
dist_TESTS =
|
||||||
noinst_LIBRARIES =
|
noinst_LIBRARIES =
|
||||||
|
|
||||||
include build-aux/local.mk
|
include build-aux/local.mk
|
||||||
include data/local.mk
|
include data/local.mk
|
||||||
|
include djgpp/local.mk
|
||||||
include doc/local.mk
|
include doc/local.mk
|
||||||
include etc/local.mk
|
include etc/local.mk
|
||||||
include examples/local.mk
|
include examples/local.mk
|
||||||
|
|||||||
@@ -1,327 +1,5 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
* Noteworthy changes in release 3.3 (2019-01-26) [stable]
|
|
||||||
|
|
||||||
A new mailing list was created, Bison Announce. It is low traffic, and is
|
|
||||||
only about announcing new releases and important messages (e.g., polls about
|
|
||||||
major decisions to make).
|
|
||||||
|
|
||||||
https://lists.gnu.org/mailman/listinfo/bison-announce
|
|
||||||
|
|
||||||
** Backward incompatible changes
|
|
||||||
|
|
||||||
Support for DJGPP, which has been unmaintained and untested for years, is
|
|
||||||
removed.
|
|
||||||
|
|
||||||
** Deprecated features
|
|
||||||
|
|
||||||
A new feature, --update (see below) helps adjusting existing grammars to
|
|
||||||
deprecations.
|
|
||||||
|
|
||||||
*** Deprecated directives
|
|
||||||
|
|
||||||
The %error-verbose directive is deprecated in favor of '%define
|
|
||||||
parse.error verbose' since Bison 3.0, but no warning was issued.
|
|
||||||
|
|
||||||
The '%name-prefix "xx"' directive is deprecated in favor of '%define
|
|
||||||
api.prefix {xx}' since Bison 3.0, but no warning was issued. These
|
|
||||||
directives are slightly different, you might need to adjust your code.
|
|
||||||
%name-prefix renames only symbols with external linkage, while api.prefix
|
|
||||||
also renames types and macros, including YYDEBUG, YYTOKENTYPE,
|
|
||||||
yytokentype, YYSTYPE, YYLTYPE, etc.
|
|
||||||
|
|
||||||
Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
|
|
||||||
{xx}' will typically have to update YY_DECL from
|
|
||||||
|
|
||||||
#define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
|
|
||||||
|
|
||||||
to
|
|
||||||
|
|
||||||
#define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
|
|
||||||
|
|
||||||
*** Deprecated %define variable names
|
|
||||||
|
|
||||||
The following variables, mostly related to parsers in Java, have been
|
|
||||||
renamed for consistency. Backward compatibility is ensured, but upgrading
|
|
||||||
is recommended.
|
|
||||||
|
|
||||||
abstract -> api.parser.abstract
|
|
||||||
annotations -> api.parser.annotations
|
|
||||||
extends -> api.parser.extends
|
|
||||||
final -> api.parser.final
|
|
||||||
implements -> api.parser.implements
|
|
||||||
parser_class_name -> api.parser.class
|
|
||||||
public -> api.parser.public
|
|
||||||
strictfp -> api.parser.strictfp
|
|
||||||
|
|
||||||
** New features
|
|
||||||
|
|
||||||
*** Generation of fix-its for IDEs/Editors
|
|
||||||
|
|
||||||
When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
|
|
||||||
bison now generates machine readable editing instructions to fix some
|
|
||||||
issues. Currently, this is mostly limited to updating deprecated
|
|
||||||
directives and removing duplicates. For instance:
|
|
||||||
|
|
||||||
$ cat foo.y
|
|
||||||
%error-verbose
|
|
||||||
%define parser_class_name "Parser"
|
|
||||||
%define api.parser.class "Parser"
|
|
||||||
%%
|
|
||||||
exp:;
|
|
||||||
|
|
||||||
See the "fix-it:" lines below:
|
|
||||||
|
|
||||||
$ bison -ffixit foo.y
|
|
||||||
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
|
|
||||||
%error-verbose
|
|
||||||
^~~~~~~~~~~~~~
|
|
||||||
fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
|
|
||||||
foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
|
|
||||||
%define parser_class_name "Parser"
|
|
||||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
|
|
||||||
foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
|
|
||||||
%define api.parser.class "Parser"
|
|
||||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
foo.y:2.1-34: previous definition
|
|
||||||
%define parser_class_name "Parser"
|
|
||||||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
fix-it:"foo.y":{3:1-3:34}:""
|
|
||||||
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
|
||||||
|
|
||||||
This uses the same output format as GCC and Clang.
|
|
||||||
|
|
||||||
*** Updating grammar files
|
|
||||||
|
|
||||||
Fixes can be applied on the fly. The previous example ends with the
|
|
||||||
suggestion to re-run bison with the option -u/--update, which results in a
|
|
||||||
cleaner grammar file.
|
|
||||||
|
|
||||||
$ bison --update foo.y
|
|
||||||
[...]
|
|
||||||
bison: file 'foo.y' was updated (backup: 'foo.y~')
|
|
||||||
|
|
||||||
$ cat foo.y
|
|
||||||
%define parse.error verbose
|
|
||||||
%define api.parser.class {Parser}
|
|
||||||
%%
|
|
||||||
exp:;
|
|
||||||
|
|
||||||
*** Bison is now relocatable
|
|
||||||
|
|
||||||
If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
|
|
||||||
|
|
||||||
A relocatable program can be moved or copied to a different location on
|
|
||||||
the file system. It can also be used through mount points for network
|
|
||||||
sharing. It is possible to make symbolic links to the installed and moved
|
|
||||||
programs, and invoke them through the symbolic link.
|
|
||||||
|
|
||||||
*** %expect and %expect-rr modifiers on individual rules
|
|
||||||
|
|
||||||
One can now document (and check) which rules participate in shift/reduce
|
|
||||||
and reduce/reduce conflicts. This is particularly important GLR parsers,
|
|
||||||
where conflicts are a normal occurrence. For example,
|
|
||||||
|
|
||||||
%glr-parser
|
|
||||||
%expect 1
|
|
||||||
%%
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
argument_list:
|
|
||||||
arguments %expect 1
|
|
||||||
| arguments ','
|
|
||||||
| %empty
|
|
||||||
;
|
|
||||||
|
|
||||||
arguments:
|
|
||||||
expression
|
|
||||||
| argument_list ',' expression
|
|
||||||
;
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
Looking at the output from -v, one can see that the shift-reduce conflict
|
|
||||||
here is due to the fact that the parser does not know whether to reduce
|
|
||||||
arguments to argument_list until it sees the token _after_ the following
|
|
||||||
','. By marking the rule with %expect 1 (because there is a conflict in
|
|
||||||
one state), we document the source of the 1 overall shift-reduce conflict.
|
|
||||||
|
|
||||||
In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
|
|
||||||
conflicts. In this case, we mark each of the conflicting rules. For
|
|
||||||
example,
|
|
||||||
|
|
||||||
%glr-parser
|
|
||||||
%expect-rr 1
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
stmt:
|
|
||||||
target_list '=' expr ';'
|
|
||||||
| expr_list ';'
|
|
||||||
;
|
|
||||||
|
|
||||||
target_list:
|
|
||||||
target
|
|
||||||
| target ',' target_list
|
|
||||||
;
|
|
||||||
|
|
||||||
target:
|
|
||||||
ID %expect-rr 1
|
|
||||||
;
|
|
||||||
|
|
||||||
expr_list:
|
|
||||||
expr
|
|
||||||
| expr ',' expr_list
|
|
||||||
;
|
|
||||||
|
|
||||||
expr:
|
|
||||||
ID %expect-rr 1
|
|
||||||
| ...
|
|
||||||
;
|
|
||||||
|
|
||||||
In a statement such as
|
|
||||||
|
|
||||||
x, y = 3, 4;
|
|
||||||
|
|
||||||
the parser must reduce x to a target or an expr, but does not know which
|
|
||||||
until it sees the '='. So we notate the two possible reductions to
|
|
||||||
indicate that each conflicts in one rule.
|
|
||||||
|
|
||||||
This feature needs user feedback, and might evolve in the future.
|
|
||||||
|
|
||||||
*** C++: Actual token constructors
|
|
||||||
|
|
||||||
When variants and token constructors are enabled, in addition to the
|
|
||||||
type-safe named token constructors (make_ID, make_INT, etc.), we now
|
|
||||||
generate genuine constructors for symbol_type.
|
|
||||||
|
|
||||||
For instance with these declarations
|
|
||||||
|
|
||||||
%token ':'
|
|
||||||
<std::string> ID
|
|
||||||
<int> INT;
|
|
||||||
|
|
||||||
you may use these constructors:
|
|
||||||
|
|
||||||
symbol_type (int token, const std::string&);
|
|
||||||
symbol_type (int token, const int&);
|
|
||||||
symbol_type (int token);
|
|
||||||
|
|
||||||
which should be used in a Flex-scanner as follows.
|
|
||||||
|
|
||||||
%%
|
|
||||||
[a-z]+ return yy::parser::symbol_type (ID, yytext);
|
|
||||||
[0-9]+ return yy::parser::symbol_type (INT, text_to_int (yytext);
|
|
||||||
":" return yy::parser::symbol_type (’:’);
|
|
||||||
<<EOF>> return yy::parser::symbol_type (0);
|
|
||||||
|
|
||||||
Correct matching between token types and value types is checked via
|
|
||||||
'assert'. For instance, 'symbol_type (ID, 42)' would abort (while
|
|
||||||
'make_ID (42)' would not even compile).
|
|
||||||
|
|
||||||
*** C++: Variadic emplace
|
|
||||||
|
|
||||||
If your application requires C++11 and you don't use symbol constructors,
|
|
||||||
you may now use a variadic emplace for semantic values:
|
|
||||||
|
|
||||||
%define api.value.type variant
|
|
||||||
%token <std::pair<int, int>> PAIR
|
|
||||||
|
|
||||||
in your scanner:
|
|
||||||
|
|
||||||
int yylex (parser::semantic_type *lvalp)
|
|
||||||
{
|
|
||||||
lvalp->emplace <std::pair<int, int>> (1, 2);
|
|
||||||
return parser::token::PAIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
*** C++: Syntax error exceptions in GLR
|
|
||||||
|
|
||||||
The glr.cc skeleton now supports syntax_error exceptions thrown from user
|
|
||||||
actions, or from the scanner.
|
|
||||||
|
|
||||||
*** More POSIX Yacc compatibility warnings
|
|
||||||
|
|
||||||
More Bison specific directives are now reported with -y or -Wyacc. This
|
|
||||||
change was ready since the release of Bison 3.0 in September 2015. It was
|
|
||||||
delayed because Autoconf used to define YACC as `bison -y`, which resulted
|
|
||||||
in numerous warnings for Bison users that use the GNU Build System.
|
|
||||||
|
|
||||||
If you still experience that problem, either redefine YACC as `bison -o
|
|
||||||
y.tab.c`, or pass -Wno-yacc to Bison.
|
|
||||||
|
|
||||||
*** The tables yyrhs and yyphrs are back
|
|
||||||
|
|
||||||
Because no Bison skeleton uses them, these tables were removed (no longer
|
|
||||||
passed to the skeletons, not even computed) in 2008. However, some users
|
|
||||||
have expressed interest in being able to use them in their own skeletons.
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
*** Incorrect number of reduce-reduce conflicts
|
|
||||||
|
|
||||||
On a grammar such as
|
|
||||||
|
|
||||||
exp: "num" | "num" | "num"
|
|
||||||
|
|
||||||
bison used to report a single RR conflict, instead of two. This is now
|
|
||||||
fixed. This was the oldest (known) bug in Bison: it was there when Bison
|
|
||||||
was entered in the RCS version control system, in December 1987.
|
|
||||||
|
|
||||||
Some grammar files might have to adjust their %expect-rr.
|
|
||||||
|
|
||||||
*** Parser directives that were not careful enough
|
|
||||||
|
|
||||||
Passing invalid arguments to %nterm, for instance character literals, used
|
|
||||||
to result in unclear error messages.
|
|
||||||
|
|
||||||
** Documentation
|
|
||||||
|
|
||||||
The examples/ directory (installed in .../share/doc/bison/examples) has
|
|
||||||
been restructured per language for clarity. The examples come with a
|
|
||||||
README and a Makefile. Not only can they be used to toy with Bison, they
|
|
||||||
can also be starting points for your own grammars.
|
|
||||||
|
|
||||||
There is now a Java example, and a simple example in C based on Flex and
|
|
||||||
Bison (examples/c/lexcalc/).
|
|
||||||
|
|
||||||
** Changes
|
|
||||||
|
|
||||||
*** Parsers in C++
|
|
||||||
|
|
||||||
They now use noexcept and constexpr. Please, report missing annotations.
|
|
||||||
|
|
||||||
*** Symbol Declarations
|
|
||||||
|
|
||||||
The syntax of the variation directives to declare symbols was overhauled
|
|
||||||
for more consistency, and also better POSIX Yacc compliance (which, for
|
|
||||||
instance, allows "%type" without actually providing a type). The %nterm
|
|
||||||
directive, supported by Bison since its inception, is now documented and
|
|
||||||
officially supported.
|
|
||||||
|
|
||||||
The syntax is now as follows:
|
|
||||||
|
|
||||||
%token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
|
|
||||||
%left TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
|
|
||||||
%type TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
|
|
||||||
%nterm TAG? ID+ ( TAG ID+ )*
|
|
||||||
|
|
||||||
where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
|
|
||||||
such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
|
|
||||||
‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
|
|
||||||
literal such as ‘"number"’. The post-fix quantifiers are ‘?’ (zero or
|
|
||||||
one), ‘*’ (zero or more) and ‘+’ (one or more).
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
Fix the move constructor of symbol_type.
|
|
||||||
|
|
||||||
Always provide a copy constructor for symbol_type, even in modern C++.
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
|
* Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -346,7 +24,7 @@ https://lists.gnu.org/mailman/listinfo/bison-announce
|
|||||||
|
|
||||||
** Backward incompatible changes
|
** Backward incompatible changes
|
||||||
|
|
||||||
Support for DJGPP, which has been unmaintained and untested for years, is
|
Support for DJGPP, which have been unmaintained and untested for years, is
|
||||||
obsolete. Unless there is activity to revive it, it will be removed.
|
obsolete. Unless there is activity to revive it, it will be removed.
|
||||||
|
|
||||||
** Changes
|
** Changes
|
||||||
@@ -516,7 +194,7 @@ https://lists.gnu.org/mailman/listinfo/bison-announce
|
|||||||
release of Bison 3.0, five years ago. Generated parsers do not require a
|
release of Bison 3.0, five years ago. Generated parsers do not require a
|
||||||
C99 compiler.
|
C99 compiler.
|
||||||
|
|
||||||
Support for DJGPP, which has been unmaintained and untested for years, is
|
Support for DJGPP, which have been unmaintained and untested for years, is
|
||||||
obsolete. Unless there is activity to revive it, the next release of Bison
|
obsolete. Unless there is activity to revive it, the next release of Bison
|
||||||
will have it removed.
|
will have it removed.
|
||||||
|
|
||||||
@@ -831,7 +509,7 @@ https://lists.gnu.org/mailman/listinfo/bison-announce
|
|||||||
|
|
||||||
Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
|
Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
|
||||||
Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
|
Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
|
||||||
'y.tab.h' and 'y.output') to be generated from 'foo.y'.
|
'y.tab.h' and 'y.outout') to be generated from 'foo.y'.
|
||||||
|
|
||||||
To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
|
To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
|
||||||
implementation of Yacc, was using Bison as 'bison -y'. While it does
|
implementation of Yacc, was using Bison as 'bison -y'. While it does
|
||||||
@@ -3426,7 +3104,7 @@ Output file does not redefine const for C++.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1995-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 1995-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
This file is part of Bison, the GNU Parser Generator.
|
||||||
|
|
||||||
@@ -3468,14 +3146,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
||||||
LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
|
LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
|
||||||
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir
|
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir
|
||||||
LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
|
LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles outout PROG
|
||||||
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
|
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW
|
||||||
LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
|
|
||||||
LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
|
|
||||||
LocalWords: noexcept constexpr ispell american
|
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
ispell-dictionary: "american"
|
|
||||||
mode: outline
|
mode: outline
|
||||||
fill-column: 76
|
fill-column: 76
|
||||||
End:
|
End:
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009-2015, 2018-2019 Free Software Foundation,
|
Copyright (C) 2002, 2005, 2009-2015, 2018 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.
|
||||||
|
|
||||||
|
|||||||
@@ -2,40 +2,31 @@ This package contains the GNU Bison parser generator.
|
|||||||
|
|
||||||
* Installation
|
* Installation
|
||||||
** Build
|
** Build
|
||||||
See the file INSTALL for generic compilation and installation instructions.
|
See the file INSTALL for generic compilation and installation
|
||||||
|
instructions.
|
||||||
|
|
||||||
Bison requires GNU m4 1.4.6 or later. See:
|
Bison requires GNU m4 1.4.6 or later. See:
|
||||||
|
|
||||||
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz
|
||||||
|
|
||||||
** Relocatability
|
|
||||||
If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
|
|
||||||
|
|
||||||
A relocatable program can be moved or copied to a different location on the
|
|
||||||
file system. It can also be used through mount points for network sharing.
|
|
||||||
It is possible to make symlinks to the installed and moved programs, and
|
|
||||||
invoke them through the symlink.
|
|
||||||
|
|
||||||
See "Enabling Relocatability" in the documentation.
|
|
||||||
|
|
||||||
** Internationalization
|
** Internationalization
|
||||||
Bison supports two catalogs: one for Bison itself (i.e., for the
|
Bison supports two catalogs: one for Bison itself (i.e., for the
|
||||||
maintainer-side parser generation), and one for the generated parsers (i.e.,
|
maintainer-side parser generation), and one for the generated parsers
|
||||||
for the user-side parser execution). The requirements between both differ:
|
(i.e., for the user-side parser execution). The requirements between
|
||||||
bison needs ngettext, the generated parsers do not. To simplify the build
|
both differ: bison needs ngettext, the generated parsers do not. To
|
||||||
system, neither are installed if ngettext is not supported, even if
|
simplify the build system, neither are installed if ngettext is not
|
||||||
generated parsers could have been localized. See
|
supported, even if generated parsers could have been localized. See
|
||||||
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for more
|
http://lists.gnu.org/archive/html/bug-bison/2009-08/msg00006.html for
|
||||||
details.
|
more details.
|
||||||
|
|
||||||
* Questions
|
* Questions
|
||||||
See the section FAQ in the documentation (doc/bison.info) for frequently
|
See the section FAQ in the documentation (doc/bison.info) for
|
||||||
asked questions. The documentation is also available in PDF and HTML,
|
frequently asked questions. The documentation is also available in
|
||||||
provided you have a recent version of Texinfo installed: run "make pdf" or
|
PDF and HTML, provided you have a recent version of Texinfo installed:
|
||||||
"make html".
|
run "make pdf" or "make html".
|
||||||
|
|
||||||
If you have questions about using Bison and the documentation does not
|
If you have questions about using Bison and the documentation does
|
||||||
answer them, please send mail to <[email protected]>.
|
not answer them, please send mail to <[email protected]>.
|
||||||
|
|
||||||
* Bug reports
|
* Bug reports
|
||||||
Please send bug reports to <[email protected]>. Be sure to include the
|
Please send bug reports to <[email protected]>. Be sure to include the
|
||||||
@@ -43,8 +34,8 @@ version number from 'bison --version', and a complete, self-contained test
|
|||||||
case in each bug report.
|
case in each bug report.
|
||||||
|
|
||||||
* Copyright statements
|
* Copyright statements
|
||||||
For any copyright year range specified as YYYY-ZZZZ in this package, note
|
For any copyright year range specified as YYYY-ZZZZ in this package,
|
||||||
that the range specifies every single year in that closed interval.
|
note that the range specifies every single year in that closed interval.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
@@ -54,8 +45,8 @@ fill-column: 76
|
|||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2019 Free
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018 Free Software
|
||||||
Software Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
This file is part of GNU bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -12,8 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2015, 2018-2019 Free Software Foundation,
|
Copyright (C) 2002, 2004, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||||
Inc.
|
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+21
-26
@@ -91,20 +91,20 @@ might be needed.
|
|||||||
|
|
||||||
** First checkout
|
** First checkout
|
||||||
|
|
||||||
Obviously, if you are reading these notes, you did manage to check out this
|
Obviously, if you are reading these notes, you did manage to check out
|
||||||
package from the repository. For the record, you will find all the relevant
|
this package from the repository. For the record, you will find all the
|
||||||
information on:
|
relevant information on:
|
||||||
|
|
||||||
http://savannah.gnu.org/git/?group=bison
|
http://savannah.gnu.org/git/?group=bison
|
||||||
|
|
||||||
Bison uses Git submodules: subscriptions to other Git repositories. In
|
Bison uses Git submodules: subscriptions to other Git repositories.
|
||||||
particular it uses gnulib, the GNU portability library. To ask Git to
|
In particular it uses gnulib, the GNU portability library. To ask Git
|
||||||
perform the first checkout of the submodules, run
|
to perform the first checkout of the submodules, run
|
||||||
|
|
||||||
$ git submodule update --init
|
$ git submodule update --init
|
||||||
|
|
||||||
The next step is to get other files needed to build, which are extracted
|
The next step is to get other files needed to build, which are
|
||||||
from other source packages:
|
extracted from other source packages:
|
||||||
|
|
||||||
$ ./bootstrap
|
$ ./bootstrap
|
||||||
|
|
||||||
@@ -115,15 +115,14 @@ bootstrap.
|
|||||||
|
|
||||||
If it fails with missing symbols (e.g., "error: possibly undefined macro:
|
If it fails with missing symbols (e.g., "error: possibly undefined macro:
|
||||||
AC_PROG_GNU_M4"), you are likely to have forgotten the submodule
|
AC_PROG_GNU_M4"), you are likely to have forgotten the submodule
|
||||||
initialization part. To recover from it, run `git reset --hard HEAD`, and
|
initialization part. Otherwise, there you are! Just
|
||||||
restart with the submodule initialization. Otherwise, there you are! Just
|
|
||||||
|
|
||||||
$ ./configure
|
$ ./configure
|
||||||
$ make
|
$ make
|
||||||
$ make check
|
$ make check
|
||||||
|
|
||||||
At this point, there should be no difference between your local copy, and
|
At this point, there should be no difference between your local copy,
|
||||||
the master copy:
|
and the master copy:
|
||||||
|
|
||||||
$ git diff
|
$ git diff
|
||||||
|
|
||||||
@@ -133,9 +132,9 @@ Enjoy!
|
|||||||
|
|
||||||
** Updating
|
** Updating
|
||||||
|
|
||||||
The use of submodules make things somewhat different because git does not
|
The use of submodules make things somewhat different because git does
|
||||||
support recursive operations: submodules must be taken care of explicitly by
|
not support recursive operations: submodules must be taken care of
|
||||||
the user.
|
explicitly by the user.
|
||||||
|
|
||||||
*** Updating Bison
|
*** Updating Bison
|
||||||
|
|
||||||
@@ -378,13 +377,6 @@ Here's a brief reminder of how to roll the tarballs and upload them:
|
|||||||
|
|
||||||
** Update Bison manual on www.gnu.org.
|
** Update Bison manual on www.gnu.org.
|
||||||
|
|
||||||
The instructions below are obsolete, and left in case one would like to run
|
|
||||||
the commands by hand. Today, one just needs to run
|
|
||||||
|
|
||||||
$ make web-manual-update
|
|
||||||
|
|
||||||
See README-release.
|
|
||||||
|
|
||||||
*** You need a non-anonymous checkout of the web pages directory.
|
*** You need a non-anonymous checkout of the web pages directory.
|
||||||
|
|
||||||
$ cvs -d [email protected]:/web/bison checkout bison
|
$ cvs -d [email protected]:/web/bison checkout bison
|
||||||
@@ -420,8 +412,12 @@ files, add a line to the file .symlinks. This will ensure that hyperlinks
|
|||||||
to the removed files will redirect to the entire manual; this is better than
|
to the removed files will redirect to the entire manual; this is better than
|
||||||
a 404 error.
|
a 404 error.
|
||||||
|
|
||||||
|
There is a problem with 'index.html' being written twice (once for POSIX
|
||||||
|
function 'index', once for the table of contents); you can ignore this
|
||||||
|
issue.
|
||||||
|
|
||||||
** Announce
|
** Announce
|
||||||
The "make release" command just created a template,
|
The "make stable" (or alpha/beta) command just created a template,
|
||||||
$HOME/announce-bison-X.Y. Otherwise, to generate it, run:
|
$HOME/announce-bison-X.Y. Otherwise, to generate it, run:
|
||||||
|
|
||||||
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
||||||
@@ -452,8 +448,7 @@ Push these changes.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2015, 2018-2019 Free Software Foundation,
|
Copyright (C) 2002-2005, 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
Inc.
|
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ Dagobert Michelsen [email protected]
|
|||||||
Daniel Frużyński [email protected]
|
Daniel Frużyński [email protected]
|
||||||
Daniel Galloway [email protected]
|
Daniel Galloway [email protected]
|
||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
David Barto [email protected]
|
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
David Kastrup [email protected]
|
David Kastrup [email protected]
|
||||||
David Michael [email protected]
|
David Michael [email protected]
|
||||||
@@ -122,7 +121,6 @@ Noah Friedman [email protected]
|
|||||||
Odd Arild Olsen [email protected]
|
Odd Arild Olsen [email protected]
|
||||||
Oleg Smolsky [email protected]
|
Oleg Smolsky [email protected]
|
||||||
Oleksii Taran [email protected]
|
Oleksii Taran [email protected]
|
||||||
Oliver Mangold [email protected]
|
|
||||||
Paolo Bonzini [email protected]
|
Paolo Bonzini [email protected]
|
||||||
Paolo Simone Gasparello [email protected]
|
Paolo Simone Gasparello [email protected]
|
||||||
Pascal Bart [email protected]
|
Pascal Bart [email protected]
|
||||||
@@ -175,14 +173,12 @@ 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]
|
Victor Khomenko [email protected]
|
||||||
Victor Zverovich [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]
|
||||||
Wei Song [email protected]
|
Wei Song [email protected]
|
||||||
Wojciech Polak [email protected]
|
Wojciech Polak [email protected]
|
||||||
Wolfgang S. Kechel [email protected]
|
Wolfgang S. Kechel [email protected]
|
||||||
Wolfgang Thaller [email protected]
|
|
||||||
Wolfram Wagner [email protected]
|
Wolfram Wagner [email protected]
|
||||||
Wwp [email protected]
|
Wwp [email protected]
|
||||||
xolodho [email protected]
|
xolodho [email protected]
|
||||||
@@ -199,7 +195,7 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2000-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2000-2015, 2018 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,82 +1,4 @@
|
|||||||
* Bison 3.4
|
|
||||||
** injection rules
|
|
||||||
** glr.cc
|
|
||||||
move glr.c into the yy namespace
|
|
||||||
** improve syntax errors (UTF-8, internationalization)
|
|
||||||
Bison depends on the current locale. For instance:
|
|
||||||
|
|
||||||
%define parse.error verbose
|
|
||||||
%code top {
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
void yyerror(const char* msg) { fprintf(stderr, "%s\n", msg); }
|
|
||||||
int yylex() { return 0; }
|
|
||||||
}
|
|
||||||
%%
|
|
||||||
exp: "↦" | "🎅🐃" | '\n'
|
|
||||||
%%
|
|
||||||
int main() { return yyparse(); }
|
|
||||||
|
|
||||||
gives different results with/without LC_ALL=C.
|
|
||||||
|
|
||||||
$ LC_ALL=C /opt/local/bin/bison /tmp/mangle.y -o ascii.c
|
|
||||||
$ /opt/local/bin/bison /tmp/mangle.y -o utf8.c
|
|
||||||
$ diff -u ascii.c utf8.c -I#line
|
|
||||||
--- ascii.c 2019-01-12 08:15:35.878010093 +0100
|
|
||||||
+++ utf8.c 2019-01-12 08:15:38.856495929 +0100
|
|
||||||
@@ -415,9 +415,8 @@
|
|
||||||
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
|
||||||
static const char *const yytname[] =
|
|
||||||
{
|
|
||||||
- "$end", "error", "$undefined", "\"\\342\\206\\246\"",
|
|
||||||
- "\"\\360\\237\\216\\205\\360\\237\\220\\203\"", "'\\n'", "$accept",
|
|
||||||
- "exp", YY_NULLPTR
|
|
||||||
+ "$end", "error", "$undefined", "\"↦\"", "\"🎅🐃\"", "'\\n'",
|
|
||||||
+ "$accept", "exp", YY_NULLPTR
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
$ gcc ascii.c -o ascii && ./ascii
|
|
||||||
syntax error, unexpected $end, expecting "\342\206\246" or "\360\237\216\205\360\237\220\203" or '\n'
|
|
||||||
$ gcc utf8.c -o utf8 && ./utf8
|
|
||||||
syntax error, unexpected $end, expecting ↦ or 🎅🐃 or '\n'
|
|
||||||
|
|
||||||
|
|
||||||
While at it, we should stop using "$end" by default, in favor of "end of
|
|
||||||
file", or "end of input", whatever.
|
|
||||||
|
|
||||||
** use gettext-h in gnulib instead of gettext
|
|
||||||
** use gnulib-po
|
|
||||||
For some reason, according to syntax-check, we have to keep getopt.c in
|
|
||||||
POTIFILES.in, but not bitset/stats.c, although both come from gnulib. But
|
|
||||||
bitset/stats.c is a symlink, not getopt.c. This is fishy and should be
|
|
||||||
fixed.
|
|
||||||
|
|
||||||
Meanwhile, bitset/stats.c is removed from the set of translations, which is
|
|
||||||
not too much of a problem as users are not expected to see this.
|
|
||||||
|
|
||||||
|
|
||||||
* Completion
|
|
||||||
Several features are not available in all the backends.
|
|
||||||
|
|
||||||
- push parsers: glr.cc, lalr1.cc
|
|
||||||
- ielr: C++ and Java
|
|
||||||
- glr: Java
|
|
||||||
- token constructors: Java and C
|
|
||||||
|
|
||||||
* Bugs
|
|
||||||
** Autotest has quotation issues
|
|
||||||
tests/input.at:1730:AT_SETUP([%define errors])
|
|
||||||
|
|
||||||
->
|
|
||||||
|
|
||||||
$ ./tests/testsuite -l | grep errors | sed q
|
|
||||||
38: input.at:1730 errors
|
|
||||||
|
|
||||||
* Short term
|
* Short term
|
||||||
** consistency
|
|
||||||
token vs terminal
|
|
||||||
|
|
||||||
** yacc.c
|
** yacc.c
|
||||||
Now that ylwrap is fixed, we should include foo.tab.h from foo.tab.c rather
|
Now that ylwrap is fixed, we should include foo.tab.h from foo.tab.c rather
|
||||||
than duplicating it.
|
than duplicating it.
|
||||||
@@ -148,6 +70,11 @@ back-ported.
|
|||||||
yytoken = yytranslate_ (yychar);
|
yytoken = yytranslate_ (yychar);
|
||||||
|
|
||||||
|
|
||||||
|
** stack.hh
|
||||||
|
Get rid of it. The original idea is nice, but actually it makes
|
||||||
|
the code harder to follow, and uselessly different from the other
|
||||||
|
skeletons.
|
||||||
|
|
||||||
** Get rid of fake #lines [Bison: ...]
|
** Get rid of fake #lines [Bison: ...]
|
||||||
Possibly as simple as checking whether the column number is nonnegative.
|
Possibly as simple as checking whether the column number is nonnegative.
|
||||||
|
|
||||||
@@ -175,11 +102,6 @@ since it is no longer bound to a particular parser, it's just a
|
|||||||
as lr0.cc, why upper case?
|
as lr0.cc, why upper case?
|
||||||
|
|
||||||
* Various
|
* Various
|
||||||
** Rewrite glr.cc in C++
|
|
||||||
As a matter of fact, it would be very interesting to see how much we can
|
|
||||||
share between lalr1.cc and glr.cc. Most of the skeletons should be common.
|
|
||||||
It would be a very nice source of inspiration for the other languages.
|
|
||||||
|
|
||||||
** YYERRCODE
|
** YYERRCODE
|
||||||
Defined to 256, but not used, not documented. Probably the token
|
Defined to 256, but not used, not documented. Probably the token
|
||||||
number for the error token, which POSIX wants to be 256, but which
|
number for the error token, which POSIX wants to be 256, but which
|
||||||
@@ -285,10 +207,9 @@ Provide better assistance for understanding the conflicts by providing
|
|||||||
a sample text exhibiting the (LALR) ambiguity. See the paper from
|
a sample text exhibiting the (LALR) ambiguity. See the paper from
|
||||||
DeRemer and Penello: they already provide the algorithm.
|
DeRemer and Penello: they already provide the algorithm.
|
||||||
|
|
||||||
** Statically check for potential ambiguities in GLR grammars
|
** Statically check for potential ambiguities in GLR grammars. See
|
||||||
See <http://www.lsv.fr/~schmitz/pub/expamb.pdf> for an approach.
|
<http://www.i3s.unice.fr/~schmitz/papers.html#expamb> for an approach.
|
||||||
An Experimental Ambiguity Detection Tool ∗ Sylvain Schmitz
|
|
||||||
LORIA, INRIA Nancy - Grand Est, Nancy, France
|
|
||||||
|
|
||||||
* Extensions
|
* Extensions
|
||||||
** Multiple start symbols
|
** Multiple start symbols
|
||||||
@@ -356,9 +277,7 @@ https://lists.gnu.org/archive/html/bug-bison/2016-06/msg00000.html
|
|||||||
http://www.cs.cornell.edu/andru/papers/cupex/
|
http://www.cs.cornell.edu/andru/papers/cupex/
|
||||||
|
|
||||||
* Unit rules
|
* Unit rules
|
||||||
Maybe we could expand unit rules (or "injections", see
|
Maybe we could expand unit rules, i.e., transform
|
||||||
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
|
||||||
transform
|
|
||||||
|
|
||||||
exp: arith | bool;
|
exp: arith | bool;
|
||||||
arith: exp '+' exp;
|
arith: exp '+' exp;
|
||||||
@@ -368,11 +287,11 @@ into
|
|||||||
|
|
||||||
exp: exp '+' exp | exp '&' exp;
|
exp: exp '+' exp | exp '&' exp;
|
||||||
|
|
||||||
when there are no actions. This can significantly speed up some grammars.
|
when there are no actions. This can significantly speed up some
|
||||||
I can't find the papers. In particular the book 'LR parsing: Theory and
|
grammars. I can't find the papers. In particular the book 'LR
|
||||||
Practice' is impossible to find, but according to 'Parsing Techniques: a
|
parsing: Theory and Practice' is impossible to find, but according to
|
||||||
Practical Guide', it includes information about this issue. Does anybody
|
'Parsing Techniques: a Practical Guide', it includes information about
|
||||||
have it?
|
this issue. Does anybody have it?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -411,6 +330,10 @@ It is unfortunate that there is a total order for precedence. It
|
|||||||
makes it impossible to have modular precedence information. We should
|
makes it impossible to have modular precedence information. We should
|
||||||
move to partial orders (sounds like series/parallel orders to me).
|
move to partial orders (sounds like series/parallel orders to me).
|
||||||
|
|
||||||
|
** RR conflicts
|
||||||
|
See if we can use precedence between rules to solve RR conflicts. See
|
||||||
|
what POSIX says.
|
||||||
|
|
||||||
|
|
||||||
* $undefined
|
* $undefined
|
||||||
From Hans:
|
From Hans:
|
||||||
@@ -421,6 +344,20 @@ addition to the $undefined value.
|
|||||||
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
||||||
|
|
||||||
|
|
||||||
|
* Default Action
|
||||||
|
From Hans:
|
||||||
|
- For use with my C++ parser, I transported the "switch (yyn)" statement
|
||||||
|
that Bison writes to the bison.simple skeleton file. This way, I can remove
|
||||||
|
the current default rule $$ = $1 implementation, which causes a double
|
||||||
|
assignment to $$ which may not be OK under C++, replacing it with a
|
||||||
|
"default:" part within the switch statement.
|
||||||
|
|
||||||
|
Note that the default rule $$ = $1, when typed, is perfectly OK under C,
|
||||||
|
but in the C++ implementation I made, this rule is different from
|
||||||
|
$<type_name>$ = $<type_name>1. I therefore think that one should implement
|
||||||
|
a Bison option where every typed default rule is explicitly written out
|
||||||
|
(same typed ruled can of course be grouped together).
|
||||||
|
|
||||||
* Pre and post actions.
|
* Pre and post actions.
|
||||||
From: Florian Krohm <[email protected]>
|
From: Florian Krohm <[email protected]>
|
||||||
Subject: YYACT_EPILOGUE
|
Subject: YYACT_EPILOGUE
|
||||||
@@ -478,8 +415,8 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2019 Free Software
|
Copyright (C) 2001-2004, 2006, 2008-2015, 2018 Free Software Foundation,
|
||||||
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=2019-01-04.17; # UTC
|
scriptversion=2018-10-13.05; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
# Copyright (C) 2003-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2003-2018 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
|
||||||
@@ -963,16 +963,6 @@ fi
|
|||||||
bootstrap_post_import_hook \
|
bootstrap_post_import_hook \
|
||||||
|| die "bootstrap_post_import_hook failed"
|
|| die "bootstrap_post_import_hook failed"
|
||||||
|
|
||||||
# Don't proceed if there are uninitialized submodules. In particular,
|
|
||||||
# the next step will remove dangling links, which might be links into
|
|
||||||
# uninitialized submodules.
|
|
||||||
#
|
|
||||||
# Uninitialized submodules are listed with an initial dash.
|
|
||||||
if $use_git && git submodule | grep '^-' >/dev/null; then
|
|
||||||
die "some git submodules are not initialized. " \
|
|
||||||
"Run 'git submodule init' and bootstrap again."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||||
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
||||||
# The following requires GNU find 4.2.3 or newer. Considering the usual
|
# The following requires GNU find 4.2.3 or newer. Considering the usual
|
||||||
|
|||||||
+4
-10
@@ -1,6 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2015, 2018 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 array-list assert
|
argmatch assert
|
||||||
bitsetv
|
|
||||||
calloc-posix close closeout config-h c-strcase
|
calloc-posix close closeout config-h c-strcase
|
||||||
configmake
|
configmake
|
||||||
dirname
|
dirname
|
||||||
@@ -26,9 +25,7 @@ gnulib_modules='
|
|||||||
getopt-gnu
|
getopt-gnu
|
||||||
gettext git-version-gen gitlog-to-changelog
|
gettext git-version-gen gitlog-to-changelog
|
||||||
gpl-3.0 hash inttypes isnan javacomp-script
|
gpl-3.0 hash inttypes isnan javacomp-script
|
||||||
javaexec-script
|
javaexec-script ldexpl malloc-gnu
|
||||||
ldexpl
|
|
||||||
malloc-gnu
|
|
||||||
mbswidth
|
mbswidth
|
||||||
non-recursive-gnulib-prefix-hack
|
non-recursive-gnulib-prefix-hack
|
||||||
obstack
|
obstack
|
||||||
@@ -37,8 +34,6 @@ gnulib_modules='
|
|||||||
quote quotearg
|
quote quotearg
|
||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
relocatable-prog relocatable-script
|
|
||||||
rename
|
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
||||||
timevar
|
timevar
|
||||||
unistd unistd-safer unlink unlocked-io
|
unistd unistd-safer unlink unlocked-io
|
||||||
@@ -47,7 +42,6 @@ gnulib_modules='
|
|||||||
xalloc
|
xalloc
|
||||||
xalloc-die
|
xalloc-die
|
||||||
xconcat-filename
|
xconcat-filename
|
||||||
xlist
|
|
||||||
xmemdup0
|
xmemdup0
|
||||||
xstrndup
|
xstrndup
|
||||||
|
|
||||||
@@ -84,7 +78,7 @@ excluded_files='
|
|||||||
m4/visibility.m4
|
m4/visibility.m4
|
||||||
'
|
'
|
||||||
|
|
||||||
gnulib_tool_option_extras='--symlink --conditional-dependencies --makefile-name=gnulib.mk'
|
gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
|
||||||
|
|
||||||
bootstrap_post_import_hook()
|
bootstrap_post_import_hook()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,3 @@
|
|||||||
/useless-if-before-free
|
/useless-if-before-free
|
||||||
/vc-list-files
|
/vc-list-files
|
||||||
/ylwrap
|
/ylwrap
|
||||||
/config.libpath
|
|
||||||
/install-reloc
|
|
||||||
/reloc-ldflags
|
|
||||||
/relocatable.sh.in
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2015, 2018 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,4 +1,4 @@
|
|||||||
# Copyright (C) 2012-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2015, 2018 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
|
||||||
|
|||||||
@@ -48,11 +48,7 @@ while (<STDIN>)
|
|||||||
# are strings and have the same syntax as on the command line.
|
# are strings and have the same syntax as on the command line.
|
||||||
if ($dir_arg eq 'name[=value]')
|
if ($dir_arg eq 'name[=value]')
|
||||||
{
|
{
|
||||||
# -D/-F do not add quotes to the argument.
|
$dir_arg = '@var{name} ["@var{value}"]';
|
||||||
$dir_arg =
|
|
||||||
$dir eq "%define"
|
|
||||||
? '@var{name} [@var{value}]'
|
|
||||||
: '@var{name} ["@var{value}"]';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2000-2015, 2018-2019 Free Software Foundation, Inc.
|
## Copyright (C) 2000-2015, 2018 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
|
||||||
|
|||||||
@@ -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-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2009-2015, 2018 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-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2010-2015, 2018 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-2019 Free Software Foundation, Inc.
|
## Copyright (C) 2008-2015, 2018 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
|
||||||
@@ -158,22 +158,21 @@ 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$$ \
|
||||||
cast_of_argument_to_free=^src/muscle-tab.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/skeletons/yacc.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$$ \
|
||||||
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)$$|^\.git|Makefile$$ \
|
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^djgpp/|^\.git|Makefile$$ \
|
||||||
require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||||
require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
space_before_open_paren=^(data/|djgpp/) \
|
||||||
space_before_open_paren=^data/skeletons/ \
|
two_space_separator_in_usage=^(bootstrap|build-aux/install-icc.sh) \
|
||||||
two_space_separator_in_usage=^(bootstrap|build-aux/install-icc.sh) \
|
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||||
unmarked_diagnostics=^(doc/bison.texi$$|tests/c\+\+\.at$$) \
|
|
||||||
)
|
)
|
||||||
|
|||||||
+8
-30
@@ -1,6 +1,6 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2015, 2018 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,7 +27,7 @@ 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], [2019])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2018])
|
||||||
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])
|
||||||
|
|
||||||
@@ -96,11 +96,9 @@ 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
|
-fparse-all-comments -Wdocumentation
|
||||||
-Wformat -Wimplicit-fallthrough -Wnull-dereference
|
-Wformat -Wnull-dereference -Wpointer-arith -Wwrite-strings'
|
||||||
-Wpointer-arith -Wshadow
|
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||||
-Wwrite-strings'
|
warn_cxx='-Wnoexcept'
|
||||||
warn_c='-Wbad-function-cast -Wstrict-prototypes'
|
|
||||||
warn_cxx='-Wextra-semi -Wnoexcept -Wundefined-func-template -Wweak-vtables'
|
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
#
|
#
|
||||||
# -fno-color-diagnostics: Clang's use of colors in the error
|
# -fno-color-diagnostics: Clang's use of colors in the error
|
||||||
@@ -115,7 +113,6 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
-fno-color-diagnostics
|
-fno-color-diagnostics
|
||||||
-Wno-keyword-macro'
|
-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
|
||||||
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
||||||
@@ -129,11 +126,6 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
# CFLAGS, and restore CFLAGS after the tests.
|
# CFLAGS, and restore CFLAGS after the tests.
|
||||||
save_CFLAGS=$CFLAGS
|
save_CFLAGS=$CFLAGS
|
||||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
||||||
# Accept this warning only if it is not too touchy (e.g., clang 3.3
|
|
||||||
# and 3.4).
|
|
||||||
gl_WARN_ADD([-Wunreachable-code], [WARN_CFLAGS],
|
|
||||||
[AC_LANG_PROGRAM([],
|
|
||||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
|
||||||
for i in $warn_common $warn_c;
|
for i in $warn_common $warn_c;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
||||||
@@ -155,7 +147,6 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
CFLAGS=$save_CFLAGS
|
CFLAGS=$save_CFLAGS
|
||||||
AC_LANG_POP([C])
|
AC_LANG_POP([C])
|
||||||
|
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
save_CXXFLAGS=$CXXFLAGS
|
save_CXXFLAGS=$CXXFLAGS
|
||||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
||||||
@@ -163,11 +154,6 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
||||||
done
|
done
|
||||||
# Accept this warning only if it is not too touchy (e.g., clang 3.3
|
|
||||||
# and 3.4).
|
|
||||||
gl_WARN_ADD([-Wunreachable-code], [WARN_CXXFLAGS],
|
|
||||||
[AC_LANG_PROGRAM([],
|
|
||||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
|
||||||
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
||||||
[AC_LANG_PROGRAM([], [nullptr])])
|
[AC_LANG_PROGRAM([], [nullptr])])
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||||
@@ -190,22 +176,11 @@ BISON_C_COMPILER_POSIXLY_CORRECT
|
|||||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
BISON_CXX_COMPILER_POSIXLY_CORRECT
|
BISON_CXX_COMPILER_POSIXLY_CORRECT
|
||||||
|
|
||||||
# D.
|
|
||||||
AC_CHECK_PROGS([DC], [dmd])
|
|
||||||
AM_CONDITIONAL([ENABLE_D], [test x"$DC" != x])
|
|
||||||
|
|
||||||
# Java.
|
|
||||||
gt_JAVACOMP([1.7], [1.7])
|
|
||||||
gt_JAVAEXEC
|
|
||||||
AM_CONDITIONAL([ENABLE_JAVA], [test x"$CONF_JAVAC" != x && test x"$CONF_JAVA" != x])
|
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([yacc],
|
AC_ARG_ENABLE([yacc],
|
||||||
[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])
|
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
||||||
AC_CONFIG_FILES([src/yacc], [chmod +x src/yacc])
|
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AM_MISSING_PROG([DOT], [dot])
|
AM_MISSING_PROG([DOT], [dot])
|
||||||
@@ -291,6 +266,9 @@ 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_JAVAEXEC
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
doc/yacc.1])
|
doc/yacc.1])
|
||||||
|
|||||||
+16
-108
@@ -1,9 +1,8 @@
|
|||||||
This directory contains data needed by Bison.
|
This directory contains data needed by Bison.
|
||||||
|
|
||||||
# Directory content
|
* Skeletons
|
||||||
## Skeletons
|
Bison skeletons: the general shapes of the different parser kinds,
|
||||||
Bison skeletons: the general shapes of the different parser kinds, that are
|
that are specialized for specific grammars by the bison program.
|
||||||
specialized for specific grammars by the bison program.
|
|
||||||
|
|
||||||
Currently, the supported skeletons are:
|
Currently, the supported skeletons are:
|
||||||
|
|
||||||
@@ -23,18 +22,19 @@ Currently, the supported skeletons are:
|
|||||||
- glr.cc
|
- glr.cc
|
||||||
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
||||||
|
|
||||||
These skeletons are the only ones supported by the Bison team. Because the
|
These skeletons are the only ones supported by the Bison team.
|
||||||
interface between skeletons and the bison program is not finished, *we are
|
Because the interface between skeletons and the bison program is not
|
||||||
not bound to it*. In particular, Bison is not mature enough for us to
|
finished, *we are not bound to it*. In particular, Bison is not
|
||||||
consider that "foreign skeletons" are supported.
|
mature enough for us to consider that "foreign skeletons" are
|
||||||
|
supported.
|
||||||
|
|
||||||
## m4sugar
|
* m4sugar
|
||||||
This directory contains M4sugar, sort of an extended library for M4, which
|
This directory contains M4sugar, sort of an extended library for M4,
|
||||||
is used by Bison to instantiate the skeletons.
|
which is used by Bison to instantiate the skeletons.
|
||||||
|
|
||||||
## xslt
|
* xslt
|
||||||
This directory contains XSLT programs that transform Bison's XML output into
|
This directory contains XSLT programs that transform Bison's XML output
|
||||||
various formats.
|
into various formats.
|
||||||
|
|
||||||
- bison.xsl
|
- bison.xsl
|
||||||
A library of routines used by the other XSLT programs.
|
A library of routines used by the other XSLT programs.
|
||||||
@@ -48,105 +48,13 @@ various formats.
|
|||||||
- xml2xhtml.xsl
|
- xml2xhtml.xsl
|
||||||
Conversion into XHTML.
|
Conversion into XHTML.
|
||||||
|
|
||||||
# Implementation note about the skeletons
|
|
||||||
|
|
||||||
"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
|
|
||||||
executable with LR tables, facts about the symbols, etc. and they generate
|
|
||||||
the output (say parser.cc, parser.hh, location.hh, etc.). They are only in
|
|
||||||
charge of generating the parser and its auxiliary files, they do not
|
|
||||||
generate the XML output, the parser.output reports, nor the graphical
|
|
||||||
rendering.
|
|
||||||
|
|
||||||
The bits of information passing from bison to the backend is named
|
|
||||||
"muscles". Muscles are passed to M4 via its standard input: it's a set of
|
|
||||||
m4 definitions. To see them, use `--trace=muscles`.
|
|
||||||
|
|
||||||
Except for muscles, whose names are generated by bison, the skeletons have
|
|
||||||
no constraint at all on the macro names: there is no technical/theoretical
|
|
||||||
limitation, as long as you generate the output, you can do what you want.
|
|
||||||
However, of course, that would be a bad idea if, say, the C and C++
|
|
||||||
skeletons used different approaches and had completely different
|
|
||||||
implementations. That would be a maintenance nightmare.
|
|
||||||
|
|
||||||
Below, we document some of the macros that we use in several of the
|
|
||||||
skeletons. If you are to write a new skeleton, please, implement them for
|
|
||||||
your language. Overall, be sure to follow the same patterns as the existing
|
|
||||||
skeletons.
|
|
||||||
|
|
||||||
## Symbols
|
|
||||||
|
|
||||||
In order to unify the handling of the various aspects of symbols (tag, type
|
|
||||||
name, whether terminal, etc.), bison.exe defines one macro per (token,
|
|
||||||
field), where field can `has_id`, `id`, etc.: see
|
|
||||||
src/output.c:prepare_symbols_definitions().
|
|
||||||
|
|
||||||
The various FIELDS are:
|
|
||||||
|
|
||||||
- has_id: 0 or 1.
|
|
||||||
Whether the symbol has an id.
|
|
||||||
- id: string
|
|
||||||
If has_id, the id. Guaranteed to be usable as a C identifier.
|
|
||||||
Prefixed by api.token.prefix if defined.
|
|
||||||
- tag: string.
|
|
||||||
A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
|
||||||
- user_number: integer
|
|
||||||
The external number as used by yylex. Can be ASCII code when a character,
|
|
||||||
some number chosen by bison, or some user number in the case of
|
|
||||||
%token FOO <NUM>. Corresponds to yychar in yacc.c.
|
|
||||||
- is_token: 0 or 1
|
|
||||||
Whether this is a terminal symbol.
|
|
||||||
- number: integer
|
|
||||||
The internal number (computed from the external number by yytranslate).
|
|
||||||
Corresponds to yytoken in yacc.c. This is the same number that serves as
|
|
||||||
key in b4_symbol(NUM, FIELD).
|
|
||||||
- has_type: 0, 1
|
|
||||||
Whether has a semantic value.
|
|
||||||
- type_tag: string
|
|
||||||
When api.value.type=union, the generated name for the union member.
|
|
||||||
yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
|
||||||
- type
|
|
||||||
If it has a semantic value, its type tag, or, if variant are used,
|
|
||||||
its type.
|
|
||||||
In the case of api.value.type=union, type is the real type (e.g. int).
|
|
||||||
- has_printer: 0, 1
|
|
||||||
- printer: string
|
|
||||||
- printer_file: string
|
|
||||||
- printer_line: integer
|
|
||||||
If the symbol has a printer, everything about it.
|
|
||||||
- has_destructor, destructor, destructor_file, destructor_line
|
|
||||||
Likewise.
|
|
||||||
|
|
||||||
### b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
|
||||||
Expansion of $$, $1, $<TYPE-TAG>3, etc.
|
|
||||||
|
|
||||||
The semantic value from a given VAL.
|
|
||||||
- `VAL`: some semantic value storage (typically a union). e.g., `yylval`
|
|
||||||
- `SYMBOL-NUM`: the symbol number from which we extract the type tag.
|
|
||||||
- `TYPE-TAG`, the user forced the `<TYPE-TAG>`.
|
|
||||||
|
|
||||||
The result can be used safely, it is put in parens to avoid nasty precedence
|
|
||||||
issues.
|
|
||||||
|
|
||||||
### b4_lhs_value(SYMBOL-NUM, [TYPE])
|
|
||||||
Expansion of `$$` or `$<TYPE>$`, for symbol `SYMBOL-NUM`.
|
|
||||||
|
|
||||||
### b4_rhs_data(RULE-LENGTH, POS)
|
|
||||||
The data corresponding to the symbol `#POS`, where the current rule has
|
|
||||||
`RULE-LENGTH` symbols on RHS.
|
|
||||||
|
|
||||||
### b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
|
||||||
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
|
|
||||||
on RHS.
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: markdown
|
mode: outline
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
# Language-independent M4 Macros for Bison.
|
# Language-independent M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2015, 2018-2019 Free Software Foundation,
|
# Copyright (C) 2002, 2004-2015, 2018 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
|
||||||
@@ -264,8 +263,8 @@ m4_define([b4_subtract],
|
|||||||
# -------------------
|
# -------------------
|
||||||
# Join with comma, skipping empty arguments.
|
# Join with comma, skipping empty arguments.
|
||||||
# b4_join calls itself recursively until it sees the first non-empty
|
# b4_join calls itself recursively until it sees the first non-empty
|
||||||
# argument, then calls _b4_join (i.e., `_$0`) which prepends each
|
# argument, then calls _b4_join which prepends each non-empty argument
|
||||||
# non-empty argument with a comma.
|
# with a comma.
|
||||||
m4_define([b4_join],
|
m4_define([b4_join],
|
||||||
[m4_if([$#$1],
|
[m4_if([$#$1],
|
||||||
[1], [],
|
[1], [],
|
||||||
@@ -375,19 +374,48 @@ b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
|||||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||||
|
|
||||||
|
|
||||||
# b4_glr_cc_if([IF-TRUE], [IF-FALSE])
|
|
||||||
# -----------------------------------
|
|
||||||
m4_define([b4_glr_cc_if],
|
|
||||||
[m4_if(b4_skeleton, ["glr.cc"], $@)])
|
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
## --------- ##
|
||||||
## Symbols. ##
|
## Symbols. ##
|
||||||
## --------- ##
|
## --------- ##
|
||||||
|
|
||||||
# For a description of the Symbol handling, see README.
|
# In order to unify the handling of the various aspects of symbols
|
||||||
|
# (tag, type_name, whether terminal, etc.), bison.exe defines one
|
||||||
|
# macro per (token, field), where field can has_id, id, etc.: see
|
||||||
|
# src/output.c:prepare_symbols_definitions().
|
||||||
#
|
#
|
||||||
# The following macros provide access to symbol related values.
|
# The various FIELDS are:
|
||||||
|
#
|
||||||
|
# - has_id: 0 or 1.
|
||||||
|
# Whether the symbol has an id.
|
||||||
|
# - id: string
|
||||||
|
# If has_id, the id. Guaranteed to be usable as a C identifier.
|
||||||
|
# Prefixed by api.token.prefix if defined.
|
||||||
|
# - tag: string.
|
||||||
|
# A representat of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||||
|
# - user_number: integer
|
||||||
|
# The assigned (external) number as used by yylex.
|
||||||
|
# - is_token: 0 or 1
|
||||||
|
# Whether this is a terminal symbol.
|
||||||
|
# - number: integer
|
||||||
|
# The internalized number (used after yytranslate).
|
||||||
|
# - has_type: 0, 1
|
||||||
|
# Whether has a semantic value.
|
||||||
|
# - type_tag: string
|
||||||
|
# When api.value.type=union, the generated name for the union member.
|
||||||
|
# yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
||||||
|
# - type
|
||||||
|
# If it has a semantic value, its type tag, or, if variant are used,
|
||||||
|
# its type.
|
||||||
|
# In the case of api.value.type=union, type is the real type (e.g. int).
|
||||||
|
# - has_printer: 0, 1
|
||||||
|
# - printer: string
|
||||||
|
# - printer_file: string
|
||||||
|
# - printer_line: integer
|
||||||
|
# If the symbol has a printer, everything about it.
|
||||||
|
# - has_destructor, destructor, destructor_file, destructor_line
|
||||||
|
# Likewise.
|
||||||
|
#
|
||||||
|
# The following macros provide access to these values.
|
||||||
|
|
||||||
# _b4_symbol(NUM, FIELD)
|
# _b4_symbol(NUM, FIELD)
|
||||||
# ----------------------
|
# ----------------------
|
||||||
@@ -440,8 +468,8 @@ m4_define([b4_symbol_action_location],
|
|||||||
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)],
|
||||||
[$1],
|
b4_symbol_if([$1], [has_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])])
|
||||||
@@ -469,7 +497,7 @@ m4_define([b4_symbol_actions],
|
|||||||
m4_ifval(m4_defn([b4_actions_]),
|
m4_ifval(m4_defn([b4_actions_]),
|
||||||
[switch (m4_default([$2], [yytype]))
|
[switch (m4_default([$2], [yytype]))
|
||||||
{
|
{
|
||||||
m4_defn([b4_actions_])[]dnl
|
m4_defn([b4_actions_])
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}dnl
|
}dnl
|
||||||
@@ -480,9 +508,7 @@ m4_popdef([b4_actions_])dnl
|
|||||||
|
|
||||||
# _b4_symbol_case(SYMBOL-NUM)
|
# _b4_symbol_case(SYMBOL-NUM)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# Issue a "case NUM" for SYMBOL-NUM. Ends with its EOL to make it
|
# Issue a "case NUM" for SYMBOL-NUM.
|
||||||
# easier to use with m4_map, but then, use []dnl to suppress the last
|
|
||||||
# one.
|
|
||||||
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])])
|
||||||
])
|
])
|
||||||
@@ -543,7 +569,7 @@ m4_define([b4_token_format],
|
|||||||
# 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(SYMBOL-NUM,
|
# 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],
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# C++ skeleton dispatching for Bison.
|
# C++ skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2019 Free Software
|
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
|
||||||
# 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
|
||||||
@@ -18,10 +18,10 @@
|
|||||||
# 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_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
||||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.cc]])
|
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]])
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||||
|
|
||||||
m4_include(b4_used_skeleton)
|
m4_include(b4_used_skeleton)
|
||||||
+102
-147
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2018 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
|
||||||
@@ -22,10 +22,10 @@ b4_percent_define_ifdef([[api.value.union.name]],
|
|||||||
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
|
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
|
||||||
[named %union is invalid in C++])])
|
[named %union is invalid in C++])])
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c.m4])
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
||||||
b4_percent_define_check_kind([api.parser.class], [code], [deprecated])
|
b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
|
||||||
|
|
||||||
|
|
||||||
## ----- ##
|
## ----- ##
|
||||||
@@ -72,22 +72,6 @@ m4_define([b4_cxx_portability],
|
|||||||
# define YY_MOVE_REF(Type) Type&
|
# define YY_MOVE_REF(Type) Type&
|
||||||
# define YY_RVREF(Type) const Type&
|
# define YY_RVREF(Type) const Type&
|
||||||
# define YY_COPY(Type) const Type&
|
# define YY_COPY(Type) const Type&
|
||||||
#endif
|
|
||||||
|
|
||||||
// Support noexcept when possible.
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
# define YY_NOEXCEPT noexcept
|
|
||||||
# define YY_NOTHROW
|
|
||||||
#else
|
|
||||||
# define YY_NOEXCEPT
|
|
||||||
# define YY_NOTHROW throw ()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Support constexpr when possible.
|
|
||||||
#if 201703 <= YY_CPLUSPLUS
|
|
||||||
# define YY_CONSTEXPR constexpr
|
|
||||||
#else
|
|
||||||
# define YY_CONSTEXPR
|
|
||||||
#endif[]dnl
|
#endif[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -96,7 +80,7 @@ m4_define([b4_cxx_portability],
|
|||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
b4_percent_define_default([[api.parser.class]], [[parser]])
|
b4_percent_define_default([[parser_class_name]], [[parser]])
|
||||||
|
|
||||||
# Don't do that so that we remember whether we're using a user
|
# Don't do that so that we remember whether we're using a user
|
||||||
# request, or the default value.
|
# request, or the default value.
|
||||||
@@ -216,18 +200,7 @@ m4_define([b4_public_types_declare],
|
|||||||
/// Syntax errors thrown from user actions.
|
/// Syntax errors thrown from user actions.
|
||||||
struct syntax_error : std::runtime_error
|
struct syntax_error : std::runtime_error
|
||||||
{
|
{
|
||||||
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m);]b4_locations_if([
|
||||||
: std::runtime_error (m)]b4_locations_if([
|
|
||||||
, location (l)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
syntax_error (const syntax_error& s)
|
|
||||||
: std::runtime_error (s.what ())]b4_locations_if([
|
|
||||||
, location (s.location)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
~syntax_error () YY_NOEXCEPT YY_NOTHROW;]b4_locations_if([
|
|
||||||
|
|
||||||
location_type location;])[
|
location_type location;])[
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -251,11 +224,11 @@ m4_define([b4_public_types_declare],
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_type_define
|
# b4_symbol_type_declare
|
||||||
# ---------------------
|
# ----------------------
|
||||||
# Define symbol_type, the external type for symbols used for symbol
|
# Define symbol_type, the external type for symbols used for symbol
|
||||||
# constructors.
|
# constructors.
|
||||||
m4_define([b4_symbol_type_define],
|
m4_define([b4_symbol_type_declare],
|
||||||
[[ /// A complete symbol.
|
[[ /// 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
|
||||||
@@ -269,21 +242,14 @@ m4_define([b4_symbol_type_define],
|
|||||||
typedef Base super_type;
|
typedef Base super_type;
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
basic_symbol ()
|
basic_symbol ();
|
||||||
: value ()]b4_locations_if([
|
|
||||||
, location ()])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
/// Move or copy constructor.
|
||||||
/// Move constructor.
|
basic_symbol (YY_RVREF (basic_symbol) other);
|
||||||
basic_symbol (basic_symbol&& that);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Copy constructor.
|
|
||||||
basic_symbol (const basic_symbol& that);]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_define])], [[
|
]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])[);
|
YY_MOVE_REF (location_type) l])[);
|
||||||
@@ -291,35 +257,16 @@ m4_define([b4_symbol_type_define],
|
|||||||
/// 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([,
|
YY_RVREF (semantic_type) v]b4_locations_if([,
|
||||||
YY_RVREF (location_type) l])[);
|
YY_RVREF (location_type) l])[);]])[
|
||||||
]])[
|
|
||||||
/// Destroy the symbol.
|
/// Destroy the symbol.
|
||||||
~basic_symbol ()
|
~basic_symbol ();
|
||||||
{
|
|
||||||
clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Destroy contents, and record that is empty.
|
/// Destroy contents, and record that is empty.
|
||||||
void clear ()
|
void clear ();
|
||||||
{]b4_variant_if([[
|
|
||||||
// User destructor.
|
|
||||||
symbol_number_type yytype = this->type_get ();
|
|
||||||
basic_symbol<Base>& yysym = *this;
|
|
||||||
(void) yysym;
|
|
||||||
switch (yytype)
|
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type destructor.
|
|
||||||
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
|
||||||
Base::clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether empty.
|
/// Whether empty.
|
||||||
bool empty () const YY_NOEXCEPT;
|
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);
|
||||||
@@ -333,7 +280,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
private:
|
private:
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
/// Assignment operator.
|
/// Assignment operator.
|
||||||
basic_symbol& operator= (const basic_symbol& that);
|
basic_symbol& operator= (const basic_symbol& other);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -343,13 +290,8 @@ m4_define([b4_symbol_type_define],
|
|||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
by_type ();
|
by_type ();
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Move constructor.
|
|
||||||
by_type (by_type&& that);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Copy constructor.
|
/// Copy constructor.
|
||||||
by_type (const by_type& that);
|
by_type (const by_type& other);
|
||||||
|
|
||||||
/// The symbol type as needed by the constructor.
|
/// The symbol type as needed by the constructor.
|
||||||
typedef token_type kind_type;
|
typedef token_type kind_type;
|
||||||
@@ -365,10 +307,10 @@ m4_define([b4_symbol_type_define],
|
|||||||
|
|
||||||
/// The (internal) type number (corresponding to \a type).
|
/// The (internal) type number (corresponding to \a type).
|
||||||
/// \a empty when empty.
|
/// \a empty when empty.
|
||||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
symbol_number_type type_get () const;
|
||||||
|
|
||||||
/// The token.
|
/// The token.
|
||||||
token_type token () const YY_NOEXCEPT;
|
token_type token () const;
|
||||||
|
|
||||||
/// The symbol type.
|
/// The symbol type.
|
||||||
/// \a empty_symbol when empty.
|
/// \a empty_symbol when empty.
|
||||||
@@ -377,17 +319,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
/// "External" symbols: returned by the scanner.
|
||||||
struct symbol_type : basic_symbol<by_type>
|
typedef basic_symbol<by_type> symbol_type;
|
||||||
{]b4_variant_if([[
|
|
||||||
/// Superclass.
|
|
||||||
typedef basic_symbol<by_type> super_type;
|
|
||||||
|
|
||||||
/// Empty symbol.
|
|
||||||
symbol_type () {}
|
|
||||||
|
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
|
||||||
]b4_type_foreach([_b4_token_constructor_define])dnl
|
|
||||||
])[};
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -395,33 +327,34 @@ m4_define([b4_symbol_type_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],
|
||||||
[[ // basic_symbol.
|
[ b4_inline([$1])b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
: std::runtime_error (m)]b4_locations_if([
|
||||||
|
, location (l)])[
|
||||||
|
{}
|
||||||
|
|
||||||
|
// basic_symbol.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
|
||||||
: Base (std::move (that))
|
: value ()]b4_locations_if([
|
||||||
, value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
|
, location ()])[
|
||||||
, location (std::move (that.location))])[
|
{}
|
||||||
{]b4_variant_if([
|
|
||||||
b4_symbol_variant([this->type_get ()], [value], [move],
|
|
||||||
[std::move (that.value)])
|
|
||||||
])[}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (YY_RVREF (basic_symbol) other)
|
||||||
: Base (that)
|
: Base (YY_MOVE (other))
|
||||||
, value (]b4_variant_if([], [that.value]))b4_locations_if([
|
, value (]b4_variant_if([], [YY_MOVE (other.value)]))b4_locations_if([
|
||||||
, location (that.location)])[
|
, location (YY_MOVE (other.location))])[
|
||||||
{]b4_variant_if([
|
{]b4_variant_if([
|
||||||
b4_symbol_variant([this->type_get ()], [value], [copy],
|
b4_symbol_variant([other.type_get ()], [value], [YY_MOVE_OR_COPY],
|
||||||
[YY_MOVE (that.value)])
|
[YY_MOVE (other.value)])])[
|
||||||
])[}
|
}
|
||||||
|
|
||||||
]b4_variant_if([], [[
|
]b4_variant_if([[
|
||||||
|
// Implementation of basic_symbol constructor for each type.
|
||||||
|
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
||||||
/// Constructor for valueless symbols.
|
/// Constructor for valueless symbols.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::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([YY_MOVE_REF (location_type) l]))[)
|
||||||
: Base (t)
|
: Base (t)
|
||||||
@@ -430,7 +363,7 @@ m4_define([b4_public_types_define],
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::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],
|
||||||
[YY_RVREF (semantic_type) v],
|
[YY_RVREF (semantic_type) v],
|
||||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
b4_locations_if([YY_RVREF (location_type) l]))[)
|
||||||
@@ -441,16 +374,42 @@ m4_define([b4_public_types_define],
|
|||||||
(void) v;
|
(void) v;
|
||||||
]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
||||||
|
|
||||||
|
template <typename Base>
|
||||||
|
]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([[
|
||||||
|
// User destructor.
|
||||||
|
symbol_number_type yytype = this->type_get ();
|
||||||
|
basic_symbol<Base>& yysym = *this;
|
||||||
|
(void) yysym;
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type destructor.
|
||||||
|
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
||||||
|
Base::clear ();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
]b4_parser_class_name[::basic_symbol<Base>::empty () const
|
||||||
{
|
{
|
||||||
return Base::type_get () == empty_symbol;
|
return Base::type_get () == empty_symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
void
|
void
|
||||||
]b4_parser_class[::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],
|
||||||
@@ -460,47 +419,39 @@ m4_define([b4_public_types_define],
|
|||||||
}
|
}
|
||||||
|
|
||||||
// by_type.
|
// by_type.
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type ()
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type ()
|
||||||
: type (empty_symbol)
|
: type (empty_symbol)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (by_type&& that)
|
: type (other.type)
|
||||||
: type (that.type)
|
|
||||||
{
|
|
||||||
that.clear ();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (const by_type& that)
|
|
||||||
: type (that.type)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (token_type t)
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
|
||||||
: type (yytranslate_ (t))
|
: type (yytranslate_ (t))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class[::by_type::clear ()
|
]b4_parser_class_name[::by_type::clear ()
|
||||||
{
|
{
|
||||||
type = empty_symbol;
|
type = empty_symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class[::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.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[int
|
]b4_inline([$1])[int
|
||||||
]b4_parser_class[::by_type::type_get () const YY_NOEXCEPT
|
]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[::token_type
|
]b4_inline([$1])b4_parser_class_name[::token_type
|
||||||
]b4_parser_class[::by_type::token () const YY_NOEXCEPT
|
]b4_parser_class_name[::by_type::token () const
|
||||||
{
|
{
|
||||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
||||||
// (internal) symbol number NUM (which must be that of a token). */
|
// (internal) symbol number NUM (which must be that of a token). */
|
||||||
@@ -510,17 +461,20 @@ m4_define([b4_public_types_define],
|
|||||||
{
|
{
|
||||||
]b4_toknum[
|
]b4_toknum[
|
||||||
};
|
};
|
||||||
return token_type (yytoken_number_[type]);
|
return static_cast<token_type> (yytoken_number_[type]);
|
||||||
}
|
}
|
||||||
]])[]dnl
|
]])[]dnl
|
||||||
])
|
|
||||||
|
b4_symbol_constructor_define])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_constructor_define
|
# b4_symbol_constructor_declare
|
||||||
# ----------------------------
|
# b4_symbol_constructor_define
|
||||||
# Define symbol constructors for all the value types.
|
# -----------------------------
|
||||||
|
# Declare/define symbol constructors for all the value types.
|
||||||
# Use at class-level. Redefined in variant.hh.
|
# Use at class-level. Redefined in variant.hh.
|
||||||
m4_define([b4_token_constructor_define], [])
|
m4_define([b4_symbol_constructor_declare], [])
|
||||||
|
m4_define([b4_symbol_constructor_define], [])
|
||||||
|
|
||||||
|
|
||||||
# b4_yytranslate_define(cc|hh)
|
# b4_yytranslate_define(cc|hh)
|
||||||
@@ -528,17 +482,16 @@ m4_define([b4_token_constructor_define], [])
|
|||||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
||||||
# sometimes in the cc file.
|
# sometimes in the cc file.
|
||||||
m4_define([b4_yytranslate_define],
|
m4_define([b4_yytranslate_define],
|
||||||
[ b4_inline([$1])b4_parser_class[::token_number_type
|
[[ // Symbol number corresponding to token number t.
|
||||||
]b4_parser_class[::yytranslate_ (]b4_token_ctor_if([token_type],
|
]b4_inline([$1])b4_parser_class_name[::token_number_type
|
||||||
|
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
|
||||||
[int])[ t)
|
[int])[ t)
|
||||||
{
|
{
|
||||||
// YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
|
||||||
// TOKEN-NUM as returned by yylex.
|
|
||||||
static
|
static
|
||||||
const token_number_type
|
const token_number_type
|
||||||
translate_table[] =
|
translate_table[] =
|
||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
const unsigned user_token_number_max_ = ]b4_user_token_number_max[;
|
const unsigned 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[;
|
||||||
@@ -555,13 +508,15 @@ m4_define([b4_yytranslate_define],
|
|||||||
|
|
||||||
# b4_lhs_value([TYPE])
|
# b4_lhs_value([TYPE])
|
||||||
# --------------------
|
# --------------------
|
||||||
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value([yyval], [$1])])
|
[b4_symbol_value([yyval], [$1])])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# FIXME: Dead code.
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
|
[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
|
||||||
|
|
||||||
@@ -573,9 +528,9 @@ m4_define([b4_lhs_location],
|
|||||||
[(yyloc)])
|
[(yyloc)])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, POS)
|
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||||
# on RHS.
|
# on RHS.
|
||||||
m4_define([b4_rhs_location],
|
m4_define([b4_rhs_location],
|
||||||
[(yylocation_stack_@{($1) - ($2)@})])
|
[(yylocation_stack_@{($1) - ($2)@})])
|
||||||
@@ -648,7 +603,7 @@ m4_define([b4_yylloc_default_define],
|
|||||||
{ \
|
{ \
|
||||||
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
||||||
} \
|
} \
|
||||||
while (false)
|
while (/*CONSTCOND*/ false)
|
||||||
# endif
|
# endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -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-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2015, 2018 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
|
||||||
@@ -39,26 +39,25 @@ m4_define([b4_comment],
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_dollar_dollar(VALUE, SYMBOL-NUM, 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)" if 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],
|
||||||
[$2],
|
m4_if([$2], [[]],
|
||||||
m4_if([$3], [[]],
|
[[$3]], [[$2]]))])
|
||||||
[[$4]], [[$3]]))])
|
|
||||||
|
|
||||||
# b4_dollar_pushdef(VALUE-POINTER, SYMBOL-NUM, [TYPE_TAG], LOCATION)
|
# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
|
||||||
# b4_dollar_popdef
|
# b4_dollar_popdef
|
||||||
# ------------------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Define b4_dollar_dollar for VALUE-POINTER and DEFAULT-FIELD,
|
# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
|
||||||
# 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], [$2], m4_dquote($][1), [$3])])dnl
|
[_b4_dollar_dollar([$1], m4_dquote($][1), [$2])])dnl
|
||||||
m4_pushdef([b4_at_dollar], [$4])dnl
|
m4_pushdef([b4_at_dollar], [$3])dnl
|
||||||
])
|
])
|
||||||
m4_define([b4_dollar_popdef],
|
m4_define([b4_dollar_popdef],
|
||||||
[m4_popdef([b4_at_dollar])dnl
|
[m4_popdef([b4_at_dollar])dnl
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# C skeleton dispatching for Bison.
|
# C skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2019 Free Software
|
# Copyright (C) 2006-2007, 2009-2015, 2018 Free Software Foundation,
|
||||||
# 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
|
||||||
@@ -18,10 +18,10 @@
|
|||||||
# 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_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
b4_glr_if( [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
||||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.c]])])
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[yacc.c]])
|
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[yacc.c]])
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||||
|
|
||||||
m4_include(b4_used_skeleton)
|
m4_include(b4_used_skeleton)
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
# C M4 Macros for Bison.
|
# C M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2015, 2018-2019 Free Software Foundation,
|
# Copyright (C) 2002, 2004-2015, 2018 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
|
||||||
@@ -18,7 +17,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/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
m4_include(b4_pkgdatadir/[c-like.m4])
|
||||||
|
|
||||||
# b4_tocpp(STRING)
|
# b4_tocpp(STRING)
|
||||||
# ----------------
|
# ----------------
|
||||||
@@ -374,17 +373,15 @@ m4_define([b4_token_enums_defines],
|
|||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
# b4_symbol_value(VAL, [TYPE])
|
||||||
# ----------------------------------------------
|
# ----------------------------
|
||||||
# See README.
|
# 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
|
||||||
|
# used safely, it is put in parens to avoid nasty precedence issues.
|
||||||
|
# TYPE is *not* put in braces, provide some if needed.
|
||||||
m4_define([b4_symbol_value],
|
m4_define([b4_symbol_value],
|
||||||
[m4_ifval([$3],
|
[($1[]m4_ifval([$2], [.$2]))])
|
||||||
[($1.$3)],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[($1.b4_symbol([$2], [type]))],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------------- ##
|
## ---------------------- ##
|
||||||
@@ -607,17 +604,14 @@ m4_define([b4_type_define_tag],
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value_union(VAL, SYMBOL-NUM, [TYPE])
|
# b4_symbol_value_union(VAL, [TYPE])
|
||||||
# ----------------------------------------------
|
# ----------------------------------
|
||||||
# Same of b4_symbol_value, but when api.value.type=union.
|
# Same of b4_symbol_value, but when api.value.type=union.
|
||||||
m4_define([b4_symbol_value_union],
|
m4_define([b4_symbol_value_union],
|
||||||
[m4_ifval([$3],
|
[m4_ifval([$2],
|
||||||
[(*($3*)(&$1))],
|
[(*($2*)(&$1))],
|
||||||
[m4_ifval([$2],
|
[$1])])
|
||||||
[b4_symbol_if([$2], [has_type],
|
])
|
||||||
[($1.b4_symbol([$2], [type_tag]))],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_setup_union
|
# b4_value_type_setup_union
|
||||||
+110
-135
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# GLR skeleton for Bison
|
# GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 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
|
||||||
@@ -21,8 +21,7 @@
|
|||||||
# If we are loaded by glr.cc, do not override c++.m4 definitions by
|
# If we are loaded by glr.cc, do not override c++.m4 definitions by
|
||||||
# those of c.m4.
|
# those of c.m4.
|
||||||
m4_if(b4_skeleton, ["glr.c"],
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
[m4_include(b4_skeletonsdir/[c.m4])])
|
[m4_include(b4_pkgdatadir/[c.m4])])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
@@ -97,7 +96,6 @@ m4_define([b4_pure_formals],
|
|||||||
|
|
||||||
# b4_locuser_formals(LOC = yylocp)
|
# b4_locuser_formals(LOC = yylocp)
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# User formal arguments, possibly preceded by location argument.
|
|
||||||
m4_define([b4_locuser_formals],
|
m4_define([b4_locuser_formals],
|
||||||
[b4_locations_if([, YYLTYPE *m4_default([$1], [yylocp])])[]b4_user_formals])
|
[b4_locations_if([, YYLTYPE *m4_default([$1], [yylocp])])[]b4_user_formals])
|
||||||
|
|
||||||
@@ -114,25 +112,27 @@ m4_define([b4_locuser_args],
|
|||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
# b4_lhs_value([TYPE])
|
||||||
# --------------------------------
|
# --------------------
|
||||||
# See README.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value([(*yyvalp)], [$1], [$2])])
|
[b4_symbol_value([(*yyvalp)], [$1])])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_data(RULE-LENGTH, POS)
|
# b4_rhs_data(RULE-LENGTH, NUM)
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# See README.
|
# Expand to the semantic stack place that contains value and location
|
||||||
|
# of symbol number NUM in a rule of length RULE-LENGTH.
|
||||||
m4_define([b4_rhs_data],
|
m4_define([b4_rhs_data],
|
||||||
[((yyGLRStackItem const *)yyvsp)@{YYFILL (b4_subtract([$2], [$1]))@}.yystate])
|
[((yyGLRStackItem const *)yyvsp)@{YYFILL (b4_subtract([$2], [$1]))@}.yystate])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
# --------------------------------------------------
|
# --------------------------------------
|
||||||
# Expansion of $$ or $<TYPE>$, for symbol SYMBOL-NUM.
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yysval], [$3], [$4])])
|
[b4_symbol_value([b4_rhs_data([$1], [$2]).yysemantics.yysval], [$3])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -194,11 +194,11 @@ m4_if(b4_skeleton, ["glr.c"],
|
|||||||
# ----------------- #
|
# ----------------- #
|
||||||
|
|
||||||
# glr.cc produces its own header.
|
# glr.cc produces its own header.
|
||||||
b4_glr_cc_if([],
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
[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-2019])[
|
[2002-2015, 2018])[
|
||||||
]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])[
|
||||||
@@ -212,7 +212,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
|||||||
|
|
||||||
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-2019])[
|
[2002-2015, 2018])[
|
||||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||||
|
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
@@ -228,7 +228,8 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
|||||||
#define yyparse ]b4_prefix[parse
|
#define yyparse ]b4_prefix[parse
|
||||||
#define yylex ]b4_prefix[lex
|
#define yylex ]b4_prefix[lex
|
||||||
#define yyerror ]b4_prefix[error
|
#define yyerror ]b4_prefix[error
|
||||||
#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[
|
#define yydebug ]b4_prefix[debug
|
||||||
|
]]b4_pure_if([], [[
|
||||||
#define yylval ]b4_prefix[lval
|
#define yylval ]b4_prefix[lval
|
||||||
#define yychar ]b4_prefix[char
|
#define yychar ]b4_prefix[char
|
||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
@@ -327,7 +328,7 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
|||||||
#define YYNNTS ]b4_nterms_number[
|
#define YYNNTS ]b4_nterms_number[
|
||||||
/* YYNRULES -- Number of rules. */
|
/* YYNRULES -- Number of rules. */
|
||||||
#define YYNRULES ]b4_rules_number[
|
#define YYNRULES ]b4_rules_number[
|
||||||
/* YYNSTATES -- Number of states. */
|
/* YYNRULES -- Number of states. */
|
||||||
#define YYNSTATES ]b4_states_number[
|
#define YYNSTATES ]b4_states_number[
|
||||||
/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */
|
/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */
|
||||||
#define YYMAXRHS ]b4_r2_max[
|
#define YYMAXRHS ]b4_r2_max[
|
||||||
@@ -335,22 +336,14 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
|||||||
accessed by $0, $-1, etc., in any rule. */
|
accessed by $0, $-1, etc., in any rule. */
|
||||||
#define YYMAXLEFT ]b4_max_left_semantic_context[
|
#define YYMAXLEFT ]b4_max_left_semantic_context[
|
||||||
|
|
||||||
/* YYMAXUTOK -- Last valid token number (for yychar). */
|
/* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */
|
||||||
#define YYMAXUTOK ]b4_user_token_number_max[]b4_glr_cc_if([[
|
|
||||||
/* YYFAULTYTOK -- Token number (for yychar) that denotes a
|
|
||||||
syntax_error thrown from the scanner. */
|
|
||||||
#define YYFAULTYTOK (YYMAXUTOK + 1)]])[
|
|
||||||
/* YYUNDEFTOK -- Symbol number (for yytoken) that denotes an unknown
|
|
||||||
token. */
|
|
||||||
#define YYUNDEFTOK ]b4_undef_token_number[
|
#define YYUNDEFTOK ]b4_undef_token_number[
|
||||||
|
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||||
|
|
||||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
|
||||||
#define YYTRANSLATE(YYX) \
|
#define YYTRANSLATE(YYX) \
|
||||||
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||||
|
|
||||||
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||||||
as returned by yylex. */
|
|
||||||
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
@@ -590,10 +583,7 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
case '\\':
|
case '\\':
|
||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
else
|
/* Fall through. */
|
||||||
goto append;
|
|
||||||
|
|
||||||
append:
|
|
||||||
default:
|
default:
|
||||||
if (yyres)
|
if (yyres)
|
||||||
yyres[yyn] = *yyp;
|
yyres[yyn] = *yyp;
|
||||||
@@ -649,7 +639,7 @@ struct yyGLRState {
|
|||||||
size_t yyposn;
|
size_t yyposn;
|
||||||
union {
|
union {
|
||||||
/** First in a chain of alternative reductions producing the
|
/** First in a chain of alternative reductions producing the
|
||||||
* nonterminal corresponding to this state, threaded through
|
* non-terminal corresponding to this state, threaded through
|
||||||
* yynext. */
|
* yynext. */
|
||||||
yySemanticOption* yyfirstVal;
|
yySemanticOption* yyfirstVal;
|
||||||
/** Semantic value for this state. */
|
/** Semantic value for this state. */
|
||||||
@@ -768,50 +758,6 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
]m4_define([b4_yygetToken_call],
|
|
||||||
[[yygetToken (&yychar][]b4_pure_if([, yystackp])[]b4_user_args[)]])[
|
|
||||||
/** If yychar is empty, fetch the next token. */
|
|
||||||
static inline yySymbol
|
|
||||||
yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals[)
|
|
||||||
{
|
|
||||||
yySymbol yytoken;
|
|
||||||
]b4_parse_param_use()dnl
|
|
||||||
[ if (*yycharp == YYEMPTY)
|
|
||||||
{
|
|
||||||
YYDPRINTF ((stderr, "Reading a token: "));]b4_glr_cc_if([[
|
|
||||||
#if YY_EXCEPTIONS
|
|
||||||
try
|
|
||||||
{
|
|
||||||
#endif // YY_EXCEPTIONS
|
|
||||||
*yycharp = ]b4_lex[;
|
|
||||||
#if YY_EXCEPTIONS
|
|
||||||
}
|
|
||||||
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
|
|
||||||
{
|
|
||||||
YYDPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([
|
|
||||||
yylloc = yyexc.location;])[
|
|
||||||
yyerror (]b4_lyyerror_args[yyexc.what ());
|
|
||||||
// Map errors caught in the scanner to the undefined token
|
|
||||||
// (YYUNDEFTOK), so that error handling is started.
|
|
||||||
// However, record this with this special value of yychar.
|
|
||||||
*yycharp = YYFAULTYTOK;
|
|
||||||
}
|
|
||||||
#endif // YY_EXCEPTIONS]], [[
|
|
||||||
*yycharp = ]b4_lex[;]])[
|
|
||||||
}
|
|
||||||
if (*yycharp <= YYEOF)
|
|
||||||
{
|
|
||||||
*yycharp = yytoken = YYEOF;
|
|
||||||
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yytoken = YYTRANSLATE (*yycharp);
|
|
||||||
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
|
||||||
}
|
|
||||||
return yytoken;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
|
/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
|
||||||
* 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. */
|
||||||
@@ -869,27 +815,12 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
/* Default location. */
|
/* 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;
|
||||||
]])[]b4_glr_cc_if([[
|
]])[
|
||||||
#if YY_EXCEPTIONS
|
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::syntax_error syntax_error;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
#endif // YY_EXCEPTIONS]])[
|
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
]b4_user_actions[
|
]b4_user_actions[
|
||||||
default: break;
|
default: break;
|
||||||
}]b4_glr_cc_if([[
|
|
||||||
#if YY_EXCEPTIONS
|
|
||||||
}
|
|
||||||
catch (const syntax_error& yyexc)
|
|
||||||
{
|
|
||||||
YYDPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([
|
|
||||||
*yylocp = yyexc.location;])[
|
|
||||||
yyerror (]b4_yyerror_args[yyexc.what ());
|
|
||||||
YYERROR;
|
|
||||||
}
|
}
|
||||||
#endif // YY_EXCEPTIONS]])[
|
|
||||||
|
|
||||||
return yyok;
|
return yyok;
|
||||||
# undef yyerrok
|
# undef yyerrok
|
||||||
@@ -986,7 +917,7 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
#define yytable_value_is_error(Yytable_value) \
|
#define yytable_value_is_error(Yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
/** The action to take in YYSTATE on seeing YYTOKEN.
|
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
||||||
* Result R means
|
* Result R means
|
||||||
* R < 0: Reduce on rule -R.
|
* R < 0: Reduce on rule -R.
|
||||||
* R = 0: Error.
|
* R = 0: Error.
|
||||||
@@ -994,25 +925,26 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
* Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list
|
* Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list
|
||||||
* of conflicting reductions.
|
* of conflicting reductions.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline void
|
||||||
yygetLRActions (yyStateNum yystate, yySymbol yytoken, const short** yyconflicts)
|
yygetLRActions (yyStateNum yystate, int yytoken,
|
||||||
|
int* yyaction, const short** yyconflicts)
|
||||||
{
|
{
|
||||||
int yyindex = yypact[yystate] + yytoken;
|
int yyindex = yypact[yystate] + yytoken;
|
||||||
if (yyisDefaultedState (yystate)
|
if (yyisDefaultedState (yystate)
|
||||||
|| yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
|| yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
||||||
{
|
{
|
||||||
|
*yyaction = -yydefact[yystate];
|
||||||
*yyconflicts = yyconfl;
|
*yyconflicts = yyconfl;
|
||||||
return -yydefact[yystate];
|
|
||||||
}
|
}
|
||||||
else if (! yytable_value_is_error (yytable[yyindex]))
|
else if (! yytable_value_is_error (yytable[yyindex]))
|
||||||
{
|
{
|
||||||
|
*yyaction = yytable[yyindex];
|
||||||
*yyconflicts = yyconfl + yyconflp[yyindex];
|
*yyconflicts = yyconfl + yyconflp[yyindex];
|
||||||
return yytable[yyindex];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*yyaction = 0;
|
||||||
*yyconflicts = yyconfl + yyconflp[yyindex];
|
*yyconflicts = yyconfl + yyconflp[yyindex];
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1322,10 +1254,10 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
# define YY_REDUCE_PRINT(Args)
|
# define YY_REDUCE_PRINT(Args)
|
||||||
#else
|
#else
|
||||||
# define YY_REDUCE_PRINT(Args) \
|
# define YY_REDUCE_PRINT(Args) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_reduce_print Args; \
|
yy_reduce_print Args; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*----------------------------------------------------------------------.
|
/*----------------------------------------------------------------------.
|
||||||
| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
|
| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
|
||||||
@@ -1986,8 +1918,24 @@ yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
|||||||
const short* yyconflicts;
|
const short* yyconflicts;
|
||||||
|
|
||||||
yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
|
yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
|
||||||
yytoken = ]b4_yygetToken_call[;
|
if (yychar == YYEMPTY)
|
||||||
yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
|
{
|
||||||
|
YYDPRINTF ((stderr, "Reading a token: "));
|
||||||
|
yychar = ]b4_lex[;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yychar <= YYEOF)
|
||||||
|
{
|
||||||
|
yychar = yytoken = YYEOF;
|
||||||
|
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yytoken = YYTRANSLATE (yychar);
|
||||||
|
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
||||||
|
}
|
||||||
|
|
||||||
|
yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts);
|
||||||
|
|
||||||
while (*yyconflicts != 0)
|
while (*yyconflicts != 0)
|
||||||
{
|
{
|
||||||
@@ -2186,13 +2134,15 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
static void
|
static void
|
||||||
yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
|
size_t yyk;
|
||||||
|
int yyj;
|
||||||
|
|
||||||
if (yystackp->yyerrState == 3)
|
if (yystackp->yyerrState == 3)
|
||||||
/* We just shifted the error token and (perhaps) took some
|
/* We just shifted the error token and (perhaps) took some
|
||||||
reductions. Skip tokens until we can proceed. */
|
reductions. Skip tokens until we can proceed. */
|
||||||
while (yytrue)
|
while (yytrue)
|
||||||
{
|
{
|
||||||
yySymbol yytoken;
|
yySymbol yytoken;
|
||||||
int yyj;
|
|
||||||
if (yychar == YYEOF)
|
if (yychar == YYEOF)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
@@ -2207,9 +2157,19 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yytoken = YYTRANSLATE (yychar);
|
yytoken = YYTRANSLATE (yychar);
|
||||||
yydestruct ("Error: discarding",
|
yydestruct ("Error: discarding",
|
||||||
yytoken, &yylval]b4_locuser_args([&yylloc])[);
|
yytoken, &yylval]b4_locuser_args([&yylloc])[);
|
||||||
yychar = YYEMPTY;
|
|
||||||
}
|
}
|
||||||
yytoken = ]b4_yygetToken_call[;
|
YYDPRINTF ((stderr, "Reading a token: "));
|
||||||
|
yychar = ]b4_lex[;
|
||||||
|
if (yychar <= YYEOF)
|
||||||
|
{
|
||||||
|
yychar = yytoken = YYEOF;
|
||||||
|
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yytoken = YYTRANSLATE (yychar);
|
||||||
|
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
||||||
|
}
|
||||||
yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
|
yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
|
||||||
if (yypact_value_is_default (yyj))
|
if (yypact_value_is_default (yyj))
|
||||||
return;
|
return;
|
||||||
@@ -2224,25 +2184,22 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Reduce to one stack. */
|
/* Reduce to one stack. */
|
||||||
{
|
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
size_t yyk;
|
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
break;
|
||||||
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
if (yyk >= yystackp->yytops.yysize)
|
||||||
break;
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
if (yyk >= yystackp->yytops.yysize)
|
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
yyremoveDeletes (yystackp);
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yycompressStack (yystackp);
|
||||||
yyremoveDeletes (yystackp);
|
|
||||||
yycompressStack (yystackp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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_NULLPTR)
|
||||||
{
|
{
|
||||||
yyGLRState *yys = yystackp->yytops.yystates[0];
|
yyGLRState *yys = yystackp->yytops.yystates[0];
|
||||||
int yyj = yypact[yys->yylrState];
|
yyj = yypact[yys->yylrState];
|
||||||
if (! yypact_value_is_default (yyj))
|
if (! yypact_value_is_default (yyj))
|
||||||
{
|
{
|
||||||
yyj += YYTERROR;
|
yyj += YYTERROR;
|
||||||
@@ -2306,7 +2263,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yylval = yyval_default;]b4_locations_if([
|
yylval = yyval_default;]b4_locations_if([
|
||||||
yylloc = yyloc_default;])[
|
yylloc = yyloc_default;])[
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
|
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef])[]dnl
|
b4_dollar_popdef])[]dnl
|
||||||
[
|
[
|
||||||
@@ -2330,13 +2287,17 @@ b4_dollar_popdef])[]dnl
|
|||||||
/* Standard mode */
|
/* Standard mode */
|
||||||
while (yytrue)
|
while (yytrue)
|
||||||
{
|
{
|
||||||
|
yyRuleNum yyrule;
|
||||||
|
int yyaction;
|
||||||
|
const short* 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));
|
||||||
if (yystate == YYFINAL)
|
if (yystate == YYFINAL)
|
||||||
goto yyacceptlab;
|
goto yyacceptlab;
|
||||||
if (yyisDefaultedState (yystate))
|
if (yyisDefaultedState (yystate))
|
||||||
{
|
{
|
||||||
yyRuleNum yyrule = yydefaultAction (yystate);
|
yyrule = yydefaultAction (yystate);
|
||||||
if (yyrule == 0)
|
if (yyrule == 0)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||||
@@ -2347,9 +2308,25 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yySymbol yytoken = ]b4_yygetToken_call;[
|
yySymbol yytoken;
|
||||||
const short* yyconflicts;
|
if (yychar == YYEMPTY)
|
||||||
int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
|
{
|
||||||
|
YYDPRINTF ((stderr, "Reading a token: "));
|
||||||
|
yychar = ]b4_lex[;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (yychar <= YYEOF)
|
||||||
|
{
|
||||||
|
yychar = yytoken = YYEOF;
|
||||||
|
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yytoken = YYTRANSLATE (yychar);
|
||||||
|
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
||||||
|
}
|
||||||
|
|
||||||
|
yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts);
|
||||||
if (*yyconflicts != 0)
|
if (*yyconflicts != 0)
|
||||||
break;
|
break;
|
||||||
if (yyisShiftAction (yyaction))
|
if (yyisShiftAction (yyaction))
|
||||||
@@ -2363,11 +2340,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
else if (yyisErrorAction (yyaction))
|
else if (yyisErrorAction (yyaction))
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[]b4_glr_cc_if([[
|
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||||
/* Don't issue an error message again for exceptions
|
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||||
thrown from the scanner. */
|
|
||||||
if (yychar != YYFAULTYTOK)
|
|
||||||
]])[ yyreportSyntaxError (&yystack]b4_user_args[);
|
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2427,9 +2401,10 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyposn += 1;
|
yyposn += 1;
|
||||||
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
||||||
{
|
{
|
||||||
yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState;
|
int yyaction;
|
||||||
const short* yyconflicts;
|
const short* yyconflicts;
|
||||||
int yyaction = yygetLRActions (yystate, yytoken_to_shift,
|
yyStateNum yystate = yystack.yytops.yystates[yys]->yylrState;
|
||||||
|
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) yys));
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# C++ GLR skeleton for Bison
|
# C++ GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 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
|
||||||
@@ -46,11 +46,11 @@
|
|||||||
# We require a pure interface.
|
# We require a pure interface.
|
||||||
m4_define([b4_pure_flag], [1])
|
m4_define([b4_pure_flag], [1])
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
b4_bison_locations_if([m4_include(b4_skeletonsdir/[location.cc])])
|
b4_bison_locations_if([m4_include(b4_pkgdatadir/[location.cc])])
|
||||||
|
|
||||||
m4_define([b4_parser_class],
|
m4_define([b4_parser_class_name],
|
||||||
[b4_percent_define_get([[api.parser.class]])])
|
[b4_percent_define_get([[parser_class_name]])])
|
||||||
|
|
||||||
# Save the parse parameters.
|
# Save the parse parameters.
|
||||||
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||||
@@ -60,10 +60,10 @@ m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
|||||||
# New ones.
|
# New ones.
|
||||||
m4_ifset([b4_parse_param],
|
m4_ifset([b4_parse_param],
|
||||||
[m4_define([b4_parse_param_wrap],
|
[m4_define([b4_parse_param_wrap],
|
||||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]],]
|
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
|
||||||
m4_defn([b4_parse_param]))],
|
m4_defn([b4_parse_param]))],
|
||||||
[m4_define([b4_parse_param_wrap],
|
[m4_define([b4_parse_param_wrap],
|
||||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
|
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -81,10 +81,10 @@ m4_define([b4_yy_symbol_print_define],
|
|||||||
[static void],
|
[static void],
|
||||||
[[FILE *], []],
|
[[FILE *], []],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
[[const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
|
||||||
[yyvaluep]][]dnl
|
[yyvaluep]][]dnl
|
||||||
b4_locations_if([,
|
b4_locations_if([,
|
||||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]]]),
|
[yylocationp]]]),
|
||||||
b4_parse_param)[
|
b4_parse_param)[
|
||||||
{
|
{
|
||||||
@@ -98,15 +98,18 @@ b4_locations_if([,
|
|||||||
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
||||||
m4_defn([b4_initial_action])]))])[
|
m4_defn([b4_initial_action])]))])[
|
||||||
|
|
||||||
# Hijack the post prologue to declare yyerror.
|
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
||||||
|
# and declaration of yyerror.
|
||||||
]m4_append([b4_post_prologue],
|
]m4_append([b4_post_prologue],
|
||||||
[b4_syncline([@oline@], [@ofile@])[
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
|
]b4_yylloc_default_define[
|
||||||
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
]b4_function_declare([yyerror],
|
]b4_function_declare([yyerror],
|
||||||
[static void],b4_locations_if([
|
[static void],b4_locations_if([
|
||||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],])
|
[yylocationp]],])
|
||||||
b4_parse_param,
|
b4_parse_param,
|
||||||
[[const char* msg], [msg]])])[
|
[[const char* msg], [msg]])])
|
||||||
|
|
||||||
|
|
||||||
#undef yynerrs
|
#undef yynerrs
|
||||||
@@ -119,7 +122,8 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#define yyparse ]b4_prefix[parse
|
#define yyparse ]b4_prefix[parse
|
||||||
#define yylex ]b4_prefix[lex
|
#define yylex ]b4_prefix[lex
|
||||||
#define yyerror ]b4_prefix[error
|
#define yyerror ]b4_prefix[error
|
||||||
#define yydebug ]b4_prefix[debug]]b4_pure_if([], [[
|
#define yydebug ]b4_prefix[debug
|
||||||
|
]]b4_pure_if([], [[
|
||||||
#define yylval ]b4_prefix[lval
|
#define yylval ]b4_prefix[lval
|
||||||
#define yychar ]b4_prefix[char
|
#define yychar ]b4_prefix[char
|
||||||
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
@@ -136,7 +140,7 @@ m4_append([b4_epilogue],
|
|||||||
|
|
||||||
]b4_function_define([yyerror],
|
]b4_function_define([yyerror],
|
||||||
[static void],b4_locations_if([
|
[static void],b4_locations_if([
|
||||||
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],])
|
[yylocationp]],])
|
||||||
b4_parse_param,
|
b4_parse_param,
|
||||||
[[const char* msg], [msg]])[
|
[[const char* msg], [msg]])[
|
||||||
@@ -150,27 +154,26 @@ m4_append([b4_epilogue],
|
|||||||
]dnl In this section, the parse params are the original parse_params.
|
]dnl In this section, the parse params are the original parse_params.
|
||||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||||
[ /// Build a parser object.
|
[ /// Build a parser object.
|
||||||
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||||
:])[
|
:])[
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||||
#endif]b4_parse_param_cons[
|
#endif]b4_parse_param_cons[
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
]b4_parser_class::~b4_parser_class[ ()
|
]b4_parser_class_name::~b4_parser_class_name[ ()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
|
|
||||||
{}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class[::operator() ()
|
]b4_parser_class_name[::operator() ()
|
||||||
{
|
{
|
||||||
return parse ();
|
return parse ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class[::parse ()
|
]b4_parser_class_name[::parse ()
|
||||||
{
|
{
|
||||||
return ::yyparse (*this]b4_user_args[);
|
return ::yyparse (*this]b4_user_args[);
|
||||||
}
|
}
|
||||||
@@ -181,7 +184,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::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]])[)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
@@ -195,7 +198,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_print_ (int yytype,
|
]b4_parser_class_name[::yy_symbol_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]])[)
|
||||||
{
|
{
|
||||||
@@ -207,26 +210,26 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
]b4_parser_class[::debug_stream () const
|
]b4_parser_class_name[::debug_stream () const
|
||||||
{
|
{
|
||||||
return *yycdebug_;
|
return *yycdebug_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::set_debug_stream (std::ostream& o)
|
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
|
||||||
{
|
{
|
||||||
yycdebug_ = &o;
|
yycdebug_ = &o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]b4_parser_class[::debug_level_type
|
]b4_parser_class_name[::debug_level_type
|
||||||
]b4_parser_class[::debug_level () const
|
]b4_parser_class_name[::debug_level () const
|
||||||
{
|
{
|
||||||
return yydebug;
|
return yydebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::set_debug_level (debug_level_type l)
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
{
|
{
|
||||||
// Actually, it is yydebug which is really used.
|
// Actually, it is yydebug which is really used.
|
||||||
yydebug = l;
|
yydebug = l;
|
||||||
@@ -249,39 +252,26 @@ b4_percent_code_get([[requires]])[
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
]b4_cxx_portability[
|
]m4_ifdef([b4_location_file],
|
||||||
]m4_ifdef([b4_location_include],
|
|
||||||
[[# include ]b4_location_include])[
|
[[# include ]b4_location_include])[
|
||||||
]b4_variant_if([b4_variant_includes])[
|
|
||||||
|
|
||||||
]b4_attribute_define[
|
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
// Whether we are compiled with exception support.
|
|
||||||
#ifndef YY_EXCEPTIONS
|
|
||||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
|
||||||
# define YY_EXCEPTIONS 0
|
|
||||||
# else
|
|
||||||
# define YY_EXCEPTIONS 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|
||||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
||||||
[b4_location_define])])[
|
[b4_location_define])])[
|
||||||
|
|
||||||
/// A Bison parser.
|
/// A Bison parser.
|
||||||
class ]b4_parser_class[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
]b4_public_types_declare[
|
]b4_public_types_declare[
|
||||||
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class[ (]b4_parse_param_decl[);
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
virtual ~]b4_parser_class[ ();
|
virtual ~]b4_parser_class_name[ ();
|
||||||
|
|
||||||
/// Parse. An alias for parse ().
|
/// Parse. An alias for parse ().
|
||||||
/// \returns 0 iff parsing succeeded.
|
/// \returns 0 iff parsing succeeded.
|
||||||
@@ -291,7 +281,6 @@ b4_percent_code_get([[requires]])[
|
|||||||
/// \returns 0 iff parsing succeeded.
|
/// \returns 0 iff parsing succeeded.
|
||||||
virtual int parse ();
|
virtual int parse ();
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
|
||||||
/// The current debugging stream.
|
/// The current debugging stream.
|
||||||
std::ostream& debug_stream () const;
|
std::ostream& debug_stream () const;
|
||||||
/// Set the current debugging stream.
|
/// Set the current debugging stream.
|
||||||
@@ -303,8 +292,8 @@ b4_percent_code_get([[requires]])[
|
|||||||
debug_level_type debug_level () const;
|
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
|
|
||||||
|
|
||||||
|
public:
|
||||||
/// Report a syntax error.]b4_locations_if([[
|
/// Report a syntax error.]b4_locations_if([[
|
||||||
/// \param loc where the syntax error is found.]])[
|
/// \param loc where the syntax error is found.]])[
|
||||||
/// \param msg a description of the syntax error.
|
/// \param msg a description of the syntax error.
|
||||||
@@ -339,10 +328,10 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|||||||
[b4_token_defines])
|
[b4_token_defines])
|
||||||
[
|
[
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::semantic_type
|
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
|
||||||
#endif
|
#endif
|
||||||
#ifndef ]b4_api_PREFIX[LTYPE
|
#ifndef ]b4_api_PREFIX[LTYPE
|
||||||
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class_name[::location_type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
@@ -353,7 +342,7 @@ 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-2019])[
|
[2002-2015, 2018])[
|
||||||
// C++ GLR parser skeleton written by Akim Demaille.
|
// C++ GLR parser skeleton written by Akim Demaille.
|
||||||
|
|
||||||
]b4_disclaimer[
|
]b4_disclaimer[
|
||||||
@@ -365,5 +354,5 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
# 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.
|
||||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_wrap]))
|
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_wrap]))
|
||||||
m4_include(b4_skeletonsdir/[glr.c])
|
m4_include(b4_pkgdatadir/[glr.c])
|
||||||
m4_popdef([b4_parse_param])
|
m4_popdef([b4_parse_param])
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
# Java skeleton dispatching for Bison.
|
# Java skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2007, 2009-2015, 2018-2019 Free Software Foundation,
|
# Copyright (C) 2007, 2009-2015, 2018 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
|
||||||
@@ -21,7 +20,7 @@
|
|||||||
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
||||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.java]])
|
m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.java]])
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||||
|
|
||||||
m4_include(b4_used_skeleton)
|
m4_include(b4_used_skeleton)
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java language support for Bison
|
# Java language support for Bison
|
||||||
|
|
||||||
# Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2015, 2018 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 @@
|
|||||||
# 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_include(b4_skeletonsdir/[c-like.m4])
|
m4_include(b4_pkgdatadir/[c-like.m4])
|
||||||
|
|
||||||
|
|
||||||
# b4_list2(LIST1, LIST2)
|
# b4_list2(LIST1, LIST2)
|
||||||
@@ -42,24 +42,32 @@ m4_define([b4_percent_define_get3],
|
|||||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
||||||
|
|
||||||
|
|
||||||
# b4_parser_class_declaration
|
# b4_public_if(TRUE, FALSE)
|
||||||
# ---------------------------
|
# -------------------------
|
||||||
# The declaration of the parser class ("class YYParser"), with all its
|
b4_percent_define_default([[public]], [[false]])
|
||||||
# qualifiers/annotations.
|
m4_define([b4_public_if],
|
||||||
b4_percent_define_default([[api.parser.abstract]], [[false]])
|
[b4_percent_define_flag_if([public], [$1], [$2])])
|
||||||
b4_percent_define_default([[api.parser.final]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.public]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.strictfp]], [[false]])
|
|
||||||
|
|
||||||
m4_define([b4_parser_class_declaration],
|
|
||||||
[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
|
# b4_abstract_if(TRUE, FALSE)
|
||||||
b4_percent_define_flag_if([api.parser.public], [public ])dnl
|
# ---------------------------
|
||||||
b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
|
b4_percent_define_default([[abstract]], [[false]])
|
||||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
m4_define([b4_abstract_if],
|
||||||
b4_percent_define_flag_if([api.parser.strictfp], [strictfp ])dnl
|
[b4_percent_define_flag_if([abstract], [$1], [$2])])
|
||||||
[class ]b4_parser_class[]dnl
|
|
||||||
b4_percent_define_get3([api.parser.extends], [ extends ])dnl
|
|
||||||
b4_percent_define_get3([api.parser.implements], [ implements ])])
|
# b4_final_if(TRUE, FALSE)
|
||||||
|
# ---------------------------
|
||||||
|
b4_percent_define_default([[final]], [[false]])
|
||||||
|
m4_define([b4_final_if],
|
||||||
|
[b4_percent_define_flag_if([final], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_strictfp_if(TRUE, FALSE)
|
||||||
|
# ---------------------------
|
||||||
|
b4_percent_define_default([[strictfp]], [[false]])
|
||||||
|
m4_define([b4_strictfp_if],
|
||||||
|
[b4_percent_define_flag_if([strictfp], [$1], [$2])])
|
||||||
|
|
||||||
|
|
||||||
# b4_lexer_if(TRUE, FALSE)
|
# b4_lexer_if(TRUE, FALSE)
|
||||||
@@ -172,7 +180,7 @@ b4_percent_define_check_kind([[extends]], [code], [deprecated])
|
|||||||
b4_percent_define_check_kind([[implements]], [code], [deprecated])
|
b4_percent_define_check_kind([[implements]], [code], [deprecated])
|
||||||
b4_percent_define_check_kind([[init_throws]], [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([[lex_throws]], [code], [deprecated])
|
||||||
b4_percent_define_check_kind([[api.parser.class]], [code], [deprecated])
|
b4_percent_define_check_kind([[parser_class_name]], [code], [deprecated])
|
||||||
b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
||||||
|
|
||||||
|
|
||||||
@@ -187,8 +195,8 @@ b4_percent_define_default([[api.value.type]], [[Object]])
|
|||||||
# %name-prefix
|
# %name-prefix
|
||||||
m4_define_default([b4_prefix], [[YY]])
|
m4_define_default([b4_prefix], [[YY]])
|
||||||
|
|
||||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])
|
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])
|
||||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
|
||||||
|
|
||||||
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
|
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
|
||||||
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
||||||
@@ -211,40 +219,21 @@ m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
|||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
# b4_lhs_value([TYPE])
|
||||||
# ----------------------------------------------
|
# --------------------
|
||||||
# See README.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_symbol_value],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
[(($3)($1))],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[((b4_symbol([$2], [type]))($1))],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_value([SYMBOL-NUM], [TYPE])
|
|
||||||
# ----------------------------------
|
|
||||||
# See README.
|
|
||||||
m4_define([b4_lhs_value], [yyval])
|
m4_define([b4_lhs_value], [yyval])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_data(RULE-LENGTH, POS)
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
# -----------------------------
|
# --------------------------------------
|
||||||
# See README.
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
m4_define([b4_rhs_data],
|
# symbols on RHS.
|
||||||
[yystack.valueAt (b4_subtract($@))])
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
|
||||||
# --------------------------------------------------
|
|
||||||
# See README.
|
|
||||||
#
|
#
|
||||||
# In this simple implementation, %token and %type have class names
|
# In this simple implementation, %token and %type have class names
|
||||||
# between the angle brackets.
|
# between the angle brackets.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([b4_rhs_data([$1], [$2])], [$3], [$4])])
|
[(m4_ifval($3, [($3)])[](yystack.valueAt ($1-($2))))])
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_location()
|
# b4_lhs_location()
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -253,12 +242,12 @@ m4_define([b4_lhs_location],
|
|||||||
[(yyloc)])
|
[(yyloc)])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, POS)
|
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||||
# on RHS.
|
# on RHS.
|
||||||
m4_define([b4_rhs_location],
|
m4_define([b4_rhs_location],
|
||||||
[yystack.locationAt (b4_subtract($@))])
|
[yystack.locationAt ($1-($2))])
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param
|
# b4_lex_param
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 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,7 +15,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/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
|
|
||||||
# api.value.type=variant is valid.
|
# api.value.type=variant is valid.
|
||||||
m4_define([b4_value_type_setup_variant])
|
m4_define([b4_value_type_setup_variant])
|
||||||
@@ -35,55 +35,57 @@ m4_define([b4_integral_parser_table_declare],
|
|||||||
# Define "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
# Define "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
|
||||||
m4_define([b4_integral_parser_table_define],
|
m4_define([b4_integral_parser_table_define],
|
||||||
[ const b4_int_type_for([$2])
|
[ const b4_int_type_for([$2])
|
||||||
b4_parser_class::yy$1_[[]] =
|
b4_parser_class_name::yy$1_[[]] =
|
||||||
{
|
{
|
||||||
$2
|
$2
|
||||||
};dnl
|
};dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, SYMBOL-NUM, [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. Note that b4_value_type_setup_union
|
||||||
# overrides b4_symbol_value, so we must override it again.
|
# 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_append([b4_value_type_setup_union],
|
||||||
[m4_copy_force([b4_symbol_value_union], [b4_symbol_value_template])])
|
[m4_copy_force([b4_symbol_value_union], [b4_symbol_value_template])])
|
||||||
|
|
||||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
# b4_lhs_value([TYPE])
|
||||||
# --------------------------------
|
# --------------------
|
||||||
# See README.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value([yylhs.value], [$1], [$2])])
|
[b4_symbol_value([yylhs.value], [$1])])
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_location()
|
# b4_lhs_location()
|
||||||
# -----------------
|
# -----------------
|
||||||
# Expansion of @$.
|
# Expansion of @$.
|
||||||
m4_define([b4_lhs_location],
|
m4_define([b4_lhs_location],
|
||||||
[yylhs.location])
|
[yylhs.location])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_data(RULE-LENGTH, POS)
|
# b4_rhs_data(RULE-LENGTH, NUM)
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# See README.
|
# Return the data corresponding to the symbol #NUM, where the current
|
||||||
|
# rule has RULE-LENGTH symbols on RHS.
|
||||||
m4_define([b4_rhs_data],
|
m4_define([b4_rhs_data],
|
||||||
[yystack_@{b4_subtract($@)@}])
|
[yystack_@{b4_subtract($@)@}])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_state(RULE-LENGTH, POS)
|
# b4_rhs_state(RULE-LENGTH, NUM)
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# The state corresponding to the symbol #POS, where the current
|
# The state corresponding to the symbol #NUM, where the current
|
||||||
# rule has RULE-LENGTH symbols on RHS.
|
# rule has RULE-LENGTH symbols on RHS.
|
||||||
m4_define([b4_rhs_state],
|
m4_define([b4_rhs_state],
|
||||||
[b4_rhs_data([$1], [$2]).state])
|
[b4_rhs_data([$1], [$2]).state])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
# --------------------------------------------------
|
# --------------------------------------
|
||||||
# See README.
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
|
# symbols on RHS.
|
||||||
m4_define([_b4_rhs_value],
|
m4_define([_b4_rhs_value],
|
||||||
[b4_symbol_value([b4_rhs_data([$1], [$2]).value], [$3], [$4])])
|
[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_percent_define_ifdef([api.value.automove],
|
||||||
@@ -91,12 +93,12 @@ m4_define([b4_rhs_value],
|
|||||||
[_b4_rhs_value($@)])])
|
[_b4_rhs_value($@)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, POS)
|
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||||
# on RHS.
|
# on RHS.
|
||||||
m4_define([b4_rhs_location],
|
m4_define([b4_rhs_location],
|
||||||
[b4_rhs_data([$1], [$2]).location])
|
[b4_rhs_data([$1], [$2]).location])
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
# b4_symbol_action(SYMBOL-NUM, KIND)
|
||||||
@@ -107,10 +109,10 @@ m4_define([b4_symbol_action],
|
|||||||
[b4_symbol_if([$1], [has_$2],
|
[b4_symbol_if([$1], [has_$2],
|
||||||
[m4_pushdef([b4_symbol_value], m4_defn([b4_symbol_value_template]))[]dnl
|
[m4_pushdef([b4_symbol_value], m4_defn([b4_symbol_value_template]))[]dnl
|
||||||
b4_dollar_pushdef([yysym.value],
|
b4_dollar_pushdef([yysym.value],
|
||||||
[$1],
|
b4_symbol_if([$1], [has_type],
|
||||||
[],
|
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||||
[yysym.location])dnl
|
[yysym.location])dnl
|
||||||
_b4_symbol_case([$1])[]dnl
|
_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@])
|
||||||
@@ -135,16 +137,16 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
|||||||
|
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2015, 2018-2019])
|
[2002-2015, 2018])
|
||||||
|
|
||||||
m4_define([b4_parser_class],
|
m4_define([b4_parser_class_name],
|
||||||
[b4_percent_define_get([[api.parser.class]])])
|
[b4_percent_define_get([[parser_class_name]])])
|
||||||
|
|
||||||
b4_bison_locations_if([# Backward compatibility.
|
b4_bison_locations_if([# Backward compatibility.
|
||||||
m4_define([b4_location_constructors])
|
m4_define([b4_location_constructors])
|
||||||
m4_include(b4_skeletonsdir/[location.cc])])
|
m4_include(b4_pkgdatadir/[location.cc])])
|
||||||
m4_include(b4_skeletonsdir/[stack.hh])
|
m4_include(b4_pkgdatadir/[stack.hh])
|
||||||
b4_variant_if([m4_include(b4_skeletonsdir/[variant.hh])])
|
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
|
||||||
|
|
||||||
|
|
||||||
# b4_shared_declarations(hh|cc)
|
# b4_shared_declarations(hh|cc)
|
||||||
@@ -172,18 +174,21 @@ m4_define([b4_shared_declarations],
|
|||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|
||||||
|
]b4_stack_define[
|
||||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
||||||
[b4_location_define])])[
|
[b4_location_define])])[
|
||||||
|
|
||||||
|
]b4_variant_if([b4_variant_define])[
|
||||||
|
|
||||||
/// A Bison parser.
|
/// A Bison parser.
|
||||||
class ]b4_parser_class[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
]b4_public_types_declare[
|
]b4_public_types_declare[
|
||||||
]b4_symbol_type_define[
|
]b4_symbol_type_declare[
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class[ (]b4_parse_param_decl[);
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
virtual ~]b4_parser_class[ ();
|
virtual ~]b4_parser_class_name[ ();
|
||||||
|
|
||||||
/// Parse. An alias for parse ().
|
/// Parse. An alias for parse ().
|
||||||
/// \returns 0 iff parsing succeeded.
|
/// \returns 0 iff parsing succeeded.
|
||||||
@@ -215,12 +220,12 @@ 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_token_constructor_define[
|
]b4_symbol_constructor_declare[
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// This class is not copyable.
|
/// This class is not copyable.
|
||||||
]b4_parser_class[ (const ]b4_parser_class[&);
|
]b4_parser_class_name[ (const ]b4_parser_class_name[&);
|
||||||
]b4_parser_class[& operator= (const ]b4_parser_class[&);
|
]b4_parser_class_name[& operator= (const ]b4_parser_class_name[&);
|
||||||
|
|
||||||
/// State numbers.
|
/// State numbers.
|
||||||
typedef int state_type;
|
typedef int state_type;
|
||||||
@@ -291,26 +296,26 @@ m4_define([b4_shared_declarations],
|
|||||||
struct by_state
|
struct by_state
|
||||||
{
|
{
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
by_state () YY_NOEXCEPT;
|
by_state ();
|
||||||
|
|
||||||
/// The symbol type as needed by the constructor.
|
/// The symbol type as needed by the constructor.
|
||||||
typedef state_type kind_type;
|
typedef state_type kind_type;
|
||||||
|
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
by_state (kind_type s) YY_NOEXCEPT;
|
by_state (kind_type s);
|
||||||
|
|
||||||
/// Copy constructor.
|
/// Copy constructor.
|
||||||
by_state (const by_state& that) YY_NOEXCEPT;
|
by_state (const by_state& other);
|
||||||
|
|
||||||
/// Record that this symbol is empty.
|
/// Record that this symbol is empty.
|
||||||
void clear () YY_NOEXCEPT;
|
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.
|
/// \a empty_symbol when empty.
|
||||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
symbol_number_type type_get () const;
|
||||||
|
|
||||||
/// The state number used to denote an empty symbol.
|
/// The state number used to denote an empty symbol.
|
||||||
enum { empty_state = -1 };
|
enum { empty_state = -1 };
|
||||||
@@ -338,8 +343,6 @@ m4_define([b4_shared_declarations],
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
]b4_stack_define[
|
|
||||||
|
|
||||||
/// Stack type.
|
/// Stack type.
|
||||||
typedef stack<stack_symbol_type> stack_type;
|
typedef stack<stack_symbol_type> stack_type;
|
||||||
|
|
||||||
@@ -388,7 +391,7 @@ m4_define([b4_shared_declarations],
|
|||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
// Redirection for backward compatibility.
|
// Redirection for backward compatibility.
|
||||||
# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class::semantic_type
|
# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class_name::semantic_type
|
||||||
#endif
|
#endif
|
||||||
])[
|
])[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
@@ -515,11 +518,11 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
apostrophe, a comma, or backslash (other than backslash-backslash).
|
apostrophe, a comma, or backslash (other than backslash-backslash).
|
||||||
YYSTR is taken from yytname. */
|
YYSTR is taken from yytname. */
|
||||||
std::string
|
std::string
|
||||||
]b4_parser_class[::yytnamerr_ (const char *yystr)
|
]b4_parser_class_name[::yytnamerr_ (const char *yystr)
|
||||||
{
|
{
|
||||||
if (*yystr == '"')
|
if (*yystr == '"')
|
||||||
{
|
{
|
||||||
std::string yyr;
|
std::string yyr = "";
|
||||||
char const *yyp = yystr;
|
char const *yyp = yystr;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -532,10 +535,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
case '\\':
|
case '\\':
|
||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
else
|
// Fall through.
|
||||||
goto append;
|
|
||||||
|
|
||||||
append:
|
|
||||||
default:
|
default:
|
||||||
yyr += *yyp;
|
yyr += *yyp;
|
||||||
break;
|
break;
|
||||||
@@ -551,7 +551,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]])[
|
]])[
|
||||||
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||||
:])[
|
:])[
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
||||||
@@ -559,11 +559,9 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#endif]b4_parse_param_cons[
|
#endif]b4_parse_param_cons[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_parser_class::~b4_parser_class[ ()
|
]b4_parser_class_name::~b4_parser_class_name[ ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
|
|
||||||
{}
|
|
||||||
|
|
||||||
/*---------------.
|
/*---------------.
|
||||||
| Symbol types. |
|
| Symbol types. |
|
||||||
@@ -572,33 +570,33 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_token_ctor_if([], [b4_public_types_define([cc])])[
|
]b4_token_ctor_if([], [b4_public_types_define([cc])])[
|
||||||
|
|
||||||
// by_state.
|
// by_state.
|
||||||
]b4_parser_class[::by_state::by_state () YY_NOEXCEPT
|
]b4_parser_class_name[::by_state::by_state ()
|
||||||
: state (empty_state)
|
: state (empty_state)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_parser_class[::by_state::by_state (const by_state& that) YY_NOEXCEPT
|
]b4_parser_class_name[::by_state::by_state (const by_state& other)
|
||||||
: state (that.state)
|
: state (other.state)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::by_state::clear () YY_NOEXCEPT
|
]b4_parser_class_name[::by_state::clear ()
|
||||||
{
|
{
|
||||||
state = empty_state;
|
state = empty_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::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.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_parser_class[::by_state::by_state (state_type s) YY_NOEXCEPT
|
]b4_parser_class_name[::by_state::by_state (state_type s)
|
||||||
: state (s)
|
: state (s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_parser_class[::symbol_number_type
|
]b4_parser_class_name[::symbol_number_type
|
||||||
]b4_parser_class[::by_state::type_get () const YY_NOEXCEPT
|
]b4_parser_class_name[::by_state::type_get () const
|
||||||
{
|
{
|
||||||
if (state == empty_state)
|
if (state == empty_state)
|
||||||
return empty_symbol;
|
return empty_symbol;
|
||||||
@@ -606,10 +604,10 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
return yystos_[state];
|
return yystos_[state];
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
|
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_parser_class[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
|
]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)])[)
|
: super_type (YY_MOVE (that.state)]b4_variant_if([], [, YY_MOVE (that.value)])b4_locations_if([, YY_MOVE (that.location)])[)
|
||||||
{]b4_variant_if([
|
{]b4_variant_if([
|
||||||
b4_symbol_variant([that.type_get ()],
|
b4_symbol_variant([that.type_get ()],
|
||||||
@@ -620,7 +618,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_parser_class[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
|
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) that)
|
||||||
: super_type (s]b4_variant_if([], [, YY_MOVE (that.value)])[]b4_locations_if([, YY_MOVE (that.location)])[)
|
: super_type (s]b4_variant_if([], [, YY_MOVE (that.value)])[]b4_locations_if([, YY_MOVE (that.location)])[)
|
||||||
{]b4_variant_if([
|
{]b4_variant_if([
|
||||||
b4_symbol_variant([that.type_get ()],
|
b4_symbol_variant([that.type_get ()],
|
||||||
@@ -630,8 +628,8 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
]b4_parser_class[::stack_symbol_type&
|
]b4_parser_class_name[::stack_symbol_type&
|
||||||
]b4_parser_class[::stack_symbol_type::operator= (stack_symbol_type& that)
|
]b4_parser_class_name[::stack_symbol_type::operator= (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 ()],
|
||||||
@@ -646,7 +644,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
|
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
|
||||||
{
|
{
|
||||||
if (yymsg)
|
if (yymsg)
|
||||||
YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
|
YY_SYMBOL_PRINT (yymsg, yysym);]b4_variant_if([], [
|
||||||
@@ -658,18 +656,16 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_print_ (std::ostream& yyo,
|
]b4_parser_class_name[::yy_print_ (std::ostream& yyo,
|
||||||
const basic_symbol<Base>& yysym) const
|
const basic_symbol<Base>& yysym) const
|
||||||
{
|
{
|
||||||
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 ();
|
||||||
#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408
|
|
||||||
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
||||||
// below array bounds".
|
// below array bounds".
|
||||||
if (yysym.empty ())
|
if (yysym.empty ())
|
||||||
std::abort ();
|
std::abort ();
|
||||||
#endif
|
|
||||||
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
||||||
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
||||||
<< yysym.location << ": "])[;
|
<< yysym.location << ": "])[;
|
||||||
@@ -679,7 +675,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
|
]b4_parser_class_name[::yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym)
|
||||||
{
|
{
|
||||||
if (m)
|
if (m)
|
||||||
YY_SYMBOL_PRINT (m, sym);
|
YY_SYMBOL_PRINT (m, sym);
|
||||||
@@ -687,7 +683,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
|
]b4_parser_class_name[::yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym)
|
||||||
{
|
{
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
yypush_ (m, stack_symbol_type (s, std::move (sym)));
|
yypush_ (m, stack_symbol_type (s, std::move (sym)));
|
||||||
@@ -698,40 +694,40 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yypop_ (int n)
|
]b4_parser_class_name[::yypop_ (int n)
|
||||||
{
|
{
|
||||||
yystack_.pop (n);
|
yystack_.pop (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
std::ostream&
|
std::ostream&
|
||||||
]b4_parser_class[::debug_stream () const
|
]b4_parser_class_name[::debug_stream () const
|
||||||
{
|
{
|
||||||
return *yycdebug_;
|
return *yycdebug_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::set_debug_stream (std::ostream& o)
|
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
|
||||||
{
|
{
|
||||||
yycdebug_ = &o;
|
yycdebug_ = &o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]b4_parser_class[::debug_level_type
|
]b4_parser_class_name[::debug_level_type
|
||||||
]b4_parser_class[::debug_level () const
|
]b4_parser_class_name[::debug_level () const
|
||||||
{
|
{
|
||||||
return yydebug_;
|
return yydebug_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::set_debug_level (debug_level_type l)
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
{
|
{
|
||||||
yydebug_ = l;
|
yydebug_ = l;
|
||||||
}
|
}
|
||||||
#endif // ]b4_api_PREFIX[DEBUG
|
#endif // ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
]b4_parser_class[::state_type
|
]b4_parser_class_name[::state_type
|
||||||
]b4_parser_class[::yy_lr_goto_state_ (state_type yystate, int yysym)
|
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
|
||||||
{
|
{
|
||||||
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
||||||
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
||||||
@@ -741,25 +737,25 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::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
|
bool
|
||||||
]b4_parser_class[::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_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class[::operator() ()
|
]b4_parser_class_name[::operator() ()
|
||||||
{
|
{
|
||||||
return parse ();
|
return parse ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class[::parse ()
|
]b4_parser_class_name[::parse ()
|
||||||
{
|
{
|
||||||
// State.
|
// State.
|
||||||
int yyn;
|
int yyn;
|
||||||
@@ -786,7 +782,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
YYCDEBUG << "Starting parse\n";
|
YYCDEBUG << "Starting parse\n";
|
||||||
|
|
||||||
]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
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef])[]dnl
|
b4_dollar_popdef])[]dnl
|
||||||
|
|
||||||
@@ -797,22 +793,17 @@ b4_dollar_popdef])[]dnl
|
|||||||
yystack_.clear ();
|
yystack_.clear ();
|
||||||
yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
|
yypush_ (YY_NULLPTR, 0, YY_MOVE (yyla));
|
||||||
|
|
||||||
/*-----------------------------------------------.
|
// A new symbol was pushed on the stack.
|
||||||
| yynewstate -- push a new symbol on the stack. |
|
|
||||||
`-----------------------------------------------*/
|
|
||||||
yynewstate:
|
yynewstate:
|
||||||
YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
|
YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
|
||||||
|
|
||||||
// Accept?
|
// Accept?
|
||||||
if (yystack_[0].state == yyfinal_)
|
if (yystack_[0].state == yyfinal_)
|
||||||
YYACCEPT;
|
goto yyacceptlab;
|
||||||
|
|
||||||
goto yybackup;
|
goto yybackup;
|
||||||
|
|
||||||
|
// Backup.
|
||||||
/*-----------.
|
|
||||||
| yybackup. |
|
|
||||||
`-----------*/
|
|
||||||
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];
|
||||||
@@ -834,7 +825,6 @@ b4_dollar_popdef])[]dnl
|
|||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
|
|
||||||
error (yyexc);
|
error (yyexc);
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
}
|
}
|
||||||
@@ -866,7 +856,6 @@ b4_dollar_popdef])[]dnl
|
|||||||
yypush_ ("Shifting", yyn, YY_MOVE (yyla));
|
yypush_ ("Shifting", yyn, YY_MOVE (yyla));
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------.
|
/*-----------------------------------------------------------.
|
||||||
| yydefault -- do the default action for the current state. |
|
| yydefault -- do the default action for the current state. |
|
||||||
`-----------------------------------------------------------*/
|
`-----------------------------------------------------------*/
|
||||||
@@ -876,9 +865,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------.
|
/*-----------------------------.
|
||||||
| yyreduce -- do a reduction. |
|
| yyreduce -- Do a reduction. |
|
||||||
`-----------------------------*/
|
`-----------------------------*/
|
||||||
yyreduce:
|
yyreduce:
|
||||||
yylen = yyr2_[yyn];
|
yylen = yyr2_[yyn];
|
||||||
@@ -903,8 +891,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
[
|
[
|
||||||
// Default location.
|
// Default location.
|
||||||
{
|
{
|
||||||
stack_type::slice range (yystack_, yylen);
|
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
|
||||||
YYLLOC_DEFAULT (yylhs.location, range, yylen);
|
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
|
||||||
yyerror_range[1].location = yylhs.location;
|
yyerror_range[1].location = yylhs.location;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
@@ -924,7 +912,6 @@ b4_dollar_popdef])[]dnl
|
|||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Caught exception: " << yyexc.what() << '\n';
|
|
||||||
error (yyexc);
|
error (yyexc);
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
@@ -939,7 +926,6 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------.
|
/*--------------------------------------.
|
||||||
| yyerrlab -- here on detecting error. |
|
| yyerrlab -- here on detecting error. |
|
||||||
`--------------------------------------*/
|
`--------------------------------------*/
|
||||||
@@ -977,18 +963,18 @@ b4_dollar_popdef])[]dnl
|
|||||||
| yyerrorlab -- error raised explicitly by YYERROR. |
|
| yyerrorlab -- error raised explicitly by YYERROR. |
|
||||||
`---------------------------------------------------*/
|
`---------------------------------------------------*/
|
||||||
yyerrorlab:
|
yyerrorlab:
|
||||||
/* Pacify compilers when the user code never invokes YYERROR and
|
|
||||||
the label yyerrorlab therefore never appears in user code. */
|
|
||||||
if (false)
|
|
||||||
YYERROR;
|
|
||||||
|
|
||||||
|
/* Pacify compilers like GCC when the user code never invokes
|
||||||
|
YYERROR and the label yyerrorlab therefore never appears in user
|
||||||
|
code. */
|
||||||
|
if (false)
|
||||||
|
goto yyerrorlab;
|
||||||
/* 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);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------.
|
/*-------------------------------------------------------------.
|
||||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||||
`-------------------------------------------------------------*/
|
`-------------------------------------------------------------*/
|
||||||
@@ -1029,26 +1015,16 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
|
// Accept.
|
||||||
/*-------------------------------------.
|
|
||||||
| yyacceptlab -- YYACCEPT comes here. |
|
|
||||||
`-------------------------------------*/
|
|
||||||
yyacceptlab:
|
yyacceptlab:
|
||||||
yyresult = 0;
|
yyresult = 0;
|
||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
|
// Abort.
|
||||||
/*-----------------------------------.
|
|
||||||
| yyabortlab -- YYABORT comes here. |
|
|
||||||
`-----------------------------------*/
|
|
||||||
yyabortlab:
|
yyabortlab:
|
||||||
yyresult = 1;
|
yyresult = 1;
|
||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------.
|
|
||||||
| yyreturn -- parsing is finished, return the result. |
|
|
||||||
`-----------------------------------------------------*/
|
|
||||||
yyreturn:
|
yyreturn:
|
||||||
if (!yyla.empty ())
|
if (!yyla.empty ())
|
||||||
yy_destroy_ ("Cleanup: discarding lookahead", yyla);
|
yy_destroy_ ("Cleanup: discarding lookahead", yyla);
|
||||||
@@ -1084,7 +1060,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::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 ()]])[);
|
||||||
@@ -1092,7 +1068,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
std::string
|
std::string
|
||||||
]b4_parser_class[::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, const symbol_type& yyla],
|
||||||
[state_type, const symbol_type&])[) const
|
[state_type, const symbol_type&])[) const
|
||||||
{]b4_error_verbose_if([[
|
{]b4_error_verbose_if([[
|
||||||
@@ -1191,9 +1167,9 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_class::yypact_ninf_ = b4_pact_ninf[;
|
const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_class_name::yypact_ninf_ = b4_pact_ninf[;
|
||||||
|
|
||||||
const ]b4_int_type(b4_table_ninf, b4_table_ninf) b4_parser_class::yytable_ninf_ = b4_table_ninf[;
|
const ]b4_int_type(b4_table_ninf, b4_table_ninf) b4_parser_class_name::yytable_ninf_ = b4_table_ninf[;
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
|
|
||||||
@@ -1201,7 +1177,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
// YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
// YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
// First, the terminals, then, starting at \a yyntokens_, nonterminals.
|
// First, the terminals, then, starting at \a yyntokens_, nonterminals.
|
||||||
const char*
|
const char*
|
||||||
const ]b4_parser_class[::yytname_[] =
|
const ]b4_parser_class_name[::yytname_[] =
|
||||||
{
|
{
|
||||||
]b4_tname[
|
]b4_tname[
|
||||||
};
|
};
|
||||||
@@ -1211,7 +1187,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
|
|
||||||
// Print the state stack on the debug stream.
|
// Print the state stack on the debug stream.
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yystack_print_ ()
|
]b4_parser_class_name[::yystack_print_ ()
|
||||||
{
|
{
|
||||||
*yycdebug_ << "Stack now";
|
*yycdebug_ << "Stack now";
|
||||||
for (stack_type::const_iterator
|
for (stack_type::const_iterator
|
||||||
@@ -1224,7 +1200,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
|
|
||||||
// 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[::yy_reduce_print_ (int yyrule)
|
]b4_parser_class_name[::yy_reduce_print_ (int yyrule)
|
||||||
{
|
{
|
||||||
unsigned yylno = yyrline_[yyrule];
|
unsigned yylno = yyrline_[yyrule];
|
||||||
int yynrhs = yyr2_[yyrule];
|
int yynrhs = yyr2_[yyrule];
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
# Java skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2015, 2018 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,7 +15,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/>.
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[java.m4])
|
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])])
|
||||||
@@ -95,7 +95,14 @@ b4_output_begin([b4_parser_file_name])[
|
|||||||
*
|
*
|
||||||
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
||||||
*/
|
*/
|
||||||
]b4_parser_class_declaration[
|
]b4_percent_define_get3([annotations], [], [ ])dnl
|
||||||
|
b4_public_if([public ])dnl
|
||||||
|
b4_abstract_if([abstract ])dnl
|
||||||
|
b4_final_if([final ])dnl
|
||||||
|
b4_strictfp_if([strictfp ])dnl
|
||||||
|
[class ]b4_parser_class_name[]dnl
|
||||||
|
b4_percent_define_get3([extends], [ extends ])dnl
|
||||||
|
b4_percent_define_get3([implements], [ implements ])[
|
||||||
{
|
{
|
||||||
]b4_identification[
|
]b4_identification[
|
||||||
]b4_error_verbose_if([[
|
]b4_error_verbose_if([[
|
||||||
@@ -180,7 +187,7 @@ b4_locations_if([[
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Communication interface between the scanner and the Bison-generated
|
* Communication interface between the scanner and the Bison-generated
|
||||||
* parser <tt>]b4_parser_class[</tt>.
|
* parser <tt>]b4_parser_class_name[</tt>.
|
||||||
*/
|
*/
|
||||||
public interface Lexer {
|
public interface Lexer {
|
||||||
/** Token returned by the scanner to signal the end of its input. */
|
/** Token returned by the scanner to signal the end of its input. */
|
||||||
@@ -240,7 +247,7 @@ b4_lexer_if([[
|
|||||||
/**
|
/**
|
||||||
* Instantiates the Bison-generated parser.
|
* Instantiates the Bison-generated parser.
|
||||||
*/
|
*/
|
||||||
public ]b4_parser_class (b4_parse_param_decl([b4_lex_param_decl])[) ]b4_maybe_throws([b4_init_throws])[
|
public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) ]b4_maybe_throws([b4_init_throws])[
|
||||||
{
|
{
|
||||||
]b4_percent_code_get([[init]])[
|
]b4_percent_code_get([[init]])[
|
||||||
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
||||||
@@ -252,7 +259,7 @@ b4_lexer_if([[
|
|||||||
* Instantiates the Bison-generated parser.
|
* Instantiates the Bison-generated parser.
|
||||||
* @@param yylexer The scanner that will supply tokens to the parser.
|
* @@param yylexer The scanner that will supply tokens to the parser.
|
||||||
*/
|
*/
|
||||||
b4_lexer_if([[protected]], [[public]]) b4_parser_class[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[
|
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[
|
||||||
{
|
{
|
||||||
]b4_percent_code_get([[init]])[
|
]b4_percent_code_get([[init]])[
|
||||||
this.yylexer = yylexer;
|
this.yylexer = yylexer;
|
||||||
@@ -382,7 +389,8 @@ b4_lexer_if([[
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Print the state stack on the debug stream.
|
// Print the state stack on the debug stream.
|
||||||
public void print (java.io.PrintStream out) {
|
public void print (java.io.PrintStream out)
|
||||||
|
{
|
||||||
out.print ("Stack now");
|
out.print ("Stack now");
|
||||||
|
|
||||||
for (int i = 0; i <= height; i++)
|
for (int i = 0; i <= height; i++)
|
||||||
@@ -576,7 +584,7 @@ b4_define_state])[
|
|||||||
/* Initialize the stack. */
|
/* Initialize the stack. */
|
||||||
yystack.push (yystate, yylval ]b4_locations_if([, yylloc])[);
|
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
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef[]dnl
|
b4_dollar_popdef[]dnl
|
||||||
])[
|
])[
|
||||||
@@ -586,7 +594,7 @@ b4_dollar_popdef[]dnl
|
|||||||
{
|
{
|
||||||
push_parse_initialize ();
|
push_parse_initialize ();
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
|
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef[]dnl
|
b4_dollar_popdef[]dnl
|
||||||
])[
|
])[
|
||||||
@@ -1025,12 +1033,11 @@ b4_both_if([[
|
|||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yy_symbol_print (" $" + (yyi + 1) + " =",
|
yy_symbol_print (" $" + (yyi + 1) + " =",
|
||||||
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
||||||
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
|
||||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
||||||
|
|
||||||
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
||||||
+18
-29
@@ -1,5 +1,4 @@
|
|||||||
## Copyright (C) 2002, 2005-2015, 2018-2019 Free Software Foundation,
|
## Copyright (C) 2002, 2005-2015, 2018 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
|
||||||
@@ -15,33 +14,23 @@
|
|||||||
## 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_pkgdata_DATA = \
|
dist_pkgdata_DATA = \
|
||||||
data/README
|
data/README \
|
||||||
|
data/bison.m4 \
|
||||||
skeletonsdir = $(pkgdatadir)/skeletons
|
data/c++-skel.m4 \
|
||||||
dist_skeletons_DATA = \
|
data/c++.m4 \
|
||||||
data/skeletons/bison.m4 \
|
data/c-like.m4 \
|
||||||
data/skeletons/c++-skel.m4 \
|
data/c-skel.m4 \
|
||||||
data/skeletons/c++.m4 \
|
data/c.m4 \
|
||||||
data/skeletons/c-like.m4 \
|
data/glr.c \
|
||||||
data/skeletons/c-skel.m4 \
|
data/glr.cc \
|
||||||
data/skeletons/c.m4 \
|
data/java-skel.m4 \
|
||||||
data/skeletons/glr.c \
|
data/java.m4 \
|
||||||
data/skeletons/glr.cc \
|
data/lalr1.cc \
|
||||||
data/skeletons/java-skel.m4 \
|
data/lalr1.java \
|
||||||
data/skeletons/java.m4 \
|
data/location.cc \
|
||||||
data/skeletons/lalr1.cc \
|
data/stack.hh \
|
||||||
data/skeletons/lalr1.java \
|
data/variant.hh \
|
||||||
data/skeletons/location.cc \
|
data/yacc.c
|
||||||
data/skeletons/stack.hh \
|
|
||||||
data/skeletons/variant.hh \
|
|
||||||
data/skeletons/yacc.c
|
|
||||||
|
|
||||||
# Experimental support for the D language.
|
|
||||||
dist_skeletons_DATA += \
|
|
||||||
data/skeletons/README-D.txt \
|
|
||||||
data/skeletons/d-skel.m4 \
|
|
||||||
data/skeletons/d.m4 \
|
|
||||||
data/skeletons/lalr1.d
|
|
||||||
|
|
||||||
m4sugardir = $(pkgdatadir)/m4sugar
|
m4sugardir = $(pkgdatadir)/m4sugar
|
||||||
dist_m4sugar_DATA = \
|
dist_m4sugar_DATA = \
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 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,7 +16,7 @@
|
|||||||
# 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-2019])
|
[2002-2015, 2018])
|
||||||
|
|
||||||
|
|
||||||
# b4_position_file
|
# b4_position_file
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
Some usage notes for the D Parser:
|
|
||||||
|
|
||||||
- it is a port of the Java parser, so interface is very similar.
|
|
||||||
|
|
||||||
- the lexer class needs to implement the interface 'Lexer' (similar to
|
|
||||||
java). It typically (depending on options) looks like this:
|
|
||||||
|
|
||||||
public interface Lexer
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Method to retrieve the beginning position of the last scanned token.
|
|
||||||
* @return the position at which the last scanned token starts. */
|
|
||||||
@property YYPosition startPos ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to retrieve the ending position of the last scanned token.
|
|
||||||
* @return the first position beyond the last scanned token. */
|
|
||||||
@property YYPosition endPos ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to retrieve the semantic value of the last scanned token.
|
|
||||||
* @return the semantic value of the last scanned token. */
|
|
||||||
@property YYSemanticType semanticVal ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Entry point for the scanner. Returns the token identifier corresponding
|
|
||||||
* to the next token and prepares to return the semantic value
|
|
||||||
* and beginning/ending positions of the token.
|
|
||||||
* @return the token identifier corresponding to the next token. */
|
|
||||||
YYTokenType yylex ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Entry point for error reporting. Emits an error
|
|
||||||
* referring to the given location in a user-defined way.
|
|
||||||
*
|
|
||||||
* @param loc The location of the element to which the
|
|
||||||
* error message is related
|
|
||||||
* @param s The string for the error message. */
|
|
||||||
void yyerror (YYLocation loc, string s);
|
|
||||||
}
|
|
||||||
|
|
||||||
- semantic types are handled by D usions (same as for C/C++ parsers)
|
|
||||||
|
|
||||||
- the following (non-standard) %defines are supported:
|
|
||||||
|
|
||||||
%define package "<package_name>"
|
|
||||||
%define api.parser.class "my_class_name>"
|
|
||||||
%define position_type "my_position_type"
|
|
||||||
%define location_type "my_location_type"
|
|
||||||
|
|
||||||
- the following declarations basically work like in C/C++:
|
|
||||||
|
|
||||||
%locations
|
|
||||||
%error-verbose
|
|
||||||
%parse-param
|
|
||||||
%initial-action
|
|
||||||
%code
|
|
||||||
%union
|
|
||||||
|
|
||||||
- %destructor is not yet supported
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
-*- Autoconf -*-
|
|
||||||
|
|
||||||
# D skeleton dispatching for Bison.
|
|
||||||
|
|
||||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
b4_glr_if( [b4_complain([%%glr-parser not supported for D])])
|
|
||||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])])
|
|
||||||
|
|
||||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.d]])
|
|
||||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
|
||||||
|
|
||||||
m4_include(b4_used_skeleton)
|
|
||||||
@@ -1,320 +0,0 @@
|
|||||||
-*- Autoconf -*-
|
|
||||||
|
|
||||||
# D language support for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
# b4_comment(TEXT)
|
|
||||||
# ----------------
|
|
||||||
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
|
||||||
], [
|
|
||||||
]) */])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_list2(LIST1, LIST2)
|
|
||||||
# ----------------------
|
|
||||||
# Join two lists with a comma if necessary.
|
|
||||||
m4_define([b4_list2],
|
|
||||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
|
||||||
# -------------------------------------------
|
|
||||||
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
|
||||||
# otherwise NOT.
|
|
||||||
m4_define([b4_percent_define_get3],
|
|
||||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
|
||||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_flag_value(BOOLEAN-FLAG)
|
|
||||||
# ---------------------------
|
|
||||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parser_class_declaration
|
|
||||||
# ---------------------------
|
|
||||||
# The declaration of the parser class ("class YYParser"), with all its
|
|
||||||
# qualifiers/annotations.
|
|
||||||
b4_percent_define_default([[api.parser.abstract]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.final]], [[false]])
|
|
||||||
b4_percent_define_default([[api.parser.public]], [[false]])
|
|
||||||
|
|
||||||
m4_define([b4_parser_class_declaration],
|
|
||||||
[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.public], [public ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
|
|
||||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
|
||||||
[class ]b4_parser_class[]dnl
|
|
||||||
b4_percent_define_get3([api.parser.extends], [ extends ])dnl
|
|
||||||
b4_percent_define_get3([api.parser.implements], [ implements ])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lexer_if(TRUE, FALSE)
|
|
||||||
# ------------------------
|
|
||||||
m4_define([b4_lexer_if],
|
|
||||||
[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_position_type_if(TRUE, FALSE)
|
|
||||||
# --------------------------------
|
|
||||||
m4_define([b4_position_type_if],
|
|
||||||
[b4_percent_define_ifdef([[position_type]], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_location_type_if(TRUE, FALSE)
|
|
||||||
# --------------------------------
|
|
||||||
m4_define([b4_location_type_if],
|
|
||||||
[b4_percent_define_ifdef([[location_type]], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_locations_if(TRUE, FALSE)
|
|
||||||
# ----------------------------
|
|
||||||
m4_define([b4_locations_if],
|
|
||||||
[m4_if(b4_locations_flag, 1, [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_identification
|
|
||||||
# -----------------
|
|
||||||
m4_define([b4_identification],
|
|
||||||
[/** Version number for the Bison executable that generated this parser. */
|
|
||||||
public static immutable string yy_bison_version = "b4_version";
|
|
||||||
|
|
||||||
/** Name of the skeleton that generated this parser. */
|
|
||||||
public static immutable string yy_bison_skeleton = b4_skeleton;
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
|
||||||
## Data types. ##
|
|
||||||
## ------------ ##
|
|
||||||
|
|
||||||
# b4_int_type(MIN, MAX)
|
|
||||||
# ---------------------
|
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
|
||||||
# MIN to MAX (included).
|
|
||||||
m4_define([b4_int_type],
|
|
||||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
|
||||||
[int])])
|
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
|
||||||
# ---------------------
|
|
||||||
# Return the smallest int type able to handle numbers ranging from
|
|
||||||
# `NAME_min' to `NAME_max' (included).
|
|
||||||
m4_define([b4_int_type_for],
|
|
||||||
[b4_int_type($1_min, $1_max)])
|
|
||||||
|
|
||||||
# b4_null
|
|
||||||
# -------
|
|
||||||
m4_define([b4_null], [null])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
|
|
||||||
#-----------------------------------------------------
|
|
||||||
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
|
||||||
m4_define([b4_integral_parser_table_define],
|
|
||||||
[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
|
|
||||||
private static immutable b4_int_type_for([$2])[[]] yy$1_ =
|
|
||||||
@{
|
|
||||||
$2
|
|
||||||
@};dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
|
||||||
## Assigning token numbers. ##
|
|
||||||
## ------------------------- ##
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
|
||||||
# ---------------------------------------
|
|
||||||
# Output the definition of this token as an enum.
|
|
||||||
m4_define([b4_token_enum],
|
|
||||||
[b4_token_format([ %s = %s,
|
|
||||||
], [$1])])
|
|
||||||
|
|
||||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
|
||||||
# -----------------------------------------------------
|
|
||||||
# Output the definition of the tokens as enums.
|
|
||||||
m4_define([b4_token_enums],
|
|
||||||
[/* Tokens. */
|
|
||||||
public enum YYTokenType {
|
|
||||||
|
|
||||||
/** Token returned by the scanner to signal the end of its input. */
|
|
||||||
EOF = 0,
|
|
||||||
b4_symbol_foreach([b4_token_enum])
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4-case(ID, CODE)
|
|
||||||
# -----------------
|
|
||||||
m4_define([b4_case], [ case $1:
|
|
||||||
$2
|
|
||||||
break;])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## Default values. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
|
||||||
b4_percent_define_default([[stype]], [[YYSemanticType]])])
|
|
||||||
|
|
||||||
# %name-prefix
|
|
||||||
m4_define_default([b4_prefix], [[YY]])
|
|
||||||
|
|
||||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]YYParser])])
|
|
||||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
|
||||||
|
|
||||||
#b4_percent_define_default([[location_type]], [Location])])
|
|
||||||
m4_define([b4_location_type], b4_percent_define_ifdef([[location_type]],[b4_percent_define_get([[location_type]])],[YYLocation]))
|
|
||||||
|
|
||||||
#b4_percent_define_default([[position_type]], [Position])])
|
|
||||||
m4_define([b4_position_type], b4_percent_define_ifdef([[position_type]],[b4_percent_define_get([[position_type]])],[YYPosition]))
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## Semantic Values. ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
|
||||||
# ----------------------------------------------
|
|
||||||
# See README. FIXME: factor in c-like?
|
|
||||||
m4_define([b4_symbol_value],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
[($1.$3)],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[($1.b4_symbol([$2], [type]))],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
|
||||||
# --------------------------------
|
|
||||||
# See README.
|
|
||||||
m4_define([b4_lhs_value],
|
|
||||||
[b4_symbol_value([yyval], [$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
|
||||||
# --------------------------------------------------
|
|
||||||
# See README.
|
|
||||||
#
|
|
||||||
# In this simple implementation, %token and %type have class names
|
|
||||||
# between the angle brackets.
|
|
||||||
m4_define([b4_rhs_value],
|
|
||||||
[b4_symbol_value([(yystack.valueAt (b4_subtract([$1], [$2])))], [$3], [$4])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_location()
|
|
||||||
# -----------------
|
|
||||||
# Expansion of @$.
|
|
||||||
m4_define([b4_lhs_location],
|
|
||||||
[(yyloc)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, POS)
|
|
||||||
# ---------------------------------
|
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
|
||||||
# on RHS.
|
|
||||||
m4_define([b4_rhs_location],
|
|
||||||
[yystack.locationAt ([$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param
|
|
||||||
# b4_parse_param
|
|
||||||
# --------------
|
|
||||||
# If defined, b4_lex_param arrives double quoted, but below we prefer
|
|
||||||
# it to be single quoted. Same for b4_parse_param.
|
|
||||||
|
|
||||||
# TODO: should be in bison.m4
|
|
||||||
m4_define_default([b4_lex_param], [[]]))
|
|
||||||
m4_define([b4_lex_param], b4_lex_param))
|
|
||||||
m4_define([b4_parse_param], b4_parse_param))
|
|
||||||
|
|
||||||
# b4_lex_param_decl
|
|
||||||
# -------------------
|
|
||||||
# Extra formal arguments of the constructor.
|
|
||||||
m4_define([b4_lex_param_decl],
|
|
||||||
[m4_ifset([b4_lex_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_decls(b4_lex_param))],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
m4_define([b4_param_decls],
|
|
||||||
[m4_map([b4_param_decl], [$@])])
|
|
||||||
m4_define([b4_param_decl], [, $1])
|
|
||||||
|
|
||||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_decl
|
|
||||||
# -------------------
|
|
||||||
# Extra formal arguments of the constructor.
|
|
||||||
m4_define([b4_parse_param_decl],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_decls(b4_parse_param))],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param_call
|
|
||||||
# -------------------
|
|
||||||
# Delegating the lexer parameters to the lexer constructor.
|
|
||||||
m4_define([b4_lex_param_call],
|
|
||||||
[m4_ifset([b4_lex_param],
|
|
||||||
[b4_remove_comma([$1],
|
|
||||||
b4_param_calls(b4_lex_param))],
|
|
||||||
[$1])])
|
|
||||||
m4_define([b4_param_calls],
|
|
||||||
[m4_map([b4_param_call], [$@])])
|
|
||||||
m4_define([b4_param_call], [, $2])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_cons
|
|
||||||
# -------------------
|
|
||||||
# Extra initialisations of the constructor.
|
|
||||||
m4_define([b4_parse_param_cons],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[b4_constructor_calls(b4_parse_param)])])
|
|
||||||
|
|
||||||
m4_define([b4_constructor_calls],
|
|
||||||
[m4_map([b4_constructor_call], [$@])])
|
|
||||||
m4_define([b4_constructor_call],
|
|
||||||
[this.$2 = $2;
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parse_param_vars
|
|
||||||
# -------------------
|
|
||||||
# Extra instance variables.
|
|
||||||
m4_define([b4_parse_param_vars],
|
|
||||||
[m4_ifset([b4_parse_param],
|
|
||||||
[
|
|
||||||
/* User arguments. */
|
|
||||||
b4_var_decls(b4_parse_param)])])
|
|
||||||
|
|
||||||
m4_define([b4_var_decls],
|
|
||||||
[m4_map_sep([b4_var_decl], [
|
|
||||||
], [$@])])
|
|
||||||
m4_define([b4_var_decl],
|
|
||||||
[ protected $1;])
|
|
||||||
@@ -1,897 +0,0 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
|
||||||
|
|
||||||
# Copyright (C) 2007-2011, 2019 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[d.m4])
|
|
||||||
|
|
||||||
|
|
||||||
m4_divert_push(0)dnl
|
|
||||||
@output(b4_parser_file_name@)@
|
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
|
|
||||||
[2007-2012, 2019])
|
|
||||||
|
|
||||||
b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
|
|
||||||
])[
|
|
||||||
version(D_Version2) {
|
|
||||||
} else {
|
|
||||||
static assert(false, "need compiler for D Version 2");
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_user_pre_prologue[
|
|
||||||
]b4_user_post_prologue[
|
|
||||||
]b4_percent_code_get([[imports]])[
|
|
||||||
import std.format;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
|
||||||
*
|
|
||||||
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
|
||||||
* Port to D language was done by Oliver Mangold.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Communication interface between the scanner and the Bison-generated
|
|
||||||
* parser <tt>]b4_parser_class[</tt>.
|
|
||||||
*/
|
|
||||||
public interface Lexer
|
|
||||||
{
|
|
||||||
]b4_locations_if([[/**
|
|
||||||
* Method to retrieve the beginning position of the last scanned token.
|
|
||||||
* @@return the position at which the last scanned token starts. */
|
|
||||||
@@property ]b4_position_type[ startPos ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to retrieve the ending position of the last scanned token.
|
|
||||||
* @@return the first position beyond the last scanned token. */
|
|
||||||
@@property ]b4_position_type[ endPos ();]])[
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to retrieve the semantic value of the last scanned token.
|
|
||||||
* @@return the semantic value of the last scanned token. */
|
|
||||||
@@property ]b4_yystype[ semanticVal ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Entry point for the scanner. Returns the token identifier corresponding
|
|
||||||
* to the next token and prepares to return the semantic value
|
|
||||||
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
|
||||||
* @@return the token identifier corresponding to the next token. */
|
|
||||||
YYTokenType yylex ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Entry point for error reporting. Emits an error
|
|
||||||
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
|
|
||||||
*
|
|
||||||
* ]b4_locations_if([[@@param loc The location of the element to which the
|
|
||||||
* error message is related]])[
|
|
||||||
* @@param s The string for the error message. */
|
|
||||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[string s);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final struct YYStackElement{
|
|
||||||
int state;
|
|
||||||
]b4_yystype[ value;
|
|
||||||
]b4_locations_if(b4_location_type[[] location;])[
|
|
||||||
}
|
|
||||||
|
|
||||||
private final struct YYStack {
|
|
||||||
private YYStackElement[] stack = [];
|
|
||||||
|
|
||||||
public final @@property ulong height()
|
|
||||||
{
|
|
||||||
return stack.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void push (int state, ]b4_yystype[ value]dnl
|
|
||||||
b4_locations_if([, ref ]b4_location_type[ loc])[)
|
|
||||||
{
|
|
||||||
stack ~= YYStackElement(state, value]b4_locations_if([, loc])[);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void pop ()
|
|
||||||
{
|
|
||||||
pop (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void pop (int num)
|
|
||||||
{
|
|
||||||
stack.length -= num;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int stateAt (int i)
|
|
||||||
{
|
|
||||||
return stack[$-i-1].state;
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_locations_if([[public final ref ]b4_location_type[ locationAt (int i)
|
|
||||||
{
|
|
||||||
return stack[$-i-1].location;
|
|
||||||
}
|
|
||||||
|
|
||||||
]])[public final ref ]b4_yystype[ valueAt (int i)
|
|
||||||
{
|
|
||||||
return stack[$-i-1].value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print the state stack on the debug stream.
|
|
||||||
public final void print (File stream)
|
|
||||||
{
|
|
||||||
stream.write ("Stack now");
|
|
||||||
for (int i = 0; i < stack.length; i++)
|
|
||||||
stream.write (" %d", stack[i].state);
|
|
||||||
stream.writeln ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]b4_locations_if(b4_position_type_if([[[
|
|
||||||
static assert(__traits(compiles,
|
|
||||||
(new ]b4_position_type[[1])[0]=(new ]b4_position_type[[1])[0]),
|
|
||||||
"struct/class ]b4_position_type[ must be default-constructible "
|
|
||||||
"and assignable");
|
|
||||||
static assert(__traits(compiles, (new string[1])[0]=(new ]b4_position_type[).toString()),
|
|
||||||
"error: struct/class ]b4_position_type[ must have toString method");
|
|
||||||
]]], [[
|
|
||||||
/**
|
|
||||||
* A struct denoting a point in the input.*/
|
|
||||||
public struct ]b4_position_type[ {
|
|
||||||
|
|
||||||
/** The column index within the line of input. */
|
|
||||||
public int column = 1;
|
|
||||||
/** The line number within an input file. */
|
|
||||||
public int line = 1;
|
|
||||||
/** The name of the input file. */
|
|
||||||
public string filename = "(unspecified file)";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a string representation of the position. */
|
|
||||||
public string toString() const {
|
|
||||||
return format("%s:%d.%d", filename, line, column);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]])b4_location_type_if([[[
|
|
||||||
static assert(__traits(compiles, (new ]b4_location_type[((new ]b4_position_type[[1])[0]))) &&
|
|
||||||
__traits(compiles, (new ]b4_location_type[((new ]b4_position_type[[1])[0], (new ]b4_position_type[[1])[0]))),
|
|
||||||
"error: struct/class ]b4_location_type[ must have "
|
|
||||||
"default constructor and constructors this(]b4_position_type[) and this(]b4_position_type[, ]b4_position_type[).");
|
|
||||||
static assert(__traits(compiles, (new ]b4_location_type[[1])[0].begin=(new ]b4_location_type[[1])[0].begin) &&
|
|
||||||
__traits(compiles, (new ]b4_location_type[[1])[0].begin=(new ]b4_location_type[[1])[0].end) &&
|
|
||||||
__traits(compiles, (new ]b4_location_type[[1])[0].end=(new ]b4_location_type[[1])[0].begin) &&
|
|
||||||
__traits(compiles, (new ]b4_location_type[[1])[0].end=(new ]b4_location_type[[1])[0].end),
|
|
||||||
"error: struct/class ]b4_location_type[ must have assignment-compatible "
|
|
||||||
"members/properties 'begin' and 'end'.");
|
|
||||||
static assert(__traits(compiles, (new string[1])[0]=(new ]b4_location_type[[1])[0].toString()),
|
|
||||||
"error: struct/class ]b4_location_type[ must have toString method.");
|
|
||||||
|
|
||||||
private immutable bool yy_location_is_class = !__traits(compiles, *(new ]b4_location_type[((new ]b4_position_type[[1])[0])));]]], [[
|
|
||||||
/**
|
|
||||||
* A class defining a pair of positions. Positions, defined by the
|
|
||||||
* <code>]b4_position_type[</code> class, denote a point in the input.
|
|
||||||
* Locations represent a part of the input through the beginning
|
|
||||||
* and ending positions. */
|
|
||||||
public class ]b4_location_type[
|
|
||||||
{
|
|
||||||
/** The first, inclusive, position in the range. */
|
|
||||||
public ]b4_position_type[ begin;
|
|
||||||
|
|
||||||
/** The first position beyond the range. */
|
|
||||||
public ]b4_position_type[ end;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a <code>]b4_location_type[</code> denoting an empty range located at
|
|
||||||
* a given point.
|
|
||||||
* @@param loc The position at which the range is anchored. */
|
|
||||||
public this (]b4_position_type[ loc) {
|
|
||||||
this.begin = this.end = loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a <code>]b4_location_type[</code> from the endpoints of the range.
|
|
||||||
* @@param begin The first position included in the range.
|
|
||||||
* @@param end The first position beyond the range. */
|
|
||||||
public this (]b4_position_type[ begin, ]b4_position_type[ end)
|
|
||||||
{
|
|
||||||
this.begin = begin;
|
|
||||||
this.end = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a representation of the location. For this to be correct,
|
|
||||||
* <code>]b4_position_type[</code> should override the <code>toString</code>
|
|
||||||
* method. */
|
|
||||||
public const string toString () const {
|
|
||||||
if (begin==end)
|
|
||||||
return begin.toString ();
|
|
||||||
else
|
|
||||||
return begin.toString () ~ "-" ~ end.toString ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private immutable bool yy_location_is_class = true;
|
|
||||||
|
|
||||||
]]))m4_ifdef([b4_user_union_members], [private union YYSemanticType
|
|
||||||
{
|
|
||||||
b4_user_union_members
|
|
||||||
};],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[private alias int YYSemanticType;]])])[
|
|
||||||
]b4_token_enums(b4_tokens)[
|
|
||||||
]b4_parser_class_declaration[
|
|
||||||
{
|
|
||||||
]b4_identification[
|
|
||||||
|
|
||||||
/** True if verbose error messages are enabled. */
|
|
||||||
public bool errorVerbose = ]b4_flag_value([error_verbose]);
|
|
||||||
|
|
||||||
b4_locations_if([[
|
|
||||||
private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n)
|
|
||||||
{
|
|
||||||
static if (yy_location_is_class) {
|
|
||||||
if (n > 0)
|
|
||||||
return new ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
|
|
||||||
else
|
|
||||||
return new ]b4_location_type[ (rhs.locationAt (0).end);
|
|
||||||
} else {
|
|
||||||
if (n > 0)
|
|
||||||
return ]b4_location_type[ (rhs.locationAt (n-1).begin, rhs.locationAt (0).end);
|
|
||||||
else
|
|
||||||
return ]b4_location_type[ (rhs.locationAt (0).end);
|
|
||||||
}
|
|
||||||
}]])[
|
|
||||||
|
|
||||||
]b4_lexer_if([[private class YYLexer implements Lexer {
|
|
||||||
]b4_percent_code_get([[lexer]])[
|
|
||||||
}
|
|
||||||
|
|
||||||
]])[/** The object doing lexical analysis for us. */
|
|
||||||
private Lexer yylexer;
|
|
||||||
]
|
|
||||||
b4_parse_param_vars
|
|
||||||
|
|
||||||
b4_lexer_if([[
|
|
||||||
/**
|
|
||||||
* Instantiates the Bison-generated parser.
|
|
||||||
*/
|
|
||||||
public this] (b4_parse_param_decl([b4_lex_param_decl])[) {
|
|
||||||
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
|
||||||
this.yyDebugStream = stderr;
|
|
||||||
]b4_parse_param_cons[
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates the Bison-generated parser.
|
|
||||||
* @@param yylexer The scanner that will supply tokens to the parser.
|
|
||||||
*/
|
|
||||||
b4_lexer_if([[protected]], [[public]]) [this (]b4_parse_param_decl([[Lexer yylexer]])[) {
|
|
||||||
this.yylexer = yylexer;
|
|
||||||
this.yyDebugStream = stderr;
|
|
||||||
]b4_parse_param_cons[
|
|
||||||
}
|
|
||||||
|
|
||||||
private File yyDebugStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the <tt>File</tt> on which the debugging output is
|
|
||||||
* printed.
|
|
||||||
*/
|
|
||||||
public File getDebugStream () { return yyDebugStream; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the <tt>std.File</tt> on which the debug output is printed.
|
|
||||||
* @@param s The stream that is used for debugging output.
|
|
||||||
*/
|
|
||||||
public final void setDebugStream(File s) { yyDebugStream = s; }
|
|
||||||
|
|
||||||
private int yydebug = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Answer the verbosity of the debugging output; 0 means that all kinds of
|
|
||||||
* output from the parser are suppressed.
|
|
||||||
*/
|
|
||||||
public final int getDebugLevel() { return yydebug; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the verbosity of the debugging output; 0 means that all kinds of
|
|
||||||
* output from the parser are suppressed.
|
|
||||||
* @@param level The verbosity level for debugging output.
|
|
||||||
*/
|
|
||||||
public final void setDebugLevel(int level) { yydebug = level; }
|
|
||||||
|
|
||||||
private final int yylex () {
|
|
||||||
return yylexer.yylex ();
|
|
||||||
}
|
|
||||||
protected final void yyerror (]b4_locations_if(ref [b4_location_type[ loc, ]])[string s) {
|
|
||||||
yylexer.yyerror (]b4_locations_if([loc, ])[s);
|
|
||||||
}]
|
|
||||||
|
|
||||||
[protected final void yycdebug (string s) {
|
|
||||||
if (yydebug > 0)
|
|
||||||
yyDebugStream.writeln (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returned by a Bison action in order to stop the parsing process and
|
|
||||||
* return success (<tt>true</tt>). */
|
|
||||||
public static immutable int YYACCEPT = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returned by a Bison action in order to stop the parsing process and
|
|
||||||
* return failure (<tt>false</tt>). */
|
|
||||||
public static immutable int YYABORT = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returned by a Bison action in order to start error recovery without
|
|
||||||
* printing an error message. */
|
|
||||||
public static immutable int YYERROR = 2;
|
|
||||||
|
|
||||||
// Internal return codes that are not supported for user semantic
|
|
||||||
// actions.
|
|
||||||
private static immutable int YYERRLAB = 3;
|
|
||||||
private static immutable int YYNEWSTATE = 4;
|
|
||||||
private static immutable int YYDEFAULT = 5;
|
|
||||||
private static immutable int YYREDUCE = 6;
|
|
||||||
private static immutable int YYERRLAB1 = 7;
|
|
||||||
private static immutable int YYRETURN = 8;
|
|
||||||
]b4_locations_if([
|
|
||||||
private static immutable YYSemanticType yy_semantic_null = cast(YYSemanticType)null;])[
|
|
||||||
private int yyerrstatus_ = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether error recovery is being done. In this state, the parser
|
|
||||||
* reads token until it reaches a known state, and then restarts normal
|
|
||||||
* operation. */
|
|
||||||
public final bool recovering ()
|
|
||||||
{
|
|
||||||
return yyerrstatus_ == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int yyaction (int yyn, ref YYStack yystack, int yylen)
|
|
||||||
{
|
|
||||||
]b4_yystype[ yyval;
|
|
||||||
]b4_locations_if([b4_location_type[ yyloc = yylloc_from_stack (yystack, yylen);]])[
|
|
||||||
|
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
|
||||||
`$$ = $1'. Otherwise, use the top of the stack.
|
|
||||||
|
|
||||||
Otherwise, the following line sets YYVAL to garbage.
|
|
||||||
This behavior is undocumented and Bison
|
|
||||||
users should not rely upon it. */
|
|
||||||
if (yylen > 0)
|
|
||||||
yyval = yystack.valueAt (yylen - 1);
|
|
||||||
else
|
|
||||||
yyval = yystack.valueAt (0);
|
|
||||||
|
|
||||||
yy_reduce_print (yyn, yystack);
|
|
||||||
|
|
||||||
switch (yyn)
|
|
||||||
{
|
|
||||||
]b4_user_actions[
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
|
||||||
|
|
||||||
yystack.pop (yylen);
|
|
||||||
yylen = 0;
|
|
||||||
|
|
||||||
/* Shift the result of the reduction. */
|
|
||||||
yyn = yyr1_[yyn];
|
|
||||||
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
|
||||||
if (0 <= yystate && yystate <= yylast_
|
|
||||||
&& yycheck_[yystate] == yystack.stateAt (0))
|
|
||||||
yystate = yytable_[yystate];
|
|
||||||
else
|
|
||||||
yystate = yydefgoto_[yyn - yyntokens_];
|
|
||||||
|
|
||||||
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
|
||||||
return YYNEWSTATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return YYSTR after stripping away unnecessary quotes and
|
|
||||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
|
||||||
that double-quoting is unnecessary unless the string contains an
|
|
||||||
apostrophe, a comma, or backslash (other than backslash-backslash).
|
|
||||||
YYSTR is taken from yytname. */
|
|
||||||
private final string yytnamerr_ (string yystr)
|
|
||||||
{
|
|
||||||
if (yystr[0] == '"')
|
|
||||||
{
|
|
||||||
string yyr;
|
|
||||||
strip_quotes: for (int i = 1; i < yystr.length; i++)
|
|
||||||
switch (yystr[i])
|
|
||||||
{
|
|
||||||
case '\'':
|
|
||||||
case ',':
|
|
||||||
break strip_quotes;
|
|
||||||
|
|
||||||
case '\\':
|
|
||||||
if (yystr[++i] != '\\')
|
|
||||||
break strip_quotes;
|
|
||||||
goto default;
|
|
||||||
default:
|
|
||||||
yyr ~= yystr[i];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '"':
|
|
||||||
return yyr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (yystr=="$end")
|
|
||||||
return "end of input";
|
|
||||||
|
|
||||||
return yystr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*--------------------------------.
|
|
||||||
| Print this symbol on YYOUTPUT. |
|
|
||||||
`--------------------------------*/
|
|
||||||
|
|
||||||
private final void yy_symbol_print (string s, int yytype,
|
|
||||||
ref ]b4_yystype[ yyvaluep]dnl
|
|
||||||
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
|
||||||
{
|
|
||||||
if (yydebug > 0) {
|
|
||||||
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
|
|
||||||
~ yytname_[yytype] ~ " ("]b4_locations_if([
|
|
||||||
~ yylocationp.toString() ~ ": "])[;
|
|
||||||
static if (__traits(compiles, message~=yyvaluep.toString ()))
|
|
||||||
message ~= yyvaluep.toString ();
|
|
||||||
else
|
|
||||||
message ~= format ("%s", &yyvaluep);
|
|
||||||
message ~= ")";
|
|
||||||
yycdebug (message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse input from the scanner that was specified at object construction
|
|
||||||
* time. Return whether the end of the input was reached successfully.
|
|
||||||
*
|
|
||||||
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
|
||||||
* imply that there were no syntax errors.
|
|
||||||
*/
|
|
||||||
public bool parse ()
|
|
||||||
{
|
|
||||||
/// Lookahead and lookahead in internal form.
|
|
||||||
int yychar = yyempty_;
|
|
||||||
int yytoken = 0;
|
|
||||||
|
|
||||||
/* State. */
|
|
||||||
int yyn = 0;
|
|
||||||
int yylen = 0;
|
|
||||||
int yystate = 0;
|
|
||||||
|
|
||||||
YYStack 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;
|
|
||||||
|
|
||||||
/// @@$.
|
|
||||||
]b4_location_type[ yyloc;])[
|
|
||||||
|
|
||||||
/// Semantic value of the lookahead.
|
|
||||||
]b4_yystype[ yylval;
|
|
||||||
|
|
||||||
int yyresult;
|
|
||||||
|
|
||||||
yycdebug ("Starting parse\n");
|
|
||||||
yyerrstatus_ = 0;
|
|
||||||
|
|
||||||
]m4_ifdef([b4_initial_action], [
|
|
||||||
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
|
||||||
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
|
||||||
/* User initialization code. */
|
|
||||||
b4_user_initial_action
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
m4_popdef([b4_at_dollar])])dnl
|
|
||||||
|
|
||||||
[ /* Initialize the stack. */
|
|
||||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
|
||||||
|
|
||||||
int label = YYNEWSTATE;
|
|
||||||
for (;;)
|
|
||||||
final switch (label)
|
|
||||||
{
|
|
||||||
/* New state. Unlike in the C/C++ skeletons, the state is already
|
|
||||||
pushed when we come here. */
|
|
||||||
case YYNEWSTATE:
|
|
||||||
yycdebug (format("Entering state %d\n", yystate));
|
|
||||||
if (yydebug > 0)
|
|
||||||
yystack.print (yyDebugStream);
|
|
||||||
|
|
||||||
/* Accept? */
|
|
||||||
if (yystate == yyfinal_)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* Take a decision. First try without lookahead. */
|
|
||||||
yyn = yypact_[yystate];
|
|
||||||
if (yy_pact_value_is_default_ (yyn))
|
|
||||||
{
|
|
||||||
label = YYDEFAULT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read a lookahead token. */
|
|
||||||
if (yychar == yyempty_)
|
|
||||||
{
|
|
||||||
yycdebug ("Reading a token: ");
|
|
||||||
yychar = yylex ();]
|
|
||||||
b4_locations_if([[
|
|
||||||
static if (yy_location_is_class) {
|
|
||||||
yylloc = new ]b4_location_type[(yylexer.startPos, yylexer.endPos);
|
|
||||||
} else {
|
|
||||||
yylloc = ]b4_location_type[(yylexer.startPos, yylexer.endPos);
|
|
||||||
}]])
|
|
||||||
yylval = yylexer.semanticVal;[
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert token to internal form. */
|
|
||||||
if (yychar <= YYTokenType.EOF)
|
|
||||||
{
|
|
||||||
yychar = yytoken = YYTokenType.EOF;
|
|
||||||
yycdebug ("Now at end of input.\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yytoken = yytranslate_ (yychar);
|
|
||||||
yy_symbol_print ("Next token is",
|
|
||||||
yytoken, yylval]b4_locations_if([, yylloc])[);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
|
||||||
detect an error, take that action. */
|
|
||||||
yyn += yytoken;
|
|
||||||
if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
|
|
||||||
label = YYDEFAULT;
|
|
||||||
|
|
||||||
/* <= 0 means reduce or error. */
|
|
||||||
else if ((yyn = yytable_[yyn]) <= 0)
|
|
||||||
{
|
|
||||||
if (yy_table_value_is_error_ (yyn))
|
|
||||||
label = YYERRLAB;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yyn = -yyn;
|
|
||||||
label = YYREDUCE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Shift the lookahead token. */
|
|
||||||
yy_symbol_print ("Shifting", yytoken,
|
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
|
||||||
|
|
||||||
/* Discard the token being shifted. */
|
|
||||||
yychar = yyempty_;
|
|
||||||
|
|
||||||
/* Count tokens shifted since error; after three, turn off error
|
|
||||||
* status. */
|
|
||||||
if (yyerrstatus_ > 0)
|
|
||||||
--yyerrstatus_;
|
|
||||||
|
|
||||||
yystate = yyn;
|
|
||||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
|
||||||
label = YYNEWSTATE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------.
|
|
||||||
| yydefault -- do the default action for the current state. |
|
|
||||||
`-----------------------------------------------------------*/
|
|
||||||
case YYDEFAULT:
|
|
||||||
yyn = yydefact_[yystate];
|
|
||||||
if (yyn == 0)
|
|
||||||
label = YYERRLAB;
|
|
||||||
else
|
|
||||||
label = YYREDUCE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*-----------------------------.
|
|
||||||
| yyreduce -- Do a reduction. |
|
|
||||||
`-----------------------------*/
|
|
||||||
case YYREDUCE:
|
|
||||||
yylen = yyr2_[yyn];
|
|
||||||
label = yyaction (yyn, yystack, yylen);
|
|
||||||
yystate = yystack.stateAt (0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*------------------------------------.
|
|
||||||
| yyerrlab -- here on detecting error |
|
|
||||||
`------------------------------------*/
|
|
||||||
case YYERRLAB:
|
|
||||||
/* If not already recovering from an error, report this error. */
|
|
||||||
if (yyerrstatus_ == 0)
|
|
||||||
{
|
|
||||||
++yynerrs_;
|
|
||||||
if (yychar == yyempty_)
|
|
||||||
yytoken = yyempty_;
|
|
||||||
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yylloc;])[
|
|
||||||
if (yyerrstatus_ == 3)
|
|
||||||
{
|
|
||||||
/* If just tried and failed to reuse lookahead token after an
|
|
||||||
* error, discard it. */
|
|
||||||
|
|
||||||
if (yychar <= YYTokenType.EOF)
|
|
||||||
{
|
|
||||||
/* Return failure if at end of input. */
|
|
||||||
if (yychar == YYTokenType.EOF)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
yychar = yyempty_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token after shifting the error
|
|
||||||
* token. */
|
|
||||||
label = YYERRLAB1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*-------------------------------------------------.
|
|
||||||
| errorlab -- error raised explicitly by YYERROR. |
|
|
||||||
`-------------------------------------------------*/
|
|
||||||
case YYERROR:
|
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (yylen - 1);])[
|
|
||||||
/* Do not reclaim the symbols of the rule which action triggered
|
|
||||||
this YYERROR. */
|
|
||||||
yystack.pop (yylen);
|
|
||||||
yylen = 0;
|
|
||||||
yystate = yystack.stateAt (0);
|
|
||||||
label = YYERRLAB1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------.
|
|
||||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
|
||||||
`-------------------------------------------------------------*/
|
|
||||||
case YYERRLAB1:
|
|
||||||
yyerrstatus_ = 3; /* Each real token shifted decrements this.xb */
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
yyn = yypact_[yystate];
|
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
|
||||||
{
|
|
||||||
yyn += yyterror_;
|
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
|
||||||
{
|
|
||||||
yyn = yytable_[yyn];
|
|
||||||
if (0 < yyn)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pop the current state because it cannot handle the error token. */
|
|
||||||
if (yystack.height == 1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
|
||||||
yystack.pop ();
|
|
||||||
yystate = yystack.stateAt (0);
|
|
||||||
if (yydebug > 0)
|
|
||||||
yystack.print (yyDebugStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
]b4_locations_if([
|
|
||||||
/* Muck with the stack to setup for yylloc. */
|
|
||||||
yystack.push (0, yy_semantic_null, yylloc);
|
|
||||||
yystack.push (0, yy_semantic_null, yyerrloc);
|
|
||||||
yyloc = yylloc_from_stack (yystack, 2);
|
|
||||||
yystack.pop (2);])[
|
|
||||||
|
|
||||||
/* Shift the error token. */
|
|
||||||
yy_symbol_print ("Shifting", yystos_[yyn],
|
|
||||||
yylval]b4_locations_if([, yyloc])[);
|
|
||||||
|
|
||||||
yystate = yyn;
|
|
||||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
|
||||||
label = YYNEWSTATE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Accept. */
|
|
||||||
case YYACCEPT:
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* Abort. */
|
|
||||||
case YYABORT:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate an error message.
|
|
||||||
private final string yysyntax_error (int yystate, int tok)
|
|
||||||
{
|
|
||||||
if (errorVerbose)
|
|
||||||
{
|
|
||||||
/* There are many possibilities here to consider:
|
|
||||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
|
||||||
See
|
|
||||||
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
|
||||||
for details. YYERROR is fine as it does not invoke this
|
|
||||||
function.
|
|
||||||
- If this state is a consistent state with a default action,
|
|
||||||
then the only way this function was invoked is if the
|
|
||||||
default action is an error action. In that case, don't
|
|
||||||
check for expected tokens because there are none.
|
|
||||||
- The only way there can be no lookahead present (in tok) is
|
|
||||||
if this state is a consistent state with a default action.
|
|
||||||
Thus, detecting the absence of a lookahead is sufficient to
|
|
||||||
determine that there is no unexpected or expected token to
|
|
||||||
report. In that case, just report a simple "syntax error".
|
|
||||||
- Don't assume there isn't a lookahead just because this
|
|
||||||
state is a consistent state with a default action. There
|
|
||||||
might have been a previous inconsistent state, consistent
|
|
||||||
state with a non-default action, or user semantic action
|
|
||||||
that manipulated yychar. (However, yychar is currently out
|
|
||||||
of scope during semantic actions.)
|
|
||||||
- Of course, the expected token list depends on states to
|
|
||||||
have correct lookahead information, and it depends on the
|
|
||||||
parser not to perform extra reductions after fetching a
|
|
||||||
lookahead from the scanner and before detecting a syntax
|
|
||||||
error. Thus, state merging (from LALR or IELR) and default
|
|
||||||
reductions corrupt the expected token list. However, the
|
|
||||||
list is correct for canonical LR with one exception: it
|
|
||||||
will still contain any token that will not be accepted due
|
|
||||||
to an error action in a later state.
|
|
||||||
*/
|
|
||||||
if (tok != yyempty_)
|
|
||||||
{
|
|
||||||
// FIXME: This method of building the message is not compatible
|
|
||||||
// with internationalization.
|
|
||||||
string res = "syntax error, unexpected ";
|
|
||||||
res ~= yytnamerr_ (yytname_[tok]);
|
|
||||||
int yyn = yypact_[yystate];
|
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
|
||||||
{
|
|
||||||
/* Start YYX at -YYN if negative to avoid negative
|
|
||||||
indexes in YYCHECK. In other words, skip the first
|
|
||||||
-YYN actions for this state because they are default
|
|
||||||
actions. */
|
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
|
||||||
int yychecklim = yylast_ - yyn + 1;
|
|
||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
|
||||||
int count = 0;
|
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
|
||||||
++count;
|
|
||||||
if (count < 5)
|
|
||||||
{
|
|
||||||
count = 0;
|
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
|
||||||
{
|
|
||||||
res ~= count++ == 0 ? ", expecting " : " or ";
|
|
||||||
res ~= yytnamerr_ (yytname_[x]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "syntax error";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the given <code>yypact_</code> value indicates a defaulted state.
|
|
||||||
* @@param yyvalue the value to check
|
|
||||||
*/
|
|
||||||
private static bool yy_pact_value_is_default_ (int yyvalue)
|
|
||||||
{
|
|
||||||
return yyvalue == yypact_ninf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
|
||||||
* @@param yyvalue the value to check
|
|
||||||
*/
|
|
||||||
private static bool yy_table_value_is_error_ (int yyvalue)
|
|
||||||
{
|
|
||||||
return yyvalue == yytable_ninf_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
|
||||||
STATE-NUM. */
|
|
||||||
private static immutable ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
|
||||||
|
|
||||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
|
||||||
positive, shift that token. If negative, reduce the rule which
|
|
||||||
number is the opposite. If YYTABLE_NINF_, syntax error. */
|
|
||||||
private static immutable ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
|
||||||
|
|
||||||
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
|
||||||
to YYLEX-NUM. */
|
|
||||||
private static immutable ]b4_int_type_for([b4_toknum])[[]
|
|
||||||
yytoken_number_ =
|
|
||||||
@{
|
|
||||||
]b4_toknum[
|
|
||||||
@};
|
|
||||||
|
|
||||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
|
||||||
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
|
||||||
private static immutable string[] yytname_ =
|
|
||||||
@{
|
|
||||||
]b4_tname[
|
|
||||||
@};
|
|
||||||
|
|
||||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
|
||||||
private static immutable ]b4_int_type_for([b4_rline])[[] yyrline_ =
|
|
||||||
@{
|
|
||||||
]b4_rline[
|
|
||||||
@};
|
|
||||||
|
|
||||||
// Report on the debug stream that the rule yyrule is going to be reduced.
|
|
||||||
private final void yy_reduce_print (int yyrule, ref YYStack yystack)
|
|
||||||
{
|
|
||||||
if (yydebug == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int yylno = yyrline_[yyrule];
|
|
||||||
int yynrhs = yyr2_[yyrule];
|
|
||||||
/* Print the symbols being reduced, and their result. */
|
|
||||||
yycdebug (format("Reducing stack by rule %d (line %d), ",
|
|
||||||
yyrule - 1, yylno));
|
|
||||||
|
|
||||||
/* The symbols being reduced. */
|
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
|
||||||
yy_symbol_print (format(" $%d =", yyi + 1),
|
|
||||||
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
|
||||||
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
|
||||||
private static immutable ]b4_int_type_for([b4_translate])[[] yytranslate_table_ =
|
|
||||||
@{
|
|
||||||
]b4_translate[
|
|
||||||
@};
|
|
||||||
|
|
||||||
private static ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
|
||||||
{
|
|
||||||
if (t >= 0 && t <= yyuser_token_number_max_)
|
|
||||||
return yytranslate_table_[t];
|
|
||||||
else
|
|
||||||
return yyundef_token_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static immutable int yylast_ = ]b4_last[;
|
|
||||||
private static immutable int yynnts_ = ]b4_nterms_number[;
|
|
||||||
private static immutable int yyempty_ = -2;
|
|
||||||
private static immutable int yyfinal_ = ]b4_final_state_number[;
|
|
||||||
private static immutable int yyterror_ = 1;
|
|
||||||
private static immutable int yyerrcode_ = 256;
|
|
||||||
private static immutable int yyntokens_ = ]b4_tokens_number[;
|
|
||||||
|
|
||||||
private static immutable int yyuser_token_number_max_ = ]b4_user_token_number_max[;
|
|
||||||
private static immutable int yyundef_token_ = ]b4_undef_token_number[;
|
|
||||||
|
|
||||||
]/* User implementation code. */
|
|
||||||
b4_percent_code_get[]dnl
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
b4_epilogue
|
|
||||||
m4_divert_pop(0)dnl
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
# C++ skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
# b4_stack_file
|
|
||||||
# -------------
|
|
||||||
# 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
|
|
||||||
# ---------------
|
|
||||||
m4_define([b4_stack_define],
|
|
||||||
[[ /// A stack with random access from its top.
|
|
||||||
template <typename T, typename S = std::vector<T> >
|
|
||||||
class stack
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Hide our reversed order.
|
|
||||||
typedef typename S::reverse_iterator iterator;
|
|
||||||
typedef typename S::const_reverse_iterator const_iterator;
|
|
||||||
typedef typename S::size_type size_type;
|
|
||||||
|
|
||||||
stack (size_type n = 200)
|
|
||||||
: seq_ (n)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/// Random access.
|
|
||||||
///
|
|
||||||
/// Index 0 returns the topmost element.
|
|
||||||
T&
|
|
||||||
operator[] (size_type i)
|
|
||||||
{
|
|
||||||
return seq_[size () - 1 - i];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Random access.
|
|
||||||
///
|
|
||||||
/// Index 0 returns the topmost element.
|
|
||||||
T&
|
|
||||||
operator[] (int i)
|
|
||||||
{
|
|
||||||
return operator[] (size_type (i));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Random access.
|
|
||||||
///
|
|
||||||
/// Index 0 returns the topmost element.
|
|
||||||
const T&
|
|
||||||
operator[] (size_type i) const
|
|
||||||
{
|
|
||||||
return seq_[size () - 1 - i];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Random access.
|
|
||||||
///
|
|
||||||
/// Index 0 returns the topmost element.
|
|
||||||
const T&
|
|
||||||
operator[] (int i) const
|
|
||||||
{
|
|
||||||
return operator[] (size_type (i));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Steal the contents of \a t.
|
|
||||||
///
|
|
||||||
/// Close to move-semantics.
|
|
||||||
void
|
|
||||||
push (YY_MOVE_REF (T) t)
|
|
||||||
{
|
|
||||||
seq_.push_back (T ());
|
|
||||||
operator[] (0).move (t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pop elements from the stack.
|
|
||||||
void
|
|
||||||
pop (int n = 1) YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
for (; 0 < n; --n)
|
|
||||||
seq_.pop_back ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pop all elements from the stack.
|
|
||||||
void
|
|
||||||
clear () YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
seq_.clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Number of elements on the stack.
|
|
||||||
size_type
|
|
||||||
size () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return seq_.size ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Iterator on top of the stack (going downwards).
|
|
||||||
const_iterator
|
|
||||||
begin () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return seq_.rbegin ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bottom of the stack.
|
|
||||||
const_iterator
|
|
||||||
end () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
return seq_.rend ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Present a slice of the top of a stack.
|
|
||||||
class slice
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
slice (const stack& stack, int range)
|
|
||||||
: stack_ (stack)
|
|
||||||
, range_ (range)
|
|
||||||
{}
|
|
||||||
|
|
||||||
const T&
|
|
||||||
operator[] (int i) const
|
|
||||||
{
|
|
||||||
return stack_[range_ - i];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
const stack& stack_;
|
|
||||||
int range_;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
stack (const stack&);
|
|
||||||
stack& operator= (const stack&);
|
|
||||||
/// The wrapped container.
|
|
||||||
S seq_;
|
|
||||||
};
|
|
||||||
]])
|
|
||||||
|
|
||||||
m4_ifdef([b4_stack_file],
|
|
||||||
[b4_output_begin([b4_dir_prefix], [b4_stack_file])[
|
|
||||||
]b4_generated_by[
|
|
||||||
// Starting with Bison 3.2, this file is useless: the structure it
|
|
||||||
// used to define is now defined with the parser itself.
|
|
||||||
//
|
|
||||||
// To get rid of this file:
|
|
||||||
// 1. add 'require "3.2"' (or newer) to your grammar file
|
|
||||||
// 2. remove references to this file from your build system.
|
|
||||||
]b4_output_end[
|
|
||||||
]])
|
|
||||||
+159
@@ -0,0 +1,159 @@
|
|||||||
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
|
# Copyright (C) 2002-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/>.
|
||||||
|
|
||||||
|
|
||||||
|
# b4_stack_file
|
||||||
|
# -------------
|
||||||
|
# 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
|
||||||
|
# ---------------
|
||||||
|
m4_define([b4_stack_define],
|
||||||
|
[[ /// A stack with random access from its top.
|
||||||
|
template <typename T, typename S = std::vector<T> >
|
||||||
|
class stack
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Hide our reversed order.
|
||||||
|
typedef typename S::reverse_iterator iterator;
|
||||||
|
typedef typename S::const_reverse_iterator const_iterator;
|
||||||
|
typedef typename S::size_type size_type;
|
||||||
|
|
||||||
|
stack (size_type n = 200)
|
||||||
|
: seq_ (n)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/// Random access.
|
||||||
|
///
|
||||||
|
/// Index 0 returns the topmost element.
|
||||||
|
T&
|
||||||
|
operator[] (size_type i)
|
||||||
|
{
|
||||||
|
return seq_[size () - 1 - i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Random access.
|
||||||
|
///
|
||||||
|
/// Index 0 returns the topmost element.
|
||||||
|
T&
|
||||||
|
operator[] (int i)
|
||||||
|
{
|
||||||
|
return operator[] (size_type (i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Random access.
|
||||||
|
///
|
||||||
|
/// Index 0 returns the topmost element.
|
||||||
|
const T&
|
||||||
|
operator[] (size_type i) const
|
||||||
|
{
|
||||||
|
return seq_[size () - 1 - i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Random access.
|
||||||
|
///
|
||||||
|
/// Index 0 returns the topmost element.
|
||||||
|
const T&
|
||||||
|
operator[] (int i) const
|
||||||
|
{
|
||||||
|
return operator[] (size_type (i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Steal the contents of \a t.
|
||||||
|
///
|
||||||
|
/// Close to move-semantics.
|
||||||
|
void
|
||||||
|
push (YY_MOVE_REF (T) t)
|
||||||
|
{
|
||||||
|
seq_.push_back (T ());
|
||||||
|
operator[](0).move (t);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pop (int n = 1)
|
||||||
|
{
|
||||||
|
for (; 0 < n; --n)
|
||||||
|
seq_.pop_back ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clear ()
|
||||||
|
{
|
||||||
|
seq_.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
|
size_type
|
||||||
|
size () const
|
||||||
|
{
|
||||||
|
return seq_.size ();
|
||||||
|
}
|
||||||
|
|
||||||
|
const_iterator
|
||||||
|
begin () const
|
||||||
|
{
|
||||||
|
return seq_.rbegin ();
|
||||||
|
}
|
||||||
|
|
||||||
|
const_iterator
|
||||||
|
end () const
|
||||||
|
{
|
||||||
|
return seq_.rend ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
stack (const stack&);
|
||||||
|
stack& operator= (const stack&);
|
||||||
|
/// The wrapped container.
|
||||||
|
S seq_;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Present a slice of the top of a stack.
|
||||||
|
template <typename T, typename S = stack<T> >
|
||||||
|
class slice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
slice (const S& stack, int range)
|
||||||
|
: stack_ (stack)
|
||||||
|
, range_ (range)
|
||||||
|
{}
|
||||||
|
|
||||||
|
const T&
|
||||||
|
operator[] (int i) const
|
||||||
|
{
|
||||||
|
return stack_[range_ - i];
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const S& stack_;
|
||||||
|
int range_;
|
||||||
|
};
|
||||||
|
]])
|
||||||
|
|
||||||
|
m4_ifdef([b4_stack_file],
|
||||||
|
[b4_output_begin([b4_dir_prefix], [b4_stack_file])[
|
||||||
|
]b4_generated_by[
|
||||||
|
// Starting with Bison 3.2, this file is useless: the structure it
|
||||||
|
// used to define is now defined with the parser itself.
|
||||||
|
//
|
||||||
|
// To get rid of this file:
|
||||||
|
// 1. add 'require "3.2"' (or newer) to your grammar file
|
||||||
|
// 2. remove references to this file from your build system.
|
||||||
|
]b4_output_end[
|
||||||
|
]])
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2015, 2018 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
|
||||||
@@ -78,79 +78,72 @@ m4_define([b4_variant_includes],
|
|||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
# b4_variant_define
|
||||||
|
# -----------------
|
||||||
## -------------------------- ##
|
# Define "variant".
|
||||||
## Adjustments for variants. ##
|
m4_define([b4_variant_define],
|
||||||
## -------------------------- ##
|
[[ /// A char[S] buffer to store and retrieve objects.
|
||||||
|
|
||||||
|
|
||||||
# b4_value_type_declare
|
|
||||||
# ---------------------
|
|
||||||
# Define semantic_type.
|
|
||||||
m4_define([b4_value_type_declare],
|
|
||||||
[[ /// A buffer to store and retrieve objects.
|
|
||||||
///
|
///
|
||||||
/// Sort of a variant, but does not keep track of the nature
|
/// Sort of a variant, but does not keep track of the nature
|
||||||
/// of the stored data, since that knowledge is available
|
/// of the stored data, since that knowledge is available
|
||||||
/// via the current parser state.
|
/// via the current state.
|
||||||
class semantic_type
|
template <size_t S>
|
||||||
|
struct variant
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
/// Type of *this.
|
/// Type of *this.
|
||||||
typedef semantic_type self_type;
|
typedef variant<S> self_type;
|
||||||
|
|
||||||
/// Empty construction.
|
/// Empty construction.
|
||||||
semantic_type () YY_NOEXCEPT
|
variant ()
|
||||||
: yybuffer_ ()]b4_parse_assert_if([
|
: yybuffer_ ()]b4_parse_assert_if([
|
||||||
, yytypeid_ (YY_NULLPTR)])[
|
, yytypeid_ (YY_NULLPTR)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Construct and fill.
|
/// Construct and fill.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
variant (YY_RVREF (T) t)]b4_parse_assert_if([
|
||||||
: yytypeid_ (&typeid (T))])[
|
: yytypeid_ (&typeid (T))])[
|
||||||
{
|
{
|
||||||
YYASSERT (sizeof (T) <= size);
|
YYASSERT (sizeof (T) <= S);
|
||||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destruction, allowed only if empty.
|
/// Destruction, allowed only if empty.
|
||||||
~semantic_type () YY_NOEXCEPT
|
~variant ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YYASSERT (!yytypeid_);
|
||||||
])[}
|
])[}
|
||||||
|
|
||||||
# if 201103L <= YY_CPLUSPLUS
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
|
||||||
template <typename T, typename... U>
|
|
||||||
T&
|
|
||||||
emplace (U&&... u)
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
YYASSERT (!yytypeid_);
|
|
||||||
YYASSERT (sizeof (T) <= size);
|
|
||||||
yytypeid_ = & typeid (T);])[
|
|
||||||
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
|
||||||
}
|
|
||||||
# else
|
|
||||||
/// Instantiate an empty \a T in here.
|
/// Instantiate an empty \a T in here.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
emplace ()
|
emplace ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YYASSERT (!yytypeid_);
|
||||||
YYASSERT (sizeof (T) <= size);
|
YYASSERT (sizeof (T) <= S);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);])[
|
||||||
return *new (yyas_<T> ()) T ();
|
return *new (yyas_<T> ()) T ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# if 201103L <= YY_CPLUSPLUS
|
||||||
|
/// Instantiate a \a T in here from \a t.
|
||||||
|
template <typename T, typename U>
|
||||||
|
T&
|
||||||
|
emplace (U&& u)
|
||||||
|
{]b4_parse_assert_if([
|
||||||
|
YYASSERT (!yytypeid_);
|
||||||
|
YYASSERT (sizeof (T) <= S);
|
||||||
|
yytypeid_ = & typeid (T);])[
|
||||||
|
return *new (yyas_<T> ()) T (std::forward <U>(u));
|
||||||
|
}
|
||||||
|
# else
|
||||||
/// Instantiate a \a T in here from \a t.
|
/// Instantiate a \a T in here from \a t.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
emplace (const T& t)
|
emplace (const T& t)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YYASSERT (!yytypeid_);
|
||||||
YYASSERT (sizeof (T) <= size);
|
YYASSERT (sizeof (T) <= S);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);])[
|
||||||
return *new (yyas_<T> ()) T (t);
|
return *new (yyas_<T> ()) T (t);
|
||||||
}
|
}
|
||||||
@@ -177,75 +170,75 @@ m4_define([b4_value_type_declare],
|
|||||||
/// Accessor to a built \a T.
|
/// Accessor to a built \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T&
|
T&
|
||||||
as () YY_NOEXCEPT
|
as ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YYASSERT (yytypeid_);
|
||||||
YYASSERT (*yytypeid_ == typeid (T));
|
YYASSERT (*yytypeid_ == typeid (T));
|
||||||
YYASSERT (sizeof (T) <= size);])[
|
YYASSERT (sizeof (T) <= S);])[
|
||||||
return *yyas_<T> ();
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Const accessor to a built \a T (for %printer).
|
/// Const accessor to a built \a T (for %printer).
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T&
|
const T&
|
||||||
as () const YY_NOEXCEPT
|
as () const
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YYASSERT (yytypeid_);
|
||||||
YYASSERT (*yytypeid_ == typeid (T));
|
YYASSERT (*yytypeid_ == typeid (T));
|
||||||
YYASSERT (sizeof (T) <= size);])[
|
YYASSERT (sizeof (T) <= S);])[
|
||||||
return *yyas_<T> ();
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Swap the content with \a that, of same type.
|
/// Swap the content with \a other, of same type.
|
||||||
///
|
///
|
||||||
/// 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 responsibility.
|
||||||
/// Swapping between built and (possibly) non-built is done with
|
/// Swapping between built and (possibly) non-built is done with
|
||||||
/// self_type::move ().
|
/// variant::move ().
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
swap (self_type& that) YY_NOEXCEPT
|
swap (self_type& other)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YYASSERT (yytypeid_);
|
||||||
YYASSERT (*yytypeid_ == *that.yytypeid_);])[
|
YYASSERT (*yytypeid_ == *other.yytypeid_);])[
|
||||||
std::swap (as<T> (), that.as<T> ());
|
std::swap (as<T> (), other.as<T> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Move the content of \a that to this.
|
/// Move the content of \a other to this.
|
||||||
///
|
///
|
||||||
/// Destroys \a that.
|
/// Destroys \a other.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
move (self_type& that)
|
move (self_type& other)
|
||||||
{
|
{
|
||||||
# if 201103L <= YY_CPLUSPLUS
|
# if 201103L <= YY_CPLUSPLUS
|
||||||
emplace<T> (std::move (that.as<T> ()));
|
emplace<T> (std::move (other.as<T> ()));
|
||||||
# else
|
# else
|
||||||
emplace<T> ();
|
emplace<T> ();
|
||||||
swap<T> (that);
|
swap<T> (other);
|
||||||
# endif
|
# endif
|
||||||
that.destroy<T> ();
|
other.destroy<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
# if 201103L <= YY_CPLUSPLUS
|
# if 201103L <= YY_CPLUSPLUS
|
||||||
/// Move the content of \a that to this.
|
/// Move the content of \a other to this.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
move (self_type&& that)
|
move (self_type&& other)
|
||||||
{
|
{
|
||||||
emplace<T> (std::move (that.as<T> ()));
|
emplace<T> (std::move (other.as<T> ()));
|
||||||
that.destroy<T> ();
|
other.destroy<T> ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Copy the content of \a that to this.
|
/// Copy the content of \a other to this.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
copy (const self_type& that)
|
copy (const self_type& other)
|
||||||
{
|
{
|
||||||
emplace<T> (that.as<T> ());
|
emplace<T> (other.as<T> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destroy the stored \a T.
|
/// Destroy the stored \a T.
|
||||||
@@ -260,12 +253,12 @@ m4_define([b4_value_type_declare],
|
|||||||
private:
|
private:
|
||||||
/// Prohibit blind copies.
|
/// Prohibit blind copies.
|
||||||
self_type& operator= (const self_type&);
|
self_type& operator= (const self_type&);
|
||||||
semantic_type (const self_type&);
|
variant (const self_type&);
|
||||||
|
|
||||||
/// Accessor to raw memory as \a T.
|
/// Accessor to raw memory as \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T*
|
T*
|
||||||
yyas_ () YY_NOEXCEPT
|
yyas_ ()
|
||||||
{
|
{
|
||||||
void *yyp = yybuffer_.yyraw;
|
void *yyp = yybuffer_.yyraw;
|
||||||
return static_cast<T*> (yyp);
|
return static_cast<T*> (yyp);
|
||||||
@@ -274,26 +267,18 @@ m4_define([b4_value_type_declare],
|
|||||||
/// Const accessor to raw memory as \a T.
|
/// Const accessor to raw memory as \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T*
|
const T*
|
||||||
yyas_ () const YY_NOEXCEPT
|
yyas_ () const
|
||||||
{
|
{
|
||||||
const void *yyp = yybuffer_.yyraw;
|
const void *yyp = yybuffer_.yyraw;
|
||||||
return static_cast<const T*> (yyp);
|
return static_cast<const T*> (yyp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An auxiliary type to compute the largest semantic type.
|
|
||||||
union union_type
|
|
||||||
{]b4_type_foreach([b4_char_sizeof])[ };
|
|
||||||
|
|
||||||
/// The size of the largest semantic type.
|
|
||||||
enum { size = sizeof (union_type) };
|
|
||||||
|
|
||||||
/// A buffer to store semantic values.
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
/// Strongest alignment constraints.
|
/// Strongest alignment constraints.
|
||||||
long double yyalign_me;
|
long double yyalign_me;
|
||||||
/// A buffer large enough to store any of the semantic values.
|
/// A buffer large enough to store any of the semantic values.
|
||||||
char yyraw[size];
|
char yyraw[S];
|
||||||
} yybuffer_;]b4_parse_assert_if([
|
} 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.
|
||||||
@@ -302,31 +287,40 @@ m4_define([b4_value_type_declare],
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
## -------------------------- ##
|
||||||
|
## Adjustments for variants. ##
|
||||||
|
## -------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_value_type_declare
|
||||||
|
# ---------------------
|
||||||
|
# Declare semantic_type.
|
||||||
|
m4_define([b4_value_type_declare],
|
||||||
|
[[ /// An auxiliary type to compute the largest semantic type.
|
||||||
|
union union_type
|
||||||
|
{]b4_type_foreach([b4_char_sizeof])[};
|
||||||
|
|
||||||
|
/// Symbol semantic values.
|
||||||
|
typedef variant<sizeof (union_type)> semantic_type;][]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# How the semantic value is extracted when using variants.
|
# How the semantic value is extracted when using variants.
|
||||||
|
|
||||||
# b4_symbol_value(VAL, SYMBOL-NUM, [TYPE])
|
# b4_symbol_value(VAL, [TYPE])
|
||||||
# ----------------------------------------
|
# ----------------------------
|
||||||
# See README.
|
|
||||||
m4_define([b4_symbol_value],
|
m4_define([b4_symbol_value],
|
||||||
[m4_ifval([$3],
|
[m4_ifval([$2],
|
||||||
[$1.as< $3 > ()],
|
[$1.as< $2 > ()],
|
||||||
[m4_ifval([$2],
|
[$1])])
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[$1.as < b4_symbol([$2], [type]) > ()],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
|
# b4_symbol_value_template(VAL, [TYPE])
|
||||||
# -------------------------------------------------
|
# -------------------------------------
|
||||||
# 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([$3],
|
[m4_ifval([$2],
|
||||||
[$1.template as< $3 > ()],
|
[$1.template as< $2 > ()],
|
||||||
[m4_ifval([$2],
|
[$1])])
|
||||||
[b4_symbol_if([$2], [has_type],
|
|
||||||
[$1.template as < b4_symbol([$2], [type]) > ()],
|
|
||||||
[$1])],
|
|
||||||
[$1])])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -335,119 +329,120 @@ m4_define([b4_symbol_value_template],
|
|||||||
## ------------- ##
|
## ------------- ##
|
||||||
|
|
||||||
|
|
||||||
# _b4_includes_tokens(SYMBOL-NUM...)
|
# _b4_symbol_constructor_declare(SYMBOL-NUMBER)
|
||||||
# ----------------------------------
|
# ---------------------------------------------
|
||||||
# Expands to non-empty iff one of the SYMBOL-NUM denotes
|
# Declare the overloaded version of make_symbol for the (common) type of
|
||||||
# a token.
|
# these SYMBOL-NUMBERS. Use at class-level.
|
||||||
m4_define([_b4_is_token],
|
m4_define([_b4_symbol_constructor_declare],
|
||||||
[b4_symbol_if([$1], [is_token], [1])])
|
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||||
m4_define([_b4_includes_tokens],
|
|
||||||
[m4_map([_b4_is_token], [$@])])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_token_maker_define(SYMBOL-NUM)
|
|
||||||
# ----------------------------------
|
|
||||||
# Declare make_SYMBOL for SYMBOL-NUM. Use at class-level.
|
|
||||||
m4_define([_b4_token_maker_define],
|
|
||||||
[b4_token_visible_if([$1],
|
|
||||||
[#if 201103L <= YY_CPLUSPLUS
|
[#if 201103L <= YY_CPLUSPLUS
|
||||||
static
|
static
|
||||||
symbol_type
|
symbol_type
|
||||||
make_[]_b4_symbol([$1], [id]) (b4_join(
|
make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
b4_symbol_if([$1], [has_type],
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
[b4_symbol([$1], [type]) v]),
|
[b4_symbol([$1], [type]) v]),
|
||||||
b4_locations_if([location_type l])))
|
b4_locations_if([location_type l])));
|
||||||
{
|
|
||||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
|
||||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
|
||||||
b4_locations_if([std::move (l)])));
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static
|
static
|
||||||
symbol_type
|
symbol_type
|
||||||
make_[]_b4_symbol([$1], [id]) (b4_join(
|
make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
b4_symbol_if([$1], [has_type],
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
[const b4_symbol([$1], [type])& v]),
|
[const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([const location_type& l])))
|
b4_locations_if([const location_type& l])));
|
||||||
{
|
|
||||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
|
||||||
b4_locations_if([l])));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
])])
|
])])])
|
||||||
|
|
||||||
|
|
||||||
m4_define([_b4_type_clause],
|
# b4_symbol_constructor_declare
|
||||||
[b4_symbol_if([$1], [is_token],
|
# -----------------------------
|
||||||
[b4_symbol_if([$1], [has_id],
|
# Declare symbol constructors for all the value types.
|
||||||
[tok == token::b4_symbol([$1], [id])],
|
# Use at class-level.
|
||||||
[tok == b4_symbol([$1], [user_number])])])])
|
m4_define([b4_symbol_constructor_declare],
|
||||||
|
[ // Symbol constructors declarations.
|
||||||
|
b4_symbol_foreach([_b4_symbol_constructor_declare])])
|
||||||
|
|
||||||
|
|
||||||
# _b4_token_constructor_define(SYMBOL-NUM...)
|
|
||||||
# -------------------------------------------
|
# _b4_symbol_constructor_define(SYMBOL-NUMBER)
|
||||||
# Define a unique make_symbol for all the SYMBOL-NUM (they
|
# --------------------------------------------
|
||||||
# have the same type). Use at class-level.
|
# Define symbol constructor for this SYMBOL-NUMBER.
|
||||||
m4_define([_b4_token_constructor_define],
|
m4_define([_b4_symbol_constructor_define],
|
||||||
[m4_ifval(_b4_includes_tokens($@),
|
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||||
[[#if 201103L <= YY_CPLUSPLUS
|
[# if 201103L <= YY_CPLUSPLUS
|
||||||
symbol_type (]b4_join(
|
inline
|
||||||
[int tok],
|
b4_parser_class_name::symbol_type
|
||||||
b4_symbol_if([$1], [has_type],
|
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
[b4_symbol([$1], [type]) v]),
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
b4_locations_if([location_type l]))[)
|
[b4_symbol([$1], [type]) v]),
|
||||||
: super_type(]b4_join([token_type (tok)],
|
b4_locations_if([location_type l])))
|
||||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
{
|
||||||
b4_locations_if([std::move (l)]))[)
|
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||||
{
|
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||||
YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
b4_locations_if([std::move (l)])));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
symbol_type (]b4_join(
|
inline
|
||||||
[int tok],
|
b4_parser_class_name::symbol_type
|
||||||
b4_symbol_if([$1], [has_type],
|
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
[const b4_symbol([$1], [type])& v]),
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
b4_locations_if([const location_type& l]))[)
|
[const b4_symbol([$1], [type])& v]),
|
||||||
: super_type(]b4_join([token_type (tok)],
|
b4_locations_if([const location_type& l])))
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
{
|
||||||
b4_locations_if([l]))[)
|
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||||
{
|
b4_symbol_if([$1], [has_type], [v]),
|
||||||
YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
b4_locations_if([l])));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
]])])
|
])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_basic_symbol_constructor_define(SYMBOL-NUM)
|
# b4_basic_symbol_constructor_declare
|
||||||
# ----------------------------------------------
|
# -----------------------------------
|
||||||
# Generate a constructor for basic_symbol from given type.
|
# Generate a constructor declaration for basic_symbol from given type.
|
||||||
m4_define([b4_basic_symbol_constructor_define],
|
m4_define([b4_basic_symbol_constructor_declare],
|
||||||
[[#if 201103L <= YY_CPLUSPLUS
|
[[# if 201103L <= YY_CPLUSPLUS
|
||||||
basic_symbol (]b4_join(
|
basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
|
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
|
||||||
b4_locations_if([location_type&& l]))[)
|
b4_locations_if([location_type&& l]))[);
|
||||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
|
||||||
, value (std::move (v))])[]b4_locations_if([
|
|
||||||
, location (std::move (l))])[
|
|
||||||
{}
|
|
||||||
#else
|
#else
|
||||||
basic_symbol (]b4_join(
|
basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),
|
b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),
|
||||||
b4_locations_if([const location_type& l]))[)
|
b4_locations_if([const location_type& l]))[);
|
||||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
|
||||||
, value (v)])[]b4_locations_if([
|
|
||||||
, location (l)])[
|
|
||||||
{}
|
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
# b4_basic_symbol_constructor_define
|
||||||
|
# ----------------------------------
|
||||||
|
# Generate a constructor implementation for basic_symbol from given type.
|
||||||
|
m4_define([b4_basic_symbol_constructor_define],
|
||||||
|
[[# if 201103L <= YY_CPLUSPLUS
|
||||||
|
template <typename Base>
|
||||||
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
|
[typename Base::kind_type t],
|
||||||
|
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
|
||||||
|
b4_locations_if([location_type&& l]))[)
|
||||||
|
: Base (t)]b4_symbol_if([$1], [has_type], [
|
||||||
|
, value (std::move (v))])[]b4_locations_if([
|
||||||
|
, location (std::move (l))])[
|
||||||
|
{}
|
||||||
|
#else
|
||||||
|
template <typename Base>
|
||||||
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
|
[typename Base::kind_type t],
|
||||||
|
b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),
|
||||||
|
b4_locations_if([const location_type& l]))[)
|
||||||
|
: Base (t)]b4_symbol_if([$1], [has_type], [
|
||||||
|
, value (v)])[]b4_locations_if([
|
||||||
|
, location (l)])[
|
||||||
|
{}
|
||||||
|
#endif
|
||||||
|
]])
|
||||||
|
|
||||||
# b4_token_constructor_define
|
# b4_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_token_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_token_maker_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-2019 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018 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-2019 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018 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 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2text.xsl - transform Bison XML Report into plain text.
|
xml2text.xsl - transform Bison XML Report into plain text.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018 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 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||||
|
|
||||||
Copyright (C) 2007-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
-*- C -*-
|
-*- C -*-
|
||||||
# Yacc compatible skeleton for Bison
|
# Yacc compatible skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software
|
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software
|
||||||
# Foundation, Inc.
|
# Foundation, Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[1984, 1989-1990, 2000-2015, 2018-2019])
|
[1984, 1989-1990, 2000-2015, 2018])
|
||||||
|
|
||||||
# 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
|
||||||
@@ -51,7 +51,7 @@ m4_define([b4_lac_flag],
|
|||||||
[m4_if(b4_percent_define_get([[parse.lac]]),
|
[m4_if(b4_percent_define_get([[parse.lac]]),
|
||||||
[none], [[0]], [[1]])])
|
[none], [[0]], [[1]])])
|
||||||
|
|
||||||
m4_include(b4_skeletonsdir/[c.m4])
|
m4_include(b4_pkgdatadir/[c.m4])
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
@@ -128,18 +128,19 @@ m4_define([b4_int_type],
|
|||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
# b4_lhs_value([TYPE])
|
||||||
# --------------------------------
|
# --------------------
|
||||||
# See README.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value(yyval, [$1], [$2])])
|
[b4_symbol_value(yyval, [$1])])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, POS, [SYMBOL-NUM], [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
# ----------------------------------------------------
|
# --------------------------------------
|
||||||
# See README.
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3], [$4])])
|
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
@@ -153,12 +154,12 @@ m4_define([b4_lhs_location],
|
|||||||
[(yyloc)])
|
[(yyloc)])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_location(RULE-LENGTH, POS)
|
# b4_rhs_location(RULE-LENGTH, NUM)
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||||
# on RHS.
|
# on RHS.
|
||||||
m4_define([b4_rhs_location],
|
m4_define([b4_rhs_location],
|
||||||
[(yylsp@{b4_subtract([$2], [$1])@})])
|
[(yylsp@{b4_subtract([$2], [$1])@})])
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
@@ -561,16 +562,16 @@ union yyalloc
|
|||||||
/* YYNSTATES -- Number of states. */
|
/* YYNSTATES -- Number of states. */
|
||||||
#define YYNSTATES ]b4_states_number[
|
#define YYNSTATES ]b4_states_number[
|
||||||
|
|
||||||
|
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
|
||||||
|
by yylex, with out-of-bounds checking. */
|
||||||
#define YYUNDEFTOK ]b4_undef_token_number[
|
#define YYUNDEFTOK ]b4_undef_token_number[
|
||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||||
|
|
||||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
|
||||||
#define YYTRANSLATE(YYX) \
|
#define YYTRANSLATE(YYX) \
|
||||||
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
((unsigned) (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. */
|
as returned by yylex, without out-of-bounds checking. */
|
||||||
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
@@ -623,23 +624,23 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
|
|
||||||
#define YYRECOVERING() (!!yyerrstatus)
|
#define YYRECOVERING() (!!yyerrstatus)
|
||||||
|
|
||||||
#define YYBACKUP(Token, Value) \
|
#define YYBACKUP(Token, Value) \
|
||||||
do \
|
do \
|
||||||
if (yychar == YYEMPTY) \
|
if (yychar == YYEMPTY) \
|
||||||
{ \
|
{ \
|
||||||
yychar = (Token); \
|
yychar = (Token); \
|
||||||
yylval = (Value); \
|
yylval = (Value); \
|
||||||
YYPOPSTACK (yylen); \
|
YYPOPSTACK (yylen); \
|
||||||
yystate = *yyssp; \]b4_lac_if([[
|
yystate = *yyssp; \]b4_lac_if([[
|
||||||
YY_LAC_DISCARD ("YYBACKUP"); \]])[
|
YY_LAC_DISCARD ("YYBACKUP"); \]])[
|
||||||
goto yybackup; \
|
goto yybackup; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
||||||
YYERROR; \
|
YYERROR; \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/* Error token number */
|
/* Error token number */
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
@@ -1066,10 +1067,7 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
case '\\':
|
case '\\':
|
||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
else
|
/* Fall through. */
|
||||||
goto append;
|
|
||||||
|
|
||||||
append:
|
|
||||||
default:
|
default:
|
||||||
if (yyres)
|
if (yyres)
|
||||||
yyres[yyn] = *yyp;
|
yyres[yyn] = *yyp;
|
||||||
@@ -1186,10 +1184,10 @@ 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_NULLPTR, yytname[yyx]);
|
||||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
if (! (yysize <= yysize1
|
||||||
yysize = yysize1;
|
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
else
|
|
||||||
return 2;
|
return 2;
|
||||||
|
yysize = yysize1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]b4_lac_if([[
|
}]b4_lac_if([[
|
||||||
@@ -1217,10 +1215,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
|
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
||||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
yysize = yysize1;
|
|
||||||
else
|
|
||||||
return 2;
|
return 2;
|
||||||
|
yysize = yysize1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*yymsg_alloc < yysize)
|
if (*yymsg_alloc < yysize)
|
||||||
@@ -1278,10 +1275,13 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
]b4_function_define([[yypull_parse]], [[int]],
|
]b4_function_define([[yypull_parse]], [[int]],
|
||||||
[[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
[[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))[
|
b4_parse_param]))[
|
||||||
{]b4_pure_if([b4_locations_if([[
|
{
|
||||||
|
int yystatus;
|
||||||
|
yypstate *yyps_local;]b4_pure_if([[
|
||||||
|
int yychar;
|
||||||
|
YYSTYPE yylval;]b4_locations_if([[
|
||||||
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
||||||
YYLTYPE yylloc = yyloc_default;]])])[
|
YYLTYPE yylloc = yyloc_default;]])])[
|
||||||
yypstate *yyps_local;
|
|
||||||
if (yyps)
|
if (yyps)
|
||||||
yyps_local = yyps;
|
yyps_local = yyps;
|
||||||
else
|
else
|
||||||
@@ -1295,10 +1295,8 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int yystatus;
|
do {
|
||||||
do {]b4_pure_if([[
|
yychar = ]b4_lex[;
|
||||||
YYSTYPE yylval;
|
|
||||||
int ]])[yychar = ]b4_lex[;
|
|
||||||
yystatus =
|
yystatus =
|
||||||
yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
|
yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
|
||||||
} while (yystatus == YYPUSH_MORE);
|
} while (yystatus == YYPUSH_MORE);
|
||||||
@@ -1429,7 +1427,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yynerrs = 0;
|
yynerrs = 0;
|
||||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [], [],
|
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [],
|
||||||
[b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
|
[b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef[]dnl
|
b4_dollar_popdef[]dnl
|
||||||
@@ -1439,31 +1437,23 @@ b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yyllo
|
|||||||
]])dnl
|
]])dnl
|
||||||
[ goto yysetstate;
|
[ goto yysetstate;
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------.
|
/*------------------------------------------------------------.
|
||||||
| yynewstate -- push a new state, which is found in yystate. |
|
| yynewstate -- Push a new state, which is found in yystate. |
|
||||||
`------------------------------------------------------------*/
|
`------------------------------------------------------------*/
|
||||||
yynewstate:
|
yynewstate:
|
||||||
/* In all cases, when you get here, the value and location stacks
|
/* In all cases, when you get here, the value and location stacks
|
||||||
have just been pushed. So pushing a state here evens the stacks. */
|
have just been pushed. So pushing a state here evens the stacks. */
|
||||||
yyssp++;
|
yyssp++;
|
||||||
|
|
||||||
|
yysetstate:
|
||||||
/*--------------------------------------------------------------------.
|
|
||||||
| yynewstate -- set current state (the top of the stack) to yystate. |
|
|
||||||
`--------------------------------------------------------------------*/
|
|
||||||
yysetstate:
|
|
||||||
*yyssp = (yytype_int16) yystate;
|
*yyssp = (yytype_int16) yystate;
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
|
||||||
goto yyexhaustedlab;
|
|
||||||
#else
|
|
||||||
{
|
{
|
||||||
/* Get the current used size of the three stacks, in elements. */
|
/* Get the current used size of the three stacks, in elements. */
|
||||||
YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
|
YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
|
||||||
|
|
||||||
# if defined yyoverflow
|
#ifdef yyoverflow
|
||||||
{
|
{
|
||||||
/* Give user a chance to reallocate the stack. Use copies of
|
/* Give user a chance to reallocate the stack. Use copies of
|
||||||
these so that the &'s don't force the real ones into
|
these so that the &'s don't force the real ones into
|
||||||
@@ -1485,7 +1475,10 @@ yysetstate:
|
|||||||
yyvs = yyvs1;]b4_locations_if([
|
yyvs = yyvs1;]b4_locations_if([
|
||||||
yyls = yyls1;])[
|
yyls = yyls1;])[
|
||||||
}
|
}
|
||||||
# else /* defined YYSTACK_RELOCATE */
|
#else /* no yyoverflow */
|
||||||
|
# ifndef YYSTACK_RELOCATE
|
||||||
|
goto yyexhaustedlab;
|
||||||
|
# else
|
||||||
/* Extend the stack our own way. */
|
/* Extend the stack our own way. */
|
||||||
if (YYMAXDEPTH <= yystacksize)
|
if (YYMAXDEPTH <= yystacksize)
|
||||||
goto yyexhaustedlab;
|
goto yyexhaustedlab;
|
||||||
@@ -1502,11 +1495,12 @@ yysetstate:
|
|||||||
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
||||||
YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
|
YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
|
||||||
YYSTACK_RELOCATE (yyls_alloc, yyls);])[
|
YYSTACK_RELOCATE (yyls_alloc, yyls);])[
|
||||||
# undef YYSTACK_RELOCATE
|
# undef YYSTACK_RELOCATE
|
||||||
if (yyss1 != yyssa)
|
if (yyss1 != yyssa)
|
||||||
YYSTACK_FREE (yyss1);
|
YYSTACK_FREE (yyss1);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
#endif /* no yyoverflow */
|
||||||
|
|
||||||
yyssp = yyss + yysize - 1;
|
yyssp = yyss + yysize - 1;
|
||||||
yyvsp = yyvs + yysize - 1;]b4_locations_if([
|
yyvsp = yyvs + yysize - 1;]b4_locations_if([
|
||||||
@@ -1518,7 +1512,6 @@ yysetstate:
|
|||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
|
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||||
|
|
||||||
@@ -1527,11 +1520,11 @@ yysetstate:
|
|||||||
|
|
||||||
goto yybackup;
|
goto yybackup;
|
||||||
|
|
||||||
|
|
||||||
/*-----------.
|
/*-----------.
|
||||||
| yybackup. |
|
| yybackup. |
|
||||||
`-----------*/
|
`-----------*/
|
||||||
yybackup:
|
yybackup:
|
||||||
|
|
||||||
/* Do appropriate processing given the current state. Read a
|
/* Do appropriate processing given the current state. Read a
|
||||||
lookahead token if we need one and don't already have one. */
|
lookahead token if we need one and don't already have one. */
|
||||||
|
|
||||||
@@ -1629,7 +1622,7 @@ yydefault:
|
|||||||
|
|
||||||
|
|
||||||
/*-----------------------------.
|
/*-----------------------------.
|
||||||
| yyreduce -- do a reduction. |
|
| yyreduce -- Do a reduction. |
|
||||||
`-----------------------------*/
|
`-----------------------------*/
|
||||||
yyreduce:
|
yyreduce:
|
||||||
/* yyn is the number of a rule to reduce with. */
|
/* yyn is the number of a rule to reduce with. */
|
||||||
@@ -1780,10 +1773,12 @@ yyerrlab:
|
|||||||
| yyerrorlab -- error raised explicitly by YYERROR. |
|
| yyerrorlab -- error raised explicitly by YYERROR. |
|
||||||
`---------------------------------------------------*/
|
`---------------------------------------------------*/
|
||||||
yyerrorlab:
|
yyerrorlab:
|
||||||
/* Pacify compilers when the user code never invokes YYERROR and the
|
|
||||||
label yyerrorlab therefore never appears in user code. */
|
/* Pacify compilers like GCC when the user code never invokes
|
||||||
if (0)
|
YYERROR and the label yyerrorlab therefore never appears in user
|
||||||
YYERROR;
|
code. */
|
||||||
|
if (/*CONSTCOND*/ 0)
|
||||||
|
goto yyerrorlab;
|
||||||
|
|
||||||
/* 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. */
|
||||||
@@ -1854,7 +1849,6 @@ yyacceptlab:
|
|||||||
yyresult = 0;
|
yyresult = 0;
|
||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------.
|
/*-----------------------------------.
|
||||||
| yyabortlab -- YYABORT comes here. |
|
| yyabortlab -- YYABORT comes here. |
|
||||||
`-----------------------------------*/
|
`-----------------------------------*/
|
||||||
@@ -1862,7 +1856,6 @@ yyabortlab:
|
|||||||
yyresult = 1;
|
yyresult = 1;
|
||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
|
|
||||||
#if ]b4_lac_if([[1]], [[!defined yyoverflow || YYERROR_VERBOSE]])[
|
#if ]b4_lac_if([[1]], [[!defined yyoverflow || YYERROR_VERBOSE]])[
|
||||||
/*-------------------------------------------------.
|
/*-------------------------------------------------.
|
||||||
| yyexhaustedlab -- memory exhaustion comes here. |
|
| yyexhaustedlab -- memory exhaustion comes here. |
|
||||||
@@ -1873,10 +1866,6 @@ yyexhaustedlab:
|
|||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------.
|
|
||||||
| yyreturn -- parsing is finished, return the result. |
|
|
||||||
`-----------------------------------------------------*/
|
|
||||||
yyreturn:
|
yyreturn:
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
{
|
{
|
||||||
@@ -1904,10 +1893,6 @@ yyreturn:
|
|||||||
YYSTACK_FREE (yyes);]])b4_push_if([[
|
YYSTACK_FREE (yyes);]])b4_push_if([[
|
||||||
yyps->yynew = 1;
|
yyps->yynew = 1;
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------.
|
|
||||||
| yypushreturn -- ask for the next token. |
|
|
||||||
`-----------------------------------------*/
|
|
||||||
yypushreturn:]])[
|
yypushreturn:]])[
|
||||||
#if YYERROR_VERBOSE
|
#if YYERROR_VERBOSE
|
||||||
if (yymsg != yymsgbuf)
|
if (yymsg != yymsgbuf)
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||||
|
# Requires GNU sed
|
||||||
|
|
||||||
|
## Copyright (C) 2005-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/>.
|
||||||
|
|
||||||
|
top_srcdir = ..
|
||||||
|
srcdir = .
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
all: README
|
||||||
|
|
||||||
|
README: README.in $(top_srcdir)/configure
|
||||||
|
PACKAGE=`grep "^[ ]*PACKAGE=" $(top_srcdir)/configure | sed -e 's/^[ ]*PACKAGE=//' -e s/[\"\']//g`; \
|
||||||
|
VERSION=`grep "^[ ]*VERSION=" $(top_srcdir)/configure | sed -e 's/^[ ]*VERSION=//' -e s/[\"\']//g`; \
|
||||||
|
package_version=`echo "$${VERSION}" | sed 's/\.//g'`; \
|
||||||
|
tree_version=`echo "$${VERSION}" | sed 's/\.//2g'`; \
|
||||||
|
sed \
|
||||||
|
-e "s/@V@/$${PACKAGE}-$${VERSION}/g" \
|
||||||
|
-e "s/@VERSION@/$${VERSION}/g" \
|
||||||
|
-e "s/@PACKAGE_VERSION@/$$package_version/g" \
|
||||||
|
-e "s/@TREE_VERSION@/$$tree_version/g" \
|
||||||
|
$(srcdir)/README.in > t-$@
|
||||||
|
mv t-$@ $@
|
||||||
+195
@@ -0,0 +1,195 @@
|
|||||||
|
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||||
|
|
||||||
|
Copyright (C) 2005-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/>.
|
||||||
|
|
||||||
|
|
||||||
|
1.: DJGPP specific changes.
|
||||||
|
=======================
|
||||||
|
|
||||||
|
The DJGPP port of Bison offers LFN and SFN support depending on which
|
||||||
|
OS it is running. If LFN support is available or not is determined at
|
||||||
|
run time. If LFN support is available (DOS session under Win9X, Win2K,
|
||||||
|
WinXP, etc.) the standard posix file name extensions will be used.
|
||||||
|
These are: y.tab.c, y.tab.c++, y.tab.h, y.output, etc. If only SFN
|
||||||
|
support is available (plain DOS), then the standard MSDOS short file
|
||||||
|
names will be used. These are: y_tab.c, y_tab.h, y.out, etc.
|
||||||
|
It should be noticed that this bison version needs the m4 program as
|
||||||
|
back end to generate the parser file (y.tab.c etc.) from the skeleton
|
||||||
|
files. This implies that m4 must always be installed to get bison
|
||||||
|
working. m4 will use a couple of m4 scripts that will be installed in
|
||||||
|
/dev/env/DJDIR/share/bison and shall not be removed.
|
||||||
|
It should also be noticed that the skeleton files bison.simple and
|
||||||
|
bison.hairy are no longer supported. This applies also to the environ-
|
||||||
|
ment variables BISON_HAIRY and BISON_SIMPLE. Those variables are *no*
|
||||||
|
longer honored at all.
|
||||||
|
The kind of skeleton file bison.hairy is no longer supported at all.
|
||||||
|
The skeleton file bison.simple is now called yacc.c and is an m4 script.
|
||||||
|
The other two skeleton files supported by this bison version are glr.c
|
||||||
|
and lalr1.cc. The first one is a generalized LR C parser based on
|
||||||
|
Bison's LALR(1) tables and the second one is a experimental C++ parser
|
||||||
|
class.
|
||||||
|
As has been told before, bison uses m4 to generate the parser file.
|
||||||
|
This is done by forking and using pipes for the IPC. MSDOS does not
|
||||||
|
support this functionality so this has been reproduced in the usual
|
||||||
|
way by redirecting stdin and stdout of bison and m4 to temporary files
|
||||||
|
and processing these files in sequence.
|
||||||
|
It should be noticed that due to the great amount of file names that do
|
||||||
|
not cleanly map to 8.3 file names, you will need an OS with LFN support
|
||||||
|
to configure and compile the sources. On Win98 this implies that the
|
||||||
|
generation of numeric tails for 8.3 file name aliases must be enabled
|
||||||
|
or the compilation will fail.
|
||||||
|
|
||||||
|
|
||||||
|
Please **read** the docs.
|
||||||
|
|
||||||
|
|
||||||
|
2.: Installing the binary package.
|
||||||
|
==============================
|
||||||
|
|
||||||
|
2.1.: Copy the binary distribution into the top DJGPP installation directory,
|
||||||
|
just unzip it preserving the directory structure running *ONE* of the
|
||||||
|
following commands:
|
||||||
|
unzip32 bsn@[email protected] or
|
||||||
|
djtarx bsn@[email protected] or
|
||||||
|
pkunzip -d bsn@[email protected]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
3.: Building the binaries from sources.
|
||||||
|
===================================
|
||||||
|
|
||||||
|
3.1.: Create a temporary directory and copy the source package into the
|
||||||
|
directory. If you download the source distribution from one of the
|
||||||
|
DJGPP sites, just unzip it preserving the directory structure
|
||||||
|
running *ONE* of the following commands:
|
||||||
|
unzip32 bsn@[email protected] or
|
||||||
|
djtarx bsn@[email protected] or
|
||||||
|
pkunzip -d bsn@[email protected]
|
||||||
|
and proceed to the paragraph 3.3, below.
|
||||||
|
|
||||||
|
3.2.: Source distributions downloaded from one of the GNU FTP sites need
|
||||||
|
some more work to unpack, if LFN support is not available. If LFN is
|
||||||
|
available then you can extract the source files from the archive with
|
||||||
|
any unzip program and proceed to the paragraph 3.3, below. Any file
|
||||||
|
name issue will be handled by the DJGPP configuration files.
|
||||||
|
To unpack the source distribution on SFN systems, first, you MUST use
|
||||||
|
the `djunpack' batch file to unzip the package. That is because some
|
||||||
|
file names in the official distributions need to be changed to avoid
|
||||||
|
problems on the various platforms supported by DJGPP.
|
||||||
|
`djunpack' invokes the `djtar' program (that is part of the basic DJGPP
|
||||||
|
development kit) to rename these files on the fly given a file with
|
||||||
|
name mappings; the distribution includes a file `djgpp/fnchange.lst'
|
||||||
|
with the necessary mappings. So you need first to retrieve that batch
|
||||||
|
file, and then invoke it to unpack the distribution. Here's how:
|
||||||
|
|
||||||
|
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||||
|
djunpack bison-@[email protected]
|
||||||
|
|
||||||
|
(The name of the distribution archive and the leading directory of the
|
||||||
|
path to `djunpack.bat' in the distribution will be different for
|
||||||
|
versions of Bison other than @VERSION@.)
|
||||||
|
|
||||||
|
If the argument to `djunpack.bat' include leading directories, it MUST
|
||||||
|
be given with the DOS-style backslashes; Unix-style forward slashes
|
||||||
|
will NOT work.
|
||||||
|
|
||||||
|
If the distribution comes as a .tar.bz2 archive, and your version of
|
||||||
|
`djtar' doesn't support bzip2 decompression, you need to unpack it as
|
||||||
|
follows:
|
||||||
|
|
||||||
|
bnzip2 bison-@[email protected]
|
||||||
|
djtar -x -p -o bison-@VERSION@/djgpp/djunpack.bat bison-@[email protected] > djunpack.bat
|
||||||
|
djunpack bison-@[email protected]
|
||||||
|
|
||||||
|
3.3.: To build the binaries you will need the following binary packages:
|
||||||
|
djdev203.zip (or a later but NOT a prior version)
|
||||||
|
bsh204b.zip (or a later but NOT a prior version)
|
||||||
|
gccNNNb.zip, gppNNN.zip, bnuNNNb.zip, makNNNb.zip, filNNNb.zip,
|
||||||
|
perlNNNb.zip, shlNNNb.zip, txtNNNb.zip, txiNNNb.zip, grepNNNb.zip,
|
||||||
|
sedNNNb.zip and m4NNN.zip
|
||||||
|
|
||||||
|
If you want to run the check you will need also:
|
||||||
|
difNNNb.zip
|
||||||
|
|
||||||
|
NNN represents the latest version number of the binary packages. All
|
||||||
|
this packages can be found in the /v2gnu directory of any
|
||||||
|
ftp.delorie.com mirror.
|
||||||
|
You will need bsh204b.zip or later and *NOT* a prior version or
|
||||||
|
the build will fail. The same applies to djdev203.zip. Please note
|
||||||
|
that Bison requires m4-144b.zip or later to work properly.
|
||||||
|
|
||||||
|
3.4.: If for some reason you want to reconfigure the package cd into the top
|
||||||
|
srcdir (bison-@TREE_VERSION@) and run the following commands:
|
||||||
|
del djgpp\config.cache
|
||||||
|
make clean
|
||||||
|
djgpp\config
|
||||||
|
|
||||||
|
Please note that you *MUST* delete the config.cache file in the djgpp
|
||||||
|
subdir or you will not really reconfigure the sources because the
|
||||||
|
configuration informations will be read from the cache file instead
|
||||||
|
of being newly computed.
|
||||||
|
To build the programs in a directory other than where the sources are,
|
||||||
|
you must add the parameter that specifies the source directory,
|
||||||
|
e.g:
|
||||||
|
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||||
|
|
||||||
|
Lets assume you want to build the binaries in a directory placed on a
|
||||||
|
different drive (z:\build in this case) from where the sources are,
|
||||||
|
then you will run the following commands:
|
||||||
|
z:
|
||||||
|
md \build
|
||||||
|
cd \build
|
||||||
|
x:\src\gnu\bison-@TREE_VERSION@\djgpp\config x:/src/gnu/bison-@TREE_VERSION@
|
||||||
|
|
||||||
|
The order of the options and the srcdir option does not matter. You
|
||||||
|
*MUST* use forward slashes to specify the source directory.
|
||||||
|
|
||||||
|
The batch file will set same environment variables, make MSDOS specific
|
||||||
|
modifications to the Makefile.in's and supply all other needed options
|
||||||
|
to the configure script.
|
||||||
|
|
||||||
|
3.5.: To compile the package run from the top srcdir the command:
|
||||||
|
make
|
||||||
|
|
||||||
|
3.6.: Now you can run the tests if you like. From the top srcdir run the
|
||||||
|
command:
|
||||||
|
make check
|
||||||
|
|
||||||
|
No test should fail but the tests #131 (Doxygen Public Documentation)
|
||||||
|
and #132 (Doxygen Private Documentation) will be skipped. Please note
|
||||||
|
that the testsuite only works with LFN available. On plain DOS, most
|
||||||
|
of the tests will fail due to invalid DOS names.
|
||||||
|
|
||||||
|
3.7.: To install the binaries, header, library, catalogs, and info docs
|
||||||
|
run the following command from the top srcdir:
|
||||||
|
make install
|
||||||
|
|
||||||
|
This will install the products into your DJGPP installation tree given
|
||||||
|
by the default prefix "/dev/env/DJDIR". If you prefer to install them
|
||||||
|
into some other directory you will have to set prefix to the appropriate
|
||||||
|
value:
|
||||||
|
make install prefix=z:/some/other/place
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Send GNU bison specific bug reports to <[email protected]>.
|
||||||
|
Send suggestions and bug reports concerning the DJGPP port to
|
||||||
|
comp.os.msdos.djgpp or <[email protected]>.
|
||||||
|
|
||||||
|
|
||||||
|
Enjoy.
|
||||||
|
|
||||||
|
Guerrero, Juan Manuel <[email protected]>
|
||||||
@@ -0,0 +1,547 @@
|
|||||||
|
@echo off
|
||||||
|
Rem Configure Bison for DJGPP.
|
||||||
|
|
||||||
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
|
||||||
|
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
Rem the Free Software Foundation, either version 3 of the License, or
|
||||||
|
Rem (at your option) any later version.
|
||||||
|
Rem
|
||||||
|
Rem This program is distributed in the hope that it will be useful,
|
||||||
|
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
Rem GNU General Public License for more details.
|
||||||
|
Rem
|
||||||
|
Rem You should have received a copy of the GNU General Public License
|
||||||
|
Rem along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
echo Configuring Bison for DJGPP v2.x...
|
||||||
|
|
||||||
|
Rem The SmallEnv tests protect against fixed and too small size
|
||||||
|
Rem of the environment in stock DOS shell.
|
||||||
|
|
||||||
|
Rem Find out if NLS is wanted or not,
|
||||||
|
Rem if dependency-tracking is wanted or not,
|
||||||
|
Rem if caching is wanted or not
|
||||||
|
Rem and where the sources are.
|
||||||
|
Rem We always default to NLS support,
|
||||||
|
Rem no dependency tracking
|
||||||
|
Rem and to in place configuration.
|
||||||
|
set ARGS=
|
||||||
|
set NLS=enabled
|
||||||
|
if not "%NLS%" == "enabled" goto SmallEnv
|
||||||
|
set CACHING=enabled
|
||||||
|
if not "%CACHING%" == "enabled" goto SmallEnv
|
||||||
|
set DEPENDENCY_TRACKING=disabled
|
||||||
|
if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
|
||||||
|
set LIBICONV_PREFIX=disabled
|
||||||
|
if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
|
||||||
|
set LIBINTL_PREFIX=disabled
|
||||||
|
if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
|
||||||
|
set HTML=enabled
|
||||||
|
if not "%HTML%" == "enabled" goto SmallEnv
|
||||||
|
set XSRC=.
|
||||||
|
if not "%XSRC%" == "." goto SmallEnv
|
||||||
|
|
||||||
|
Rem Loop over all arguments.
|
||||||
|
Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
|
||||||
|
Rem All other arguments are stored into ARGS.
|
||||||
|
:ArgLoop
|
||||||
|
if "%1" == "nls" goto NextArgument
|
||||||
|
if "%1" == "NLS" goto NextArgument
|
||||||
|
if "%1" == "no-nls" goto NoNLS
|
||||||
|
if "%1" == "no-NLS" goto NoNLS
|
||||||
|
if "%1" == "NO-NLS" goto NoNLS
|
||||||
|
goto CachingOption
|
||||||
|
:NoNLS
|
||||||
|
if "%1" == "no-nls" set NLS=disabled
|
||||||
|
if "%1" == "no-NLS" set NLS=disabled
|
||||||
|
if "%1" == "NO-NLS" set NLS=disabled
|
||||||
|
if not "%NLS%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:CachingOption
|
||||||
|
if "%1" == "cache" goto NextArgument
|
||||||
|
if "%1" == "CACHE" goto NextArgument
|
||||||
|
if "%1" == "no-cache" goto NoCaching
|
||||||
|
if "%1" == "no-CACHE" goto NoCaching
|
||||||
|
if "%1" == "NO-CACHE" goto NoCaching
|
||||||
|
goto DependencyOption
|
||||||
|
:NoCaching
|
||||||
|
if "%1" == "no-cache" set CACHING=disabled
|
||||||
|
if "%1" == "no-CACHE" set CACHING=disabled
|
||||||
|
if "%1" == "NO-CACHE" set CACHING=disabled
|
||||||
|
if not "%CACHING%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:DependencyOption
|
||||||
|
if "%1" == "no-dep" goto NextArgument
|
||||||
|
if "%1" == "no-DEP" goto NextArgument
|
||||||
|
if "%1" == "NO-DEP" goto NextArgument
|
||||||
|
if "%1" == "dep" goto DependecyTracking
|
||||||
|
if "%1" == "DEP" goto DependecyTracking
|
||||||
|
goto LibiconvPrefixOption
|
||||||
|
:DependecyTracking
|
||||||
|
if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
|
||||||
|
if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
|
||||||
|
if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:LibiconvPrefixOption
|
||||||
|
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||||
|
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "libiconvprefix" goto WithLibiconvPrefix
|
||||||
|
if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
|
||||||
|
goto LibintlPrefixOption
|
||||||
|
:WithLibiconvPrefix
|
||||||
|
if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled
|
||||||
|
if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled
|
||||||
|
if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:LibintlPrefixOption
|
||||||
|
if "%1" == "no-libiconvprefix" goto NextArgument
|
||||||
|
if "%1" == "no-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
|
||||||
|
if "%1" == "libintlprefix" goto _WithLibintlPrefix
|
||||||
|
if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
|
||||||
|
goto HTMLOption
|
||||||
|
:_WithLibintlPrefix
|
||||||
|
if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled
|
||||||
|
if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled
|
||||||
|
if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
|
||||||
|
:HTMLOption
|
||||||
|
if "%1" == "withhtml" goto NextArgument
|
||||||
|
if "%1" == "withHTML" goto NextArgument
|
||||||
|
if "%1" == "WITHHTML" goto NextArgument
|
||||||
|
if "%1" == "withouthtml" goto _WithoutHTML
|
||||||
|
if "%1" == "withoutHTML" goto _WithoutHTML
|
||||||
|
if "%1" == "WITHOUTHTML" goto _WithoutHTML
|
||||||
|
goto SrcDirOption
|
||||||
|
:_WithoutHTML
|
||||||
|
if "%1" == "withouthtml" set HTML=disabled
|
||||||
|
if "%1" == "withoutHTML" set HTML=disabled
|
||||||
|
if "%1" == "WITHOUTHTML" set HTML=disabled
|
||||||
|
if not "%HTML%" == "disabled" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:SrcDirOption
|
||||||
|
echo %1 | grep -q "/"
|
||||||
|
if errorlevel 1 goto CollectArgument
|
||||||
|
set XSRC=%1
|
||||||
|
if not "%XSRC%" == "%1" goto SmallEnv
|
||||||
|
goto NextArgument
|
||||||
|
:CollectArgument
|
||||||
|
set _ARGS=%ARGS% %1
|
||||||
|
if not "%_ARGS%" == "%ARGS% %1" if not "%_ARGS%" == "%ARGS%%1" goto SmallEnv
|
||||||
|
echo %_ARGS% | grep -q "[^ ]"
|
||||||
|
if not errorlevel 0 set ARGS=%_ARGS%
|
||||||
|
set _ARGS=
|
||||||
|
:NextArgument
|
||||||
|
shift
|
||||||
|
if not "%1" == "" goto ArgLoop
|
||||||
|
|
||||||
|
Rem Create an arguments file for the configure script.
|
||||||
|
echo --srcdir=%XSRC% > args
|
||||||
|
if "%CACHING%" == "enabled" echo --cache-file=%XSRC%/djgpp/config.cache >> args
|
||||||
|
if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable-dependency-tracking >> args
|
||||||
|
if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> args
|
||||||
|
if "%LIBICONV_PREFIX%" == "enabled" echo --with-libiconv-prefix >> args
|
||||||
|
if "%LIBICONV_PREFIX%" == "disabled" echo --without-libiconv-prefix >> args
|
||||||
|
if "%LIBINTL_PREFIX%" == "enabled" echo --with-libintl-prefix >> args
|
||||||
|
if "%LIBINTL_PREFIX%" == "disabled" echo --without-libintl-prefix >> args
|
||||||
|
if "%HTML%" == "enabled" echo --enable-html >> args
|
||||||
|
if "%HTML%" == "disabled" echo --disable-html >> args
|
||||||
|
if not "%ARGS%" == "" echo %ARGS% >> args
|
||||||
|
set ARGS=
|
||||||
|
set CACHING=
|
||||||
|
set DEPENDENCY_TRACKING=
|
||||||
|
set LIBICONV_PREFIX=
|
||||||
|
set LIBINTL_PREFIX=
|
||||||
|
set HTML=
|
||||||
|
|
||||||
|
if "%XSRC%" == "." goto InPlace
|
||||||
|
|
||||||
|
:NotInPlace
|
||||||
|
redir -e /dev/null update %XSRC%/configure.org ./configure
|
||||||
|
test -f ./configure
|
||||||
|
if errorlevel 1 update %XSRC%/configure ./configure
|
||||||
|
|
||||||
|
:InPlace
|
||||||
|
Rem Update configuration files
|
||||||
|
echo Updating configuration scripts...
|
||||||
|
test -f ./configure.org
|
||||||
|
if errorlevel 1 update configure configure.org
|
||||||
|
sed -f %XSRC%/djgpp/config.sed configure.org > configure
|
||||||
|
if errorlevel 1 goto SedError
|
||||||
|
|
||||||
|
Rem Make sure they have a config.site file
|
||||||
|
set CONFIG_SITE=%XSRC%/djgpp/config.site
|
||||||
|
if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
|
||||||
|
|
||||||
|
Rem inttypes_.h and inttypes.h map to the same 8.3 alias.
|
||||||
|
test -f %XSRC%/lib/inttypes_.h
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/lib/inttypes_.h %XSRC%/lib/_inttypes.h
|
||||||
|
|
||||||
|
Rem Make sure crucial file names are not munged by unpacking
|
||||||
|
test -f %XSRC%/po/Makefile.in.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.inin %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile.in_in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/po/Makefile_in.in %XSRC%/po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.inin %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile.in_in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/runtime-po/Makefile_in.in %XSRC%/runtime-po/Makefile.in-in
|
||||||
|
test -f %XSRC%/data/c++.m4
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/data/c++.m4 %XSRC%/data/cxx.m4
|
||||||
|
test -f %XSRC%/data/cxx.m4
|
||||||
|
if errorlevel 1 mv -f %XSRC%/data/cpp.m4 %XSRC%/data/cxx.m4
|
||||||
|
test -f %XSRC%/data/c++-skel.m4
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/data/c++-skel.m4 %XSRC%/data/cxx-skel.m4
|
||||||
|
test -f %XSRC%/data/cxx-skel.m4
|
||||||
|
if errorlevel 1 mv -f %XSRC%/data/cpp-skel.m4 %XSRC%/data/cxx-skel.m4
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.shin %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh_in %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javacomp.sh.in %XSRC%/build-aux/javacomp.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh.in %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.shin %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec.sh_in %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/build-aux/javaexec_sh.in %XSRC%/build-aux/javaexec.sh-in
|
||||||
|
test -f %XSRC%/doc/yacc.1.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/doc/yacc.1.in %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/doc/yacc.1-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/doc/yacc.1 %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/doc/yacc.1-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/doc/yacc.1in %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/doc/yacc.1-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/doc/yacc.1_in %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/doc/yacc.1-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/doc/yacc_1.in %XSRC%/doc/yacc.1-in
|
||||||
|
test -f %XSRC%/etc/bench.pl.in
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/etc/bench.pl.in %XSRC%/etc/bench.pl-in
|
||||||
|
test -f %XSRC%/etc/bench.pl-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/etc/bench.pl %XSRC%/etc/bench.pl-in
|
||||||
|
test -f %XSRC%/etc/bench.pl-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/etc/bench.plin %XSRC%/etc/bench.pl-in
|
||||||
|
test -f %XSRC%/etc/bench.pl-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/etc/bench.pl_in %XSRC%/etc/bench.pl-in
|
||||||
|
test -f %XSRC%/etc/bench.pl-in
|
||||||
|
if errorlevel 1 mv -f %XSRC%/etc/bench_pl.in %XSRC%/etc/bench.pl-in
|
||||||
|
|
||||||
|
:scan_gram_c_Test
|
||||||
|
test -f %XSRC%/src/c-scan-gram.c
|
||||||
|
if not errorlevel 1 goto scan_skel_c_Test
|
||||||
|
test -f %XSRC%/src/scan-gram-c.c
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/src/scan-gram-c.c %XSRC%/src/c-scan-gram.c
|
||||||
|
:scan_skel_c_Test
|
||||||
|
test -f %XSRC%/src/c-scan-skel.c
|
||||||
|
if not errorlevel 1 goto FixFiles
|
||||||
|
test -f %XSRC%/src/scan-skel-c.c
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/src/scan-skel-c.c %XSRC%/src/c-scan-skel.c
|
||||||
|
|
||||||
|
:FixFiles
|
||||||
|
Rem Fix data/lalr1.cc and data/location.cc to reflect the renaming of c++.m4
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/lalr1.cc > lalr1.cc
|
||||||
|
if errorlevel 1 goto lalr1_ccFileError
|
||||||
|
mv ./lalr1.cc %XSRC%/data/lalr1.cc
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/location.cc > location.cc
|
||||||
|
if errorlevel 1 goto location_ccFileError
|
||||||
|
mv ./location.cc %XSRC%/data/location.cc
|
||||||
|
sed "s/c++\.m4/cxx.m4/" %XSRC%/data/glr.cc > glr.cc
|
||||||
|
if errorlevel 1 goto glr_ccFileError
|
||||||
|
mv ./glr.cc %XSRC%/data/glr.cc
|
||||||
|
|
||||||
|
Rem Fix src/getargs.c to reflect the renaming of c++-skel.m4
|
||||||
|
sed "s/c++-skel\.m4/cxx-skel.m4/" %XSRC%/src/getargs.c > getargs.c
|
||||||
|
if errorlevel 1 goto getargs_cFileError
|
||||||
|
mv ./getargs.c %XSRC%/src/getargs.c
|
||||||
|
|
||||||
|
Rem Define DJGPP specific defs in config.hin
|
||||||
|
echo Editing config.hin...
|
||||||
|
test -f %XSRC%/lib/config_h.org
|
||||||
|
if errorlevel 1 update %XSRC%/lib/config.hin %XSRC%/lib/config_h.org
|
||||||
|
sed -f %XSRC%/djgpp/config_h.sed %XSRC%/lib/config_h.org > config.hin
|
||||||
|
if errorlevel 1 goto SedError2
|
||||||
|
mv -f config.hin %XSRC%/lib/config.hin
|
||||||
|
|
||||||
|
|
||||||
|
Rem Fixing illicit testsuite file name.
|
||||||
|
test -f %XSRC%/tests/c++.at
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/tests/c++.at %XSRC%/tests/cxx.at
|
||||||
|
|
||||||
|
test -f %XSRC%/tests/testsuite.org
|
||||||
|
if errorlevel 1 update %XSRC%/tests/testsuite %XSRC%/tests/testsuite.org
|
||||||
|
sed -f %XSRC%/djgpp/testsuite.sed %XSRC%/tests/testsuite.org > testsuite.tmp
|
||||||
|
if errorlevel 1 goto SedError3
|
||||||
|
mv -f ./testsuite.tmp %XSRC%/tests/testsuite
|
||||||
|
|
||||||
|
Rem Fixing illicit calc++ file names in the calc++ directory.
|
||||||
|
test -d %XSRC%/examples/calc++
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calc++ %XSRC%/examples/calcxx
|
||||||
|
test -d %XSRC%/examples/calcxx
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcpp %XSRC%/examples/calcxx
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-scanner.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-scanner.ll
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-driver.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-driver.hh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.hh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.stamp
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.stamp %XSRC%/examples/calcxx/calcxx-parser.stamp
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++-parser.yy
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
test -f %XSRC%/examples/calcxx/calc++.cc
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/examples/calcxx/calc++.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
test -f %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
if errorlevel 1 mv -f %XSRC%/examples/calcxx/calcpp.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
|
||||||
|
Rem Fixing #include lines in calcxx files.
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx.cc > calcxx.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx.cc %XSRC%/examples/calcxx/calcxx.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.cc > calcxx-driver.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-driver.cc %XSRC%/examples/calcxx/calcxx-driver.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-driver.hh > calcxx-driver.hh
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-driver.hh %XSRC%/examples/calcxx/calcxx-driver.hh
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.cc > calcxx-parser.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-parser.cc %XSRC%/examples/calcxx/calcxx-parser.cc
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.hh > calcxx-parser.hh
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-parser.hh %XSRC%/examples/calcxx/calcxx-parser.hh
|
||||||
|
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-parser.yy > calcxx-parser.yy
|
||||||
|
:if errorlevel 1 goto calcxxFileError
|
||||||
|
:mv ./calcxx-parser.yy %XSRC%/examples/calcxx/calcxx-parser.yy
|
||||||
|
sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.cc > calcxx-scanner.cc
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./calcxx-scanner.cc %XSRC%/examples/calcxx/calcxx-scanner.cc
|
||||||
|
:sed "/#[ ]*include/s/++/xx/" %XSRC%/examples/calcxx/calcxx-scanner.ll > calcxx-scanner.ll
|
||||||
|
:if errorlevel 1 goto calcxxFileError
|
||||||
|
:mv ./calcxx-scanner.ll %XSRC%/examples/calcxx/calcxx-scanner.ll
|
||||||
|
sed "s/calc++/calcxx/" %XSRC%/examples/calcxx/test > test
|
||||||
|
if errorlevel 1 goto calcxxFileError
|
||||||
|
mv ./test %XSRC%/examples/calcxx/test
|
||||||
|
|
||||||
|
|
||||||
|
Rem Fixing the scanner files to make file names 8.3 valid.
|
||||||
|
Rem Use only if you want to change the scan-gram.l and scan-skel.l files.
|
||||||
|
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-gram.l > scan-gram.l
|
||||||
|
: if errorlevel 1 goto ScannerFileError
|
||||||
|
: mv ./scan-gram.l %XSRC%/src/scan-gram.l
|
||||||
|
: sed "/outfile=/s/\.yy/yy/" %XSRC%/src/scan-skel.l > scan-skel.l
|
||||||
|
: if errorlevel 1 goto ScannerFileError
|
||||||
|
: mv ./scan-skel.l %XSRC%/src/scan-skel.l
|
||||||
|
|
||||||
|
|
||||||
|
Rem This is required because DOS/Windows are case-insensitive
|
||||||
|
Rem to file names, and "make install" will do nothing if Make
|
||||||
|
Rem finds a file called `install'.
|
||||||
|
if exist INSTALL ren INSTALL INSTALL.txt
|
||||||
|
|
||||||
|
Rem Set SHELL to a sane default or some configure tests stop working
|
||||||
|
Rem if the package is configured across partitions.
|
||||||
|
if not "%SHELL%" == "" goto HomeName
|
||||||
|
set SHELL=/bin/sh
|
||||||
|
if not "%SHELL%" == "/bin/sh" goto SmallEnv
|
||||||
|
echo No SHELL found in the environment, using default value
|
||||||
|
|
||||||
|
:HomeName
|
||||||
|
Rem Set HOME to a sane default so configure stops complaining.
|
||||||
|
if not "%HOME%" == "" goto HostName
|
||||||
|
set HOME=%XSRC%/djgpp
|
||||||
|
if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
|
||||||
|
echo No HOME found in the environment, using default value
|
||||||
|
|
||||||
|
:HostName
|
||||||
|
Rem Set HOSTNAME so it shows in config.status
|
||||||
|
if not "%HOSTNAME%" == "" goto hostdone
|
||||||
|
if "%windir%" == "" goto msdos
|
||||||
|
set OS=MS-Windows
|
||||||
|
if not "%OS%" == "MS-Windows" goto SmallEnv
|
||||||
|
goto haveos
|
||||||
|
:msdos
|
||||||
|
set OS=MS-DOS
|
||||||
|
if not "%OS%" == "MS-DOS" goto SmallEnv
|
||||||
|
:haveos
|
||||||
|
if not "%USERNAME%" == "" goto haveuname
|
||||||
|
if not "%USER%" == "" goto haveuser
|
||||||
|
echo No USERNAME and no USER found in the environment, using default values
|
||||||
|
set HOSTNAME=Unknown PC
|
||||||
|
if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
|
||||||
|
goto userdone
|
||||||
|
:haveuser
|
||||||
|
set HOSTNAME=%USER%'s PC
|
||||||
|
if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
|
||||||
|
goto userdone
|
||||||
|
:haveuname
|
||||||
|
set HOSTNAME=%USERNAME%'s PC
|
||||||
|
if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
|
||||||
|
:userdone
|
||||||
|
set _HOSTNAME=%HOSTNAME%, %OS%
|
||||||
|
if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
|
||||||
|
set HOSTNAME=%_HOSTNAME%
|
||||||
|
:hostdone
|
||||||
|
set _HOSTNAME=
|
||||||
|
set OS=
|
||||||
|
|
||||||
|
Rem install-sh is required by the configure script but clashes with the
|
||||||
|
Rem various Makefile install-foo targets, so we MUST have it before the
|
||||||
|
Rem script runs and rename it afterwards
|
||||||
|
test -f %XSRC%/install-sh
|
||||||
|
if not errorlevel 1 goto NoRen0
|
||||||
|
test -f %XSRC%/install-sh.sh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
|
||||||
|
:NoRen0
|
||||||
|
|
||||||
|
if "%NLS%" == "disabled" goto WithoutNLS
|
||||||
|
|
||||||
|
:WithNLS
|
||||||
|
Rem Check for the needed libraries and binaries.
|
||||||
|
test -x /dev/env/DJDIR/bin/msgfmt.exe
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -x /dev/env/DJDIR/bin/xgettext.exe
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/libcharset.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libcharset.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/iconv.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libiconv.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/include/libintl.h
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
test -f /dev/env/DJDIR/lib/libintl.a
|
||||||
|
if errorlevel 1 goto MissingNLSTools
|
||||||
|
|
||||||
|
Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
|
||||||
|
redir -e /dev/null rm %XSRC%/po/*.gmo
|
||||||
|
redir -e /dev/null rm %XSRC%/po/bison.pot
|
||||||
|
redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
|
||||||
|
redir -e /dev/null rm %XSRC%/po/stamp-cat-id
|
||||||
|
|
||||||
|
Rem Update the arguments file for the configure script.
|
||||||
|
Rem We prefer without-included-gettext because libintl.a from gettext package
|
||||||
|
Rem is the only one that is guaranteed to have been ported to DJGPP.
|
||||||
|
echo --enable-nls --without-included-gettext >> args
|
||||||
|
goto ConfigurePackage
|
||||||
|
|
||||||
|
:MissingNLSTools
|
||||||
|
echo Needed libs/tools for NLS not found. Configuring without NLS.
|
||||||
|
:WithoutNLS
|
||||||
|
Rem Update the arguments file for the configure script.
|
||||||
|
echo --disable-nls >> args
|
||||||
|
|
||||||
|
:ConfigurePackage
|
||||||
|
echo Running the ./configure script...
|
||||||
|
sh ./configure @args
|
||||||
|
if errorlevel 1 goto CfgError
|
||||||
|
rm args
|
||||||
|
echo Done.
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:lalr1_ccFileError
|
||||||
|
echo ./data/lalr1.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:glr_ccFileError
|
||||||
|
echo ./data/glr.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:getargs_cFileError
|
||||||
|
echo ./src/getargs.c file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:location_ccFileError
|
||||||
|
echo ./data/location.cc file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:calcxxFileError
|
||||||
|
echo ./examples/calcxx file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:ScannerFileError
|
||||||
|
echo ./scanner file editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SedError
|
||||||
|
echo ./configure script editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SedError2
|
||||||
|
echo ./lib/config.hin editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SedError3
|
||||||
|
echo ./tests/testsuite editing failed!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:CfgError
|
||||||
|
echo ./configure script exited abnormally!
|
||||||
|
goto End
|
||||||
|
|
||||||
|
:SmallEnv
|
||||||
|
echo Your environment size is too small. Enlarge it and run me again.
|
||||||
|
echo Configuration NOT done!
|
||||||
|
|
||||||
|
:End
|
||||||
|
test -f %XSRC%/install-sh.sh
|
||||||
|
if not errorlevel 1 goto NoRen1
|
||||||
|
test -f %XSRC%/install-sh
|
||||||
|
if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
|
||||||
|
:NoRen1
|
||||||
|
if "%SHELL%" == "/bin/sh" set SHELL=
|
||||||
|
if "%HOME%" == "%XSRC%/djgpp" set HOME=
|
||||||
|
set CONFIG_SITE=
|
||||||
|
set HOSTNAME=
|
||||||
|
set NLS=
|
||||||
|
set XSRC=
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
# DJGPP specific configuration file.
|
||||||
|
# Sed script for additional DJGPP specific editing
|
||||||
|
# of the configure script generated by autoconf 2.62.
|
||||||
|
|
||||||
|
# Copyright (C) 2005-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/>.
|
||||||
|
|
||||||
|
|
||||||
|
# Additional editing of Makefiles
|
||||||
|
/^eval sed.*ac_file_inputs.*tmp\/out \\$/ {
|
||||||
|
:loop
|
||||||
|
n
|
||||||
|
/^$/!b loop
|
||||||
|
a\
|
||||||
|
cat > "$tmp/subs-djgpp.sed" << eof_djgpp\
|
||||||
|
# DJGPP specific Makefile changes.\
|
||||||
|
s,\\.deps,_deps,g\
|
||||||
|
s,\\.libs,_libs,g\
|
||||||
|
s,\\.new\\.,_new.,g\
|
||||||
|
s,\\.old\\.,_old.,g\
|
||||||
|
s,\\.tab\\.,_tab.,g\
|
||||||
|
s,c++\\.at,cxx.at,g\
|
||||||
|
s,c++\\.m4,cxx.m4,g\
|
||||||
|
s,c++-skel\\.m4,cxx-skel.m4,g\
|
||||||
|
s,calc++,calcxx,g\
|
||||||
|
s,scan-gram-c,c-scan-gram,g\
|
||||||
|
s,scan-skel-c,c-scan-skel,g\
|
||||||
|
s,inttypes_,_inttypes,g\
|
||||||
|
s,javacomp\\.sh\\.in,javacomp.sh-in,g\
|
||||||
|
s,javaexec\\.sh\\.in,javaexec.sh-in,g\
|
||||||
|
s,yacc\\.1\\.in,yacc.1-in,g\
|
||||||
|
s,bench\\.pl\\.in,bench.pl-in,g\
|
||||||
|
s,Makefile\\.am\\.in,Makefile.am-in,g\
|
||||||
|
s,Makefile\\.in\\.in,Makefile.in-in,g\
|
||||||
|
/^\\.y\\.c:/,/^$/ {\
|
||||||
|
/\\\$(YACCCOMPILE)/ {\
|
||||||
|
a\\\\\
|
||||||
|
-@test -f y.tab.c && mv -f y.tab.c y_tab.c\\\\\
|
||||||
|
-@test -f y.tab.h && mv -f y.tab.h y_tab.h\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
/^libbison.a:/ i\\\\\
|
||||||
|
\\$(top_srcdir)/djgpp/subpipe.c: \\$(top_srcdir)/djgpp/subpipe.h\\\\\
|
||||||
|
subpipe.o: \\$(top_srcdir)/djgpp/subpipe.c \\$(top_srcdir)/djgpp/subpipe.h\\\\\
|
||||||
|
\\$(COMPILE) -c \\$<\
|
||||||
|
/^yacc:/ i\\\\\
|
||||||
|
yacc.bat:\\\\\
|
||||||
|
echo "bison\\$(EXEEXT) -y %1 %2 %3 %4 %5 %6 %7 %8 %9" >\\$@\
|
||||||
|
/^bin_SCRIPTS =/s/$/ yacc.bat/\
|
||||||
|
/^MOSTLYCLEANFILES = yacc/s/$/ yacc.bat/\
|
||||||
|
/cross-options.texi:/,/^$/ s|bison|&.exe|g\
|
||||||
|
/^\\.x\\.1:/,/^$/ s|\\$program|&.exe|g\
|
||||||
|
eof_djgpp\
|
||||||
|
sed -f "\$tmp/subs-djgpp.sed" \$tmp/out > \$tmp/out.djgpp\
|
||||||
|
mv -f \$tmp/out.djgpp \$tmp/out
|
||||||
|
}
|
||||||
|
|
||||||
|
# Makefile.in.in is renamed to Makefile.in-in.
|
||||||
|
/ac_config_files=/ {
|
||||||
|
/runtime-po/!s|po/Makefile\.in|&:po/Makefile.in-in|
|
||||||
|
s|runtime-po/Makefile\.in|&:runtime-po/Makefile.in-in|
|
||||||
|
s|javacomp\.sh\.in|javacomp.sh-in|
|
||||||
|
s|javaexec\.sh\.in|javaexec.sh-in|
|
||||||
|
s|doc/yacc\.1|&:doc/yacc.1-in|
|
||||||
|
s|etc/bench.pl|&:etc/bench.pl-in|
|
||||||
|
}
|
||||||
|
|
||||||
|
/CONFIG_FILES=/ {
|
||||||
|
/runtime-po/!s|po/Makefile\.in|&:po/Makefile.in-in|2
|
||||||
|
s|runtime-po/Makefile\.in|&:runtime-po/Makefile.in-in|2
|
||||||
|
s|javacomp\.sh\.in|javacomp.sh-in|
|
||||||
|
s|javaexec\.sh\.in|javaexec.sh-in|
|
||||||
|
s|doc/yacc\.1|&:doc/yacc.1-in|2
|
||||||
|
s|etc/bench\.pl|&:etc/bench.pl-in|2
|
||||||
|
}
|
||||||
|
|
||||||
|
# We always use _deps and _libs instead of .deps and .libs, because
|
||||||
|
# the latter is an invalid name on 8+3 MS-DOS file system. This makes
|
||||||
|
# the generated Makefiles good for every DJGPP installation, not only
|
||||||
|
# the one where the package was configured (which could happen to be
|
||||||
|
# a Windows box, where leading dots in file names are allowed).
|
||||||
|
/^rmdir[ ]*\.tst/ i\
|
||||||
|
am__leading_dot=_
|
||||||
|
|
||||||
|
# Replace (command) > /dev/null with `command > /dev/null`, since
|
||||||
|
# parenthesized commands always return zero status in the ported Bash,
|
||||||
|
# even if the named command doesn't exist
|
||||||
|
/if ([^|;`]*null/{
|
||||||
|
s,(,`,
|
||||||
|
s,),,
|
||||||
|
/null[ ]*2>&1/ s,2>&1,&`,
|
||||||
|
/null.*null/ s,null.*null,&`,
|
||||||
|
/null.*null/ !{
|
||||||
|
/null[ ]*2>&1/ !s,null,&`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# DOS-style absolute file names should be supported as well
|
||||||
|
/\*) top_srcdir=/s,/\*,[\\\\/]* | ?:[\\\\/]*,
|
||||||
|
|
||||||
|
# The following two items are changes needed for configuring
|
||||||
|
# and compiling across partitions.
|
||||||
|
# 1) The given srcdir value is always translated from the
|
||||||
|
# "x:" syntax into "/dev/x" syntax while we run configure.
|
||||||
|
/^[ ]*-srcdir=\*.*$/ a\
|
||||||
|
ac_optarg=`echo "$ac_optarg" | sed "s,^\\([A-Za-z]\\):,/dev/\\1,"`
|
||||||
|
/set X `ls -Lt \$srcdir/ i\
|
||||||
|
if `echo $srcdir | grep "^/dev/" - > /dev/null`; then\
|
||||||
|
srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`\
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Autoconf 2.52e generated configure scripts
|
||||||
|
# write absolute paths into Makefiles and bison.in
|
||||||
|
# making them useless for DJGPP installations for
|
||||||
|
# which the package has not been configured for.
|
||||||
|
/MISSING=/,/^$/ {
|
||||||
|
/^fi$/ a\
|
||||||
|
am_missing_run=`echo "$am_missing_run" | sed 's%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'`
|
||||||
|
}
|
||||||
|
/^install_sh=/a\
|
||||||
|
install_sh=`echo "$install_sh" | sed 's%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'`
|
||||||
|
|
||||||
|
# This will only work if the assumption that the
|
||||||
|
# testsuite is ran from the following path:
|
||||||
|
# ${top_srcdir}/tests/testsuite.dir
|
||||||
|
# holds. The explicit names are of no importance.
|
||||||
|
# ../../. == ${top_srcdir}
|
||||||
|
#/^esac$/,/^ac_abs_srcdir=/ {
|
||||||
|
/^ac_abs_srcdir=/ i\
|
||||||
|
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`\
|
||||||
|
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`\
|
||||||
|
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`
|
||||||
|
#ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%/dev/.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/bison[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`
|
||||||
|
/^ac_abs_srcdir=/ a\
|
||||||
|
for dj_dir in $ac_abs_builddir $ac_abs_top_builddir $ac_abs_top_srcdir $ac_abs_srcdir\
|
||||||
|
do\
|
||||||
|
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%//%/%g"`\
|
||||||
|
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%//%/%g"`\
|
||||||
|
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%//%/%g"`\
|
||||||
|
ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%//%/%g"`\
|
||||||
|
done
|
||||||
|
|
||||||
|
# Add DJGPP version information.
|
||||||
|
/^#define VERSION/ s/\$VERSION/& (DJGPP port (r1))/
|
||||||
|
|
||||||
|
# We need makeinfo to make the html formated docs.
|
||||||
|
/\$am_missing_run[ ]*makeinfo/ s,\$am_missing_run,,
|
||||||
|
|
||||||
|
# The path to the FORTRAN compiler and libraries
|
||||||
|
# shall contain no absolute path reference so it
|
||||||
|
# will be good for all djgpp installations.
|
||||||
|
/^FLIBS="\$ac_cv_flibs"/ i\
|
||||||
|
ac_djgpp_path=`echo "$DJDIR" | sed 's%\\\\\\%/%g' | tr $as_cr_LETTERS $as_cr_letters`\
|
||||||
|
ac_cv_flibs=`echo "$ac_cv_flibs" | sed "s%-L$ac_djgpp_path%-L/dev/env/DJDIR%g"`
|
||||||
|
|
||||||
|
# Autoconf generated configure scripts write absolute
|
||||||
|
# paths of certain header files into Makefiles making
|
||||||
|
# them useless for DJGPP installations for which the
|
||||||
|
# package has not been configured for.
|
||||||
|
/^.*echo "\$as_me:\$LINENO: result: \$gl_cv_absolute_.*$/ {
|
||||||
|
h
|
||||||
|
s,^.*\(gl_cv_absolute_\)\([a-z0-9_]*\)\(_h\).*$,\1\2\3=`echo $\1\2\3 | sed "s%[^:]:.*/include/%/dev/env/DJDIR/include/%"`,
|
||||||
|
G
|
||||||
|
}
|
||||||
|
/^.*echo "\$as_me:\$LINENO: result: \$gl_cv_full_.*$/ {
|
||||||
|
h
|
||||||
|
s,^.*\(gl_cv_full_\)\([a-z0-9_]*\)\(_h\).*$,\1\2\3=`echo $\1\2\3 | sed "s%[^:]:.*/include/%/dev/env/DJDIR/include/%"`,
|
||||||
|
G
|
||||||
|
}
|
||||||
|
|
||||||
|
# The following is not a valid DOS file name
|
||||||
|
s/calc++/calcxx/g
|
||||||
|
|
||||||
|
# The CR test for awk does not work for DJGPP.
|
||||||
|
/^ac_cs_awk_cr=/,/^$/ {
|
||||||
|
/^fi$/ a\
|
||||||
|
ac_cs_awk_cr=$ac_cr
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# This is the config.site file for configuring GNU packages
|
||||||
|
# which are to be built with DJGPP tools.
|
||||||
|
|
||||||
|
# Copyright (C) 2005-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/>.
|
||||||
|
|
||||||
|
|
||||||
|
# Include the djgpp subdirectory in PATH, so that getconf is found
|
||||||
|
PATH="$srcdir/djgpp:$PATH"
|
||||||
|
|
||||||
|
# These two variables are required, otherwise looking for
|
||||||
|
# programs along the PATH will not work.
|
||||||
|
PATH_SEPARATOR=:
|
||||||
|
PATH_EXPAND=y
|
||||||
|
|
||||||
|
# This is required in for "test -f foo" to find foo.exe
|
||||||
|
export TEST_FINDS_EXE=y
|
||||||
|
|
||||||
|
# The root of the DJGPP tree serves as the default prefix
|
||||||
|
test "x$prefix" = xNONE && prefix='/dev/env/DJDIR'
|
||||||
|
|
||||||
|
# This is required for config.status script to be run, since
|
||||||
|
# ./configure runs it by invoking ${CONFIG_SHELL-/bin/sh}
|
||||||
|
CONFIG_SHELL=${CONFIG_SHELL='sh'}
|
||||||
|
|
||||||
|
# These are set here so the generated Makefile's will be good
|
||||||
|
# for every DJGPP installation, not only the one where the
|
||||||
|
# package was configured.
|
||||||
|
# $INSTALL must be an absolute path name, otherwise config.status
|
||||||
|
# will try to prepend ./ and ../ to it when it goes into subdirs.
|
||||||
|
INSTALL=${INSTALL='/dev/env/DJDIR/bin/ginstall -c'}
|
||||||
|
RANLIB=${RANLIB='ranlib'}
|
||||||
|
GMSGFMT=${GMSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||||
|
MSGFMT=${MSGFMT='/dev/env/DJDIR/bin/msgfmt'}
|
||||||
|
XGETTEXT=${XGETTEXT='/dev/env/DJDIR/bin/xgettext'}
|
||||||
|
AWK=${AWK='gawk'}
|
||||||
|
|
||||||
|
# A sane default for emacs.
|
||||||
|
ac_cv_path_EMACS=${EMACS='/dev/env/DJDIR/gnu/emacs/bin/emacs'}
|
||||||
|
|
||||||
|
# A sane default for m4.
|
||||||
|
ac_cv_path_M4=${M4='/dev/env/DJDIR/bin/m4'}
|
||||||
|
|
||||||
|
# A sane default for grep.
|
||||||
|
ac_cv_path_GREP=${GREP='/dev/env/DJDIR/bin/grep'}
|
||||||
|
|
||||||
|
# A sane default for egrep.
|
||||||
|
ac_cv_path_EGREP=${EGREP='/dev/env/DJDIR/bin/egrep'}
|
||||||
|
|
||||||
|
# A sane default for fgrep.
|
||||||
|
ac_cv_path_FGREP=${FGREP='/dev/env/DJDIR/bin/fgrep'}
|
||||||
|
|
||||||
|
# A sane default for sed.
|
||||||
|
ac_cv_path_SED=${SED='/dev/env/DJDIR/bin/sed'}
|
||||||
|
|
||||||
|
# A sane default for mkdir.
|
||||||
|
ac_cv_path_mkdir=${MKDIR_P='/dev/env/DJDIR/bin/mkdir -p'}
|
||||||
|
|
||||||
|
# These are set here so the generated libtool will be good
|
||||||
|
# for every DJGPP installation, not only the one where the
|
||||||
|
# package was configured.
|
||||||
|
NM=${NM='nm'}
|
||||||
|
LD=${LD='ld'}
|
||||||
|
|
||||||
|
# Force the test for 'ln -s' to report 'cp -pf'.
|
||||||
|
ac_cv_prog_LN_S='cp -pf'
|
||||||
|
|
||||||
|
# There is no fork and vfork functionality.
|
||||||
|
ac_cv_func_fork=no
|
||||||
|
ac_cv_func_vfork=no
|
||||||
|
ac_cv_func_pipe=no
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
# sed script for DJGPP specific editing of config.hin
|
||||||
|
|
||||||
|
# Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -15,12 +15,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/>.
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1 + 2 * 3
|
|
||||||
EOF
|
|
||||||
run 0 7
|
|
||||||
|
|
||||||
cat >input <<EOF
|
$ a\
|
||||||
1 + 2 * * 3
|
\
|
||||||
EOF
|
\
|
||||||
run 0 "err: syntax error, unexpected *, expecting - or ! or ( or number"
|
/* DJGPP specific defines. */\
|
||||||
|
\
|
||||||
|
#include <unistd.h>\
|
||||||
|
#define TAB_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".tab" : "_tab")\
|
||||||
|
#define OUTPUT_EXT ((pathconf(NULL, _PC_NAME_MAX) > 12) ? ".output" : ".out")\
|
||||||
|
\
|
||||||
|
#define DEFAULT_TMPDIR "/dev/env/DJDIR/tmp"
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
@echo off
|
||||||
|
Rem
|
||||||
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
Rem
|
||||||
|
Rem This batch file unpacks the Bison distribution while simultaneously
|
||||||
|
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||||
|
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||||
|
Rem
|
||||||
|
Rem Copyright (C) 2005-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
Rem
|
||||||
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
Rem the Free Software Foundation, either version 3 of the License, or
|
||||||
|
Rem (at your option) any later version.
|
||||||
|
Rem
|
||||||
|
Rem This program is distributed in the hope that it will be useful,
|
||||||
|
Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
Rem GNU General Public License for more details.
|
||||||
|
Rem
|
||||||
|
Rem You should have received a copy of the GNU General Public License
|
||||||
|
Rem along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
Rem
|
||||||
|
Rem
|
||||||
|
Rem Invoke like this:
|
||||||
|
Rem
|
||||||
|
Rem djunpack bison-XYZ.tar.gz
|
||||||
|
Rem or
|
||||||
|
Rem djunpack bison-XYZ.tar.bz2
|
||||||
|
Rem
|
||||||
|
Rem where XYZ is the version number. If the argument includes leading
|
||||||
|
Rem directories, it MUST use backslashes, not forward slashes.
|
||||||
|
Rem
|
||||||
|
|
||||||
|
set ENVIRONMENT_SIZE_TEST_STRING=ENVIRONMENT_SIZE_TEST_STRING
|
||||||
|
if "%ENVIRONMENT_SIZE_TEST_STRING%"=="ENVIRONMENT_SIZE_TEST_STRING" GoTo EnvOk
|
||||||
|
Rem If their environment space is too small, re-exec with a larger one
|
||||||
|
command.com /e:4096 /c %0 %1
|
||||||
|
GoTo End
|
||||||
|
|
||||||
|
:EnvOk
|
||||||
|
set ENVIRONMENT_SIZE_TEST_STRING=
|
||||||
|
if "%1" == "" GoTo NoArgument
|
||||||
|
if not exist %1 GoTo NoArchive
|
||||||
|
Rem Extract top src dir from archive file.
|
||||||
|
djtar -t %1 > top_src.dir
|
||||||
|
Rem The following uses a feature of COPY whereby it does not copy
|
||||||
|
Rem empty files. We need that because the previous line will create
|
||||||
|
Rem an empty fnchange.tmp even if the command failed for some reason.
|
||||||
|
copy top_src.dir junk.tmp > nul
|
||||||
|
if not exist junk.tmp GoTo NoDjTar
|
||||||
|
del junk.tmp
|
||||||
|
sed "1{s/^.*bison-/djtar -x -p -o bison-/;s|$|djgpp/fnchange.lst %%1 > fnchange.tmp|};2,$d" top_src.dir > ext_list.bat
|
||||||
|
Rem See the comment above about the reason for using COPY.
|
||||||
|
copy ext_list.bat junk.tmp > nul
|
||||||
|
if not exist junk.tmp GoTo NoSed
|
||||||
|
del junk.tmp
|
||||||
|
Rem Extract fnchange.lst from archive.
|
||||||
|
call ext_list.bat %1
|
||||||
|
del ext_list.bat
|
||||||
|
sed "1{s|^.*bison-|s/@V@/bison-|;s|$|g|};2,$d" top_src.dir > version.sed
|
||||||
|
sed -f version.sed < fnchange.tmp > fnchange.lst
|
||||||
|
del version.sed
|
||||||
|
del fnchange.tmp
|
||||||
|
del top_src.dir
|
||||||
|
Rem unpack the source distribution
|
||||||
|
djtar -x -n fnchange.lst %1
|
||||||
|
del fnchange.lst
|
||||||
|
GoTo End
|
||||||
|
|
||||||
|
:NoSed
|
||||||
|
del junk.tmp
|
||||||
|
echo FAIL: Sed is not available.
|
||||||
|
GoTo End
|
||||||
|
:NoDjTar
|
||||||
|
del junk.tmp
|
||||||
|
echo FAIL: DJTAR is not available or no fnchange.lst file in %1.
|
||||||
|
GoTo End
|
||||||
|
:NoArchive
|
||||||
|
echo FAIL: the file %1 does not seem to exist.
|
||||||
|
echo Remember that %1 cannot use forward slashes, only backslashes.
|
||||||
|
GoTo End
|
||||||
|
:NoArgument
|
||||||
|
echo FAIL: no archive file has been specified.
|
||||||
|
echo Remember that the file name cannot use forward slashes, only backslashes.
|
||||||
|
:End
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
@V@/build-aux/javacomp.sh.in @V@/build-aux/javacomp.sh-in
|
||||||
|
@V@/build-aux/javaexec.sh.in @V@/build-aux/javaexec.sh-in
|
||||||
|
@V@/data/c++-skel.m4 @V@/data/cxx-skel.m4
|
||||||
|
@V@/data/c++.m4 @V@/data/cxx.m4
|
||||||
|
@V@/doc/yacc.1.in @V@/doc/yacc.1-in
|
||||||
|
@V@/etc/bench.pl.in @V@/etc/bench.pl-in
|
||||||
|
@V@/examples/calc++/ @V@/examples/calcxx/
|
||||||
|
@V@/examples/calc++/Makefile.am @V@/examples/calcxx/Makefile.am
|
||||||
|
@V@/examples/calc++/Makefile.in @V@/examples/calcxx/Makefile.in
|
||||||
|
@V@/examples/calc++/calc++-scanner.cc @V@/examples/calcxx/calcxx-scanner.cc
|
||||||
|
@V@/examples/calc++/calc++-scanner.ll @V@/examples/calcxx/calcxx-scanner.ll
|
||||||
|
@V@/examples/calc++/calc++.cc @V@/examples/calcxx/calcxx.cc
|
||||||
|
@V@/examples/calc++/calc++-driver.hh @V@/examples/calcxx/calcxx-driver.hh
|
||||||
|
@V@/examples/calc++/calc++-driver.cc @V@/examples/calcxx/calcxx-driver.cc
|
||||||
|
@V@/examples/calc++/stack.hh @V@/examples/calcxx/stack.hh
|
||||||
|
@V@/examples/calc++/position.hh @V@/examples/calcxx/position.hh
|
||||||
|
@V@/examples/calc++/location.hh @V@/examples/calcxx/location.hh
|
||||||
|
@V@/examples/calc++/calc++-parser.hh @V@/examples/calcxx/calcxx-parser.hh
|
||||||
|
@V@/examples/calc++/calc++-parser.cc @V@/examples/calcxx/calcxx-parser.cc
|
||||||
|
@V@/examples/calc++/calc++-parser.stamp @V@/examples/calcxx/calcxx-parser.stamp
|
||||||
|
@V@/examples/calc++/calc++-parser.yy @V@/examples/calcxx/calcxx-parser.yy
|
||||||
|
@V@/examples/calc++/test @V@/examples/calcxx/test
|
||||||
|
@V@/po/Makefile.in.in @V@/po/Makefile.in-in
|
||||||
|
@V@/runtime-po/Makefile.in.in @V@/runtime-po/Makefile.in-in
|
||||||
|
@V@/src/scan-gram-c.c @V@/src/c-scan-gram.c
|
||||||
|
@V@/src/scan-skel-c.c @V@/src/c-scan-skel.c
|
||||||
|
@V@/tests/c++.at @V@/tests/cxx.at
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
## Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
## Copyright (C) 2008-2015, 2018 Free Software Foundation, Inc.
|
||||||
##
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
## This program is free software: you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published by
|
## it under the terms of the GNU General Public License as published by
|
||||||
## the Free Software Foundation, either version 3 of the License, or
|
## the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -13,9 +13,15 @@
|
|||||||
## 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/>.
|
||||||
|
|
||||||
cdir = $(docdir)/%D%
|
EXTRA_DIST += \
|
||||||
dist_c_DATA = %D%/README.md
|
djgpp/Makefile.maint \
|
||||||
|
djgpp/README.in \
|
||||||
include %D%/lexcalc/local.mk
|
djgpp/config.bat \
|
||||||
include %D%/mfcalc/local.mk
|
djgpp/config.sed \
|
||||||
include %D%/rpcalc/local.mk
|
djgpp/config.site \
|
||||||
|
djgpp/config_h.sed \
|
||||||
|
djgpp/djunpack.bat \
|
||||||
|
djgpp/fnchange.lst \
|
||||||
|
djgpp/subpipe.c \
|
||||||
|
djgpp/subpipe.h \
|
||||||
|
djgpp/testsuite.sed
|
||||||
+293
@@ -0,0 +1,293 @@
|
|||||||
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
|
Copyright (C) 2005-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/>. */
|
||||||
|
|
||||||
|
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "subpipe.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "xalloc.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef STDIN_FILENO
|
||||||
|
# define STDIN_FILENO 0
|
||||||
|
#endif
|
||||||
|
#ifndef STDOUT_FILENO
|
||||||
|
# define STDOUT_FILENO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "gettext.h"
|
||||||
|
#define _(Msgid) gettext (Msgid)
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize this module. */
|
||||||
|
|
||||||
|
|
||||||
|
static int old_stdin;
|
||||||
|
static int old_stdout;
|
||||||
|
static char **arguments;
|
||||||
|
static char tmp_file_name[2][L_tmpnam];
|
||||||
|
|
||||||
|
#define remove_tmp_file(fd, name) \
|
||||||
|
do { \
|
||||||
|
close ((fd)); \
|
||||||
|
if (unlink ((name))) \
|
||||||
|
error (EXIT_FAILURE, 0, _("removing of '%s' failed"), (name)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
init_subpipe(void)
|
||||||
|
{
|
||||||
|
char *tmpdir;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
tmpdir = getenv("TMPDIR");
|
||||||
|
if (tmpdir == NULL)
|
||||||
|
tmpdir = getenv("TMP");
|
||||||
|
if (tmpdir == NULL)
|
||||||
|
tmpdir = getenv("TEMP");
|
||||||
|
if (access(tmpdir, D_OK))
|
||||||
|
tmpdir = ".";
|
||||||
|
|
||||||
|
strcpy(tmp_file_name[0], tmpdir);
|
||||||
|
strcat(tmp_file_name[0], "/bnXXXXXX");
|
||||||
|
fd = mkstemp(tmp_file_name[0]);
|
||||||
|
if (fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||||
|
close (fd);
|
||||||
|
|
||||||
|
strcpy(tmp_file_name[1], tmpdir);
|
||||||
|
strcat(tmp_file_name[1], "/bnXXXXXX");
|
||||||
|
fd = mkstemp(tmp_file_name[1]);
|
||||||
|
if (fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("creation of a temporary file failed"));
|
||||||
|
close (fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create a subprocess that is run as a filter. ARGV is the
|
||||||
|
NULL-terminated argument vector for the subprocess. Store read and
|
||||||
|
write file descriptors for communication with the subprocess into
|
||||||
|
FD[0] and FD[1]: input meant for the process can be written into
|
||||||
|
FD[0], and output from the process can be read from FD[1]. Return
|
||||||
|
the subprocess id.
|
||||||
|
|
||||||
|
Because DOS has neither fork nor pipe functionality to run the subprocess
|
||||||
|
as a filter, the filter is reproduced using temporary files. First bison's
|
||||||
|
stdout is redirected to a temporary file. After bison has produced all of
|
||||||
|
is output, this file is closed and connected to m4's stdin. All m4's output
|
||||||
|
is redirected from m4's stdout to a second temporary file and reopened as
|
||||||
|
bison's stdin. */
|
||||||
|
|
||||||
|
pid_t
|
||||||
|
create_subpipe(char const *const *argv, int fd[2])
|
||||||
|
{
|
||||||
|
int argc;
|
||||||
|
int from_in_fd; /* pipe from bison to m4. */
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
|
||||||
|
pid = getpid();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save original stdin and stdout
|
||||||
|
* for later restauration.
|
||||||
|
*/
|
||||||
|
old_stdin = dup(STDIN_FILENO);
|
||||||
|
if (old_stdin < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("saving stdin failed"));
|
||||||
|
|
||||||
|
old_stdout = dup(STDOUT_FILENO);
|
||||||
|
if (old_stdout < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("saving stdout failed"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save argv for later use.
|
||||||
|
*/
|
||||||
|
for (argc = 0; argv[argc]; argc++)
|
||||||
|
;
|
||||||
|
argc++;
|
||||||
|
arguments = xmalloc(argc * sizeof(arguments[0]));
|
||||||
|
for (argc = 0; argv[argc]; argc++)
|
||||||
|
{
|
||||||
|
arguments[argc] = xmalloc((strlen(argv[argc]) + 1) * sizeof(arguments[0][0]));
|
||||||
|
strcpy(arguments[argc], argv[argc]);
|
||||||
|
}
|
||||||
|
arguments[argc] = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All bison's output will be gathered in this temporary file
|
||||||
|
* and will be redirected to m4's stdin.
|
||||||
|
*/
|
||||||
|
from_in_fd = open(tmp_file_name[0], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR);
|
||||||
|
if (from_in_fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
if (dup2(from_in_fd, STDOUT_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(from_in_fd, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting bison's stdout to the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(from_in_fd);
|
||||||
|
|
||||||
|
|
||||||
|
fd[0] = STDOUT_FILENO;
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* A signal handler that just records that a signal has happened. */
|
||||||
|
static int child_interrupted;
|
||||||
|
|
||||||
|
static void
|
||||||
|
signal_catcher(int signo)
|
||||||
|
{
|
||||||
|
child_interrupted++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
end_of_output_subpipe(pid_t pid, int fd[2])
|
||||||
|
{
|
||||||
|
char *program;
|
||||||
|
int from_out_fd = open(tmp_file_name[0], O_RDONLY, S_IRUSR); /* pipe from bison to m4. */
|
||||||
|
int to_in_fd = open(tmp_file_name[1], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR); /* pipe from m4 to bison. */
|
||||||
|
int status;
|
||||||
|
void (*previous_handler)(int);
|
||||||
|
|
||||||
|
|
||||||
|
program = strrchr(arguments[0], '/');
|
||||||
|
if (program)
|
||||||
|
program++;
|
||||||
|
else
|
||||||
|
program = arguments[0];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redirect bison's output to m4's stdin.
|
||||||
|
*/
|
||||||
|
if (from_out_fd < 0)
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
if (dup2(from_out_fd, STDIN_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(from_out_fd, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting m4's stdin from the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(from_out_fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All m4's output will be gathered in this temporary file
|
||||||
|
* and will be redirected to bison's stdin.
|
||||||
|
*/
|
||||||
|
if (to_in_fd < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of a temporary file failed"));
|
||||||
|
}
|
||||||
|
if (dup2(to_in_fd, STDOUT_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting m4's stdout to a temporary file failed"));
|
||||||
|
}
|
||||||
|
close(to_in_fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Run m4.
|
||||||
|
*/
|
||||||
|
child_interrupted = 0;
|
||||||
|
errno = 0;
|
||||||
|
previous_handler = signal(SIGINT, signal_catcher);
|
||||||
|
status = spawnvp(P_WAIT, program, arguments);
|
||||||
|
signal(SIGINT, previous_handler);
|
||||||
|
if (child_interrupted)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _("subsidiary program '%s' interrupted"), program);
|
||||||
|
}
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(STDOUT_FILENO, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, 0, _(errno == ENOENT
|
||||||
|
? "subsidiary program '%s' not found"
|
||||||
|
: status < 1
|
||||||
|
? "subsidiary program '%s' failed"
|
||||||
|
: "subsidiary program '%s' failed (status=%i, errno=%i)"), program, status, errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Redirect m4's output to bison's stdin.
|
||||||
|
*/
|
||||||
|
if (dup2(old_stdout, STDOUT_FILENO) < 0)
|
||||||
|
error(EXIT_FAILURE, 0, "restore of bison's stdout failed");
|
||||||
|
close(old_stdout);
|
||||||
|
to_in_fd = open(tmp_file_name[1], O_RDONLY, S_IRUSR); /* pipe from m4 to bison. */
|
||||||
|
if (to_in_fd < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
error(EXIT_FAILURE, 0, _("opening of tmpfile failed"));
|
||||||
|
}
|
||||||
|
if (dup2(to_in_fd, STDIN_FILENO) < 0)
|
||||||
|
{
|
||||||
|
remove_tmp_file(STDIN_FILENO, tmp_file_name[0]);
|
||||||
|
remove_tmp_file(to_in_fd, tmp_file_name[1]);
|
||||||
|
error(EXIT_FAILURE, -1, "dup2");
|
||||||
|
error(EXIT_FAILURE, 0, _("redirecting bison's stdin from the temporary file failed"));
|
||||||
|
}
|
||||||
|
close(to_in_fd);
|
||||||
|
|
||||||
|
|
||||||
|
fd[1] = STDIN_FILENO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free resources, unlink temporary files and restore stdin and stdout. */
|
||||||
|
|
||||||
|
void
|
||||||
|
reap_subpipe(pid_t pid, char const *program)
|
||||||
|
{
|
||||||
|
int argc;
|
||||||
|
|
||||||
|
for (argc = 0; arguments[argc]; argc++)
|
||||||
|
free(arguments[argc]);
|
||||||
|
free(arguments);
|
||||||
|
|
||||||
|
if (unlink(tmp_file_name[0]))
|
||||||
|
error(EXIT_FAILURE, 0, _("removing of '%s' failed"), tmp_file_name[0]);
|
||||||
|
if (unlink(tmp_file_name[1]))
|
||||||
|
error(EXIT_FAILURE, 0, _("removing of '%s' failed"), tmp_file_name[1]);
|
||||||
|
|
||||||
|
if (dup2(old_stdin, STDIN_FILENO) < 0)
|
||||||
|
error(EXIT_FAILURE, 0, "restore of bison's stdin failed");
|
||||||
|
close(old_stdin);
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
|
Copyright (C) 2005-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/>. */
|
||||||
|
|
||||||
|
/* Written by Juan Manuel Guerrero <[email protected]>. */
|
||||||
|
|
||||||
|
#if HAVE_SYS_TYPES_H
|
||||||
|
# include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void init_subpipe(void);
|
||||||
|
pid_t create_subpipe(char const * const *, int[2]);
|
||||||
|
void end_of_output_subpipe(pid_t, int[2]);
|
||||||
|
void reap_subpipe(pid_t, char const *);
|
||||||
@@ -1,27 +1,23 @@
|
|||||||
#! /bin/sh
|
# DJGPP specific configuration file.
|
||||||
|
# Sed script for additional DJGPP specific editing
|
||||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
# of the testsuite script generated by autoconf 2.61.
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# (at your option) any later version.
|
# it under the terms of the GNU General Public License as published by
|
||||||
#
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# This program is distributed in the hope that it will be useful,
|
# (at your option) any later version.
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
#
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# This program is distributed in the hope that it will be useful,
|
||||||
# GNU General Public License for more details.
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
#
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# You should have received a copy of the GNU General Public License
|
# GNU General Public License for more details.
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
cat >input <<EOF
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
1+2*3
|
|
||||||
EOF
|
|
||||||
run 0 7
|
# Remove disallowed characters from file names.
|
||||||
|
|
||||||
cat >input <<EOF
|
s/~!@#\\\$%^&\*()-=_+{}\[\]|\\\\:;<>, ./~!@#\\$%^\&()-=_+{}[];, ./g
|
||||||
(1+2) * 3
|
|
||||||
EOF
|
|
||||||
run 0 9
|
|
||||||
run -noerr 0 9 -p
|
|
||||||
@@ -30,4 +30,3 @@
|
|||||||
/stamp-vti
|
/stamp-vti
|
||||||
/version.texi
|
/version.texi
|
||||||
/yacc.1
|
/yacc.1
|
||||||
/relocatable.texi
|
|
||||||
|
|||||||
+356
-626
File diff suppressed because it is too large
Load Diff
+3
-4
@@ -1,5 +1,5 @@
|
|||||||
## Copyright (C) 2001-2003, 2005-2015, 2018-2019 Free Software
|
## Copyright (C) 2001-2003, 2005-2015, 2018 Free Software Foundation,
|
||||||
## 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,8 +19,7 @@ info_TEXINFOS = doc/bison.texi
|
|||||||
doc_bison_TEXINFOS = \
|
doc_bison_TEXINFOS = \
|
||||||
$(CROSS_OPTIONS_TEXI) \
|
$(CROSS_OPTIONS_TEXI) \
|
||||||
doc/fdl.texi \
|
doc/fdl.texi \
|
||||||
doc/gpl-3.0.texi \
|
doc/gpl-3.0.texi
|
||||||
doc/relocatable.texi
|
|
||||||
|
|
||||||
# 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.
|
||||||
|
|||||||
+9
-9
@@ -19,8 +19,8 @@
|
|||||||
\def\finalout{\overfullrule=0pt}
|
\def\finalout{\overfullrule=0pt}
|
||||||
%\finalout
|
%\finalout
|
||||||
|
|
||||||
% Copyright (c) 1998, 2001, 2009-2015, 2018-2019 Free Software
|
% Copyright (c) 1998, 2001, 2009-2015, 2018 Free Software Foundation,
|
||||||
% Foundation, Inc.
|
% Inc.
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% This file is part of Bison.
|
||||||
%
|
%
|
||||||
@@ -358,7 +358,7 @@ otherwise it will have the format {\tt {\it name}.tab.h}, where
|
|||||||
|
|
||||||
In the above, {\it t} is a {\it type} defined in the {\tt \%union}
|
In the above, {\it t} is a {\it type} defined in the {\tt \%union}
|
||||||
definition, {\it n} is a {\it terminal} symbol name, {\it m} is a
|
definition, {\it n} is a {\it terminal} symbol name, {\it m} is a
|
||||||
{\it nonterminal} symbol name, and {\it association} can be one of
|
{\it non-terminal} symbol name, and {\it association} can be one of
|
||||||
{\tt \%left}, {\tt \%right}, or {\tt \%nonassoc}.
|
{\tt \%left}, {\tt \%right}, or {\tt \%nonassoc}.
|
||||||
|
|
||||||
\vskip .10truein
|
\vskip .10truein
|
||||||
@@ -401,16 +401,16 @@ Rules take the form:
|
|||||||
|
|
||||||
\vskip -\baselineskip
|
\vskip -\baselineskip
|
||||||
\beginexample
|
\beginexample
|
||||||
nonterminal : {\it statement} 1
|
non-terminal : {\it statement} 1
|
||||||
| {\it statement} 2
|
| {\it statement} 2
|
||||||
\vdots
|
\vdots
|
||||||
| {\it statement n}
|
| {\it statement n}
|
||||||
;
|
;
|
||||||
\endexample
|
\endexample
|
||||||
|
|
||||||
Where {\it statements} can be either empty, or contain
|
Where {\it statements} can be either empty, or contain
|
||||||
a mixture of C code (enclosed in {\tt \{...\}}), and the
|
a mixture of C code (enclosed in {\tt \{...\}}), and the
|
||||||
symbols that make up the nonterminal. For example:
|
symbols that make up the non-terminal. For example:
|
||||||
|
|
||||||
\vskip -\baselineskip
|
\vskip -\baselineskip
|
||||||
\beginexample
|
\beginexample
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
|
|||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Copyright (C) 2006, 2009-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2006, 2009-2015, 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
# Copyright (C) 2006, 2008-2015, 2018-2019 Free Software Foundation,
|
# Copyright (C) 2006, 2008-2015, 2018 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
-2
@@ -1,5 +1,4 @@
|
|||||||
## Copyright (C) 2006, 2008-2015, 2018-2019 Free Software Foundation,
|
## Copyright (C) 2006, 2008-2015, 2018 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
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ This directory contains examples of Bison grammar files.
|
|||||||
Most of them come from the documentation, which should be installed together
|
Most of them come from the documentation, which should be installed together
|
||||||
with Bison. The URLs are provided for convenience.
|
with Bison. The URLs are provided for convenience.
|
||||||
|
|
||||||
# rpcalc - Reverse Polish Notation Calculator
|
|
||||||
|
* Examples in C
|
||||||
|
|
||||||
|
** rpcalc - Reverse Polish Notation Calculator
|
||||||
The first example is that of a simple double-precision Reverse Polish
|
The first example is that of a simple double-precision Reverse Polish
|
||||||
Notation calculator (a calculator using postfix operators). This example
|
Notation calculator (a calculator using postfix operators). This example
|
||||||
provides a good starting point, since operator precedence is not an issue.
|
provides a good starting point, since operator precedence is not an issue.
|
||||||
@@ -11,21 +14,35 @@ provides a good starting point, since operator precedence is not an issue.
|
|||||||
Extracted from the documentation: "Reverse Polish Notation Calculator"
|
Extracted from the documentation: "Reverse Polish Notation Calculator"
|
||||||
https://www.gnu.org/software/bison/manual/html_node/RPN-Calc.html
|
https://www.gnu.org/software/bison/manual/html_node/RPN-Calc.html
|
||||||
|
|
||||||
# mfcalc - Multi-Function Calculator
|
** mfcalc - Multi-Function Calculator
|
||||||
A more complete C example: a multi-function calculator.
|
A more complete C example: a multi-function calculator.
|
||||||
|
|
||||||
Extracted from the documentation: "Multi-Function Calculator: mfcalc".
|
Extracted from the documentation: "Multi-Function Calculator: mfcalc".
|
||||||
https://www.gnu.org/software/bison/manual/html_node/Multi_002dfunction-Calc.html
|
https://www.gnu.org/software/bison/manual/html_node/Multi_002dfunction-Calc.html
|
||||||
|
|
||||||
|
|
||||||
<!---
|
|
||||||
|
* Examples in C++
|
||||||
|
|
||||||
|
** c++ - A directory of simple C++ examples
|
||||||
|
|
||||||
|
** calc++ - A Complete C++ Example
|
||||||
|
A fully featured C++ version of the canonical example for parsers: a
|
||||||
|
calculator. Also uses Flex for the scanner.
|
||||||
|
|
||||||
|
Extracted from the documentation: "A Complete C++ Example".
|
||||||
|
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
||||||
|
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
fill-column: 76
|
fill-column: 76
|
||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
@@ -35,4 +52,3 @@ Texts. A copy of the license is included in the "GNU Free
|
|||||||
Documentation License" file as part of this distribution.
|
Documentation License" file as part of this distribution.
|
||||||
|
|
||||||
# LocalWords: mfcalc calc parsers yy
|
# LocalWords: mfcalc calc parsers yy
|
||||||
--->
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
This directory contains examples of Bison grammar files, sorted per
|
|
||||||
language.
|
|
||||||
|
|
||||||
Several of them come from the documentation, which should be installed
|
|
||||||
together with Bison. The URLs are provided for convenience.
|
|
||||||
|
|
||||||
These examples come with a README and a Makefile. Not only can they be used
|
|
||||||
to toy with Bison, they can also be starting points for your own grammars.
|
|
||||||
|
|
||||||
Please, be sure to read the C examples before looking at the other
|
|
||||||
languages, as these examples are simpler.
|
|
||||||
|
|
||||||
<!---
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2018-2019 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.
|
|
||||||
--->
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
# Examples in C++
|
|
||||||
|
|
||||||
This directory contains examples of Bison grammar files in C++.
|
This directory contains examples of Bison grammar files in C++.
|
||||||
|
|
||||||
|
* Examples in C++
|
||||||
|
|
||||||
You can run `make` to compile these examples. And `make clean` to tidy
|
You can run `make` to compile these examples. And `make clean` to tidy
|
||||||
afterwards.
|
afterwards.
|
||||||
|
|
||||||
## simple.yy - Simple example in C++14
|
** simple.yy - Simple example in C++14
|
||||||
A very simple example in C++, based on variants and symbol constructors.
|
A very simple example in C++, based on variants and symbol constructors.
|
||||||
Variants allow to use any C++ type as semantic value type, and symbol
|
Variants allow to use any C++ type as semantic value type, and symbol
|
||||||
constructors ensure consistency between declared token type and effective
|
constructors ensure consistency between declared token type and effective
|
||||||
@@ -16,37 +16,26 @@ Run as `./simple`.
|
|||||||
Extracted from the documentation: "A Simple C++ Example".
|
Extracted from the documentation: "A Simple C++ Example".
|
||||||
https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html
|
https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html
|
||||||
|
|
||||||
## variant.yy - Self-contained example in C++98
|
** variant.yy - Self-contained example in C++98
|
||||||
A variation of simple.yy, in C++98.
|
A variation of simple.yy, in C++98.
|
||||||
|
|
||||||
Run as `./variant`.
|
Run as `./variant`.
|
||||||
|
|
||||||
## variant-11.yy - Self-contained example in modern C++
|
** variant-11.yy - Self-contained example in modern C++
|
||||||
Another variation of simple.yy, closely related to the previous one, but
|
Another variation of simple.yy, closely related to the previous one, but
|
||||||
exhibiting support for C++11's move semantics.
|
exhibiting support for C++11's move semantics.
|
||||||
|
|
||||||
Run as `./variant` or `./variant NUMBER`.
|
Run as `./variant` or `./variant NUMBER`.
|
||||||
|
|
||||||
## calc++ - A Complete C++ Example
|
-----
|
||||||
A fully featured C++ version of the canonical example for parsers: a
|
|
||||||
calculator. Also uses Flex for the scanner.
|
|
||||||
|
|
||||||
Don't look at this example first: it is fully featured and can serve as a
|
|
||||||
starting point for a clean parser in C++. The previous examples are better
|
|
||||||
introductory examples, and the C examples are also useful introductory
|
|
||||||
examples.
|
|
||||||
|
|
||||||
Extracted from the documentation: "A Complete C++ Example".
|
|
||||||
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
|
||||||
|
|
||||||
<!---
|
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
fill-column: 76
|
fill-column: 76
|
||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||||
@@ -56,4 +45,3 @@ Texts. A copy of the license is included in the "GNU Free
|
|||||||
Documentation License" file as part of this distribution.
|
Documentation License" file as part of this distribution.
|
||||||
|
|
||||||
# LocalWords: mfcalc calc parsers yy ispell american
|
# LocalWords: mfcalc calc parsers yy ispell american
|
||||||
--->
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
# This Makefile is designed to be simple and readable. It does not
|
|
||||||
# aim at portability. It requires GNU Make.
|
|
||||||
|
|
||||||
BASE = calc++
|
|
||||||
BISON = bison
|
|
||||||
CXX = g++
|
|
||||||
FLEX = flex
|
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
all: $(BASE)
|
|
||||||
|
|
||||||
%.cc %.hh %.xml %.gv: %.yy
|
|
||||||
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.cc $<
|
|
||||||
|
|
||||||
%.cc: %.ll
|
|
||||||
$(FLEX) $(FLEXFLAGS) -o$@ $<
|
|
||||||
|
|
||||||
%.o: %.cc
|
|
||||||
$(CXX) $(CXXFLAGS) -c -o$@ $<
|
|
||||||
|
|
||||||
$(BASE): $(BASE).o driver.o parser.o scanner.o
|
|
||||||
$(CXX) -o $@ $^
|
|
||||||
|
|
||||||
$(BASE).o: parser.hh
|
|
||||||
parser.o: parser.hh
|
|
||||||
scanner.o: parser.hh
|
|
||||||
|
|
||||||
run: $(BASE)
|
|
||||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
|
||||||
./$< -
|
|
||||||
|
|
||||||
html: parser.html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
CLEANFILES = \
|
|
||||||
$(BASE) *.o \
|
|
||||||
parser.hh parser.cc parser.output parser.xml parser.html parser.gv location.hh \
|
|
||||||
scanner.cc
|
|
||||||
clean:
|
|
||||||
rm -f $(CLEANFILES)
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
## Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
## Copyright (C) 2018 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,8 +13,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/>.
|
||||||
|
|
||||||
cxxdir = $(docdir)/%D%
|
cxxdir = $(examplesdir)/c++
|
||||||
include %D%/calc++/local.mk
|
|
||||||
|
|
||||||
## -------- ##
|
## -------- ##
|
||||||
## Simple. ##
|
## Simple. ##
|
||||||
@@ -37,7 +36,7 @@ if ENABLE_CXX14
|
|||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_simple_CPPFLAGS = -I$(top_builddir)
|
%C%_simple_CPPFLAGS = -I$(top_builddir)
|
||||||
TESTS += %D%/simple.test
|
TESTS += %D%/simple.test
|
||||||
%D%/simple.cc: $(dependencies)
|
%D%/simple.cc: $(BISON_IN) $(dist_pkgdata_DATA)
|
||||||
endif
|
endif
|
||||||
EXTRA_DIST += %D%/simple.test
|
EXTRA_DIST += %D%/simple.test
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ if ENABLE_CXX
|
|||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_variant_CPPFLAGS = -I$(top_builddir)
|
%C%_variant_CPPFLAGS = -I$(top_builddir)
|
||||||
TESTS += %D%/variant.test
|
TESTS += %D%/variant.test
|
||||||
%D%/variant.cc: $(dependencies)
|
%D%/variant.cc: $(BISON_IN) $(dist_pkgdata_DATA)
|
||||||
endif
|
endif
|
||||||
EXTRA_DIST += %D%/variant.test
|
EXTRA_DIST += %D%/variant.test
|
||||||
|
|
||||||
@@ -63,9 +62,9 @@ if ENABLE_CXX11
|
|||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_variant_11_CPPFLAGS = -I$(top_builddir)
|
%C%_variant_11_CPPFLAGS = -I$(top_builddir)
|
||||||
TESTS += %D%/variant-11.test
|
TESTS += %D%/variant-11.test
|
||||||
%D%/variant-11.cc: $(dependencies)
|
%D%/variant-11.cc: $(BISON_IN) $(dist_pkgdata_DATA)
|
||||||
endif
|
endif
|
||||||
EXTRA_DIST += %D%/variant-11.test
|
EXTRA_DIST += %D%/variant-11.test
|
||||||
|
|
||||||
dist_cxx_DATA = %D%/README.md %D%/Makefile %D%/variant.yy %D%/variant-11.yy
|
dist_cxx_DATA = %D%/README %D%/Makefile %D%/variant.yy %D%/variant-11.yy
|
||||||
CLEANFILES += %D%/simple.output %D%/variant.output %D%/variant-11.output
|
CLEANFILES += %D%/simple.output %D%/variant.output %D%/variant-11.output
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2018 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 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2008-2015, 2018 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,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2018 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 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2008-2015, 2018 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,34 +0,0 @@
|
|||||||
# This Makefile is designed to be simple and readable. It does not
|
|
||||||
# aim at portability. It requires GNU Make.
|
|
||||||
|
|
||||||
BASE = lexcalc
|
|
||||||
BISON = bison
|
|
||||||
FLEX = flex
|
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
all: $(BASE)
|
|
||||||
|
|
||||||
%.c %.h %.xml %.gv: %.y
|
|
||||||
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
|
||||||
|
|
||||||
%.c: %.l
|
|
||||||
$(FLEX) $(FLEXFLAGS) -o$@ $<
|
|
||||||
|
|
||||||
scan.o: parse.h
|
|
||||||
lexcalc: parse.o scan.o
|
|
||||||
$(CC) $(CFLAGS) -o $@ $^
|
|
||||||
|
|
||||||
run: $(BASE)
|
|
||||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
|
||||||
./$<
|
|
||||||
|
|
||||||
html: parse.html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
CLEANFILES = \
|
|
||||||
$(BASE) *.o \
|
|
||||||
parse.[ch] parse.output parse.xml parse.html parse.gv \
|
|
||||||
scan.c
|
|
||||||
clean:
|
|
||||||
rm -f $(CLEANFILES)
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# lexcalc - calculator with Flex and Bison
|
|
||||||
|
|
||||||
This directory contains lexcalc, the traditional example of using Flex and
|
|
||||||
Bison to build a simple calculator.
|
|
||||||
|
|
||||||
<!---
|
|
||||||
Local Variables:
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2018-2019 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/>.
|
|
||||||
--->
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
## Copyright (C) 2018-2019 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/>.
|
|
||||||
|
|
||||||
lexcalcdir = $(docdir)/%D%
|
|
||||||
|
|
||||||
## ------ ##
|
|
||||||
## Calc. ##
|
|
||||||
## ------ ##
|
|
||||||
|
|
||||||
check_PROGRAMS += %D%/lexcalc
|
|
||||||
TESTS += %D%/lexcalc.test
|
|
||||||
EXTRA_DIST += %D%/lexcalc.test
|
|
||||||
%C%_lexcalc_SOURCES = %D%/parse.y %D%/parse.h %D%/scan.l
|
|
||||||
|
|
||||||
# Don't use gnulib's system headers.
|
|
||||||
%C%_lexcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
|
||||||
|
|
||||||
dist_lexcalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
|
|
||||||
CLEANFILES += %D%/lexcalc %D%/*.o %D%/parse.c %D%/scan.c
|
|
||||||
CLEANDIRS += %D%/*.dSYM
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
// Prologue (directives).
|
|
||||||
%expect 0
|
|
||||||
|
|
||||||
// Emitted in the header file, after the definition of YYSTYPE.
|
|
||||||
%code provides
|
|
||||||
{
|
|
||||||
// Tell Flex the expected prototype of yylex.
|
|
||||||
#define YY_DECL \
|
|
||||||
enum yytokentype yylex (YYSTYPE* yylval, int *nerrs)
|
|
||||||
YY_DECL;
|
|
||||||
|
|
||||||
void yyerror (int *nerrs, const char *msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Emitted on top of the implementation file.
|
|
||||||
%code top
|
|
||||||
{
|
|
||||||
#include <stdio.h> /* printf. */
|
|
||||||
#include <stdlib.h> /* getenv. */
|
|
||||||
}
|
|
||||||
|
|
||||||
%define api.pure full
|
|
||||||
%define api.token.prefix {TOK_}
|
|
||||||
%define api.value.type union
|
|
||||||
%define parse.error verbose
|
|
||||||
%define parse.trace
|
|
||||||
// Error count, exchanged between main, yyparse and yylex.
|
|
||||||
%param {int *nerrs}
|
|
||||||
|
|
||||||
%token
|
|
||||||
PLUS "+"
|
|
||||||
MINUS "-"
|
|
||||||
STAR "*"
|
|
||||||
SLASH "/"
|
|
||||||
LPAREN "("
|
|
||||||
RPAREN ")"
|
|
||||||
EOL "end-of-line"
|
|
||||||
EOF 0 "end-of-file"
|
|
||||||
;
|
|
||||||
|
|
||||||
%token <int> NUM "number"
|
|
||||||
%type <int> exp line
|
|
||||||
%printer { fprintf (yyo, "%d", $$); } <int>
|
|
||||||
|
|
||||||
// Precedence (from lowest to highest) and associativity.
|
|
||||||
%left "+" "-"
|
|
||||||
%left "*" "/"
|
|
||||||
|
|
||||||
%%
|
|
||||||
// Rules.
|
|
||||||
input:
|
|
||||||
%empty
|
|
||||||
| input line { printf ("%d\n", $line); }
|
|
||||||
;
|
|
||||||
|
|
||||||
line:
|
|
||||||
exp EOL { $$ = $1; }
|
|
||||||
| error EOL { yyerrok; }
|
|
||||||
;
|
|
||||||
|
|
||||||
exp:
|
|
||||||
exp "+" exp { $$ = $1 + $3; }
|
|
||||||
| exp "-" exp { $$ = $1 - $3; }
|
|
||||||
| exp "*" exp { $$ = $1 * $3; }
|
|
||||||
| exp "/" exp
|
|
||||||
{
|
|
||||||
if ($3 == 0)
|
|
||||||
{
|
|
||||||
yyerror (nerrs, "invalid division by zero");
|
|
||||||
YYERROR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$$ = $1 / $3;
|
|
||||||
}
|
|
||||||
| "(" exp ")" { $$ = $2; }
|
|
||||||
| NUM { $$ = $1; }
|
|
||||||
;
|
|
||||||
%%
|
|
||||||
// Epilogue (C code).
|
|
||||||
void yyerror(int *nerrs, const char *msg)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s\n", msg);
|
|
||||||
++nerrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main (void)
|
|
||||||
{
|
|
||||||
int nerrs = 0;
|
|
||||||
// Possibly enable parser runtime debugging.
|
|
||||||
yydebug = !!getenv ("YYDEBUG");
|
|
||||||
yyparse (&nerrs);
|
|
||||||
// Exit on failure if there were errors.
|
|
||||||
return !!nerrs;
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/* Prologue (directives). -*- C++ -*- */
|
|
||||||
|
|
||||||
/* Disable Flex features we don't need, to avoid warnings. */
|
|
||||||
%option nodefault noinput nounput noyywrap
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include <limits.h> /* INT_MIN */
|
|
||||||
#include <stdlib.h> /* strtol */
|
|
||||||
|
|
||||||
#include "parse.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%%
|
|
||||||
/* Rules. */
|
|
||||||
|
|
||||||
"+" return TOK_PLUS;
|
|
||||||
"-" return TOK_MINUS;
|
|
||||||
"*" return TOK_STAR;
|
|
||||||
"/" return TOK_SLASH;
|
|
||||||
|
|
||||||
"(" return TOK_LPAREN;
|
|
||||||
")" return TOK_RPAREN;
|
|
||||||
|
|
||||||
/* Scan an integer. */
|
|
||||||
[0-9]+ {
|
|
||||||
errno = 0;
|
|
||||||
long n = strtol (yytext, NULL, 10);
|
|
||||||
if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
|
|
||||||
yyerror (nerrs, "integer is out of range");
|
|
||||||
yylval->TOK_NUM = (int) n;
|
|
||||||
return TOK_NUM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ignore white spaces. */
|
|
||||||
[ \t]+ continue;
|
|
||||||
|
|
||||||
"\n" return TOK_EOL;
|
|
||||||
|
|
||||||
. yyerror (nerrs, "syntax error, invalid character");
|
|
||||||
|
|
||||||
<<EOF>> return TOK_EOF;
|
|
||||||
%%
|
|
||||||
/* Epilogue (C code). */
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# This Makefile is designed to be simple and readable. It does not
|
|
||||||
# aim at portability. It requires GNU Make.
|
|
||||||
|
|
||||||
BASE = mfcalc
|
|
||||||
BISON = bison
|
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
all: $(BASE)
|
|
||||||
|
|
||||||
%.c %.xml %.gv: %.y
|
|
||||||
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.c $<
|
|
||||||
|
|
||||||
%: %.c
|
|
||||||
$(CC) $(CFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
run: $(BASE)
|
|
||||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
|
||||||
./$<
|
|
||||||
|
|
||||||
html: $(BASE).html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(BASE) $(BASE).c $(BASE).html $(BASE).xml $(BASE).gv $(BASE).output
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# This Makefile is designed to be simple and readable. It does not
|
|
||||||
# aim at portability. It requires GNU Make.
|
|
||||||
|
|
||||||
BASE = rpcalc
|
|
||||||
BISON = bison
|
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
all: $(BASE)
|
|
||||||
|
|
||||||
%.c %.xml %.gv: %.y
|
|
||||||
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.c $<
|
|
||||||
|
|
||||||
%: %.c
|
|
||||||
$(CC) $(CFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
run: $(BASE)
|
|
||||||
@echo "Type arithmetic expressions in Reverse Polish Notation. Quit with ctrl-d."
|
|
||||||
./$<
|
|
||||||
|
|
||||||
html: $(BASE).html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(BASE) $(BASE).c $(BASE).html $(BASE).xml $(BASE).gv
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# 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,10 +1,6 @@
|
|||||||
# calc++ - A Flex+Bison calculator
|
This directory contains calc++, a simple Bison grammar file in C++.
|
||||||
|
|
||||||
This directory contains calc++, a Bison grammar file in C++. If you never
|
Please, read the corresponding chapter in the documentation: "A Complete C++
|
||||||
saw the traditional implementation in C, please first read
|
|
||||||
examples/c/lexcalc, which can be seen as a C precursor of this example.
|
|
||||||
|
|
||||||
Read the corresponding chapter in the documentation: "A Complete C++
|
|
||||||
Example". It is also available on line (maybe with a different version of
|
Example". It is also available on line (maybe with a different version of
|
||||||
Bison):
|
Bison):
|
||||||
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
https://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html
|
||||||
@@ -17,7 +13,6 @@ evaluate.
|
|||||||
The program calc++ expects the file to parse as argument; pass `-` to read
|
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).
|
the standard input (and then hit <Ctrl-d>, control-d, to end your input).
|
||||||
|
|
||||||
```
|
|
||||||
$ ./calc++ -
|
$ ./calc++ -
|
||||||
one := 1
|
one := 1
|
||||||
two := 2
|
two := 2
|
||||||
@@ -25,18 +20,19 @@ three := 3
|
|||||||
(one + two * three) * two * three
|
(one + two * three) * two * three
|
||||||
<Ctrl-d>
|
<Ctrl-d>
|
||||||
42
|
42
|
||||||
```
|
|
||||||
|
|
||||||
You may pass `-p` to activate the parser debug traces, and `-s` to activate
|
You may pass `-p` to activate the parser debug traces, and `-s` to activate
|
||||||
the scanner's.
|
the scanner's.
|
||||||
|
|
||||||
<!---
|
-----
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
fill-column: 76
|
fill-column: 76
|
||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
End:
|
End:
|
||||||
|
|
||||||
Copyright (C) 2018-2019 Free Software Foundation, Inc.
|
Copyright (C) 2018 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,5 +49,4 @@ 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 <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# LocalWords: calc parsers yy MERCHANTABILITY Ctrl ispell american
|
# LocalWords: mfcalc calc parsers yy MERCHANTABILITY Ctrl ispell american
|
||||||
--->
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2015, 2018-2019 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2015, 2018 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 @@
|
|||||||
## Copyright (C) 2005-2006, 2008-2015, 2018-2019 Free Software
|
## Copyright (C) 2005-2006, 2008-2015, 2018 Free Software Foundation,
|
||||||
## 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 +20,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: $(dependencies)
|
%D%/parser.stamp: $(BISON_IN)
|
||||||
SUFFIXES += .yy .stamp
|
SUFFIXES += .yy .stamp
|
||||||
.yy.stamp:
|
.yy.stamp:
|
||||||
$(AM_V_YACC)rm -f $@
|
$(AM_V_YACC)rm -f $@
|
||||||
@@ -79,6 +79,6 @@ EXTRA_DIST += %D%/calc++.test
|
|||||||
## Installing. ##
|
## Installing. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|
||||||
calcxxdir = $(docdir)/%D%
|
calcxxdir = $(docdir)/examples/calc++
|
||||||
calcxx_DATA = $(calcxx_extracted)
|
calcxx_DATA = $(calcxx_extracted)
|
||||||
dist_calcxx_DATA = %D%/README.md %D%/Makefile
|
dist_calcxx_DATA = %D%/README %D%/Makefile
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# This Makefile is designed to be simple and readable. It does not
|
|
||||||
# aim at portability. It requires GNU Make.
|
|
||||||
|
|
||||||
BISON = bison
|
|
||||||
DC = dmd
|
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
all: calc
|
|
||||||
|
|
||||||
%.d %.xml %.gv: %.y
|
|
||||||
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.d $<
|
|
||||||
|
|
||||||
%: %.d
|
|
||||||
$(DC) $(DCFLAGS) $<
|
|
||||||
|
|
||||||
run: calc
|
|
||||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
|
||||||
./$<
|
|
||||||
|
|
||||||
html: calc.html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f calc calc.d calc.xml calc.gv calc.html *.o
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# Examples in D
|
|
||||||
|
|
||||||
This directory contains examples of Bison grammar files in D.
|
|
||||||
|
|
||||||
You can run `make` to compile these examples. And `make clean` to tidy
|
|
||||||
afterwards.
|
|
||||||
|
|
||||||
## d/calc.y
|
|
||||||
The usual calculator.
|
|
||||||
|
|
||||||
<!---
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2018-2019 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
|
|
||||||
--->
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
%language "D"
|
|
||||||
|
|
||||||
%define api.parser.class {Calc}
|
|
||||||
%define parse.error verbose
|
|
||||||
|
|
||||||
%code imports {
|
|
||||||
import std.ascii;
|
|
||||||
import std.stdio;
|
|
||||||
}
|
|
||||||
|
|
||||||
%union {
|
|
||||||
int ival;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bison Declarations */
|
|
||||||
%token EQ "="
|
|
||||||
PLUS "+"
|
|
||||||
MINUS "-"
|
|
||||||
STAR "*"
|
|
||||||
SLASH "/"
|
|
||||||
BANG "!"
|
|
||||||
LPAR "("
|
|
||||||
RPAR ")"
|
|
||||||
EOL "end of line"
|
|
||||||
%token <ival> NUM "number"
|
|
||||||
%type <ival> exp
|
|
||||||
|
|
||||||
%nonassoc "=" /* comparison */
|
|
||||||
%left "-" "+"
|
|
||||||
%left "*" "/"
|
|
||||||
%precedence NEG /* negation--unary minus */
|
|
||||||
|
|
||||||
/* Grammar follows */
|
|
||||||
%%
|
|
||||||
input:
|
|
||||||
line
|
|
||||||
| input line
|
|
||||||
;
|
|
||||||
|
|
||||||
line:
|
|
||||||
EOL
|
|
||||||
| exp EOL { writeln ($exp); }
|
|
||||||
| error EOL
|
|
||||||
;
|
|
||||||
|
|
||||||
exp:
|
|
||||||
NUM { $$ = $1; }
|
|
||||||
| exp "=" exp
|
|
||||||
{
|
|
||||||
if ($1 != $3)
|
|
||||||
yyerror (format ("calc: error: %d != %d", $1, $3));
|
|
||||||
}
|
|
||||||
| exp "+" exp { $$ = $1 + $3; }
|
|
||||||
| exp "-" exp { $$ = $1 - $3; }
|
|
||||||
| exp "*" exp { $$ = $1 * $3; }
|
|
||||||
| exp "/" exp { $$ = $1 / $3; }
|
|
||||||
| "-" exp %prec NEG { $$ = -$2; }
|
|
||||||
| "(" exp ")" { $$ = $2; }
|
|
||||||
| "(" error ")" { $$ = 1111; }
|
|
||||||
| "!" { $$ = 0; return YYERROR; }
|
|
||||||
| "-" error { $$ = 0; return YYERROR; }
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
%%
|
|
||||||
class CalcLexer : Lexer {
|
|
||||||
|
|
||||||
this ()
|
|
||||||
{}
|
|
||||||
|
|
||||||
int
|
|
||||||
get_char ()
|
|
||||||
{
|
|
||||||
import stdc = core.stdc.stdio;
|
|
||||||
return stdc.getc (stdc.stdin);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
unget_char (int c)
|
|
||||||
{
|
|
||||||
import stdc = core.stdc.stdio;
|
|
||||||
stdc.ungetc (c, stdc.stdin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void yyerror (string s)
|
|
||||||
{
|
|
||||||
stderr.writeln (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
read_signed_integer ()
|
|
||||||
{
|
|
||||||
int c = get_char ();
|
|
||||||
int sign = 1;
|
|
||||||
int n = 0;
|
|
||||||
|
|
||||||
if (c == '-')
|
|
||||||
{
|
|
||||||
c = get_char ();
|
|
||||||
sign = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (isDigit (c))
|
|
||||||
{
|
|
||||||
n = 10 * n + (c - '0');
|
|
||||||
c = get_char ();
|
|
||||||
}
|
|
||||||
|
|
||||||
unget_char (c);
|
|
||||||
return sign * n;
|
|
||||||
}
|
|
||||||
|
|
||||||
YYSemanticType semanticVal_;
|
|
||||||
|
|
||||||
public final @property YYSemanticType semanticVal()
|
|
||||||
{
|
|
||||||
return semanticVal_;
|
|
||||||
}
|
|
||||||
|
|
||||||
YYTokenType yylex ()
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
/* Skip white spaces. */
|
|
||||||
do
|
|
||||||
{}
|
|
||||||
while ((c = get_char ()) == ' ' || c == '\t');
|
|
||||||
|
|
||||||
/* process numbers */
|
|
||||||
if (c == '.' || isDigit (c))
|
|
||||||
{
|
|
||||||
unget_char (c);
|
|
||||||
semanticVal_.ival = read_signed_integer ();
|
|
||||||
return YYTokenType.NUM;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case EOF: return YYTokenType.EOF;
|
|
||||||
case '=': return YYTokenType.EQ;
|
|
||||||
case '+': return YYTokenType.PLUS;
|
|
||||||
case '-': return YYTokenType.MINUS;
|
|
||||||
case '*': return YYTokenType.STAR;
|
|
||||||
case '/': return YYTokenType.SLASH;
|
|
||||||
case '!': return YYTokenType.BANG;
|
|
||||||
case '(': return YYTokenType.LPAR;
|
|
||||||
case ')': return YYTokenType.RPAR;
|
|
||||||
case '\n': return YYTokenType.EOL;
|
|
||||||
default: assert(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void main ()
|
|
||||||
{
|
|
||||||
CalcLexer l = new CalcLexer ();
|
|
||||||
Calc p = new Calc (l);
|
|
||||||
p.parse ();
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
## Copyright (C) 2018-2019 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/>.
|
|
||||||
|
|
||||||
ddir = $(docdir)/%D%
|
|
||||||
|
|
||||||
## ------ ##
|
|
||||||
## Calc. ##
|
|
||||||
## ------ ##
|
|
||||||
|
|
||||||
if ENABLE_D
|
|
||||||
check_SCRIPTS += %D%/calc
|
|
||||||
TESTS += %D%/calc.test
|
|
||||||
endif
|
|
||||||
EXTRA_DIST += %D%/calc.test
|
|
||||||
|
|
||||||
%D%/calc.d: %D%/calc.y $(dependencies)
|
|
||||||
$(AM_V_GEN)$(MKDIR_P) %D%
|
|
||||||
$(AM_V_at)$(BISON) $< -o $@
|
|
||||||
|
|
||||||
%D%/calc: %D%/calc.d
|
|
||||||
$(AM_V_GEN) $(DC) $(DCFLAGS) -of$@ $<
|
|
||||||
|
|
||||||
dist_d_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
|
||||||
CLEANFILES += %D%/calc %D%/calc.[do]
|
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# This file is part of GNU Bison
|
# This file is part of GNU Bison
|
||||||
|
|
||||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018-2019 Free
|
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2015, 2018 Free
|
||||||
# Software Foundation, Inc.
|
# 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
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# Copyright (C) 2018-2019 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/>.
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1 + 2 * 3
|
|
||||||
EOF
|
|
||||||
run 0 7
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1 + 2 * * 3
|
|
||||||
EOF
|
|
||||||
run 0 "err: 1.5: syntax error, unexpected '*', expecting number or '-' or '(' or '!'"
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
%language "Java"
|
|
||||||
|
|
||||||
%define api.parser.class {Calc}
|
|
||||||
%define api.parser.public
|
|
||||||
|
|
||||||
%define parse.error verbose
|
|
||||||
%locations
|
|
||||||
|
|
||||||
%code imports {
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.StreamTokenizer;
|
|
||||||
}
|
|
||||||
|
|
||||||
%code {
|
|
||||||
public static void main (String args[]) throws IOException
|
|
||||||
{
|
|
||||||
CalcLexer l = new CalcLexer (System.in);
|
|
||||||
Calc p = new Calc (l);
|
|
||||||
p.parse ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bison Declarations */
|
|
||||||
%token <Integer> NUM "number"
|
|
||||||
%type <Integer> exp
|
|
||||||
|
|
||||||
%nonassoc '=' /* comparison */
|
|
||||||
%left '-' '+'
|
|
||||||
%left '*' '/'
|
|
||||||
%precedence NEG /* negation--unary minus */
|
|
||||||
%right '^' /* exponentiation */
|
|
||||||
|
|
||||||
/* Grammar follows */
|
|
||||||
%%
|
|
||||||
input:
|
|
||||||
line
|
|
||||||
| input line
|
|
||||||
;
|
|
||||||
|
|
||||||
line:
|
|
||||||
'\n'
|
|
||||||
| exp '\n' { System.out.println ($exp); }
|
|
||||||
| error '\n'
|
|
||||||
;
|
|
||||||
|
|
||||||
exp:
|
|
||||||
NUM { $$ = $1; }
|
|
||||||
| exp '=' exp
|
|
||||||
{
|
|
||||||
if ($1.intValue () != $3.intValue ())
|
|
||||||
yyerror (@$, "calc: error: " + $1 + " != " + $3);
|
|
||||||
}
|
|
||||||
| exp '+' exp { $$ = new Integer ($1.intValue () + $3.intValue ()); }
|
|
||||||
| exp '-' exp { $$ = new Integer ($1.intValue () - $3.intValue ()); }
|
|
||||||
| exp '*' exp { $$ = new Integer ($1.intValue () * $3.intValue ()); }
|
|
||||||
| exp '/' exp { $$ = new Integer ($1.intValue () / $3.intValue ()); }
|
|
||||||
| '-' exp %prec NEG { $$ = new Integer (-$2.intValue ()); }
|
|
||||||
| exp '^' exp { $$ = new Integer ((int)
|
|
||||||
Math.pow ($1.intValue (),
|
|
||||||
$3.intValue ())); }
|
|
||||||
| '(' exp ')' { $$ = $2; }
|
|
||||||
| '(' error ')' { $$ = new Integer (1111); }
|
|
||||||
| '!' { $$ = new Integer (0); return YYERROR; }
|
|
||||||
| '-' error { $$ = new Integer (0); return YYERROR; }
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
%%
|
|
||||||
class CalcLexer implements Calc.Lexer {
|
|
||||||
|
|
||||||
StreamTokenizer st;
|
|
||||||
|
|
||||||
public CalcLexer (InputStream is)
|
|
||||||
{
|
|
||||||
st = new StreamTokenizer (new InputStreamReader (is));
|
|
||||||
st.resetSyntax ();
|
|
||||||
st.eolIsSignificant (true);
|
|
||||||
st.whitespaceChars (9, 9);
|
|
||||||
st.whitespaceChars (32, 32);
|
|
||||||
st.wordChars (48, 57);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Position yypos = new Position (1, 0);
|
|
||||||
|
|
||||||
public Position getStartPos () {
|
|
||||||
return yypos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Position getEndPos () {
|
|
||||||
return yypos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void yyerror (Calc.Location l, String s)
|
|
||||||
{
|
|
||||||
if (l == null)
|
|
||||||
System.err.println (s);
|
|
||||||
else
|
|
||||||
System.err.println (l + ": " + s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Integer yylval;
|
|
||||||
|
|
||||||
public Object getLVal () {
|
|
||||||
return yylval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int yylex () throws IOException {
|
|
||||||
int ttype = st.nextToken ();
|
|
||||||
yypos = new Position (yypos.lineno (), yypos.token () + 1);
|
|
||||||
if (ttype == st.TT_EOF)
|
|
||||||
return EOF;
|
|
||||||
else if (ttype == st.TT_EOL)
|
|
||||||
{
|
|
||||||
yypos = new Position (yypos.lineno () + 1, 0);
|
|
||||||
return (int) '\n';
|
|
||||||
}
|
|
||||||
else if (ttype == st.TT_WORD)
|
|
||||||
{
|
|
||||||
yylval = new Integer (st.sval);
|
|
||||||
return NUM;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return st.ttype;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class Position {
|
|
||||||
public int line;
|
|
||||||
public int token;
|
|
||||||
|
|
||||||
public Position ()
|
|
||||||
{
|
|
||||||
line = 0;
|
|
||||||
token = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Position (int l, int t)
|
|
||||||
{
|
|
||||||
line = l;
|
|
||||||
token = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals (Position l)
|
|
||||||
{
|
|
||||||
return l.line == line && l.token == token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString ()
|
|
||||||
{
|
|
||||||
return Integer.toString (line) + "." + Integer.toString(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int lineno ()
|
|
||||||
{
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int token ()
|
|
||||||
{
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
# This Makefile is designed to be simple and readable. It does not
|
|
||||||
# aim at portability. It requires GNU Make.
|
|
||||||
|
|
||||||
BISON = bison
|
|
||||||
JAVAC = javac
|
|
||||||
JAVA = java
|
|
||||||
XSLTPROC = xsltproc
|
|
||||||
|
|
||||||
all: Calc.class
|
|
||||||
|
|
||||||
%.java %.xml %.gv: %.y
|
|
||||||
$(BISON) $(BISONFLAGS) --xml --graph=$*.gv -o $*.java $<
|
|
||||||
|
|
||||||
%.class: %.java
|
|
||||||
$(JAVAC) $(JAVACFLAGS) $<
|
|
||||||
|
|
||||||
run: Calc.class
|
|
||||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
|
||||||
$(JAVA) $(JAVAFLAGS) Calc
|
|
||||||
|
|
||||||
html: Calc.html
|
|
||||||
%.html: %.xml
|
|
||||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.class Calc.java Calc.html Calc.xml Calc.gv
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
# Examples in Java
|
|
||||||
|
|
||||||
This directory contains examples of Bison grammar files in Java.
|
|
||||||
|
|
||||||
You can run `make` to compile these examples. And `make clean` to tidy
|
|
||||||
afterwards.
|
|
||||||
|
|
||||||
## java/Calc.y
|
|
||||||
The usual calculator.
|
|
||||||
|
|
||||||
<!---
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
mode: markdown
|
|
||||||
fill-column: 76
|
|
||||||
ispell-dictionary: "american"
|
|
||||||
End:
|
|
||||||
|
|
||||||
Copyright (C) 2018-2019 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.
|
|
||||||
--->
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
## Copyright (C) 2018-2019 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/>.
|
|
||||||
|
|
||||||
javadir = $(docdir)/%D%
|
|
||||||
|
|
||||||
## ------ ##
|
|
||||||
## Calc. ##
|
|
||||||
## ------ ##
|
|
||||||
|
|
||||||
if ENABLE_JAVA
|
|
||||||
check_SCRIPTS += %D%/Calc.class
|
|
||||||
TESTS += %D%/Calc.test
|
|
||||||
endif
|
|
||||||
EXTRA_DIST += %D%/Calc.test
|
|
||||||
|
|
||||||
%D%/Calc.java: %D%/Calc.y $(dependencies)
|
|
||||||
$(AM_V_GEN)$(MKDIR_P) %D%
|
|
||||||
$(AM_V_at)$(BISON) $< -o $@
|
|
||||||
|
|
||||||
%D%/Calc.class: %D%/Calc.java
|
|
||||||
$(AM_V_GEN) $(SHELL) $(top_builddir)/javacomp.sh $<
|
|
||||||
|
|
||||||
dist_java_DATA = %D%/Calc.y %D%/Makefile %D%/README.md
|
|
||||||
CLEANFILES += %D%/*.class %D%/Calc.java
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user